mirror of
https://github.com/arangodb/kube-arangodb.git
synced 2024-12-14 11:57:37 +00:00
[Feature] Switch CRD to V1 (#746)
This commit is contained in:
parent
8f00e73079
commit
2b7f6303a5
4 changed files with 11 additions and 10 deletions
|
@ -1,6 +1,7 @@
|
|||
# Change Log
|
||||
|
||||
## [master](https://github.com/arangodb/kube-arangodb/tree/master) (N/A)
|
||||
- Switch K8S CRD API to V1
|
||||
- Deprecate Alpine image usage
|
||||
- Use persistent name and namespace in ArangoDeployment reconcilation loop
|
||||
|
||||
|
|
|
@ -514,7 +514,7 @@ func (d *Deployment) lookForServiceMonitorCRD() {
|
|||
if d.GetScope().IsNamespaced() {
|
||||
_, err = d.deps.KubeMonitoringCli.ServiceMonitors(d.GetNamespace()).List(context.Background(), metav1.ListOptions{})
|
||||
} else {
|
||||
_, err = d.deps.KubeExtCli.ApiextensionsV1beta1().CustomResourceDefinitions().Get(context.Background(), "servicemonitors.monitoring.coreos.com", metav1.GetOptions{})
|
||||
_, err = d.deps.KubeExtCli.ApiextensionsV1().CustomResourceDefinitions().Get(context.Background(), "servicemonitors.monitoring.coreos.com", metav1.GetOptions{})
|
||||
}
|
||||
log := d.deps.Log
|
||||
log.Debug().Msgf("Looking for ServiceMonitor CRD...")
|
||||
|
|
|
@ -24,7 +24,7 @@ package deployment
|
|||
|
||||
import (
|
||||
v1 "k8s.io/api/core/v1"
|
||||
"k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1"
|
||||
crdv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
|
||||
"k8s.io/client-go/tools/cache"
|
||||
|
||||
"github.com/arangodb/kube-arangodb/pkg/util/k8sutil"
|
||||
|
@ -203,10 +203,10 @@ func (d *Deployment) listenForServiceEvents(stopCh <-chan struct{}) {
|
|||
func (d *Deployment) listenForCRDEvents(stopCh <-chan struct{}) {
|
||||
rw := k8sutil.NewResourceWatcher(
|
||||
d.deps.Log,
|
||||
d.deps.KubeExtCli.ApiextensionsV1beta1().RESTClient(),
|
||||
d.deps.KubeExtCli.ApiextensionsV1().RESTClient(),
|
||||
"customresourcedefinitions",
|
||||
"",
|
||||
&v1beta1.CustomResourceDefinition{},
|
||||
&crdv1.CustomResourceDefinition{},
|
||||
cache.ResourceEventHandlerFuncs{
|
||||
AddFunc: func(obj interface{}) {
|
||||
d.triggerCRDInspection()
|
||||
|
|
|
@ -28,7 +28,7 @@ import (
|
|||
|
||||
"github.com/arangodb/kube-arangodb/pkg/util/errors"
|
||||
|
||||
apiextensionsv1beta1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1"
|
||||
apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
|
||||
apiextensionsclient "k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
|
||||
|
@ -46,18 +46,18 @@ func WaitReady(check func() error) error {
|
|||
// WaitCRDReady waits for a custom resource definition with given name to be ready.
|
||||
func WaitCRDReady(clientset apiextensionsclient.Interface, crdName string) error {
|
||||
op := func() error {
|
||||
crd, err := clientset.ApiextensionsV1beta1().CustomResourceDefinitions().Get(context.Background(), crdName, metav1.GetOptions{})
|
||||
crd, err := clientset.ApiextensionsV1().CustomResourceDefinitions().Get(context.Background(), crdName, metav1.GetOptions{})
|
||||
if err != nil {
|
||||
return errors.WithStack(err)
|
||||
}
|
||||
for _, cond := range crd.Status.Conditions {
|
||||
switch cond.Type {
|
||||
case apiextensionsv1beta1.Established:
|
||||
if cond.Status == apiextensionsv1beta1.ConditionTrue {
|
||||
case apiextensionsv1.Established:
|
||||
if cond.Status == apiextensionsv1.ConditionTrue {
|
||||
return nil
|
||||
}
|
||||
case apiextensionsv1beta1.NamesAccepted:
|
||||
if cond.Status == apiextensionsv1beta1.ConditionFalse {
|
||||
case apiextensionsv1.NamesAccepted:
|
||||
if cond.Status == apiextensionsv1.ConditionFalse {
|
||||
return errors.WithStack(errors.Newf("Name conflict: %v", cond.Reason))
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue