1
0
Fork 0
mirror of https://github.com/arangodb/kube-arangodb.git synced 2024-12-15 17:51:03 +00:00
kube-arangodb/pkg/operator/crd.go

54 lines
1.4 KiB
Go
Raw Normal View History

2018-02-09 16:21:06 +00:00
//
// DISCLAIMER
//
2022-01-10 11:35:49 +00:00
// Copyright 2016-2022 ArangoDB GmbH, Cologne, Germany
2018-02-09 16:21:06 +00:00
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Copyright holder is ArangoDB GmbH, Cologne, Germany
//
2018-02-27 10:50:28 +00:00
package operator
2018-02-09 16:21:06 +00:00
import (
"time"
2021-03-23 15:47:28 +00:00
2018-03-13 15:25:33 +00:00
"github.com/arangodb/kube-arangodb/pkg/util/crd"
2018-02-09 16:21:06 +00:00
)
// waitForCRD waits for the CustomResourceDefinition (created externally) to be ready.
func (o *Operator) waitForCRD(crdName string, checkFn func() error) {
2022-06-14 07:26:07 +00:00
o.log.Debug("Waiting for %s CRD to be ready - ", crdName)
for {
var err error = nil
if o.Scope.IsNamespaced() {
if checkFn != nil {
err = crd.WaitReady(checkFn)
2020-08-14 07:35:11 +00:00
}
} else {
err = crd.WaitCRDReady(o.Client.KubernetesExtensions(), crdName)
2018-03-19 10:09:20 +00:00
}
2018-03-05 09:00:23 +00:00
if err == nil {
break
} else {
2022-06-14 07:26:07 +00:00
o.log.Err(err).Error("Resource initialization failed")
o.log.Info("Retrying in %s...", initRetryWaitTime)
time.Sleep(initRetryWaitTime)
}
}
2022-06-14 07:26:07 +00:00
o.log.Debug("CRDs ready")
2018-02-09 16:21:06 +00:00
}