From b4003d7e0d2f386ef40e9bc2f4025607bd561a9c Mon Sep 17 00:00:00 2001 From: Fabio Bertinatto Date: Thu, 19 Sep 2024 07:38:02 -0300 Subject: [PATCH 01/13] move to generic operator client --- pkg/csoclients/csoclients.go | 62 ++++++++++-- pkg/csoclients/fake.go | 14 ++- pkg/operatorclient/operatorclient.go | 146 +-------------------------- 3 files changed, 65 insertions(+), 157 deletions(-) diff --git a/pkg/csoclients/csoclients.go b/pkg/csoclients/csoclients.go index 551ff892a..8bebc3b51 100644 --- a/pkg/csoclients/csoclients.go +++ b/pkg/csoclients/csoclients.go @@ -5,6 +5,8 @@ import ( "time" "github.com/openshift/library-go/pkg/config/client" + "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" + "k8s.io/apimachinery/pkg/runtime" "k8s.io/client-go/dynamic/dynamicinformer" "k8s.io/client-go/rest" @@ -16,12 +18,14 @@ import ( "k8s.io/client-go/kubernetes" "k8s.io/client-go/restmapper" + operatorv1 "github.com/openshift/api/operator/v1" cfgclientset "github.com/openshift/client-go/config/clientset/versioned" cfginformers "github.com/openshift/client-go/config/informers/externalversions" + applyoperatorv1 "github.com/openshift/client-go/operator/applyconfigurations/operator/v1" opclient "github.com/openshift/client-go/operator/clientset/versioned" opinformers "github.com/openshift/client-go/operator/informers/externalversions" - "github.com/openshift/cluster-storage-operator/pkg/operatorclient" "github.com/openshift/library-go/pkg/controller/controllercmd" + "github.com/openshift/library-go/pkg/operator/genericoperatorclient" "github.com/openshift/library-go/pkg/operator/v1helpers" prominformer "github.com/prometheus-operator/prometheus-operator/pkg/client/informers/externalversions" promclient "github.com/prometheus-operator/prometheus-operator/pkg/client/versioned" @@ -29,7 +33,7 @@ import ( type Clients struct { // Client for CSO's CR - OperatorClient *operatorclient.OperatorClient + OperatorClient v1helpers.OperatorClientWithFinalizers // Kubernetes API client KubeClient kubernetes.Interface // Kubernetes API informers, per namespace @@ -127,9 +131,15 @@ func NewClients(controllerConfig *controllercmd.ControllerContext, resync time.D } c.MonitoringInformer = prominformer.NewSharedInformerFactory(c.MonitoringClient, resync) - c.OperatorClient = &operatorclient.OperatorClient{ - Informers: c.OperatorInformers, - Client: c.OperatorClientSet, + c.OperatorClient, _, err = genericoperatorclient.NewClusterScopedOperatorClient( + controllerConfig.KubeConfig, + operatorv1.GroupVersion.WithResource("storages"), + operatorv1.GroupVersion.WithKind("Storage"), + extractOperatorSpec, + extractOperatorStatus, + ) + if err != nil { + return nil, err } dc, err := discovery.NewDiscoveryClientForConfig(controllerConfig.KubeConfig) @@ -231,10 +241,13 @@ func NewHypershiftGuestClients( } c.MonitoringInformer = prominformer.NewSharedInformerFactory(c.MonitoringClient, resync) - c.OperatorClient = &operatorclient.OperatorClient{ - Informers: c.OperatorInformers, - Client: c.OperatorClientSet, - } + c.OperatorClient, _, err = genericoperatorclient.NewClusterScopedOperatorClient( + controllerConfig.KubeConfig, + operatorv1.GroupVersion.WithResource("storages"), + operatorv1.GroupVersion.WithKind("Storage"), + extractOperatorSpec, + extractOperatorStatus, + ) dc, err := discovery.NewDiscoveryClientForConfig(kubeRestConfig) if err != nil { @@ -286,3 +299,34 @@ func StartMgmtInformers(clients *Clients, stopCh <-chan struct{}) { informer.Start(stopCh) } } + +func extractOperatorSpec(obj *unstructured.Unstructured, fieldManager string) (*applyoperatorv1.OperatorSpecApplyConfiguration, error) { + castObj := &operatorv1.Storage{} + if err := runtime.DefaultUnstructuredConverter.FromUnstructured(obj.Object, castObj); err != nil { + return nil, fmt.Errorf("unable to convert to Storage: %w", err) + } + ret, err := applyoperatorv1.ExtractStorage(castObj, fieldManager) + if err != nil { + return nil, fmt.Errorf("unable to extract fields for %q: %w", fieldManager, err) + } + if ret.Spec == nil { + return nil, nil + } + return &ret.Spec.OperatorSpecApplyConfiguration, nil +} + +func extractOperatorStatus(obj *unstructured.Unstructured, fieldManager string) (*applyoperatorv1.OperatorStatusApplyConfiguration, error) { + castObj := &operatorv1.Storage{} + if err := runtime.DefaultUnstructuredConverter.FromUnstructured(obj.Object, castObj); err != nil { + return nil, fmt.Errorf("unable to convert to Storage: %w", err) + } + ret, err := applyoperatorv1.ExtractStorageStatus(castObj, fieldManager) + if err != nil { + return nil, fmt.Errorf("unable to extract fields for %q: %w", fieldManager, err) + } + + if ret.Status == nil { + return nil, nil + } + return &ret.Status.OperatorStatusApplyConfiguration, nil +} diff --git a/pkg/csoclients/fake.go b/pkg/csoclients/fake.go index f7cb19005..185e50f3b 100644 --- a/pkg/csoclients/fake.go +++ b/pkg/csoclients/fake.go @@ -1,6 +1,7 @@ package csoclients import ( + operatorv1 "github.com/openshift/api/operator/v1" opv1 "github.com/openshift/api/operator/v1" fakeconfig "github.com/openshift/client-go/config/clientset/versioned/fake" cfginformers "github.com/openshift/client-go/config/informers/externalversions" @@ -73,13 +74,16 @@ func NewFakeClients(initialObjects *FakeTestObjects) *Clients { categoryExpander := restmapper.NewDiscoveryCategoryExpander(kubeClient.Discovery()) restMapper := restmapper.NewDeferredDiscoveryRESTMapper(memory.NewMemCacheClient(kubeClient.Discovery())) - opClient := operatorclient.OperatorClient{ - Client: operatorClient, - Informers: operatorInformerFactory, - } + opClient := v1helpers.NewFakeOperatorClient( + &operatorv1.OperatorSpec{ + ManagementState: operatorv1.Managed, + }, + &operatorv1.OperatorStatus{}, + nil, + ) return &Clients{ - OperatorClient: &opClient, + OperatorClient: opClient, KubeClient: kubeClient, KubeInformers: kubeInformers, ExtensionClientSet: apiExtClient, diff --git a/pkg/operatorclient/operatorclient.go b/pkg/operatorclient/operatorclient.go index 90a308645..bc69367ef 100644 --- a/pkg/operatorclient/operatorclient.go +++ b/pkg/operatorclient/operatorclient.go @@ -1,16 +1,8 @@ package operatorclient import ( - "context" - "reflect" - "github.com/openshift/library-go/pkg/operator/v1helpers" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/client-go/tools/cache" - - operatorv1 "github.com/openshift/api/operator/v1" - opclient "github.com/openshift/client-go/operator/clientset/versioned" - opinformers "github.com/openshift/client-go/operator/informers/externalversions" + "k8s.io/client-go/dynamic/dynamicinformer" ) const ( @@ -18,138 +10,6 @@ const ( ) type OperatorClient struct { - Informers opinformers.SharedInformerFactory - Client opclient.Interface -} - -var _ v1helpers.OperatorClient = &OperatorClient{} - -func (c OperatorClient) Informer() cache.SharedIndexInformer { - return c.Informers.Operator().V1().Storages().Informer() -} - -func (c OperatorClient) GetOperatorState() (*operatorv1.OperatorSpec, *operatorv1.OperatorStatus, string, error) { - instance, err := c.Informers.Operator().V1().Storages().Lister().Get(GlobalConfigName) - if err != nil { - return nil, nil, "", err - } - - return &instance.Spec.OperatorSpec, &instance.Status.OperatorStatus, instance.ResourceVersion, nil -} - -func (c OperatorClient) UpdateOperatorSpec(ctx context.Context, resourceVersion string, spec *operatorv1.OperatorSpec) (*operatorv1.OperatorSpec, string, error) { - original, err := c.Informers.Operator().V1().Storages().Lister().Get(GlobalConfigName) - if err != nil { - return nil, "", err - } - copy := original.DeepCopy() - copy.ResourceVersion = resourceVersion - copy.Spec.OperatorSpec = *spec - - ret, err := c.Client.OperatorV1().Storages().Update(context.TODO(), copy, metav1.UpdateOptions{}) - if err != nil { - return nil, "", err - } - - return &ret.Spec.OperatorSpec, ret.ResourceVersion, nil -} - -func (c OperatorClient) UpdateOperatorStatus(ctx context.Context, resourceVersion string, status *operatorv1.OperatorStatus) (*operatorv1.OperatorStatus, error) { - original, err := c.Informers.Operator().V1().Storages().Lister().Get(GlobalConfigName) - if err != nil { - return nil, err - } - copy := original.DeepCopy() - copy.ResourceVersion = resourceVersion - copy.Status.OperatorStatus = *status - - ret, err := c.Client.OperatorV1().Storages().UpdateStatus(context.TODO(), copy, metav1.UpdateOptions{}) - if err != nil { - return nil, err - } - - return &ret.Status.OperatorStatus, nil -} - -func (c OperatorClient) GetObjectMeta() (meta *metav1.ObjectMeta, err error) { - instance, err := c.Informers.Operator().V1().Storages().Lister().Get(GlobalConfigName) - if err != nil { - return nil, err - } - return &instance.ObjectMeta, nil -} - -func (c OperatorClient) SetObjectAnnotations(required map[string]string) error { - instance, err := c.Informers.Operator().V1().Storages().Lister().Get(GlobalConfigName) - if err != nil { - return err - } - - newInstance := instance.DeepCopy() - for k, v := range required { - metav1.SetMetaDataAnnotation(&newInstance.ObjectMeta, k, v) - } - if !reflect.DeepEqual(instance.Annotations, newInstance.Annotations) { - _, err := c.Client.OperatorV1().Storages().Update(context.TODO(), newInstance, metav1.UpdateOptions{}) - return err - } - return nil -} - -func (c OperatorClient) EnsureFinalizer(ctx context.Context, finalizer string) error { - // In theory, this is unused - CSO is not a removable operator - storage, err := c.Informers.Operator().V1().Storages().Lister().Get(GlobalConfigName) - if err != nil { - return err - } - - if storage.DeletionTimestamp != nil { - return nil - } - - for _, f := range storage.Finalizers { - if f == finalizer { - // Finalizer already exists - return nil - } - } - - newStorage := storage.DeepCopy() - newStorage.Finalizers = append(newStorage.Finalizers, finalizer) - _, err = c.Client.OperatorV1().Storages().Update(ctx, newStorage, metav1.UpdateOptions{}) - return err -} - -func (c OperatorClient) RemoveFinalizer(ctx context.Context, finalizer string) error { - // In theory, this is unused - CSO is not a removable operator - storage, err := c.Informers.Operator().V1().Storages().Lister().Get(GlobalConfigName) - if err != nil { - return err - } - - var newFinalizers []string - for _, f := range storage.Finalizers { - if f != finalizer { - newFinalizers = append(newFinalizers, f) - } - } - - if len(newFinalizers) == len(storage.Finalizers) { - return nil - } - - newStorage := storage.DeepCopy() - newStorage.Finalizers = newFinalizers - _, err = c.Client.OperatorV1().Storages().Update(ctx, newStorage, metav1.UpdateOptions{}) - return err - -} - -func (c OperatorClient) GetOperatorStateWithQuorum(ctx context.Context) (*operatorv1.OperatorSpec, *operatorv1.OperatorStatus, string, error) { - instance, err := c.Client.OperatorV1().Storages().Get(ctx, GlobalConfigName, metav1.GetOptions{}) - if err != nil { - return nil, nil, "", err - } - - return &instance.Spec.OperatorSpec, &instance.Status.OperatorStatus, instance.GetResourceVersion(), nil + Informers dynamicinformer.DynamicSharedInformerFactory + Client v1helpers.OperatorClient } From 2813ae406ff7f4b5ce093a0fa35c8cd1598f79be Mon Sep 17 00:00:00 2001 From: Fabio Bertinatto Date: Thu, 19 Sep 2024 08:07:56 -0300 Subject: [PATCH 02/13] move olmremovalcontroller to generic operator client --- .../csidriveroperator/olmremovalcontroller.go | 47 +++++++++++++------ 1 file changed, 32 insertions(+), 15 deletions(-) diff --git a/pkg/operator/csidriveroperator/olmremovalcontroller.go b/pkg/operator/csidriveroperator/olmremovalcontroller.go index 04a45f4e6..188702ff7 100644 --- a/pkg/operator/csidriveroperator/olmremovalcontroller.go +++ b/pkg/operator/csidriveroperator/olmremovalcontroller.go @@ -2,9 +2,11 @@ package csidriveroperator import ( "context" + "reflect" "time" operatorapi "github.com/openshift/api/operator/v1" + opclient "github.com/openshift/client-go/operator/clientset/versioned" "github.com/openshift/cluster-storage-operator/pkg/csoclients" "github.com/openshift/cluster-storage-operator/pkg/operator/csidriveroperator/csioperatorclient" "github.com/openshift/cluster-storage-operator/pkg/operatorclient" @@ -32,13 +34,14 @@ import ( // OLMOperatorRemovalProgressing/Degraded: for status reporting. // OLMOperatorRemovalAvailable: to signal that the removal has been complete type OLMOperatorRemovalController struct { - name string - operatorClient *operatorclient.OperatorClient - olmOptions *csioperatorclient.OLMOptions - dynamicClient dynamic.Interface - kubeClient kubernetes.Interface - eventRecorder events.Recorder - factory *factory.Factory + name string + operatorClient v1helpers.OperatorClientWithFinalizers + operatorClientSet opclient.Interface + olmOptions *csioperatorclient.OLMOptions + dynamicClient dynamic.Interface + kubeClient kubernetes.Interface + eventRecorder events.Recorder + factory *factory.Factory olmOperatorNamespace string olmOperatorCSVName string @@ -90,13 +93,14 @@ func NewOLMOperatorRemovalController( f = f.WithInformers(clients.OperatorClient.Informer()) c := &OLMOperatorRemovalController{ - name: csiOperatorConfig.ConditionPrefix, - operatorClient: clients.OperatorClient, - olmOptions: csiOperatorConfig.OLMOptions, - dynamicClient: clients.DynamicClient, - kubeClient: clients.KubeClient, - eventRecorder: eventRecorder.WithComponentSuffix(csiOperatorConfig.ConditionPrefix), - factory: f, + name: csiOperatorConfig.ConditionPrefix, + operatorClient: clients.OperatorClient, + operatorClientSet: clients.OperatorClientSet, + olmOptions: csiOperatorConfig.OLMOptions, + dynamicClient: clients.DynamicClient, + kubeClient: clients.KubeClient, + eventRecorder: eventRecorder.WithComponentSuffix(csiOperatorConfig.ConditionPrefix), + factory: f, } return c } @@ -259,7 +263,20 @@ func (c *OLMOperatorRemovalController) saveMetadata(namespace string, csvName st c.name + olmOperatorNamespaceAnnotation: namespace, c.name + olmOperatorCSVAnnotation: csvName, } - return c.operatorClient.SetObjectAnnotations(annotations) + instance, err := c.operatorClientSet.OperatorV1().Storages().Get(context.TODO(), operatorclient.GlobalConfigName, metav1.GetOptions{}) + if err != nil { + return err + } + + newInstance := instance.DeepCopy() + for k, v := range annotations { + metav1.SetMetaDataAnnotation(&newInstance.ObjectMeta, k, v) + } + if !reflect.DeepEqual(instance.Annotations, newInstance.Annotations) { + _, err := c.operatorClientSet.OperatorV1().Storages().Update(context.TODO(), newInstance, metav1.UpdateOptions{}) + return err + } + return nil } func (c *OLMOperatorRemovalController) loadMetadata() (string, string, error) { From 68f6bdc43e74dde1dfe08843fec985ad357c3039 Mon Sep 17 00:00:00 2001 From: Fabio Bertinatto Date: Fri, 20 Sep 2024 14:27:05 -0300 Subject: [PATCH 03/13] Refactor utils.CreateDeployment() to use Server-Side Apply (SSA) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use SSA for updating OperatorStatus. Although the function doesn’t appear to be in use, it is exported and may have external consumers. --- pkg/utils/deployment_controller.go | 72 ++++++++++++++++++------------ 1 file changed, 44 insertions(+), 28 deletions(-) diff --git a/pkg/utils/deployment_controller.go b/pkg/utils/deployment_controller.go index a930a1735..828e580c1 100644 --- a/pkg/utils/deployment_controller.go +++ b/pkg/utils/deployment_controller.go @@ -7,7 +7,9 @@ import ( "strings" operatorapi "github.com/openshift/api/operator/v1" + applyoperatorv1 "github.com/openshift/client-go/operator/applyconfigurations/operator/v1" "github.com/openshift/cluster-storage-operator/assets" + "github.com/openshift/library-go/pkg/controller/factory" "github.com/openshift/library-go/pkg/operator/events" "github.com/openshift/library-go/pkg/operator/loglevel" "github.com/openshift/library-go/pkg/operator/resource/resourceapply" @@ -18,6 +20,7 @@ import ( appsv1 "k8s.io/api/apps/v1" corev1 "k8s.io/api/core/v1" "k8s.io/client-go/kubernetes" + "k8s.io/utils/ptr" ) type DeploymentOptions struct { @@ -41,54 +44,67 @@ func CreateDeployment(ctx context.Context, depOpts DeploymentOptions) (*appsv1.D } // Available: at least one replica is running - deploymentAvailable := operatorapi.OperatorCondition{ - Type: depOpts.ControllerName + operatorapi.OperatorStatusTypeAvailable, - } + // deploymentAvailable := operatorapi.OperatorCondition{ + // Type: depOpts.ControllerName + operatorapi.OperatorStatusTypeAvailable, + // } + deploymentAvailable := applyoperatorv1.OperatorCondition(). + WithType(depOpts.ControllerName + operatorapi.OperatorStatusTypeAvailable) + if deployment.Status.AvailableReplicas > 0 { - deploymentAvailable.Status = operatorapi.ConditionTrue + deploymentAvailable = deploymentAvailable. + WithStatus(operatorapi.ConditionTrue) } else { - deploymentAvailable.Status = operatorapi.ConditionFalse - deploymentAvailable.Reason = "Deploying" - deploymentAvailable.Message = "Waiting for a Deployment pod to start" + deploymentAvailable = deploymentAvailable. + WithStatus(operatorapi.ConditionFalse). + WithReason("Deploying"). + WithMessage("Waiting for a Deployment pod to start") } // Not progressing: all replicas are at the latest version && Deployment generation matches - deploymentProgressing := operatorapi.OperatorCondition{ - Type: depOpts.ControllerName + operatorapi.OperatorStatusTypeProgressing, - } + deploymentProgressing := applyoperatorv1.OperatorCondition(). + WithType(depOpts.ControllerName + operatorapi.OperatorStatusTypeProgressing) + if deployment.Status.ObservedGeneration != deployment.Generation { - deploymentProgressing.Status = operatorapi.ConditionTrue - deploymentProgressing.Reason = "NewGeneration" msg := fmt.Sprintf("desired generation %d, current generation %d", deployment.Generation, deployment.Status.ObservedGeneration) - deploymentProgressing.Message = msg + deploymentProgressing = deploymentProgressing. + WithStatus(operatorapi.ConditionTrue). + WithReason("NewGeneration"). + WithMessage(msg) } else { if deployment.Spec.Replicas != nil { if deployment.Status.UpdatedReplicas == *deployment.Spec.Replicas { - deploymentProgressing.Status = operatorapi.ConditionFalse + deploymentProgressing = deploymentProgressing.WithStatus(operatorapi.ConditionFalse) // All replicas were updated, set the version depOpts.VersionGetter.SetVersion(depOpts.VersionName, depOpts.TargetVersion) } else { msg := fmt.Sprintf("%d out of %d pods running", deployment.Status.UpdatedReplicas, *deployment.Spec.Replicas) - deploymentProgressing.Status = operatorapi.ConditionTrue - deploymentProgressing.Reason = "Deploying" - deploymentProgressing.Message = msg + deploymentProgressing = deploymentProgressing. + WithStatus(operatorapi.ConditionTrue). + WithReason("Deploying"). + WithMessage(msg) } } } - updateGenerationFn := func(newStatus *operatorapi.OperatorStatus) error { - if deployment != nil { - resourcemerge.SetDeploymentGeneration(&newStatus.Generations, deployment) - } - return nil - } - if _, _, err := v1helpers.UpdateStatus(ctx, depOpts.OperatorClient, - v1helpers.UpdateConditionFn(deploymentAvailable), - v1helpers.UpdateConditionFn(deploymentProgressing), - updateGenerationFn, - ); err != nil { + // Create a partial status with conditions and generations + status := applyoperatorv1.OperatorStatus(). + WithConditions(deploymentAvailable, deploymentProgressing). + WithGenerations(&applyoperatorv1.GenerationStatusApplyConfiguration{ + Group: ptr.To("apps"), + Resource: ptr.To("deployments"), + Namespace: ptr.To(deployment.Namespace), + Name: ptr.To(deployment.Name), + LastGeneration: ptr.To(deployment.Generation), + }) + err = depOpts.OperatorClient.ApplyOperatorStatus( + ctx, + factory.ControllerFieldManager("CreateDeployment", "updateOperatorStatus"), + status, + ) + if err != nil { return nil, err } + return deployment, nil } From 4234dbb985966430c5d5b2ae852ce94cb0db5e25 Mon Sep 17 00:00:00 2001 From: Fabio Bertinatto Date: Fri, 20 Sep 2024 14:53:56 -0300 Subject: [PATCH 04/13] Refactor CommonCSIDeploymentController to use SSA to update OperatorStatus --- .../csidriveroperator/deploymentcontroller.go | 43 +++++++++++-------- 1 file changed, 24 insertions(+), 19 deletions(-) diff --git a/pkg/operator/csidriveroperator/deploymentcontroller.go b/pkg/operator/csidriveroperator/deploymentcontroller.go index ccf0fc61d..b56fb90a3 100644 --- a/pkg/operator/csidriveroperator/deploymentcontroller.go +++ b/pkg/operator/csidriveroperator/deploymentcontroller.go @@ -9,10 +9,12 @@ import ( appsv1 "k8s.io/api/apps/v1" "k8s.io/client-go/kubernetes" "k8s.io/klog/v2" + "k8s.io/utils/ptr" configv1 "github.com/openshift/api/config/v1" operatorv1 "github.com/openshift/api/operator/v1" configv1listers "github.com/openshift/client-go/config/listers/config/v1" + applyoperatorv1 "github.com/openshift/client-go/operator/applyconfigurations/operator/v1" "github.com/openshift/library-go/pkg/controller/factory" "github.com/openshift/library-go/pkg/operator/events" "github.com/openshift/library-go/pkg/operator/resource/resourceapply" @@ -77,29 +79,32 @@ func (c *CommonCSIDeploymentController) preCheckSync( } func (c *CommonCSIDeploymentController) postSync(ctx context.Context, deployment *appsv1.Deployment) error { - progressingCondition := operatorv1.OperatorCondition{ - Type: c.name + operatorv1.OperatorStatusTypeProgressing, - Status: operatorv1.ConditionFalse, - } + progressingCondition := applyoperatorv1.OperatorCondition(). + WithType(c.name + operatorv1.OperatorStatusTypeProgressing). + WithStatus(operatorv1.ConditionFalse) if ok, msg := isProgressing(deployment); ok { - progressingCondition.Status = operatorv1.ConditionTrue - progressingCondition.Message = msg - progressingCondition.Reason = "Deploying" - } - - updateStatusFn := func(newStatus *operatorv1.OperatorStatus) error { - resourcemerge.SetDeploymentGeneration(&newStatus.Generations, deployment) - return nil - } - - _, _, err := v1helpers.UpdateStatus( + progressingCondition = progressingCondition.WithStatus(operatorv1.ConditionTrue). + WithReason("Deploying"). + WithMessage(msg) + } + + // Create a partial status with conditions and generations + status := applyoperatorv1.OperatorStatus(). + WithConditions(progressingCondition). + WithGenerations(&applyoperatorv1.GenerationStatusApplyConfiguration{ + Group: ptr.To("apps"), + Resource: ptr.To("deployments"), + Namespace: ptr.To(deployment.Namespace), + Name: ptr.To(deployment.Name), + LastGeneration: ptr.To(deployment.Generation), + }) + + return c.operatorClient.ApplyOperatorStatus( ctx, - c.operatorClient, - updateStatusFn, - v1helpers.UpdateConditionFn(progressingCondition), + factory.ControllerFieldManager(c.name, "updateOperatorStatus"), + status, ) - return err } func initCommonDeploymentParams( From 1772781f998740bb5834edf0d8c4be4df633e270 Mon Sep 17 00:00:00 2001 From: Fabio Bertinatto Date: Fri, 20 Sep 2024 15:40:29 -0300 Subject: [PATCH 05/13] Refactor DefaultStorageClassController to use SSA to update OperatorStatus --- .../defaultstorageclass/controller.go | 128 +++++++++++------- 1 file changed, 80 insertions(+), 48 deletions(-) diff --git a/pkg/operator/defaultstorageclass/controller.go b/pkg/operator/defaultstorageclass/controller.go index c60120ab3..1d94214a9 100644 --- a/pkg/operator/defaultstorageclass/controller.go +++ b/pkg/operator/defaultstorageclass/controller.go @@ -7,6 +7,7 @@ import ( configv1 "github.com/openshift/api/config/v1" operatorapi "github.com/openshift/api/operator/v1" openshiftv1 "github.com/openshift/client-go/config/listers/config/v1" + applyoperatorv1 "github.com/openshift/client-go/operator/applyconfigurations/operator/v1" "github.com/openshift/cluster-storage-operator/pkg/csoclients" "github.com/openshift/library-go/pkg/controller/factory" "github.com/openshift/library-go/pkg/operator/events" @@ -74,81 +75,112 @@ func (c *Controller) sync(ctx context.Context, syncCtx factory.SyncContext) erro return nil } - availableCnd := operatorapi.OperatorCondition{ - Type: conditionsPrefix + operatorapi.OperatorStatusTypeAvailable, - Status: operatorapi.ConditionTrue, - } - progressingCnd := operatorapi.OperatorCondition{ - Type: conditionsPrefix + operatorapi.OperatorStatusTypeProgressing, - Status: operatorapi.ConditionFalse, - } + availableCnd := applyoperatorv1.OperatorCondition(). + WithType(conditionsPrefix + operatorapi.OperatorStatusTypeAvailable). + WithStatus(operatorapi.ConditionTrue) + + progressingCnd := applyoperatorv1.OperatorCondition(). + WithType(conditionsPrefix + operatorapi.OperatorStatusTypeProgressing). + WithStatus(operatorapi.ConditionFalse) syncErr := c.syncStorageClass(ctx) if syncErr != nil { if syncErr == unsupportedPlatformError { // Set Disabled condition - there is nothing to do - disabledCnd := operatorapi.OperatorCondition{ - Type: conditionsPrefix + disabledConditionType, - Status: operatorapi.ConditionTrue, - Reason: "UnsupportedPlatform", - Message: syncErr.Error(), - } - - upgradeableCnt := operatorapi.OperatorCondition{ - Type: conditionsPrefix + operatorapi.OperatorStatusTypeUpgradeable, - Status: operatorapi.ConditionTrue, - } + disabledCnd := applyoperatorv1.OperatorCondition(). + WithType(conditionsPrefix + disabledConditionType). + WithStatus(operatorapi.ConditionTrue). + WithReason("UnsupportedPlatform"). + WithMessage(syncErr.Error()) + + upgradeableCnd := applyoperatorv1.OperatorCondition(). + WithType(conditionsPrefix + operatorapi.OperatorStatusTypeUpgradeable). + WithStatus(operatorapi.ConditionTrue) // Set Available=true, Progressing=false, Upgradeable=true - everything is OK and // there is nothing to do. ClusterOperatorStatusController needs // at least one Available/Pogressing condition set to mark the // overall ClusterOperator as Available + notPogressing. - availableCnd.Message = "No default StorageClass for this platform" - availableCnd.Status = operatorapi.ConditionTrue - - _, _, updateErr := v1helpers.UpdateStatus(ctx, c.operatorClient, - v1helpers.UpdateConditionFn(disabledCnd), - v1helpers.UpdateConditionFn(availableCnd), - v1helpers.UpdateConditionFn(progressingCnd), - v1helpers.UpdateConditionFn(upgradeableCnt), + availableCnd = availableCnd. + WithMessage("No default StorageClass for this platform"). + WithStatus(operatorapi.ConditionTrue) + + // Create a partial status with conditions + status := applyoperatorv1.OperatorStatus().WithConditions( + disabledCnd, + availableCnd, + progressingCnd, + upgradeableCnd, + ) + return c.operatorClient.ApplyOperatorStatus( + ctx, + factory.ControllerFieldManager("DefaultStorageClassController", "updateOperatorStatus"), + status, ) - return updateErr } else if syncErr == supportedByCSIError { // Set Available=true, Progressing=false - everything is OK // for this operator, but there may be work remaining for the // external CSI Drivers. - availableCnd.Message = "StorageClass provided by supplied CSI Driver instead of the cluster-storage-operator" - availableCnd.Status = operatorapi.ConditionTrue - - _, _, updateErr := v1helpers.UpdateStatus(ctx, c.operatorClient, - v1helpers.UpdateConditionFn(availableCnd), - v1helpers.UpdateConditionFn(progressingCnd), + availableCnd = availableCnd. + WithStatus(operatorapi.ConditionTrue). + WithMessage("StorageClass provided by supplied CSI Driver instead of the cluster-storage-operator") + + // Create a partial status with conditions + status := applyoperatorv1.OperatorStatus().WithConditions( + availableCnd, + progressingCnd, + ) + return c.operatorClient.ApplyOperatorStatus( + ctx, + factory.ControllerFieldManager("DefaultStorageClassController", "updateOperatorStatus"), + status, ) - return updateErr } - if v1helpers.IsOperatorConditionPresentAndEqual(opStatus.Conditions, availableCnd.Type, operatorapi.ConditionTrue) { + if v1helpers.IsOperatorConditionPresentAndEqual(opStatus.Conditions, *availableCnd.Type, operatorapi.ConditionTrue) { // Don't flip Available=true -> false on a random API server hiccup, e.g. during cluster upgrade. // The operator will get Degraded=true with inertia. - availableCnd.Status = operatorapi.ConditionTrue + availableCnd = availableCnd.WithStatus(operatorapi.ConditionTrue) } else { // Either add Available=false if it's missing or keep it false. - availableCnd.Status = operatorapi.ConditionFalse + availableCnd = availableCnd.WithStatus(operatorapi.ConditionFalse) } - availableCnd.Reason = "SyncError" - availableCnd.Message = syncErr.Error() + + availableCnd = availableCnd. + WithReason("SyncError"). + WithMessage(syncErr.Error()) // Progressing=true - progressingCnd.Status = operatorapi.ConditionTrue - progressingCnd.Reason = "SyncError" - progressingCnd.Message = syncErr.Error() + progressingCnd = progressingCnd. + WithStatus(operatorapi.ConditionTrue). + WithReason("SyncError"). + WithMessage(syncErr.Error()) // fall through with syncErr -> mark as Degraded with inertia } - if _, _, updateErr := v1helpers.UpdateStatus(ctx, c.operatorClient, - v1helpers.UpdateConditionFn(availableCnd), - v1helpers.UpdateConditionFn(progressingCnd), - removeConditionFn(conditionsPrefix+disabledConditionType), - ); updateErr != nil { + // Create a partial status with conditions + status := applyoperatorv1.OperatorStatus().WithConditions( + availableCnd, + progressingCnd, + ) + + // FIXME: originally this was the code: + // + // if _, _, updateErr := v1helpers.UpdateStatus(ctx, c.operatorClient, + // v1helpers.UpdateConditionFn(availableCnd), + // v1helpers.UpdateConditionFn(progressingCnd), + // removeConditionFn(conditionsPrefix+disabledConditionType), + // ); + // + // However, now we can't remove conditions, we simply don't set them. + // Is that enought? + + updateErr := c.operatorClient.ApplyOperatorStatus( + ctx, + factory.ControllerFieldManager("DefaultStorageClassController", "updateOperatorStatus"), + status, + ) + + if updateErr != nil { return errutil.NewAggregate([]error{syncErr, updateErr}) } From f09dc339a6d8388f81866f8805d24c0d50c54dd6 Mon Sep 17 00:00:00 2001 From: Fabio Bertinatto Date: Fri, 20 Sep 2024 18:06:21 -0300 Subject: [PATCH 06/13] Refactor CSIDriverOperatorCRController to use SSA to update OperatorStatus --- .../csidriveroperator/crcontroller.go | 114 ++++++++++-------- 1 file changed, 66 insertions(+), 48 deletions(-) diff --git a/pkg/operator/csidriveroperator/crcontroller.go b/pkg/operator/csidriveroperator/crcontroller.go index 3b3275ded..385e872d8 100644 --- a/pkg/operator/csidriveroperator/crcontroller.go +++ b/pkg/operator/csidriveroperator/crcontroller.go @@ -7,6 +7,7 @@ import ( "time" operatorapi "github.com/openshift/api/operator/v1" + applyoperatorv1 "github.com/openshift/client-go/operator/applyconfigurations/operator/v1" opclient "github.com/openshift/client-go/operator/clientset/versioned" oplisters "github.com/openshift/client-go/operator/listers/operator/v1" "github.com/openshift/cluster-storage-operator/assets" @@ -14,7 +15,6 @@ import ( "github.com/openshift/cluster-storage-operator/pkg/operator/csidriveroperator/csioperatorclient" "github.com/openshift/library-go/pkg/controller/factory" "github.com/openshift/library-go/pkg/operator/events" - "github.com/openshift/library-go/pkg/operator/resource/resourcemerge" "github.com/openshift/library-go/pkg/operator/status" "github.com/openshift/library-go/pkg/operator/v1helpers" apierrors "k8s.io/apimachinery/pkg/api/errors" @@ -124,19 +124,14 @@ func (c *CSIDriverOperatorCRController) Sync(ctx context.Context, syncCtx factor return err } - newGeneration := operatorapi.GenerationStatus{ - Group: operatorapi.GroupName, - Resource: "clustercsidrivers", - Namespace: cr.Namespace, - Name: cr.Name, - LastGeneration: cr.ObjectMeta.Generation, - } - updateGenerationFn := func(newStatus *operatorapi.OperatorStatus) error { - resourcemerge.SetGeneration(&newStatus.Generations, newGeneration) - return nil - } + newGeneration := applyoperatorv1.GenerationStatus(). + WithGroup(operatorapi.GroupName). + WithResource("clustercsidrivers"). + WithNamespace(cr.Namespace). + WithName(cr.Name). + WithLastGeneration(cr.ObjectMeta.Generation) - if err := c.syncConditions(ctx, cr.Status.Conditions, updateGenerationFn); err != nil { + if err := c.syncConditions(ctx, cr.Status.Conditions, newGeneration); err != nil { errs = append(errs, err) } return errors.NewAggregate(errs) @@ -185,62 +180,85 @@ func (c *CSIDriverOperatorCRController) applyClusterCSIDriver(ctx context.Contex return existing.DeepCopy(), false, nil } -func (c *CSIDriverOperatorCRController) syncConditions(ctx context.Context, conditions []operatorapi.OperatorCondition, updatefn v1helpers.UpdateStatusFunc) error { - var availableCnd operatorapi.OperatorCondition +func (c *CSIDriverOperatorCRController) syncConditions(ctx context.Context, conditions []operatorapi.OperatorCondition, newGeneration *applyoperatorv1.GenerationStatusApplyConfiguration) error { + // Available condition + availableCnd := applyoperatorv1. + OperatorCondition(). + WithType(c.crConditionName(operatorapi.OperatorStatusTypeAvailable)) disabled, msg := c.hasDisabledCondition(conditions) if disabled && c.allowDisabled { // The driver can't be running. Mark the operator as Available, but with an extra message. - availableCnd.Status = operatorapi.ConditionTrue - availableCnd.Reason = "DriverDisabled" - availableCnd.Message = fmt.Sprintf("CSI driver for %s is disabled: %s", c.name, msg) + availableCnd = availableCnd. + WithStatus(operatorapi.ConditionTrue). + WithReason("DriverDisabled"). + WithMessage(fmt.Sprintf("CSI driver for %s is disabled: %s", c.name, msg)) } else { // The driver should be running, copy conditions from the CR - availableCnd = status.UnionCondition(operatorapi.OperatorStatusTypeAvailable, operatorapi.ConditionTrue, nil, conditions...) - if availableCnd.Status == operatorapi.ConditionUnknown { - availableCnd.Status = operatorapi.ConditionFalse - availableCnd.Reason = "WaitForOperator" - availableCnd.Message = fmt.Sprintf("Waiting for %s operator to report status", c.name) + clusterCSIDriverAvailableCnd := status.UnionCondition(operatorapi.OperatorStatusTypeAvailable, operatorapi.ConditionTrue, nil, conditions...) + if clusterCSIDriverAvailableCnd.Status == operatorapi.ConditionUnknown { + // If the ClusterCSIDriver's Available condition is Unknown, then ours will be false + availableCnd = availableCnd. + WithStatus(operatorapi.ConditionFalse). + WithReason("WaitForOperator"). + WithMessage(fmt.Sprintf("Waiting for %s operator to report status", c.name)) + } else { + // Copy the ClusterCSIDriver's Available condition as is + availableCnd = availableCnd. + WithReason(clusterCSIDriverAvailableCnd.Reason). + WithStatus(clusterCSIDriverAvailableCnd.Status). + WithMessage(clusterCSIDriverAvailableCnd.Message) } } - availableCnd.Type = c.crConditionName(operatorapi.OperatorStatusTypeAvailable) - progressingCnd := status.UnionCondition(operatorapi.OperatorStatusTypeProgressing, operatorapi.ConditionFalse, nil, conditions...) - progressingCnd.Type = c.crConditionName(operatorapi.OperatorStatusTypeProgressing) - if progressingCnd.Status == operatorapi.ConditionUnknown { + // Progressing condition + progressingCnd := applyoperatorv1.OperatorCondition().WithType(c.crConditionName(operatorapi.OperatorStatusTypeProgressing)) + clusterCSIDriverProgressingCnd := status.UnionCondition(operatorapi.OperatorStatusTypeProgressing, operatorapi.ConditionFalse, nil, conditions...) + if clusterCSIDriverProgressingCnd.Status == operatorapi.ConditionUnknown { if disabled && c.allowDisabled { - progressingCnd.Status = operatorapi.ConditionFalse + progressingCnd = progressingCnd.WithStatus(operatorapi.ConditionFalse) } else { - progressingCnd.Status = operatorapi.ConditionTrue - progressingCnd.Reason = "WaitForOperator" - progressingCnd.Message = fmt.Sprintf("Waiting for %s operator to report status", c.name) + progressingCnd = progressingCnd. + WithStatus(operatorapi.ConditionTrue). + WithReason("WaitForOperator"). + WithMessage(fmt.Sprintf("Waiting for %s operator to report status", c.name)) } } + // Upgradeable condition upgradeableConditionType := c.crConditionName(operatorapi.OperatorStatusTypeUpgradeable) - upgradeableCond := operatorapi.OperatorCondition{ - Type: upgradeableConditionType, - Status: operatorapi.ConditionTrue, - } + upgradeableCnd := applyoperatorv1.OperatorCondition(). + WithType(upgradeableConditionType). + WithStatus(operatorapi.ConditionTrue) if hasCondition(conditions, operatorapi.OperatorStatusTypeUpgradeable) { - upgradeableCond = status.UnionCondition(operatorapi.OperatorStatusTypeUpgradeable, operatorapi.ConditionTrue, nil, conditions...) - upgradeableCond.Type = upgradeableConditionType + clusterCSIDriverUpgradeableCnd := status.UnionCondition(operatorapi.OperatorStatusTypeUpgradeable, operatorapi.ConditionTrue, nil, conditions...) + upgradeableCnd = upgradeableCnd. + WithReason(clusterCSIDriverUpgradeableCnd.Reason). + WithStatus(clusterCSIDriverUpgradeableCnd.Status). + WithMessage(clusterCSIDriverUpgradeableCnd.Message) } - degradedCnd := status.UnionCondition(operatorapi.OperatorStatusTypeDegraded, operatorapi.ConditionFalse, nil, conditions...) - degradedCnd.Type = c.crConditionName(operatorapi.OperatorStatusTypeDegraded) - if degradedCnd.Status == operatorapi.ConditionUnknown { - degradedCnd.Status = operatorapi.ConditionFalse + // Degraded condition + degradedCnd := applyoperatorv1.OperatorCondition().WithType(c.crConditionName(operatorapi.OperatorStatusTypeDegraded)) + clusterCSIDriverDegradedCnd := status.UnionCondition(operatorapi.OperatorStatusTypeDegraded, operatorapi.ConditionFalse, nil, conditions...) + if clusterCSIDriverDegradedCnd.Status == operatorapi.ConditionUnknown { + degradedCnd = degradedCnd.WithStatus(operatorapi.ConditionFalse) } - _, _, err := v1helpers.UpdateStatus(ctx, c.operatorClient, - v1helpers.UpdateConditionFn(availableCnd), - v1helpers.UpdateConditionFn(progressingCnd), - v1helpers.UpdateConditionFn(degradedCnd), - v1helpers.UpdateConditionFn(upgradeableCond), - updatefn, + // Create a partial status with conditions and newGeneration + status := applyoperatorv1.OperatorStatus(). + WithConditions( + availableCnd, + progressingCnd, + degradedCnd, + upgradeableCnd). + WithGenerations(newGeneration) + + return c.operatorClient.ApplyOperatorStatus( + ctx, + factory.ControllerFieldManager(c.name, "updateOperatorStatus"), + status, ) - return err } func (c *CSIDriverOperatorCRController) hasDisabledCondition(conditions []operatorapi.OperatorCondition) (bool, string) { From 438abada8c1548a4d3a9646449ee4740000a264d Mon Sep 17 00:00:00 2001 From: Fabio Bertinatto Date: Fri, 20 Sep 2024 18:19:33 -0300 Subject: [PATCH 07/13] Refactor OLMOperatorRemovalController to use SSA to update OperatorStatus --- .../csidriveroperator/olmremovalcontroller.go | 75 ++++++++++--------- 1 file changed, 41 insertions(+), 34 deletions(-) diff --git a/pkg/operator/csidriveroperator/olmremovalcontroller.go b/pkg/operator/csidriveroperator/olmremovalcontroller.go index 188702ff7..b3d424012 100644 --- a/pkg/operator/csidriveroperator/olmremovalcontroller.go +++ b/pkg/operator/csidriveroperator/olmremovalcontroller.go @@ -6,6 +6,7 @@ import ( "time" operatorapi "github.com/openshift/api/operator/v1" + applyoperatorv1 "github.com/openshift/client-go/operator/applyconfigurations/operator/v1" opclient "github.com/openshift/client-go/operator/clientset/versioned" "github.com/openshift/cluster-storage-operator/pkg/csoclients" "github.com/openshift/cluster-storage-operator/pkg/operator/csidriveroperator/csioperatorclient" @@ -291,55 +292,61 @@ func (c *OLMOperatorRemovalController) loadMetadata() (string, string, error) { } func (c *OLMOperatorRemovalController) markProgressing(ctx context.Context, syncCtx factory.SyncContext, message string) error { - progressing := operatorapi.OperatorCondition{ - Type: c.Name() + operatorapi.OperatorStatusTypeProgressing, - Reason: "RemovingOLMOperator", - Status: operatorapi.ConditionTrue, - Message: message, - } - available := operatorapi.OperatorCondition{ - Type: c.Name() + operatorapi.OperatorStatusTypeAvailable, - Reason: "RemovingOLMOperator", - Status: operatorapi.ConditionFalse, - Message: message, - } - - if _, _, err := v1helpers.UpdateStatus(ctx, c.operatorClient, - v1helpers.UpdateConditionFn(progressing), - v1helpers.UpdateConditionFn(available), - ); err != nil { + progressing := applyoperatorv1.OperatorCondition(). + WithType(c.Name() + operatorapi.OperatorStatusTypeProgressing). + WithReason("RemovingOLMOperator"). + WithStatus(operatorapi.ConditionTrue). + WithMessage(message) + + available := applyoperatorv1.OperatorCondition(). + WithType(c.Name() + operatorapi.OperatorStatusTypeAvailable). + WithReason("RemovingOLMOperator"). + WithStatus(operatorapi.ConditionFalse). + WithMessage(message) + + // Create a partial status with conditions + status := applyoperatorv1.OperatorStatus().WithConditions(available, progressing) + + err := c.operatorClient.ApplyOperatorStatus( + ctx, + factory.ControllerFieldManager(c.Name(), "updateOperatorStatus"), + status, + ) + if err != nil { return err } // Re-sync after a while to check if there was any progress syncCtx.Queue().AddAfter(syncCtx.QueueKey(), waitInterval) - return nil } func (c *OLMOperatorRemovalController) markFinished(ctx context.Context, message string) error { - progressing := operatorapi.OperatorCondition{ - Type: c.Name() + operatorapi.OperatorStatusTypeProgressing, - Reason: "Finished", - Status: operatorapi.ConditionFalse, - Message: message, - } - available := operatorapi.OperatorCondition{ - Type: c.Name() + operatorapi.OperatorStatusTypeAvailable, - Reason: "Finished", - Status: operatorapi.ConditionTrue, - Message: message, - } + progressing := applyoperatorv1.OperatorCondition(). + WithType(c.Name() + operatorapi.OperatorStatusTypeProgressing). + WithReason("Finished"). + WithStatus(operatorapi.ConditionFalse). + WithMessage(message) + + available := applyoperatorv1.OperatorCondition(). + WithType(c.Name() + operatorapi.OperatorStatusTypeAvailable). + WithReason("Finished"). + WithStatus(operatorapi.ConditionTrue). + WithMessage(message) // Clear the old namespace annotation - the driver has been fully removed. if err := c.saveMetadata("", ""); err != nil { return err } - _, _, err := v1helpers.UpdateStatus(ctx, c.operatorClient, - v1helpers.UpdateConditionFn(progressing), - v1helpers.UpdateConditionFn(available), + + // Create a partial status with conditions + status := applyoperatorv1.OperatorStatus().WithConditions(available, progressing) + + return c.operatorClient.ApplyOperatorStatus( + ctx, + factory.ControllerFieldManager(c.Name(), "updateOperatorStatus"), + status, ) - return err } func (c *OLMOperatorRemovalController) ensureOperatorDeploymentRemoved(ctx context.Context, namespace, name string) (bool, error) { From 858bd10035d3bd4f953a8d525a5f07bd66aecce6 Mon Sep 17 00:00:00 2001 From: Fabio Bertinatto Date: Fri, 20 Sep 2024 18:24:36 -0300 Subject: [PATCH 08/13] Refactor VSphereProblemDetectorMonitoringController to use SSA to update OperatorStatus --- .../vsphereproblemdetector/monitoring.go | 23 ++++++++++--------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/pkg/operator/vsphereproblemdetector/monitoring.go b/pkg/operator/vsphereproblemdetector/monitoring.go index d82c900bb..236edef53 100644 --- a/pkg/operator/vsphereproblemdetector/monitoring.go +++ b/pkg/operator/vsphereproblemdetector/monitoring.go @@ -6,6 +6,7 @@ import ( "time" operatorapi "github.com/openshift/api/operator/v1" + applyoperatorv1 "github.com/openshift/client-go/operator/applyconfigurations/operator/v1" ov1 "github.com/openshift/client-go/operator/listers/operator/v1" "github.com/openshift/cluster-storage-operator/assets" "github.com/openshift/cluster-storage-operator/pkg/csoclients" @@ -139,17 +140,17 @@ func (c *monitoringController) sync(ctx context.Context, syncContext factory.Syn message = "vsphere-problem-detector alerts are enabled" } - monitoringCondition := operatorapi.OperatorCondition{ - Type: monitoringControllerName + operatorapi.OperatorStatusTypeAvailable, - Status: operatorapi.ConditionTrue, - Message: message, - } - if _, _, err := v1helpers.UpdateStatus(ctx, c.operatorClient, - v1helpers.UpdateConditionFn(monitoringCondition), - ); err != nil { - return err - } - return nil + monitoringCondition := applyoperatorv1.OperatorCondition(). + WithType(monitoringControllerName + operatorapi.OperatorStatusTypeAvailable). + WithStatus(operatorapi.ConditionTrue). + WithMessage(message) + + status := applyoperatorv1.OperatorStatus().WithConditions(monitoringCondition) + return c.operatorClient.ApplyOperatorStatus( + ctx, + factory.ControllerFieldManager(monitoringControllerName, "updateOperatorStatus"), + status, + ) } func (c *monitoringController) syncPrometheusRule(ctx context.Context, prometheusRuleBytes []byte) (*promv1.PrometheusRule, bool, error) { From a542ed7703d868115e1c7edaac8ef9b4c81fd6fe Mon Sep 17 00:00:00 2001 From: Fabio Bertinatto Date: Fri, 20 Sep 2024 18:30:29 -0300 Subject: [PATCH 09/13] Refactor driver starter to use SSA to update OperatorStatus --- .../csidriveroperator/driver_starter.go | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/pkg/operator/csidriveroperator/driver_starter.go b/pkg/operator/csidriveroperator/driver_starter.go index eff5798f8..3a6bb8c2f 100644 --- a/pkg/operator/csidriveroperator/driver_starter.go +++ b/pkg/operator/csidriveroperator/driver_starter.go @@ -13,6 +13,7 @@ import ( configv1 "github.com/openshift/api/config/v1" operatorapi "github.com/openshift/api/operator/v1" openshiftv1 "github.com/openshift/client-go/config/listers/config/v1" + applyoperatorv1 "github.com/openshift/client-go/operator/applyconfigurations/operator/v1" "github.com/openshift/cluster-storage-operator/assets" "github.com/openshift/cluster-storage-operator/pkg/csoclients" "github.com/openshift/cluster-storage-operator/pkg/operator/csidriveroperator/csioperatorclient" @@ -23,7 +24,6 @@ import ( "github.com/openshift/library-go/pkg/operator/resource/resourceapply" "github.com/openshift/library-go/pkg/operator/staticresourcecontroller" "github.com/openshift/library-go/pkg/operator/status" - "github.com/openshift/library-go/pkg/operator/v1helpers" "k8s.io/apimachinery/pkg/api/errors" utilerrors "k8s.io/apimachinery/pkg/util/errors" "k8s.io/apimachinery/pkg/util/sets" @@ -184,14 +184,15 @@ func (dsrc *driverStarterCommon) isOperatorInstalled(name string) (bool, error) func (dsrc *driverStarterCommon) setUpgradeableTrue(ctx context.Context) error { conditionPrefix := "StorageOperator" - upgradeableCnt := operatorapi.OperatorCondition{ - Type: conditionPrefix + operatorapi.OperatorStatusTypeUpgradeable, - Status: operatorapi.ConditionTrue, - } - _, _, err := v1helpers.UpdateStatus(ctx, dsrc.commonClients.OperatorClient, - v1helpers.UpdateConditionFn(upgradeableCnt), + status := applyoperatorv1.OperatorStatus(). + WithConditions(applyoperatorv1.OperatorCondition(). + WithType(conditionPrefix + operatorapi.OperatorStatusTypeUpgradeable). + WithStatus(operatorapi.ConditionTrue)) + return dsrc.commonClients.OperatorClient.ApplyOperatorStatus( + ctx, + factory.ControllerFieldManager("DriverStarter", "updateOperatorStatus"), + status, ) - return err } func (dsrc *driverStarterCommon) sync(ctx context.Context, syncCtx factory.SyncContext) error { From 067a279e9df43116a8cfc1b0aade975de98b2b8a Mon Sep 17 00:00:00 2001 From: Fabio Bertinatto Date: Mon, 23 Sep 2024 15:17:01 -0300 Subject: [PATCH 10/13] Add missing error check --- pkg/csoclients/csoclients.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pkg/csoclients/csoclients.go b/pkg/csoclients/csoclients.go index 8bebc3b51..0b90ffe90 100644 --- a/pkg/csoclients/csoclients.go +++ b/pkg/csoclients/csoclients.go @@ -248,6 +248,9 @@ func NewHypershiftGuestClients( extractOperatorSpec, extractOperatorStatus, ) + if err != nil { + return nil, err + } dc, err := discovery.NewDiscoveryClientForConfig(kubeRestConfig) if err != nil { From 6b7dc128b0798d3f2955d3e7ed43653720743149 Mon Sep 17 00:00:00 2001 From: Fabio Bertinatto Date: Thu, 26 Sep 2024 11:29:50 -0300 Subject: [PATCH 11/13] start generic informers --- pkg/csoclients/csoclients.go | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/pkg/csoclients/csoclients.go b/pkg/csoclients/csoclients.go index 0b90ffe90..2d9aa4472 100644 --- a/pkg/csoclients/csoclients.go +++ b/pkg/csoclients/csoclients.go @@ -33,7 +33,9 @@ import ( type Clients struct { // Client for CSO's CR - OperatorClient v1helpers.OperatorClientWithFinalizers + OperatorClient v1helpers.OperatorClientWithFinalizers + OperatorClientInformers dynamicinformer.DynamicSharedInformerFactory + // Kubernetes API client KubeClient kubernetes.Interface // Kubernetes API informers, per namespace @@ -131,7 +133,7 @@ func NewClients(controllerConfig *controllercmd.ControllerContext, resync time.D } c.MonitoringInformer = prominformer.NewSharedInformerFactory(c.MonitoringClient, resync) - c.OperatorClient, _, err = genericoperatorclient.NewClusterScopedOperatorClient( + c.OperatorClient, c.OperatorClientInformers, err = genericoperatorclient.NewClusterScopedOperatorClient( controllerConfig.KubeConfig, operatorv1.GroupVersion.WithResource("storages"), operatorv1.GroupVersion.WithKind("Storage"), @@ -241,7 +243,7 @@ func NewHypershiftGuestClients( } c.MonitoringInformer = prominformer.NewSharedInformerFactory(c.MonitoringClient, resync) - c.OperatorClient, _, err = genericoperatorclient.NewClusterScopedOperatorClient( + c.OperatorClient, c.OperatorClientInformers, err = genericoperatorclient.NewClusterScopedOperatorClient( controllerConfig.KubeConfig, operatorv1.GroupVersion.WithResource("storages"), operatorv1.GroupVersion.WithKind("Storage"), @@ -266,6 +268,7 @@ func StartInformers(clients *Clients, stopCh <-chan struct{}) { Start(stopCh <-chan struct{}) }{ clients.KubeInformers, + clients.OperatorClientInformers, clients.OperatorInformers, clients.ConfigInformers, clients.ExtensionInformer, @@ -281,6 +284,7 @@ func StartGuestInformers(clients *Clients, stopCh <-chan struct{}) { Start(stopCh <-chan struct{}) }{ clients.KubeInformers, + clients.OperatorClientInformers, clients.OperatorInformers, clients.ConfigInformers, clients.ExtensionInformer, @@ -296,6 +300,7 @@ func StartMgmtInformers(clients *Clients, stopCh <-chan struct{}) { Start(stopCh <-chan struct{}) }{ clients.KubeInformers, + clients.OperatorClientInformers, clients.ConfigInformers, clients.DynamicInformer, } { From 8532a8694f31ef1554ddf4b364ce4341e95c33d6 Mon Sep 17 00:00:00 2001 From: Fabio Bertinatto Date: Thu, 26 Sep 2024 13:27:43 -0300 Subject: [PATCH 12/13] Bump api, client-go and library-go --- go.mod | 8 +- go.sum | 12 +- .../openshift/api/operator/v1/types.go | 41 +- .../operator/v1/types_openshiftapiserver.go | 7 - ...000_10_config-operator_01_configs.crd.yaml | 26 + ..._12_etcd_01_etcds-CustomNoUpgrade.crd.yaml | 21 + .../0000_12_etcd_01_etcds-Default.crd.yaml | 21 + ...etcd_01_etcds-DevPreviewNoUpgrade.crd.yaml | 21 + ...tcd_01_etcds-TechPreviewNoUpgrade.crd.yaml | 21 + ..._kube-apiserver_01_kubeapiservers.crd.yaml | 21 + ...manager_01_kubecontrollermanagers.crd.yaml | 21 + ..._kube-scheduler_01_kubeschedulers.crd.yaml | 21 + ...-apiserver_01_openshiftapiservers.crd.yaml | 27 +- ...ud-credential_00_cloudcredentials.crd.yaml | 26 + ...or_00_kubestorageversionmigrators.crd.yaml | 26 + ...authentication_01_authentications.crd.yaml | 26 + .../0000_50_console_01_consoles.crd.yaml | 26 + ..._50_ingress_00_ingresscontrollers.crd.yaml | 18 + ..._50_insights_00_insightsoperators.crd.yaml | 26 + ...er_02_openshiftcontrollermanagers.crd.yaml | 26 + .../0000_50_service-ca_02_servicecas.crd.yaml | 26 + .../0000_50_storage_01_storages.crd.yaml | 26 + .../0000_70_dns_00_dnses.crd.yaml | 18 + ...twork_01_networks-CustomNoUpgrade.crd.yaml | 26 + ...00_70_network_01_networks-Default.crd.yaml | 26 + ...k_01_networks-DevPreviewNoUpgrade.crd.yaml | 26 + ..._01_networks-TechPreviewNoUpgrade.crd.yaml | 26 + ...troller_01_csisnapshotcontrollers.crd.yaml | 26 + ...0_csi-driver_01_clustercsidrivers.crd.yaml | 26 + .../v1/zz_generated.swagger_doc_generated.go | 25 +- .../config/v1/imagespec.go | 13 + .../config/v1/imagestatus.go | 17 +- .../applyconfigurations/config/v1/node.go | 8 +- .../config/v1/nodestatus.go | 32 ++ .../applyconfigurations/internal/internal.go | 26 +- .../applyconfigurations/internal/internal.go | 302 ++++++++-- .../v1/additionalroutingcapabilities.go | 29 + .../operator/v1/authenticationstatus.go | 8 + .../v1/awsclassicloadbalancerparameters.go | 11 +- .../operator/v1/awscsidriverconfigspec.go | 11 +- .../operator/v1/awsefsvolumemetrics.go | 36 ++ .../awsefsvolumemetricsrecursivewalkconfig.go | 32 ++ .../operator/v1/awsloadbalancerparameters.go | 6 +- .../v1/awsnetworkloadbalancerparameters.go | 38 ++ .../operator/v1/awssubnets.go | 40 ++ .../operator/v1/capability.go | 36 ++ .../operator/v1/capabilityvisibility.go | 27 + .../operator/v1/cloudcredentialstatus.go | 8 + .../operator/v1/clustercsidriverstatus.go | 8 + .../operator/v1/configstatus.go | 8 + .../operator/v1/consolecustomization.go | 20 +- .../operator/v1/consolestatus.go | 8 + .../v1/csisnapshotcontrollerstatus.go | 8 + .../operator/v1/etcdstatus.go | 16 +- .../operator/v1/insightsoperatorstatus.go | 8 + .../operator/v1/kubeapiserverstatus.go | 16 +- .../v1/kubecontrollermanagerstatus.go | 16 +- .../operator/v1/kubeschedulerstatus.go | 16 +- .../v1/kubestorageversionmigratorstatus.go | 8 + .../operator/v1/networkmigration.go | 18 +- .../operator/v1/networkspec.go | 31 +- .../operator/v1/networkstatus.go | 8 + .../operator/v1/openshiftapiserverstatus.go | 17 +- .../v1/openshiftcontrollermanagerstatus.go | 8 + .../operator/v1/operatorstatus.go | 19 +- .../operator/v1/ovnkubernetesconfig.go | 13 + .../operator/v1/servicecastatus.go | 8 + .../v1/servicecatalogapiserverstatus.go | 8 + .../servicecatalogcontrollermanagerstatus.go | 8 + .../operator/v1/staticpodoperatorstatus.go | 17 +- .../operator/v1/storagestatus.go | 8 + .../operator/v1alpha1/olmstatus.go | 8 + .../pkg/controller/factory/base_controller.go | 29 +- .../pkg/controller/factory/interfaces.go | 5 + .../pkg/operator/certrotation/cabundle.go | 29 +- .../pkg/operator/certrotation/signer.go | 46 +- .../pkg/operator/certrotation/target.go | 64 +-- .../helpers.go | 6 + .../deployment_controller.go | 80 +-- .../dynamic_operator_client.go | 539 ++++++++++++++++++ .../dynamic_staticpod_operator_client.go | 211 +++++++ .../resourceapply/admissionregistration.go | 27 +- .../resource/resourceapply/apiextensions.go | 7 +- .../resource/resourceapply/apiregistration.go | 5 +- .../operator/resource/resourceapply/apps.go | 33 +- .../operator/resource/resourceapply/core.go | 61 +- .../resource/resourceapply/event_helpers.go | 56 -- .../resource/resourceapply/generic.go | 14 + .../resource/resourceapply/migration.go | 7 +- .../resource/resourceapply/monitoring.go | 251 ++++---- .../operator/resource/resourceapply/policy.go | 7 +- .../operator/resource/resourceapply/rbac.go | 25 +- .../resource/resourceapply/storage.go | 21 +- .../resource/resourceapply/unstructured.go | 11 +- .../resourceapply/volumesnapshotclass.go | 3 +- .../resource/resourcehelper/event_helpers.go | 43 ++ .../resourcehelper/resource_helpers.go | 3 + .../resourcesync_controller.go | 31 +- .../static_resource_controller.go | 40 +- .../pkg/operator/v1helpers/canonicalize.go | 108 ++++ .../pkg/operator/v1helpers/interfaces.go | 17 + .../pkg/operator/v1helpers/test_helpers.go | 60 ++ vendor/modules.txt | 7 +- 103 files changed, 2944 insertions(+), 578 deletions(-) create mode 100644 vendor/github.com/openshift/client-go/config/applyconfigurations/config/v1/nodestatus.go create mode 100644 vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/additionalroutingcapabilities.go create mode 100644 vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/awsefsvolumemetrics.go create mode 100644 vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/awsefsvolumemetricsrecursivewalkconfig.go create mode 100644 vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/awsnetworkloadbalancerparameters.go create mode 100644 vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/awssubnets.go create mode 100644 vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/capability.go create mode 100644 vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/capabilityvisibility.go create mode 100644 vendor/github.com/openshift/library-go/pkg/operator/genericoperatorclient/dynamic_operator_client.go create mode 100644 vendor/github.com/openshift/library-go/pkg/operator/genericoperatorclient/dynamic_staticpod_operator_client.go delete mode 100644 vendor/github.com/openshift/library-go/pkg/operator/resource/resourceapply/event_helpers.go create mode 100644 vendor/github.com/openshift/library-go/pkg/operator/resource/resourcehelper/event_helpers.go create mode 100644 vendor/github.com/openshift/library-go/pkg/operator/v1helpers/canonicalize.go diff --git a/go.mod b/go.mod index 32456a4d0..10fb545c2 100644 --- a/go.mod +++ b/go.mod @@ -8,10 +8,10 @@ require ( github.com/go-logr/logr v1.4.2 // indirect github.com/google/go-cmp v0.6.0 github.com/google/gofuzz v1.2.0 // indirect - github.com/openshift/api v0.0.0-20240918014254-07bccfd9266f + github.com/openshift/api v0.0.0-20240926031850-46b94866c024 github.com/openshift/build-machinery-go v0.0.0-20240419090851-af9c868bcf52 - github.com/openshift/client-go v0.0.0-20240528061634-b054aa794d87 - github.com/openshift/library-go v0.0.0-20240715191351-e0aa70d55678 + github.com/openshift/client-go v0.0.0-20240925210910-aaed17e719c5 + github.com/openshift/library-go v0.0.0-20240925155829-3c41fd1dea0b github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring v0.75.1 github.com/prometheus-operator/prometheus-operator/pkg/client v0.75.1 github.com/prometheus/client_golang v1.18.0 @@ -23,7 +23,7 @@ require ( k8s.io/client-go v0.30.2 k8s.io/component-base v0.30.2 k8s.io/klog/v2 v2.130.1 - k8s.io/utils v0.0.0-20240711033017-18e509b52bc8 // indirect + k8s.io/utils v0.0.0-20240711033017-18e509b52bc8 sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect ) diff --git a/go.sum b/go.sum index 8769d386f..3cea0dd0e 100644 --- a/go.sum +++ b/go.sum @@ -131,14 +131,14 @@ github.com/onsi/ginkgo/v2 v2.17.2 h1:7eMhcy3GimbsA3hEnVKdw/PQM9XN9krpKVXsZdph0/g github.com/onsi/ginkgo/v2 v2.17.2/go.mod h1:nP2DPOQoNsQmsVyv5rDA8JkXQoCs6goXIvr/PRJ1eCc= github.com/onsi/gomega v1.33.1 h1:dsYjIxxSR755MDmKVsaFQTE22ChNBcuuTWgkUDSubOk= github.com/onsi/gomega v1.33.1/go.mod h1:U4R44UsT+9eLIaYRB2a5qajjtQYn0hauxvRm16AVYg0= -github.com/openshift/api v0.0.0-20240918014254-07bccfd9266f h1:jw869n5Wfttrj56lRolhl7+loudoEvxJt4oa7CbO+QM= -github.com/openshift/api v0.0.0-20240918014254-07bccfd9266f/go.mod h1:OOh6Qopf21pSzqNVCB5gomomBXb8o5sGKZxG2KNpaXM= +github.com/openshift/api v0.0.0-20240926031850-46b94866c024 h1:MuDuhmvuhnxBQRdSv2v7Rw1bLb90MTGtDTIt8pRhDTg= +github.com/openshift/api v0.0.0-20240926031850-46b94866c024/go.mod h1:OOh6Qopf21pSzqNVCB5gomomBXb8o5sGKZxG2KNpaXM= github.com/openshift/build-machinery-go v0.0.0-20240419090851-af9c868bcf52 h1:bqBwrXG7sbJUqP1Og1bR8FvVh7qb7CrMgy9saKmOZFs= github.com/openshift/build-machinery-go v0.0.0-20240419090851-af9c868bcf52/go.mod h1:b1BuldmJlbA/xYtdZvKi+7j5YGB44qJUJDZ9zwiNCfE= -github.com/openshift/client-go v0.0.0-20240528061634-b054aa794d87 h1:JtLhaGpSEconE+1IKmIgCOof/Len5ceG6H1pk43yv5U= -github.com/openshift/client-go v0.0.0-20240528061634-b054aa794d87/go.mod h1:3IPD4U0qyovZS4EFady2kqY32m8lGcbs/Wx+yprg9z8= -github.com/openshift/library-go v0.0.0-20240715191351-e0aa70d55678 h1:H08EzrqjY63m1jlZ+D4sTy9fSGlHsPwViyxFrWTIh4A= -github.com/openshift/library-go v0.0.0-20240715191351-e0aa70d55678/go.mod h1:PdASVamWinll2BPxiUpXajTwZxV8A1pQbWEsCN1od7I= +github.com/openshift/client-go v0.0.0-20240925210910-aaed17e719c5 h1:1yz2alsLpp8L99THG6tWXzeds45hf6jXI4bNoTxEim8= +github.com/openshift/client-go v0.0.0-20240925210910-aaed17e719c5/go.mod h1:axlsYEU3WeMRlIvHdsSKl/wP17k8oZgHCtPy9WgAMts= +github.com/openshift/library-go v0.0.0-20240925155829-3c41fd1dea0b h1:NOlXo7ld4xRPBKPxF38PB9m8hdfqljUPcf8bX+7aJPo= +github.com/openshift/library-go v0.0.0-20240925155829-3c41fd1dea0b/go.mod h1:f8QcnrooSwGa96xI4UaKbKGJZskhTCGeimXKyc4t/ZU= github.com/orisano/pixelmatch v0.0.0-20220722002657-fb0b55479cde/go.mod h1:nZgzbfBr3hhjoZnS66nKrHmduYNpc34ny7RK4z5/HM0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= diff --git a/vendor/github.com/openshift/api/operator/v1/types.go b/vendor/github.com/openshift/api/operator/v1/types.go index a06f0ca67..8d6f4b748 100644 --- a/vendor/github.com/openshift/api/operator/v1/types.go +++ b/vendor/github.com/openshift/api/operator/v1/types.go @@ -127,6 +127,11 @@ type OperatorStatus struct { // readyReplicas indicates how many replicas are ready and at the desired state ReadyReplicas int32 `json:"readyReplicas"` + // latestAvailableRevision is the deploymentID of the most recent deployment + // +optional + // +kubebuilder:validation:XValidation:rule="self >= oldSelf",message="must only increase" + LatestAvailableRevision int32 `json:"latestAvailableRevision,omitempty"` + // generations are used to determine when an item needs to be reconciled or has changed in a way that needs a reaction. // +listType=map // +listMapKey=group @@ -173,12 +178,34 @@ var ( // OperatorCondition is just the standard condition fields. type OperatorCondition struct { + // type of condition in CamelCase or in foo.example.com/CamelCase. + // --- + // Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be + // useful (see .node.status.conditions), the ability to deconflict is important. + // The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt) + // +required // +kubebuilder:validation:Required - Type string `json:"type"` - Status ConditionStatus `json:"status"` - LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty"` - Reason string `json:"reason,omitempty"` - Message string `json:"message,omitempty"` + // +kubebuilder:validation:Pattern=`^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$` + // +kubebuilder:validation:MaxLength=316 + Type string `json:"type" protobuf:"bytes,1,opt,name=type"` + + // status of the condition, one of True, False, Unknown. + // +required + // +kubebuilder:validation:Required + // +kubebuilder:validation:Enum=True;False;Unknown + Status ConditionStatus `json:"status"` + + // lastTransitionTime is the last time the condition transitioned from one status to another. + // This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable. + // +required + // +kubebuilder:validation:Required + // +kubebuilder:validation:Type=string + // +kubebuilder:validation:Format=date-time + LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty"` + + Reason string `json:"reason,omitempty"` + + Message string `json:"message,omitempty"` } type ConditionStatus string @@ -211,10 +238,6 @@ type StaticPodOperatorSpec struct { type StaticPodOperatorStatus struct { OperatorStatus `json:",inline"` - // latestAvailableRevision is the deploymentID of the most recent deployment - // +optional - LatestAvailableRevision int32 `json:"latestAvailableRevision,omitempty"` - // latestAvailableRevisionReason describe the detailed reason for the most recent deployment // +optional LatestAvailableRevisionReason string `json:"latestAvailableRevisionReason,omitempty"` diff --git a/vendor/github.com/openshift/api/operator/v1/types_openshiftapiserver.go b/vendor/github.com/openshift/api/operator/v1/types_openshiftapiserver.go index 3ae83e694..cd2c8a588 100644 --- a/vendor/github.com/openshift/api/operator/v1/types_openshiftapiserver.go +++ b/vendor/github.com/openshift/api/operator/v1/types_openshiftapiserver.go @@ -40,13 +40,6 @@ type OpenShiftAPIServerSpec struct { type OpenShiftAPIServerStatus struct { OperatorStatus `json:",inline"` - - // latestAvailableRevision is the latest revision used as suffix of revisioned - // secrets like encryption-config. A new revision causes a new deployment of - // pods. - // +optional - // +kubebuilder:validation:Minimum=0 - LatestAvailableRevision int32 `json:"latestAvailableRevision,omitempty"` } // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object diff --git a/vendor/github.com/openshift/api/operator/v1/zz_generated.crd-manifests/0000_10_config-operator_01_configs.crd.yaml b/vendor/github.com/openshift/api/operator/v1/zz_generated.crd-manifests/0000_10_config-operator_01_configs.crd.yaml index 080368946..c2bc68566 100644 --- a/vendor/github.com/openshift/api/operator/v1/zz_generated.crd-manifests/0000_10_config-operator_01_configs.crd.yaml +++ b/vendor/github.com/openshift/api/operator/v1/zz_generated.crd-manifests/0000_10_config-operator_01_configs.crd.yaml @@ -105,6 +105,10 @@ spec: description: OperatorCondition is just the standard condition fields. properties: lastTransitionTime: + description: lastTransitionTime is the last time the condition + transitioned from one status to another. This should be when + the underlying condition changed. If that is not known, then + using the time when the API field changed is acceptable. format: date-time type: string message: @@ -112,10 +116,24 @@ spec: reason: type: string status: + description: status of the condition, one of True, False, Unknown. + enum: + - "True" + - "False" + - Unknown type: string type: + description: type of condition in CamelCase or in foo.example.com/CamelCase. + --- Many .condition.type values are consistent across resources + like Available, but because arbitrary conditions can be useful + (see .node.status.conditions), the ability to deconflict is + important. The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt) + maxLength: 316 + pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ type: string required: + - lastTransitionTime + - status - type type: object type: array @@ -165,6 +183,14 @@ spec: - namespace - name x-kubernetes-list-type: map + latestAvailableRevision: + description: latestAvailableRevision is the deploymentID of the most + recent deployment + format: int32 + type: integer + x-kubernetes-validations: + - message: must only increase + rule: self >= oldSelf observedGeneration: description: observedGeneration is the last generation change you've dealt with diff --git a/vendor/github.com/openshift/api/operator/v1/zz_generated.crd-manifests/0000_12_etcd_01_etcds-CustomNoUpgrade.crd.yaml b/vendor/github.com/openshift/api/operator/v1/zz_generated.crd-manifests/0000_12_etcd_01_etcds-CustomNoUpgrade.crd.yaml index eef7a8b24..874161d1f 100644 --- a/vendor/github.com/openshift/api/operator/v1/zz_generated.crd-manifests/0000_12_etcd_01_etcds-CustomNoUpgrade.crd.yaml +++ b/vendor/github.com/openshift/api/operator/v1/zz_generated.crd-manifests/0000_12_etcd_01_etcds-CustomNoUpgrade.crd.yaml @@ -143,6 +143,10 @@ spec: description: OperatorCondition is just the standard condition fields. properties: lastTransitionTime: + description: lastTransitionTime is the last time the condition + transitioned from one status to another. This should be when + the underlying condition changed. If that is not known, then + using the time when the API field changed is acceptable. format: date-time type: string message: @@ -150,10 +154,24 @@ spec: reason: type: string status: + description: status of the condition, one of True, False, Unknown. + enum: + - "True" + - "False" + - Unknown type: string type: + description: type of condition in CamelCase or in foo.example.com/CamelCase. + --- Many .condition.type values are consistent across resources + like Available, but because arbitrary conditions can be useful + (see .node.status.conditions), the ability to deconflict is + important. The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt) + maxLength: 316 + pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ type: string required: + - lastTransitionTime + - status - type type: object type: array @@ -216,6 +234,9 @@ spec: recent deployment format: int32 type: integer + x-kubernetes-validations: + - message: must only increase + rule: self >= oldSelf latestAvailableRevisionReason: description: latestAvailableRevisionReason describe the detailed reason for the most recent deployment diff --git a/vendor/github.com/openshift/api/operator/v1/zz_generated.crd-manifests/0000_12_etcd_01_etcds-Default.crd.yaml b/vendor/github.com/openshift/api/operator/v1/zz_generated.crd-manifests/0000_12_etcd_01_etcds-Default.crd.yaml index 93ce88a84..3e70f9580 100644 --- a/vendor/github.com/openshift/api/operator/v1/zz_generated.crd-manifests/0000_12_etcd_01_etcds-Default.crd.yaml +++ b/vendor/github.com/openshift/api/operator/v1/zz_generated.crd-manifests/0000_12_etcd_01_etcds-Default.crd.yaml @@ -131,6 +131,10 @@ spec: description: OperatorCondition is just the standard condition fields. properties: lastTransitionTime: + description: lastTransitionTime is the last time the condition + transitioned from one status to another. This should be when + the underlying condition changed. If that is not known, then + using the time when the API field changed is acceptable. format: date-time type: string message: @@ -138,10 +142,24 @@ spec: reason: type: string status: + description: status of the condition, one of True, False, Unknown. + enum: + - "True" + - "False" + - Unknown type: string type: + description: type of condition in CamelCase or in foo.example.com/CamelCase. + --- Many .condition.type values are consistent across resources + like Available, but because arbitrary conditions can be useful + (see .node.status.conditions), the ability to deconflict is + important. The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt) + maxLength: 316 + pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ type: string required: + - lastTransitionTime + - status - type type: object type: array @@ -204,6 +222,9 @@ spec: recent deployment format: int32 type: integer + x-kubernetes-validations: + - message: must only increase + rule: self >= oldSelf latestAvailableRevisionReason: description: latestAvailableRevisionReason describe the detailed reason for the most recent deployment diff --git a/vendor/github.com/openshift/api/operator/v1/zz_generated.crd-manifests/0000_12_etcd_01_etcds-DevPreviewNoUpgrade.crd.yaml b/vendor/github.com/openshift/api/operator/v1/zz_generated.crd-manifests/0000_12_etcd_01_etcds-DevPreviewNoUpgrade.crd.yaml index 76872552f..e87764544 100644 --- a/vendor/github.com/openshift/api/operator/v1/zz_generated.crd-manifests/0000_12_etcd_01_etcds-DevPreviewNoUpgrade.crd.yaml +++ b/vendor/github.com/openshift/api/operator/v1/zz_generated.crd-manifests/0000_12_etcd_01_etcds-DevPreviewNoUpgrade.crd.yaml @@ -143,6 +143,10 @@ spec: description: OperatorCondition is just the standard condition fields. properties: lastTransitionTime: + description: lastTransitionTime is the last time the condition + transitioned from one status to another. This should be when + the underlying condition changed. If that is not known, then + using the time when the API field changed is acceptable. format: date-time type: string message: @@ -150,10 +154,24 @@ spec: reason: type: string status: + description: status of the condition, one of True, False, Unknown. + enum: + - "True" + - "False" + - Unknown type: string type: + description: type of condition in CamelCase or in foo.example.com/CamelCase. + --- Many .condition.type values are consistent across resources + like Available, but because arbitrary conditions can be useful + (see .node.status.conditions), the ability to deconflict is + important. The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt) + maxLength: 316 + pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ type: string required: + - lastTransitionTime + - status - type type: object type: array @@ -216,6 +234,9 @@ spec: recent deployment format: int32 type: integer + x-kubernetes-validations: + - message: must only increase + rule: self >= oldSelf latestAvailableRevisionReason: description: latestAvailableRevisionReason describe the detailed reason for the most recent deployment diff --git a/vendor/github.com/openshift/api/operator/v1/zz_generated.crd-manifests/0000_12_etcd_01_etcds-TechPreviewNoUpgrade.crd.yaml b/vendor/github.com/openshift/api/operator/v1/zz_generated.crd-manifests/0000_12_etcd_01_etcds-TechPreviewNoUpgrade.crd.yaml index 80da2b4c4..2211c348a 100644 --- a/vendor/github.com/openshift/api/operator/v1/zz_generated.crd-manifests/0000_12_etcd_01_etcds-TechPreviewNoUpgrade.crd.yaml +++ b/vendor/github.com/openshift/api/operator/v1/zz_generated.crd-manifests/0000_12_etcd_01_etcds-TechPreviewNoUpgrade.crd.yaml @@ -143,6 +143,10 @@ spec: description: OperatorCondition is just the standard condition fields. properties: lastTransitionTime: + description: lastTransitionTime is the last time the condition + transitioned from one status to another. This should be when + the underlying condition changed. If that is not known, then + using the time when the API field changed is acceptable. format: date-time type: string message: @@ -150,10 +154,24 @@ spec: reason: type: string status: + description: status of the condition, one of True, False, Unknown. + enum: + - "True" + - "False" + - Unknown type: string type: + description: type of condition in CamelCase or in foo.example.com/CamelCase. + --- Many .condition.type values are consistent across resources + like Available, but because arbitrary conditions can be useful + (see .node.status.conditions), the ability to deconflict is + important. The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt) + maxLength: 316 + pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ type: string required: + - lastTransitionTime + - status - type type: object type: array @@ -216,6 +234,9 @@ spec: recent deployment format: int32 type: integer + x-kubernetes-validations: + - message: must only increase + rule: self >= oldSelf latestAvailableRevisionReason: description: latestAvailableRevisionReason describe the detailed reason for the most recent deployment diff --git a/vendor/github.com/openshift/api/operator/v1/zz_generated.crd-manifests/0000_20_kube-apiserver_01_kubeapiservers.crd.yaml b/vendor/github.com/openshift/api/operator/v1/zz_generated.crd-manifests/0000_20_kube-apiserver_01_kubeapiservers.crd.yaml index 136c8bb4f..ad94d8781 100644 --- a/vendor/github.com/openshift/api/operator/v1/zz_generated.crd-manifests/0000_20_kube-apiserver_01_kubeapiservers.crd.yaml +++ b/vendor/github.com/openshift/api/operator/v1/zz_generated.crd-manifests/0000_20_kube-apiserver_01_kubeapiservers.crd.yaml @@ -122,6 +122,10 @@ spec: description: OperatorCondition is just the standard condition fields. properties: lastTransitionTime: + description: lastTransitionTime is the last time the condition + transitioned from one status to another. This should be when + the underlying condition changed. If that is not known, then + using the time when the API field changed is acceptable. format: date-time type: string message: @@ -129,10 +133,24 @@ spec: reason: type: string status: + description: status of the condition, one of True, False, Unknown. + enum: + - "True" + - "False" + - Unknown type: string type: + description: type of condition in CamelCase or in foo.example.com/CamelCase. + --- Many .condition.type values are consistent across resources + like Available, but because arbitrary conditions can be useful + (see .node.status.conditions), the ability to deconflict is + important. The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt) + maxLength: 316 + pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ type: string required: + - lastTransitionTime + - status - type type: object type: array @@ -187,6 +205,9 @@ spec: recent deployment format: int32 type: integer + x-kubernetes-validations: + - message: must only increase + rule: self >= oldSelf latestAvailableRevisionReason: description: latestAvailableRevisionReason describe the detailed reason for the most recent deployment diff --git a/vendor/github.com/openshift/api/operator/v1/zz_generated.crd-manifests/0000_25_kube-controller-manager_01_kubecontrollermanagers.crd.yaml b/vendor/github.com/openshift/api/operator/v1/zz_generated.crd-manifests/0000_25_kube-controller-manager_01_kubecontrollermanagers.crd.yaml index 86897cb44..65be918b2 100644 --- a/vendor/github.com/openshift/api/operator/v1/zz_generated.crd-manifests/0000_25_kube-controller-manager_01_kubecontrollermanagers.crd.yaml +++ b/vendor/github.com/openshift/api/operator/v1/zz_generated.crd-manifests/0000_25_kube-controller-manager_01_kubecontrollermanagers.crd.yaml @@ -132,6 +132,10 @@ spec: description: OperatorCondition is just the standard condition fields. properties: lastTransitionTime: + description: lastTransitionTime is the last time the condition + transitioned from one status to another. This should be when + the underlying condition changed. If that is not known, then + using the time when the API field changed is acceptable. format: date-time type: string message: @@ -139,10 +143,24 @@ spec: reason: type: string status: + description: status of the condition, one of True, False, Unknown. + enum: + - "True" + - "False" + - Unknown type: string type: + description: type of condition in CamelCase or in foo.example.com/CamelCase. + --- Many .condition.type values are consistent across resources + like Available, but because arbitrary conditions can be useful + (see .node.status.conditions), the ability to deconflict is + important. The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt) + maxLength: 316 + pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ type: string required: + - lastTransitionTime + - status - type type: object type: array @@ -197,6 +215,9 @@ spec: recent deployment format: int32 type: integer + x-kubernetes-validations: + - message: must only increase + rule: self >= oldSelf latestAvailableRevisionReason: description: latestAvailableRevisionReason describe the detailed reason for the most recent deployment diff --git a/vendor/github.com/openshift/api/operator/v1/zz_generated.crd-manifests/0000_25_kube-scheduler_01_kubeschedulers.crd.yaml b/vendor/github.com/openshift/api/operator/v1/zz_generated.crd-manifests/0000_25_kube-scheduler_01_kubeschedulers.crd.yaml index 24a156519..64e0ec1f5 100644 --- a/vendor/github.com/openshift/api/operator/v1/zz_generated.crd-manifests/0000_25_kube-scheduler_01_kubeschedulers.crd.yaml +++ b/vendor/github.com/openshift/api/operator/v1/zz_generated.crd-manifests/0000_25_kube-scheduler_01_kubeschedulers.crd.yaml @@ -122,6 +122,10 @@ spec: description: OperatorCondition is just the standard condition fields. properties: lastTransitionTime: + description: lastTransitionTime is the last time the condition + transitioned from one status to another. This should be when + the underlying condition changed. If that is not known, then + using the time when the API field changed is acceptable. format: date-time type: string message: @@ -129,10 +133,24 @@ spec: reason: type: string status: + description: status of the condition, one of True, False, Unknown. + enum: + - "True" + - "False" + - Unknown type: string type: + description: type of condition in CamelCase or in foo.example.com/CamelCase. + --- Many .condition.type values are consistent across resources + like Available, but because arbitrary conditions can be useful + (see .node.status.conditions), the ability to deconflict is + important. The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt) + maxLength: 316 + pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ type: string required: + - lastTransitionTime + - status - type type: object type: array @@ -187,6 +205,9 @@ spec: recent deployment format: int32 type: integer + x-kubernetes-validations: + - message: must only increase + rule: self >= oldSelf latestAvailableRevisionReason: description: latestAvailableRevisionReason describe the detailed reason for the most recent deployment diff --git a/vendor/github.com/openshift/api/operator/v1/zz_generated.crd-manifests/0000_30_openshift-apiserver_01_openshiftapiservers.crd.yaml b/vendor/github.com/openshift/api/operator/v1/zz_generated.crd-manifests/0000_30_openshift-apiserver_01_openshiftapiservers.crd.yaml index 6694660a0..83994187e 100644 --- a/vendor/github.com/openshift/api/operator/v1/zz_generated.crd-manifests/0000_30_openshift-apiserver_01_openshiftapiservers.crd.yaml +++ b/vendor/github.com/openshift/api/operator/v1/zz_generated.crd-manifests/0000_30_openshift-apiserver_01_openshiftapiservers.crd.yaml @@ -103,6 +103,10 @@ spec: description: OperatorCondition is just the standard condition fields. properties: lastTransitionTime: + description: lastTransitionTime is the last time the condition + transitioned from one status to another. This should be when + the underlying condition changed. If that is not known, then + using the time when the API field changed is acceptable. format: date-time type: string message: @@ -110,10 +114,24 @@ spec: reason: type: string status: + description: status of the condition, one of True, False, Unknown. + enum: + - "True" + - "False" + - Unknown type: string type: + description: type of condition in CamelCase or in foo.example.com/CamelCase. + --- Many .condition.type values are consistent across resources + like Available, but because arbitrary conditions can be useful + (see .node.status.conditions), the ability to deconflict is + important. The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt) + maxLength: 316 + pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ type: string required: + - lastTransitionTime + - status - type type: object type: array @@ -164,12 +182,13 @@ spec: - name x-kubernetes-list-type: map latestAvailableRevision: - description: latestAvailableRevision is the latest revision used as - suffix of revisioned secrets like encryption-config. A new revision - causes a new deployment of pods. + description: latestAvailableRevision is the deploymentID of the most + recent deployment format: int32 - minimum: 0 type: integer + x-kubernetes-validations: + - message: must only increase + rule: self >= oldSelf observedGeneration: description: observedGeneration is the last generation change you've dealt with diff --git a/vendor/github.com/openshift/api/operator/v1/zz_generated.crd-manifests/0000_40_cloud-credential_00_cloudcredentials.crd.yaml b/vendor/github.com/openshift/api/operator/v1/zz_generated.crd-manifests/0000_40_cloud-credential_00_cloudcredentials.crd.yaml index eb3cf6089..5238520a0 100644 --- a/vendor/github.com/openshift/api/operator/v1/zz_generated.crd-manifests/0000_40_cloud-credential_00_cloudcredentials.crd.yaml +++ b/vendor/github.com/openshift/api/operator/v1/zz_generated.crd-manifests/0000_40_cloud-credential_00_cloudcredentials.crd.yaml @@ -118,6 +118,10 @@ spec: description: OperatorCondition is just the standard condition fields. properties: lastTransitionTime: + description: lastTransitionTime is the last time the condition + transitioned from one status to another. This should be when + the underlying condition changed. If that is not known, then + using the time when the API field changed is acceptable. format: date-time type: string message: @@ -125,10 +129,24 @@ spec: reason: type: string status: + description: status of the condition, one of True, False, Unknown. + enum: + - "True" + - "False" + - Unknown type: string type: + description: type of condition in CamelCase or in foo.example.com/CamelCase. + --- Many .condition.type values are consistent across resources + like Available, but because arbitrary conditions can be useful + (see .node.status.conditions), the ability to deconflict is + important. The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt) + maxLength: 316 + pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ type: string required: + - lastTransitionTime + - status - type type: object type: array @@ -178,6 +196,14 @@ spec: - namespace - name x-kubernetes-list-type: map + latestAvailableRevision: + description: latestAvailableRevision is the deploymentID of the most + recent deployment + format: int32 + type: integer + x-kubernetes-validations: + - message: must only increase + rule: self >= oldSelf observedGeneration: description: observedGeneration is the last generation change you've dealt with diff --git a/vendor/github.com/openshift/api/operator/v1/zz_generated.crd-manifests/0000_40_kube-storage-version-migrator_00_kubestorageversionmigrators.crd.yaml b/vendor/github.com/openshift/api/operator/v1/zz_generated.crd-manifests/0000_40_kube-storage-version-migrator_00_kubestorageversionmigrators.crd.yaml index 6effe60bd..881f931f4 100644 --- a/vendor/github.com/openshift/api/operator/v1/zz_generated.crd-manifests/0000_40_kube-storage-version-migrator_00_kubestorageversionmigrators.crd.yaml +++ b/vendor/github.com/openshift/api/operator/v1/zz_generated.crd-manifests/0000_40_kube-storage-version-migrator_00_kubestorageversionmigrators.crd.yaml @@ -98,6 +98,10 @@ spec: description: OperatorCondition is just the standard condition fields. properties: lastTransitionTime: + description: lastTransitionTime is the last time the condition + transitioned from one status to another. This should be when + the underlying condition changed. If that is not known, then + using the time when the API field changed is acceptable. format: date-time type: string message: @@ -105,10 +109,24 @@ spec: reason: type: string status: + description: status of the condition, one of True, False, Unknown. + enum: + - "True" + - "False" + - Unknown type: string type: + description: type of condition in CamelCase or in foo.example.com/CamelCase. + --- Many .condition.type values are consistent across resources + like Available, but because arbitrary conditions can be useful + (see .node.status.conditions), the ability to deconflict is + important. The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt) + maxLength: 316 + pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ type: string required: + - lastTransitionTime + - status - type type: object type: array @@ -158,6 +176,14 @@ spec: - namespace - name x-kubernetes-list-type: map + latestAvailableRevision: + description: latestAvailableRevision is the deploymentID of the most + recent deployment + format: int32 + type: integer + x-kubernetes-validations: + - message: must only increase + rule: self >= oldSelf observedGeneration: description: observedGeneration is the last generation change you've dealt with diff --git a/vendor/github.com/openshift/api/operator/v1/zz_generated.crd-manifests/0000_50_authentication_01_authentications.crd.yaml b/vendor/github.com/openshift/api/operator/v1/zz_generated.crd-manifests/0000_50_authentication_01_authentications.crd.yaml index 16335275e..102e00226 100644 --- a/vendor/github.com/openshift/api/operator/v1/zz_generated.crd-manifests/0000_50_authentication_01_authentications.crd.yaml +++ b/vendor/github.com/openshift/api/operator/v1/zz_generated.crd-manifests/0000_50_authentication_01_authentications.crd.yaml @@ -96,6 +96,10 @@ spec: description: OperatorCondition is just the standard condition fields. properties: lastTransitionTime: + description: lastTransitionTime is the last time the condition + transitioned from one status to another. This should be when + the underlying condition changed. If that is not known, then + using the time when the API field changed is acceptable. format: date-time type: string message: @@ -103,10 +107,24 @@ spec: reason: type: string status: + description: status of the condition, one of True, False, Unknown. + enum: + - "True" + - "False" + - Unknown type: string type: + description: type of condition in CamelCase or in foo.example.com/CamelCase. + --- Many .condition.type values are consistent across resources + like Available, but because arbitrary conditions can be useful + (see .node.status.conditions), the ability to deconflict is + important. The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt) + maxLength: 316 + pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ type: string required: + - lastTransitionTime + - status - type type: object type: array @@ -156,6 +174,14 @@ spec: - namespace - name x-kubernetes-list-type: map + latestAvailableRevision: + description: latestAvailableRevision is the deploymentID of the most + recent deployment + format: int32 + type: integer + x-kubernetes-validations: + - message: must only increase + rule: self >= oldSelf oauthAPIServer: description: OAuthAPIServer holds status specific only to oauth-apiserver properties: diff --git a/vendor/github.com/openshift/api/operator/v1/zz_generated.crd-manifests/0000_50_console_01_consoles.crd.yaml b/vendor/github.com/openshift/api/operator/v1/zz_generated.crd-manifests/0000_50_console_01_consoles.crd.yaml index d13fcf2c3..1fbec8329 100644 --- a/vendor/github.com/openshift/api/operator/v1/zz_generated.crd-manifests/0000_50_console_01_consoles.crd.yaml +++ b/vendor/github.com/openshift/api/operator/v1/zz_generated.crd-manifests/0000_50_console_01_consoles.crd.yaml @@ -650,6 +650,10 @@ spec: description: OperatorCondition is just the standard condition fields. properties: lastTransitionTime: + description: lastTransitionTime is the last time the condition + transitioned from one status to another. This should be when + the underlying condition changed. If that is not known, then + using the time when the API field changed is acceptable. format: date-time type: string message: @@ -657,10 +661,24 @@ spec: reason: type: string status: + description: status of the condition, one of True, False, Unknown. + enum: + - "True" + - "False" + - Unknown type: string type: + description: type of condition in CamelCase or in foo.example.com/CamelCase. + --- Many .condition.type values are consistent across resources + like Available, but because arbitrary conditions can be useful + (see .node.status.conditions), the ability to deconflict is + important. The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt) + maxLength: 316 + pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ type: string required: + - lastTransitionTime + - status - type type: object type: array @@ -710,6 +728,14 @@ spec: - namespace - name x-kubernetes-list-type: map + latestAvailableRevision: + description: latestAvailableRevision is the deploymentID of the most + recent deployment + format: int32 + type: integer + x-kubernetes-validations: + - message: must only increase + rule: self >= oldSelf observedGeneration: description: observedGeneration is the last generation change you've dealt with diff --git a/vendor/github.com/openshift/api/operator/v1/zz_generated.crd-manifests/0000_50_ingress_00_ingresscontrollers.crd.yaml b/vendor/github.com/openshift/api/operator/v1/zz_generated.crd-manifests/0000_50_ingress_00_ingresscontrollers.crd.yaml index 6adf7cd35..09f01e7a6 100644 --- a/vendor/github.com/openshift/api/operator/v1/zz_generated.crd-manifests/0000_50_ingress_00_ingresscontrollers.crd.yaml +++ b/vendor/github.com/openshift/api/operator/v1/zz_generated.crd-manifests/0000_50_ingress_00_ingresscontrollers.crd.yaml @@ -1990,6 +1990,10 @@ spec: description: OperatorCondition is just the standard condition fields. properties: lastTransitionTime: + description: lastTransitionTime is the last time the condition + transitioned from one status to another. This should be when + the underlying condition changed. If that is not known, then + using the time when the API field changed is acceptable. format: date-time type: string message: @@ -1997,10 +2001,24 @@ spec: reason: type: string status: + description: status of the condition, one of True, False, Unknown. + enum: + - "True" + - "False" + - Unknown type: string type: + description: type of condition in CamelCase or in foo.example.com/CamelCase. + --- Many .condition.type values are consistent across resources + like Available, but because arbitrary conditions can be useful + (see .node.status.conditions), the ability to deconflict is + important. The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt) + maxLength: 316 + pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ type: string required: + - lastTransitionTime + - status - type type: object type: array diff --git a/vendor/github.com/openshift/api/operator/v1/zz_generated.crd-manifests/0000_50_insights_00_insightsoperators.crd.yaml b/vendor/github.com/openshift/api/operator/v1/zz_generated.crd-manifests/0000_50_insights_00_insightsoperators.crd.yaml index c6e1acd14..3e6150c2c 100644 --- a/vendor/github.com/openshift/api/operator/v1/zz_generated.crd-manifests/0000_50_insights_00_insightsoperators.crd.yaml +++ b/vendor/github.com/openshift/api/operator/v1/zz_generated.crd-manifests/0000_50_insights_00_insightsoperators.crd.yaml @@ -101,6 +101,10 @@ spec: description: OperatorCondition is just the standard condition fields. properties: lastTransitionTime: + description: lastTransitionTime is the last time the condition + transitioned from one status to another. This should be when + the underlying condition changed. If that is not known, then + using the time when the API field changed is acceptable. format: date-time type: string message: @@ -108,10 +112,24 @@ spec: reason: type: string status: + description: status of the condition, one of True, False, Unknown. + enum: + - "True" + - "False" + - Unknown type: string type: + description: type of condition in CamelCase or in foo.example.com/CamelCase. + --- Many .condition.type values are consistent across resources + like Available, but because arbitrary conditions can be useful + (see .node.status.conditions), the ability to deconflict is + important. The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt) + maxLength: 316 + pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ type: string required: + - lastTransitionTime + - status - type type: object type: array @@ -339,6 +357,14 @@ spec: type: array x-kubernetes-list-type: atomic type: object + latestAvailableRevision: + description: latestAvailableRevision is the deploymentID of the most + recent deployment + format: int32 + type: integer + x-kubernetes-validations: + - message: must only increase + rule: self >= oldSelf observedGeneration: description: observedGeneration is the last generation change you've dealt with diff --git a/vendor/github.com/openshift/api/operator/v1/zz_generated.crd-manifests/0000_50_openshift-controller-manager_02_openshiftcontrollermanagers.crd.yaml b/vendor/github.com/openshift/api/operator/v1/zz_generated.crd-manifests/0000_50_openshift-controller-manager_02_openshiftcontrollermanagers.crd.yaml index b15a7ef34..e78b52b3f 100644 --- a/vendor/github.com/openshift/api/operator/v1/zz_generated.crd-manifests/0000_50_openshift-controller-manager_02_openshiftcontrollermanagers.crd.yaml +++ b/vendor/github.com/openshift/api/operator/v1/zz_generated.crd-manifests/0000_50_openshift-controller-manager_02_openshiftcontrollermanagers.crd.yaml @@ -100,6 +100,10 @@ spec: description: OperatorCondition is just the standard condition fields. properties: lastTransitionTime: + description: lastTransitionTime is the last time the condition + transitioned from one status to another. This should be when + the underlying condition changed. If that is not known, then + using the time when the API field changed is acceptable. format: date-time type: string message: @@ -107,10 +111,24 @@ spec: reason: type: string status: + description: status of the condition, one of True, False, Unknown. + enum: + - "True" + - "False" + - Unknown type: string type: + description: type of condition in CamelCase or in foo.example.com/CamelCase. + --- Many .condition.type values are consistent across resources + like Available, but because arbitrary conditions can be useful + (see .node.status.conditions), the ability to deconflict is + important. The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt) + maxLength: 316 + pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ type: string required: + - lastTransitionTime + - status - type type: object type: array @@ -160,6 +178,14 @@ spec: - namespace - name x-kubernetes-list-type: map + latestAvailableRevision: + description: latestAvailableRevision is the deploymentID of the most + recent deployment + format: int32 + type: integer + x-kubernetes-validations: + - message: must only increase + rule: self >= oldSelf observedGeneration: description: observedGeneration is the last generation change you've dealt with diff --git a/vendor/github.com/openshift/api/operator/v1/zz_generated.crd-manifests/0000_50_service-ca_02_servicecas.crd.yaml b/vendor/github.com/openshift/api/operator/v1/zz_generated.crd-manifests/0000_50_service-ca_02_servicecas.crd.yaml index 7b2dec813..e2613c3cb 100644 --- a/vendor/github.com/openshift/api/operator/v1/zz_generated.crd-manifests/0000_50_service-ca_02_servicecas.crd.yaml +++ b/vendor/github.com/openshift/api/operator/v1/zz_generated.crd-manifests/0000_50_service-ca_02_servicecas.crd.yaml @@ -100,6 +100,10 @@ spec: description: OperatorCondition is just the standard condition fields. properties: lastTransitionTime: + description: lastTransitionTime is the last time the condition + transitioned from one status to another. This should be when + the underlying condition changed. If that is not known, then + using the time when the API field changed is acceptable. format: date-time type: string message: @@ -107,10 +111,24 @@ spec: reason: type: string status: + description: status of the condition, one of True, False, Unknown. + enum: + - "True" + - "False" + - Unknown type: string type: + description: type of condition in CamelCase or in foo.example.com/CamelCase. + --- Many .condition.type values are consistent across resources + like Available, but because arbitrary conditions can be useful + (see .node.status.conditions), the ability to deconflict is + important. The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt) + maxLength: 316 + pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ type: string required: + - lastTransitionTime + - status - type type: object type: array @@ -160,6 +178,14 @@ spec: - namespace - name x-kubernetes-list-type: map + latestAvailableRevision: + description: latestAvailableRevision is the deploymentID of the most + recent deployment + format: int32 + type: integer + x-kubernetes-validations: + - message: must only increase + rule: self >= oldSelf observedGeneration: description: observedGeneration is the last generation change you've dealt with diff --git a/vendor/github.com/openshift/api/operator/v1/zz_generated.crd-manifests/0000_50_storage_01_storages.crd.yaml b/vendor/github.com/openshift/api/operator/v1/zz_generated.crd-manifests/0000_50_storage_01_storages.crd.yaml index da0f6a69b..aeea70727 100644 --- a/vendor/github.com/openshift/api/operator/v1/zz_generated.crd-manifests/0000_50_storage_01_storages.crd.yaml +++ b/vendor/github.com/openshift/api/operator/v1/zz_generated.crd-manifests/0000_50_storage_01_storages.crd.yaml @@ -116,6 +116,10 @@ spec: description: OperatorCondition is just the standard condition fields. properties: lastTransitionTime: + description: lastTransitionTime is the last time the condition + transitioned from one status to another. This should be when + the underlying condition changed. If that is not known, then + using the time when the API field changed is acceptable. format: date-time type: string message: @@ -123,10 +127,24 @@ spec: reason: type: string status: + description: status of the condition, one of True, False, Unknown. + enum: + - "True" + - "False" + - Unknown type: string type: + description: type of condition in CamelCase or in foo.example.com/CamelCase. + --- Many .condition.type values are consistent across resources + like Available, but because arbitrary conditions can be useful + (see .node.status.conditions), the ability to deconflict is + important. The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt) + maxLength: 316 + pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ type: string required: + - lastTransitionTime + - status - type type: object type: array @@ -176,6 +194,14 @@ spec: - namespace - name x-kubernetes-list-type: map + latestAvailableRevision: + description: latestAvailableRevision is the deploymentID of the most + recent deployment + format: int32 + type: integer + x-kubernetes-validations: + - message: must only increase + rule: self >= oldSelf observedGeneration: description: observedGeneration is the last generation change you've dealt with diff --git a/vendor/github.com/openshift/api/operator/v1/zz_generated.crd-manifests/0000_70_dns_00_dnses.crd.yaml b/vendor/github.com/openshift/api/operator/v1/zz_generated.crd-manifests/0000_70_dns_00_dnses.crd.yaml index 8810d71bb..247e827e9 100644 --- a/vendor/github.com/openshift/api/operator/v1/zz_generated.crd-manifests/0000_70_dns_00_dnses.crd.yaml +++ b/vendor/github.com/openshift/api/operator/v1/zz_generated.crd-manifests/0000_70_dns_00_dnses.crd.yaml @@ -552,6 +552,10 @@ spec: description: OperatorCondition is just the standard condition fields. properties: lastTransitionTime: + description: lastTransitionTime is the last time the condition + transitioned from one status to another. This should be when + the underlying condition changed. If that is not known, then + using the time when the API field changed is acceptable. format: date-time type: string message: @@ -559,10 +563,24 @@ spec: reason: type: string status: + description: status of the condition, one of True, False, Unknown. + enum: + - "True" + - "False" + - Unknown type: string type: + description: type of condition in CamelCase or in foo.example.com/CamelCase. + --- Many .condition.type values are consistent across resources + like Available, but because arbitrary conditions can be useful + (see .node.status.conditions), the ability to deconflict is + important. The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt) + maxLength: 316 + pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ type: string required: + - lastTransitionTime + - status - type type: object type: array diff --git a/vendor/github.com/openshift/api/operator/v1/zz_generated.crd-manifests/0000_70_network_01_networks-CustomNoUpgrade.crd.yaml b/vendor/github.com/openshift/api/operator/v1/zz_generated.crd-manifests/0000_70_network_01_networks-CustomNoUpgrade.crd.yaml index a0b61ba6e..e5f9d8665 100644 --- a/vendor/github.com/openshift/api/operator/v1/zz_generated.crd-manifests/0000_70_network_01_networks-CustomNoUpgrade.crd.yaml +++ b/vendor/github.com/openshift/api/operator/v1/zz_generated.crd-manifests/0000_70_network_01_networks-CustomNoUpgrade.crd.yaml @@ -922,6 +922,10 @@ spec: description: OperatorCondition is just the standard condition fields. properties: lastTransitionTime: + description: lastTransitionTime is the last time the condition + transitioned from one status to another. This should be when + the underlying condition changed. If that is not known, then + using the time when the API field changed is acceptable. format: date-time type: string message: @@ -929,10 +933,24 @@ spec: reason: type: string status: + description: status of the condition, one of True, False, Unknown. + enum: + - "True" + - "False" + - Unknown type: string type: + description: type of condition in CamelCase or in foo.example.com/CamelCase. + --- Many .condition.type values are consistent across resources + like Available, but because arbitrary conditions can be useful + (see .node.status.conditions), the ability to deconflict is + important. The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt) + maxLength: 316 + pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ type: string required: + - lastTransitionTime + - status - type type: object type: array @@ -982,6 +1000,14 @@ spec: - namespace - name x-kubernetes-list-type: map + latestAvailableRevision: + description: latestAvailableRevision is the deploymentID of the most + recent deployment + format: int32 + type: integer + x-kubernetes-validations: + - message: must only increase + rule: self >= oldSelf observedGeneration: description: observedGeneration is the last generation change you've dealt with diff --git a/vendor/github.com/openshift/api/operator/v1/zz_generated.crd-manifests/0000_70_network_01_networks-Default.crd.yaml b/vendor/github.com/openshift/api/operator/v1/zz_generated.crd-manifests/0000_70_network_01_networks-Default.crd.yaml index 9c269cec4..729f7f903 100644 --- a/vendor/github.com/openshift/api/operator/v1/zz_generated.crd-manifests/0000_70_network_01_networks-Default.crd.yaml +++ b/vendor/github.com/openshift/api/operator/v1/zz_generated.crd-manifests/0000_70_network_01_networks-Default.crd.yaml @@ -867,6 +867,10 @@ spec: description: OperatorCondition is just the standard condition fields. properties: lastTransitionTime: + description: lastTransitionTime is the last time the condition + transitioned from one status to another. This should be when + the underlying condition changed. If that is not known, then + using the time when the API field changed is acceptable. format: date-time type: string message: @@ -874,10 +878,24 @@ spec: reason: type: string status: + description: status of the condition, one of True, False, Unknown. + enum: + - "True" + - "False" + - Unknown type: string type: + description: type of condition in CamelCase or in foo.example.com/CamelCase. + --- Many .condition.type values are consistent across resources + like Available, but because arbitrary conditions can be useful + (see .node.status.conditions), the ability to deconflict is + important. The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt) + maxLength: 316 + pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ type: string required: + - lastTransitionTime + - status - type type: object type: array @@ -927,6 +945,14 @@ spec: - namespace - name x-kubernetes-list-type: map + latestAvailableRevision: + description: latestAvailableRevision is the deploymentID of the most + recent deployment + format: int32 + type: integer + x-kubernetes-validations: + - message: must only increase + rule: self >= oldSelf observedGeneration: description: observedGeneration is the last generation change you've dealt with diff --git a/vendor/github.com/openshift/api/operator/v1/zz_generated.crd-manifests/0000_70_network_01_networks-DevPreviewNoUpgrade.crd.yaml b/vendor/github.com/openshift/api/operator/v1/zz_generated.crd-manifests/0000_70_network_01_networks-DevPreviewNoUpgrade.crd.yaml index d930b4dc3..6401d9406 100644 --- a/vendor/github.com/openshift/api/operator/v1/zz_generated.crd-manifests/0000_70_network_01_networks-DevPreviewNoUpgrade.crd.yaml +++ b/vendor/github.com/openshift/api/operator/v1/zz_generated.crd-manifests/0000_70_network_01_networks-DevPreviewNoUpgrade.crd.yaml @@ -922,6 +922,10 @@ spec: description: OperatorCondition is just the standard condition fields. properties: lastTransitionTime: + description: lastTransitionTime is the last time the condition + transitioned from one status to another. This should be when + the underlying condition changed. If that is not known, then + using the time when the API field changed is acceptable. format: date-time type: string message: @@ -929,10 +933,24 @@ spec: reason: type: string status: + description: status of the condition, one of True, False, Unknown. + enum: + - "True" + - "False" + - Unknown type: string type: + description: type of condition in CamelCase or in foo.example.com/CamelCase. + --- Many .condition.type values are consistent across resources + like Available, but because arbitrary conditions can be useful + (see .node.status.conditions), the ability to deconflict is + important. The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt) + maxLength: 316 + pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ type: string required: + - lastTransitionTime + - status - type type: object type: array @@ -982,6 +1000,14 @@ spec: - namespace - name x-kubernetes-list-type: map + latestAvailableRevision: + description: latestAvailableRevision is the deploymentID of the most + recent deployment + format: int32 + type: integer + x-kubernetes-validations: + - message: must only increase + rule: self >= oldSelf observedGeneration: description: observedGeneration is the last generation change you've dealt with diff --git a/vendor/github.com/openshift/api/operator/v1/zz_generated.crd-manifests/0000_70_network_01_networks-TechPreviewNoUpgrade.crd.yaml b/vendor/github.com/openshift/api/operator/v1/zz_generated.crd-manifests/0000_70_network_01_networks-TechPreviewNoUpgrade.crd.yaml index d834b1989..df18058e0 100644 --- a/vendor/github.com/openshift/api/operator/v1/zz_generated.crd-manifests/0000_70_network_01_networks-TechPreviewNoUpgrade.crd.yaml +++ b/vendor/github.com/openshift/api/operator/v1/zz_generated.crd-manifests/0000_70_network_01_networks-TechPreviewNoUpgrade.crd.yaml @@ -922,6 +922,10 @@ spec: description: OperatorCondition is just the standard condition fields. properties: lastTransitionTime: + description: lastTransitionTime is the last time the condition + transitioned from one status to another. This should be when + the underlying condition changed. If that is not known, then + using the time when the API field changed is acceptable. format: date-time type: string message: @@ -929,10 +933,24 @@ spec: reason: type: string status: + description: status of the condition, one of True, False, Unknown. + enum: + - "True" + - "False" + - Unknown type: string type: + description: type of condition in CamelCase or in foo.example.com/CamelCase. + --- Many .condition.type values are consistent across resources + like Available, but because arbitrary conditions can be useful + (see .node.status.conditions), the ability to deconflict is + important. The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt) + maxLength: 316 + pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ type: string required: + - lastTransitionTime + - status - type type: object type: array @@ -982,6 +1000,14 @@ spec: - namespace - name x-kubernetes-list-type: map + latestAvailableRevision: + description: latestAvailableRevision is the deploymentID of the most + recent deployment + format: int32 + type: integer + x-kubernetes-validations: + - message: must only increase + rule: self >= oldSelf observedGeneration: description: observedGeneration is the last generation change you've dealt with diff --git a/vendor/github.com/openshift/api/operator/v1/zz_generated.crd-manifests/0000_80_csi-snapshot-controller_01_csisnapshotcontrollers.crd.yaml b/vendor/github.com/openshift/api/operator/v1/zz_generated.crd-manifests/0000_80_csi-snapshot-controller_01_csisnapshotcontrollers.crd.yaml index 2b1d172c4..93f170815 100644 --- a/vendor/github.com/openshift/api/operator/v1/zz_generated.crd-manifests/0000_80_csi-snapshot-controller_01_csisnapshotcontrollers.crd.yaml +++ b/vendor/github.com/openshift/api/operator/v1/zz_generated.crd-manifests/0000_80_csi-snapshot-controller_01_csisnapshotcontrollers.crd.yaml @@ -101,6 +101,10 @@ spec: description: OperatorCondition is just the standard condition fields. properties: lastTransitionTime: + description: lastTransitionTime is the last time the condition + transitioned from one status to another. This should be when + the underlying condition changed. If that is not known, then + using the time when the API field changed is acceptable. format: date-time type: string message: @@ -108,10 +112,24 @@ spec: reason: type: string status: + description: status of the condition, one of True, False, Unknown. + enum: + - "True" + - "False" + - Unknown type: string type: + description: type of condition in CamelCase or in foo.example.com/CamelCase. + --- Many .condition.type values are consistent across resources + like Available, but because arbitrary conditions can be useful + (see .node.status.conditions), the ability to deconflict is + important. The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt) + maxLength: 316 + pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ type: string required: + - lastTransitionTime + - status - type type: object type: array @@ -161,6 +179,14 @@ spec: - namespace - name x-kubernetes-list-type: map + latestAvailableRevision: + description: latestAvailableRevision is the deploymentID of the most + recent deployment + format: int32 + type: integer + x-kubernetes-validations: + - message: must only increase + rule: self >= oldSelf observedGeneration: description: observedGeneration is the last generation change you've dealt with diff --git a/vendor/github.com/openshift/api/operator/v1/zz_generated.crd-manifests/0000_90_csi-driver_01_clustercsidrivers.crd.yaml b/vendor/github.com/openshift/api/operator/v1/zz_generated.crd-manifests/0000_90_csi-driver_01_clustercsidrivers.crd.yaml index 2f6b031a5..5cd4e48ec 100644 --- a/vendor/github.com/openshift/api/operator/v1/zz_generated.crd-manifests/0000_90_csi-driver_01_clustercsidrivers.crd.yaml +++ b/vendor/github.com/openshift/api/operator/v1/zz_generated.crd-manifests/0000_90_csi-driver_01_clustercsidrivers.crd.yaml @@ -384,6 +384,10 @@ spec: description: OperatorCondition is just the standard condition fields. properties: lastTransitionTime: + description: lastTransitionTime is the last time the condition + transitioned from one status to another. This should be when + the underlying condition changed. If that is not known, then + using the time when the API field changed is acceptable. format: date-time type: string message: @@ -391,10 +395,24 @@ spec: reason: type: string status: + description: status of the condition, one of True, False, Unknown. + enum: + - "True" + - "False" + - Unknown type: string type: + description: type of condition in CamelCase or in foo.example.com/CamelCase. + --- Many .condition.type values are consistent across resources + like Available, but because arbitrary conditions can be useful + (see .node.status.conditions), the ability to deconflict is + important. The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt) + maxLength: 316 + pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ type: string required: + - lastTransitionTime + - status - type type: object type: array @@ -444,6 +462,14 @@ spec: - namespace - name x-kubernetes-list-type: map + latestAvailableRevision: + description: latestAvailableRevision is the deploymentID of the most + recent deployment + format: int32 + type: integer + x-kubernetes-validations: + - message: must only increase + rule: self >= oldSelf observedGeneration: description: observedGeneration is the last generation change you've dealt with diff --git a/vendor/github.com/openshift/api/operator/v1/zz_generated.swagger_doc_generated.go b/vendor/github.com/openshift/api/operator/v1/zz_generated.swagger_doc_generated.go index 832dd01d0..d5d3e94fa 100644 --- a/vendor/github.com/openshift/api/operator/v1/zz_generated.swagger_doc_generated.go +++ b/vendor/github.com/openshift/api/operator/v1/zz_generated.swagger_doc_generated.go @@ -52,7 +52,10 @@ func (NodeStatus) SwaggerDoc() map[string]string { } var map_OperatorCondition = map[string]string{ - "": "OperatorCondition is just the standard condition fields.", + "": "OperatorCondition is just the standard condition fields.", + "type": "type of condition in CamelCase or in foo.example.com/CamelCase.", + "status": "status of the condition, one of True, False, Unknown.", + "lastTransitionTime": "lastTransitionTime is the last time the condition transitioned from one status to another. This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable.", } func (OperatorCondition) SwaggerDoc() map[string]string { @@ -73,11 +76,12 @@ func (OperatorSpec) SwaggerDoc() map[string]string { } var map_OperatorStatus = map[string]string{ - "observedGeneration": "observedGeneration is the last generation change you've dealt with", - "conditions": "conditions is a list of conditions and their status", - "version": "version is the level this availability applies to", - "readyReplicas": "readyReplicas indicates how many replicas are ready and at the desired state", - "generations": "generations are used to determine when an item needs to be reconciled or has changed in a way that needs a reaction.", + "observedGeneration": "observedGeneration is the last generation change you've dealt with", + "conditions": "conditions is a list of conditions and their status", + "version": "version is the level this availability applies to", + "readyReplicas": "readyReplicas indicates how many replicas are ready and at the desired state", + "latestAvailableRevision": "latestAvailableRevision is the deploymentID of the most recent deployment", + "generations": "generations are used to determine when an item needs to be reconciled or has changed in a way that needs a reaction.", } func (OperatorStatus) SwaggerDoc() map[string]string { @@ -97,7 +101,6 @@ func (StaticPodOperatorSpec) SwaggerDoc() map[string]string { var map_StaticPodOperatorStatus = map[string]string{ "": "StaticPodOperatorStatus is status for controllers that manage static pods. There are different needs because individual node status must be tracked.", - "latestAvailableRevision": "latestAvailableRevision is the deploymentID of the most recent deployment", "latestAvailableRevisionReason": "latestAvailableRevisionReason describe the detailed reason for the most recent deployment", "nodeStatuses": "nodeStatuses track the deployment values and errors across individual nodes", } @@ -1904,14 +1907,6 @@ func (OpenShiftAPIServerList) SwaggerDoc() map[string]string { return map_OpenShiftAPIServerList } -var map_OpenShiftAPIServerStatus = map[string]string{ - "latestAvailableRevision": "latestAvailableRevision is the latest revision used as suffix of revisioned secrets like encryption-config. A new revision causes a new deployment of pods.", -} - -func (OpenShiftAPIServerStatus) SwaggerDoc() map[string]string { - return map_OpenShiftAPIServerStatus -} - var map_OpenShiftControllerManager = map[string]string{ "": "OpenShiftControllerManager provides information to configure an operator to manage openshift-controller-manager.\n\nCompatibility level 1: Stable within a major release for a minimum of 12 months or 3 minor releases (whichever is longer).", "metadata": "metadata is the standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata", diff --git a/vendor/github.com/openshift/client-go/config/applyconfigurations/config/v1/imagespec.go b/vendor/github.com/openshift/client-go/config/applyconfigurations/config/v1/imagespec.go index 10e80e77f..48541b72c 100644 --- a/vendor/github.com/openshift/client-go/config/applyconfigurations/config/v1/imagespec.go +++ b/vendor/github.com/openshift/client-go/config/applyconfigurations/config/v1/imagespec.go @@ -2,6 +2,10 @@ package v1 +import ( + configv1 "github.com/openshift/api/config/v1" +) + // ImageSpecApplyConfiguration represents an declarative configuration of the ImageSpec type for use // with apply. type ImageSpecApplyConfiguration struct { @@ -9,6 +13,7 @@ type ImageSpecApplyConfiguration struct { ExternalRegistryHostnames []string `json:"externalRegistryHostnames,omitempty"` AdditionalTrustedCA *ConfigMapNameReferenceApplyConfiguration `json:"additionalTrustedCA,omitempty"` RegistrySources *RegistrySourcesApplyConfiguration `json:"registrySources,omitempty"` + ImageStreamImportMode *configv1.ImportModeType `json:"imageStreamImportMode,omitempty"` } // ImageSpecApplyConfiguration constructs an declarative configuration of the ImageSpec type for use with @@ -55,3 +60,11 @@ func (b *ImageSpecApplyConfiguration) WithRegistrySources(value *RegistrySources b.RegistrySources = value return b } + +// WithImageStreamImportMode sets the ImageStreamImportMode field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ImageStreamImportMode field is set to the value of the last call. +func (b *ImageSpecApplyConfiguration) WithImageStreamImportMode(value configv1.ImportModeType) *ImageSpecApplyConfiguration { + b.ImageStreamImportMode = &value + return b +} diff --git a/vendor/github.com/openshift/client-go/config/applyconfigurations/config/v1/imagestatus.go b/vendor/github.com/openshift/client-go/config/applyconfigurations/config/v1/imagestatus.go index 38c90271a..3c2aec612 100644 --- a/vendor/github.com/openshift/client-go/config/applyconfigurations/config/v1/imagestatus.go +++ b/vendor/github.com/openshift/client-go/config/applyconfigurations/config/v1/imagestatus.go @@ -2,11 +2,16 @@ package v1 +import ( + v1 "github.com/openshift/api/config/v1" +) + // ImageStatusApplyConfiguration represents an declarative configuration of the ImageStatus type for use // with apply. type ImageStatusApplyConfiguration struct { - InternalRegistryHostname *string `json:"internalRegistryHostname,omitempty"` - ExternalRegistryHostnames []string `json:"externalRegistryHostnames,omitempty"` + InternalRegistryHostname *string `json:"internalRegistryHostname,omitempty"` + ExternalRegistryHostnames []string `json:"externalRegistryHostnames,omitempty"` + ImageStreamImportMode *v1.ImportModeType `json:"imageStreamImportMode,omitempty"` } // ImageStatusApplyConfiguration constructs an declarative configuration of the ImageStatus type for use with @@ -32,3 +37,11 @@ func (b *ImageStatusApplyConfiguration) WithExternalRegistryHostnames(values ... } return b } + +// WithImageStreamImportMode sets the ImageStreamImportMode field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ImageStreamImportMode field is set to the value of the last call. +func (b *ImageStatusApplyConfiguration) WithImageStreamImportMode(value v1.ImportModeType) *ImageStatusApplyConfiguration { + b.ImageStreamImportMode = &value + return b +} diff --git a/vendor/github.com/openshift/client-go/config/applyconfigurations/config/v1/node.go b/vendor/github.com/openshift/client-go/config/applyconfigurations/config/v1/node.go index a407a9e45..0dd12da2b 100644 --- a/vendor/github.com/openshift/client-go/config/applyconfigurations/config/v1/node.go +++ b/vendor/github.com/openshift/client-go/config/applyconfigurations/config/v1/node.go @@ -16,8 +16,8 @@ import ( type NodeApplyConfiguration struct { v1.TypeMetaApplyConfiguration `json:",inline"` *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` - Spec *NodeSpecApplyConfiguration `json:"spec,omitempty"` - Status *apiconfigv1.NodeStatus `json:"status,omitempty"` + Spec *NodeSpecApplyConfiguration `json:"spec,omitempty"` + Status *NodeStatusApplyConfiguration `json:"status,omitempty"` } // Node constructs an declarative configuration of the Node type for use with @@ -234,7 +234,7 @@ func (b *NodeApplyConfiguration) WithSpec(value *NodeSpecApplyConfiguration) *No // WithStatus sets the Status field in the declarative configuration to the given value // and returns the receiver, so that objects can be built by chaining "With" function invocations. // If called multiple times, the Status field is set to the value of the last call. -func (b *NodeApplyConfiguration) WithStatus(value apiconfigv1.NodeStatus) *NodeApplyConfiguration { - b.Status = &value +func (b *NodeApplyConfiguration) WithStatus(value *NodeStatusApplyConfiguration) *NodeApplyConfiguration { + b.Status = value return b } diff --git a/vendor/github.com/openshift/client-go/config/applyconfigurations/config/v1/nodestatus.go b/vendor/github.com/openshift/client-go/config/applyconfigurations/config/v1/nodestatus.go new file mode 100644 index 000000000..8f2f4861e --- /dev/null +++ b/vendor/github.com/openshift/client-go/config/applyconfigurations/config/v1/nodestatus.go @@ -0,0 +1,32 @@ +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// NodeStatusApplyConfiguration represents an declarative configuration of the NodeStatus type for use +// with apply. +type NodeStatusApplyConfiguration struct { + Conditions []v1.ConditionApplyConfiguration `json:"conditions,omitempty"` +} + +// NodeStatusApplyConfiguration constructs an declarative configuration of the NodeStatus type for use with +// apply. +func NodeStatus() *NodeStatusApplyConfiguration { + return &NodeStatusApplyConfiguration{} +} + +// WithConditions adds the given value to the Conditions field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Conditions field. +func (b *NodeStatusApplyConfiguration) WithConditions(values ...*v1.ConditionApplyConfiguration) *NodeStatusApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithConditions") + } + b.Conditions = append(b.Conditions, *values[i]) + } + return b +} diff --git a/vendor/github.com/openshift/client-go/config/applyconfigurations/internal/internal.go b/vendor/github.com/openshift/client-go/config/applyconfigurations/internal/internal.go index fc70cbc32..e8ea2f569 100644 --- a/vendor/github.com/openshift/client-go/config/applyconfigurations/internal/internal.go +++ b/vendor/github.com/openshift/client-go/config/applyconfigurations/internal/internal.go @@ -1621,6 +1621,10 @@ var schemaYAML = typed.YAMLObject(`types: elementType: scalar: string elementRelationship: atomic + - name: imageStreamImportMode + type: + scalar: string + default: "" - name: registrySources type: namedType: com.github.openshift.api.config.v1.RegistrySources @@ -1634,6 +1638,9 @@ var schemaYAML = typed.YAMLObject(`types: elementType: scalar: string elementRelationship: atomic + - name: imageStreamImportMode + type: + scalar: string - name: internalRegistryHostname type: scalar: string @@ -2167,16 +2174,15 @@ var schemaYAML = typed.YAMLObject(`types: scalar: string - name: com.github.openshift.api.config.v1.NodeStatus map: - elementType: - scalar: untyped - list: - elementType: - namedType: __untyped_atomic_ - elementRelationship: atomic - map: - elementType: - namedType: __untyped_deduced_ - elementRelationship: separable + fields: + - name: conditions + type: + list: + elementType: + namedType: io.k8s.apimachinery.pkg.apis.meta.v1.Condition + elementRelationship: associative + keys: + - type - name: com.github.openshift.api.config.v1.NutanixFailureDomain map: fields: diff --git a/vendor/github.com/openshift/client-go/operator/applyconfigurations/internal/internal.go b/vendor/github.com/openshift/client-go/operator/applyconfigurations/internal/internal.go index 942b4b3f5..c0d12f97c 100644 --- a/vendor/github.com/openshift/client-go/operator/applyconfigurations/internal/internal.go +++ b/vendor/github.com/openshift/client-go/operator/applyconfigurations/internal/internal.go @@ -142,6 +142,9 @@ var schemaYAML = typed.YAMLObject(`types: - name: com.github.openshift.api.operator.v1.AWSCSIDriverConfigSpec map: fields: + - name: efsVolumeMetrics + type: + namedType: com.github.openshift.api.operator.v1.AWSEFSVolumeMetrics - name: kmsKeyARN type: scalar: string @@ -151,6 +154,33 @@ var schemaYAML = typed.YAMLObject(`types: - name: connectionIdleTimeout type: namedType: io.k8s.apimachinery.pkg.apis.meta.v1.Duration + - name: subnets + type: + namedType: com.github.openshift.api.operator.v1.AWSSubnets +- name: com.github.openshift.api.operator.v1.AWSEFSVolumeMetrics + map: + fields: + - name: recursiveWalk + type: + namedType: com.github.openshift.api.operator.v1.AWSEFSVolumeMetricsRecursiveWalkConfig + - name: state + type: + scalar: string + default: "" + unions: + - discriminator: state + fields: + - fieldName: recursiveWalk + discriminatorValue: RecursiveWalk +- name: com.github.openshift.api.operator.v1.AWSEFSVolumeMetricsRecursiveWalkConfig + map: + fields: + - name: fsRateLimit + type: + scalar: numeric + - name: refreshPeriodMinutes + type: + scalar: numeric - name: com.github.openshift.api.operator.v1.AWSLoadBalancerParameters map: fields: @@ -173,16 +203,31 @@ var schemaYAML = typed.YAMLObject(`types: discriminatorValue: NetworkLoadBalancerParameters - name: com.github.openshift.api.operator.v1.AWSNetworkLoadBalancerParameters map: - elementType: - scalar: untyped - list: - elementType: - namedType: __untyped_atomic_ - elementRelationship: atomic - map: - elementType: - namedType: __untyped_deduced_ - elementRelationship: separable + fields: + - name: eipAllocations + type: + list: + elementType: + scalar: string + elementRelationship: atomic + - name: subnets + type: + namedType: com.github.openshift.api.operator.v1.AWSSubnets +- name: com.github.openshift.api.operator.v1.AWSSubnets + map: + fields: + - name: ids + type: + list: + elementType: + scalar: string + elementRelationship: atomic + - name: names + type: + list: + elementType: + scalar: string + elementRelationship: atomic - name: com.github.openshift.api.operator.v1.AccessLogging map: fields: @@ -235,6 +280,15 @@ var schemaYAML = typed.YAMLObject(`types: type: scalar: string default: "" +- name: com.github.openshift.api.operator.v1.AdditionalRoutingCapabilities + map: + fields: + - name: providers + type: + list: + elementType: + scalar: string + elementRelationship: atomic - name: com.github.openshift.api.operator.v1.Authentication map: fields: @@ -293,7 +347,15 @@ var schemaYAML = typed.YAMLObject(`types: list: elementType: namedType: com.github.openshift.api.operator.v1.GenerationStatus - elementRelationship: atomic + elementRelationship: associative + keys: + - group + - resource + - namespace + - name + - name: latestAvailableRevision + type: + scalar: numeric - name: oauthAPIServer type: namedType: com.github.openshift.api.operator.v1.OAuthAPIServerStatus @@ -422,7 +484,15 @@ var schemaYAML = typed.YAMLObject(`types: list: elementType: namedType: com.github.openshift.api.operator.v1.GenerationStatus - elementRelationship: atomic + elementRelationship: associative + keys: + - group + - resource + - namespace + - name + - name: latestAvailableRevision + type: + scalar: numeric - name: observedGeneration type: scalar: numeric @@ -433,6 +503,26 @@ var schemaYAML = typed.YAMLObject(`types: - name: version type: scalar: string +- name: com.github.openshift.api.operator.v1.Capability + map: + fields: + - name: name + type: + scalar: string + default: "" + - name: visibility + type: + namedType: com.github.openshift.api.operator.v1.CapabilityVisibility + default: {} +- name: com.github.openshift.api.operator.v1.CapabilityVisibility + map: + fields: + - name: state + type: + scalar: string + default: "" + unions: + - discriminator: state - name: com.github.openshift.api.operator.v1.ClientTLS map: fields: @@ -511,7 +601,15 @@ var schemaYAML = typed.YAMLObject(`types: list: elementType: namedType: com.github.openshift.api.operator.v1.GenerationStatus - elementRelationship: atomic + elementRelationship: associative + keys: + - group + - resource + - namespace + - name + - name: latestAvailableRevision + type: + scalar: numeric - name: observedGeneration type: scalar: numeric @@ -587,7 +685,15 @@ var schemaYAML = typed.YAMLObject(`types: list: elementType: namedType: com.github.openshift.api.operator.v1.GenerationStatus - elementRelationship: atomic + elementRelationship: associative + keys: + - group + - resource + - namespace + - name + - name: latestAvailableRevision + type: + scalar: numeric - name: observedGeneration type: scalar: numeric @@ -666,7 +772,15 @@ var schemaYAML = typed.YAMLObject(`types: list: elementType: namedType: com.github.openshift.api.operator.v1.GenerationStatus - elementRelationship: atomic + elementRelationship: associative + keys: + - group + - resource + - namespace + - name + - name: latestAvailableRevision + type: + scalar: numeric - name: observedGeneration type: scalar: numeric @@ -719,6 +833,14 @@ var schemaYAML = typed.YAMLObject(`types: - name: brand type: scalar: string + - name: capabilities + type: + list: + elementType: + namedType: com.github.openshift.api.operator.v1.Capability + elementRelationship: associative + keys: + - name - name: customLogoFile type: namedType: com.github.openshift.api.config.v1.ConfigMapFileReference @@ -814,7 +936,15 @@ var schemaYAML = typed.YAMLObject(`types: list: elementType: namedType: com.github.openshift.api.operator.v1.GenerationStatus - elementRelationship: atomic + elementRelationship: associative + keys: + - group + - resource + - namespace + - name + - name: latestAvailableRevision + type: + scalar: numeric - name: observedGeneration type: scalar: numeric @@ -1157,7 +1287,12 @@ var schemaYAML = typed.YAMLObject(`types: list: elementType: namedType: com.github.openshift.api.operator.v1.GenerationStatus - elementRelationship: atomic + elementRelationship: associative + keys: + - group + - resource + - namespace + - name - name: latestAvailableRevision type: scalar: numeric @@ -1697,7 +1832,9 @@ var schemaYAML = typed.YAMLObject(`types: list: elementType: namedType: com.github.openshift.api.operator.v1.OperatorCondition - elementRelationship: atomic + elementRelationship: associative + keys: + - type - name: domain type: scalar: string @@ -1825,11 +1962,19 @@ var schemaYAML = typed.YAMLObject(`types: list: elementType: namedType: com.github.openshift.api.operator.v1.GenerationStatus - elementRelationship: atomic + elementRelationship: associative + keys: + - group + - resource + - namespace + - name - name: insightsReport type: namedType: com.github.openshift.api.operator.v1.InsightsReport default: {} + - name: latestAvailableRevision + type: + scalar: numeric - name: observedGeneration type: scalar: numeric @@ -1921,7 +2066,12 @@ var schemaYAML = typed.YAMLObject(`types: list: elementType: namedType: com.github.openshift.api.operator.v1.GenerationStatus - elementRelationship: atomic + elementRelationship: associative + keys: + - group + - resource + - namespace + - name - name: latestAvailableRevision type: scalar: numeric @@ -2024,7 +2174,12 @@ var schemaYAML = typed.YAMLObject(`types: list: elementType: namedType: com.github.openshift.api.operator.v1.GenerationStatus - elementRelationship: atomic + elementRelationship: associative + keys: + - group + - resource + - namespace + - name - name: latestAvailableRevision type: scalar: numeric @@ -2117,7 +2272,12 @@ var schemaYAML = typed.YAMLObject(`types: list: elementType: namedType: com.github.openshift.api.operator.v1.GenerationStatus - elementRelationship: atomic + elementRelationship: associative + keys: + - group + - resource + - namespace + - name - name: latestAvailableRevision type: scalar: numeric @@ -2200,7 +2360,15 @@ var schemaYAML = typed.YAMLObject(`types: list: elementType: namedType: com.github.openshift.api.operator.v1.GenerationStatus - elementRelationship: atomic + elementRelationship: associative + keys: + - group + - resource + - namespace + - name + - name: latestAvailableRevision + type: + scalar: numeric - name: observedGeneration type: scalar: numeric @@ -2428,7 +2596,6 @@ var schemaYAML = typed.YAMLObject(`types: - name: mode type: scalar: string - default: "" - name: mtu type: namedType: com.github.openshift.api.operator.v1.MTUMigration @@ -2443,7 +2610,12 @@ var schemaYAML = typed.YAMLObject(`types: list: elementType: namedType: com.github.openshift.api.operator.v1.AdditionalNetworkDefinition - elementRelationship: atomic + elementRelationship: associative + keys: + - name + - name: additionalRoutingCapabilities + type: + namedType: com.github.openshift.api.operator.v1.AdditionalRoutingCapabilities - name: clusterNetwork type: list: @@ -2516,7 +2688,15 @@ var schemaYAML = typed.YAMLObject(`types: list: elementType: namedType: com.github.openshift.api.operator.v1.GenerationStatus - elementRelationship: atomic + elementRelationship: associative + keys: + - group + - resource + - namespace + - name + - name: latestAvailableRevision + type: + scalar: numeric - name: observedGeneration type: scalar: numeric @@ -2782,6 +2962,9 @@ var schemaYAML = typed.YAMLObject(`types: - name: policyAuditConfig type: namedType: com.github.openshift.api.operator.v1.PolicyAuditConfig + - name: routeAdvertisements + type: + scalar: string - name: v4InternalSubnet type: scalar: string @@ -2846,7 +3029,12 @@ var schemaYAML = typed.YAMLObject(`types: list: elementType: namedType: com.github.openshift.api.operator.v1.GenerationStatus - elementRelationship: atomic + elementRelationship: associative + keys: + - group + - resource + - namespace + - name - name: latestAvailableRevision type: scalar: numeric @@ -2918,7 +3106,15 @@ var schemaYAML = typed.YAMLObject(`types: list: elementType: namedType: com.github.openshift.api.operator.v1.GenerationStatus - elementRelationship: atomic + elementRelationship: associative + keys: + - group + - resource + - namespace + - name + - name: latestAvailableRevision + type: + scalar: numeric - name: observedGeneration type: scalar: numeric @@ -3238,7 +3434,15 @@ var schemaYAML = typed.YAMLObject(`types: list: elementType: namedType: com.github.openshift.api.operator.v1.GenerationStatus - elementRelationship: atomic + elementRelationship: associative + keys: + - group + - resource + - namespace + - name + - name: latestAvailableRevision + type: + scalar: numeric - name: observedGeneration type: scalar: numeric @@ -3307,7 +3511,15 @@ var schemaYAML = typed.YAMLObject(`types: list: elementType: namedType: com.github.openshift.api.operator.v1.GenerationStatus - elementRelationship: atomic + elementRelationship: associative + keys: + - group + - resource + - namespace + - name + - name: latestAvailableRevision + type: + scalar: numeric - name: observedGeneration type: scalar: numeric @@ -3376,7 +3588,15 @@ var schemaYAML = typed.YAMLObject(`types: list: elementType: namedType: com.github.openshift.api.operator.v1.GenerationStatus - elementRelationship: atomic + elementRelationship: associative + keys: + - group + - resource + - namespace + - name + - name: latestAvailableRevision + type: + scalar: numeric - name: observedGeneration type: scalar: numeric @@ -3527,7 +3747,15 @@ var schemaYAML = typed.YAMLObject(`types: list: elementType: namedType: com.github.openshift.api.operator.v1.GenerationStatus - elementRelationship: atomic + elementRelationship: associative + keys: + - group + - resource + - namespace + - name + - name: latestAvailableRevision + type: + scalar: numeric - name: observedGeneration type: scalar: numeric @@ -3743,7 +3971,15 @@ var schemaYAML = typed.YAMLObject(`types: list: elementType: namedType: com.github.openshift.api.operator.v1.GenerationStatus - elementRelationship: atomic + elementRelationship: associative + keys: + - group + - resource + - namespace + - name + - name: latestAvailableRevision + type: + scalar: numeric - name: observedGeneration type: scalar: numeric diff --git a/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/additionalroutingcapabilities.go b/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/additionalroutingcapabilities.go new file mode 100644 index 000000000..1db61d87f --- /dev/null +++ b/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/additionalroutingcapabilities.go @@ -0,0 +1,29 @@ +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1 + +import ( + v1 "github.com/openshift/api/operator/v1" +) + +// AdditionalRoutingCapabilitiesApplyConfiguration represents an declarative configuration of the AdditionalRoutingCapabilities type for use +// with apply. +type AdditionalRoutingCapabilitiesApplyConfiguration struct { + Providers []v1.RoutingCapabilitiesProvider `json:"providers,omitempty"` +} + +// AdditionalRoutingCapabilitiesApplyConfiguration constructs an declarative configuration of the AdditionalRoutingCapabilities type for use with +// apply. +func AdditionalRoutingCapabilities() *AdditionalRoutingCapabilitiesApplyConfiguration { + return &AdditionalRoutingCapabilitiesApplyConfiguration{} +} + +// WithProviders adds the given value to the Providers field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Providers field. +func (b *AdditionalRoutingCapabilitiesApplyConfiguration) WithProviders(values ...v1.RoutingCapabilitiesProvider) *AdditionalRoutingCapabilitiesApplyConfiguration { + for i := range values { + b.Providers = append(b.Providers, values[i]) + } + return b +} diff --git a/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/authenticationstatus.go b/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/authenticationstatus.go index 66b05942e..c6f7c205c 100644 --- a/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/authenticationstatus.go +++ b/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/authenticationstatus.go @@ -60,6 +60,14 @@ func (b *AuthenticationStatusApplyConfiguration) WithReadyReplicas(value int32) return b } +// WithLatestAvailableRevision sets the LatestAvailableRevision field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the LatestAvailableRevision field is set to the value of the last call. +func (b *AuthenticationStatusApplyConfiguration) WithLatestAvailableRevision(value int32) *AuthenticationStatusApplyConfiguration { + b.LatestAvailableRevision = &value + return b +} + // WithGenerations adds the given value to the Generations field in the declarative configuration // and returns the receiver, so that objects can be build by chaining "With" function invocations. // If called multiple times, values provided by each call will be appended to the Generations field. diff --git a/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/awsclassicloadbalancerparameters.go b/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/awsclassicloadbalancerparameters.go index 8a0d2c2a6..892fe5814 100644 --- a/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/awsclassicloadbalancerparameters.go +++ b/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/awsclassicloadbalancerparameters.go @@ -9,7 +9,8 @@ import ( // AWSClassicLoadBalancerParametersApplyConfiguration represents an declarative configuration of the AWSClassicLoadBalancerParameters type for use // with apply. type AWSClassicLoadBalancerParametersApplyConfiguration struct { - ConnectionIdleTimeout *v1.Duration `json:"connectionIdleTimeout,omitempty"` + ConnectionIdleTimeout *v1.Duration `json:"connectionIdleTimeout,omitempty"` + Subnets *AWSSubnetsApplyConfiguration `json:"subnets,omitempty"` } // AWSClassicLoadBalancerParametersApplyConfiguration constructs an declarative configuration of the AWSClassicLoadBalancerParameters type for use with @@ -25,3 +26,11 @@ func (b *AWSClassicLoadBalancerParametersApplyConfiguration) WithConnectionIdleT b.ConnectionIdleTimeout = &value return b } + +// WithSubnets sets the Subnets field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Subnets field is set to the value of the last call. +func (b *AWSClassicLoadBalancerParametersApplyConfiguration) WithSubnets(value *AWSSubnetsApplyConfiguration) *AWSClassicLoadBalancerParametersApplyConfiguration { + b.Subnets = value + return b +} diff --git a/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/awscsidriverconfigspec.go b/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/awscsidriverconfigspec.go index 7a4fa7ab3..f9384b54f 100644 --- a/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/awscsidriverconfigspec.go +++ b/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/awscsidriverconfigspec.go @@ -5,7 +5,8 @@ package v1 // AWSCSIDriverConfigSpecApplyConfiguration represents an declarative configuration of the AWSCSIDriverConfigSpec type for use // with apply. type AWSCSIDriverConfigSpecApplyConfiguration struct { - KMSKeyARN *string `json:"kmsKeyARN,omitempty"` + KMSKeyARN *string `json:"kmsKeyARN,omitempty"` + EFSVolumeMetrics *AWSEFSVolumeMetricsApplyConfiguration `json:"efsVolumeMetrics,omitempty"` } // AWSCSIDriverConfigSpecApplyConfiguration constructs an declarative configuration of the AWSCSIDriverConfigSpec type for use with @@ -21,3 +22,11 @@ func (b *AWSCSIDriverConfigSpecApplyConfiguration) WithKMSKeyARN(value string) * b.KMSKeyARN = &value return b } + +// WithEFSVolumeMetrics sets the EFSVolumeMetrics field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the EFSVolumeMetrics field is set to the value of the last call. +func (b *AWSCSIDriverConfigSpecApplyConfiguration) WithEFSVolumeMetrics(value *AWSEFSVolumeMetricsApplyConfiguration) *AWSCSIDriverConfigSpecApplyConfiguration { + b.EFSVolumeMetrics = value + return b +} diff --git a/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/awsefsvolumemetrics.go b/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/awsefsvolumemetrics.go new file mode 100644 index 000000000..1cdeb76f0 --- /dev/null +++ b/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/awsefsvolumemetrics.go @@ -0,0 +1,36 @@ +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1 + +import ( + v1 "github.com/openshift/api/operator/v1" +) + +// AWSEFSVolumeMetricsApplyConfiguration represents an declarative configuration of the AWSEFSVolumeMetrics type for use +// with apply. +type AWSEFSVolumeMetricsApplyConfiguration struct { + State *v1.AWSEFSVolumeMetricsState `json:"state,omitempty"` + RecursiveWalk *AWSEFSVolumeMetricsRecursiveWalkConfigApplyConfiguration `json:"recursiveWalk,omitempty"` +} + +// AWSEFSVolumeMetricsApplyConfiguration constructs an declarative configuration of the AWSEFSVolumeMetrics type for use with +// apply. +func AWSEFSVolumeMetrics() *AWSEFSVolumeMetricsApplyConfiguration { + return &AWSEFSVolumeMetricsApplyConfiguration{} +} + +// WithState sets the State field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the State field is set to the value of the last call. +func (b *AWSEFSVolumeMetricsApplyConfiguration) WithState(value v1.AWSEFSVolumeMetricsState) *AWSEFSVolumeMetricsApplyConfiguration { + b.State = &value + return b +} + +// WithRecursiveWalk sets the RecursiveWalk field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the RecursiveWalk field is set to the value of the last call. +func (b *AWSEFSVolumeMetricsApplyConfiguration) WithRecursiveWalk(value *AWSEFSVolumeMetricsRecursiveWalkConfigApplyConfiguration) *AWSEFSVolumeMetricsApplyConfiguration { + b.RecursiveWalk = value + return b +} diff --git a/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/awsefsvolumemetricsrecursivewalkconfig.go b/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/awsefsvolumemetricsrecursivewalkconfig.go new file mode 100644 index 000000000..93c04827a --- /dev/null +++ b/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/awsefsvolumemetricsrecursivewalkconfig.go @@ -0,0 +1,32 @@ +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1 + +// AWSEFSVolumeMetricsRecursiveWalkConfigApplyConfiguration represents an declarative configuration of the AWSEFSVolumeMetricsRecursiveWalkConfig type for use +// with apply. +type AWSEFSVolumeMetricsRecursiveWalkConfigApplyConfiguration struct { + RefreshPeriodMinutes *int32 `json:"refreshPeriodMinutes,omitempty"` + FSRateLimit *int32 `json:"fsRateLimit,omitempty"` +} + +// AWSEFSVolumeMetricsRecursiveWalkConfigApplyConfiguration constructs an declarative configuration of the AWSEFSVolumeMetricsRecursiveWalkConfig type for use with +// apply. +func AWSEFSVolumeMetricsRecursiveWalkConfig() *AWSEFSVolumeMetricsRecursiveWalkConfigApplyConfiguration { + return &AWSEFSVolumeMetricsRecursiveWalkConfigApplyConfiguration{} +} + +// WithRefreshPeriodMinutes sets the RefreshPeriodMinutes field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the RefreshPeriodMinutes field is set to the value of the last call. +func (b *AWSEFSVolumeMetricsRecursiveWalkConfigApplyConfiguration) WithRefreshPeriodMinutes(value int32) *AWSEFSVolumeMetricsRecursiveWalkConfigApplyConfiguration { + b.RefreshPeriodMinutes = &value + return b +} + +// WithFSRateLimit sets the FSRateLimit field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the FSRateLimit field is set to the value of the last call. +func (b *AWSEFSVolumeMetricsRecursiveWalkConfigApplyConfiguration) WithFSRateLimit(value int32) *AWSEFSVolumeMetricsRecursiveWalkConfigApplyConfiguration { + b.FSRateLimit = &value + return b +} diff --git a/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/awsloadbalancerparameters.go b/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/awsloadbalancerparameters.go index a38b99197..78d5a4334 100644 --- a/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/awsloadbalancerparameters.go +++ b/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/awsloadbalancerparameters.go @@ -11,7 +11,7 @@ import ( type AWSLoadBalancerParametersApplyConfiguration struct { Type *v1.AWSLoadBalancerType `json:"type,omitempty"` ClassicLoadBalancerParameters *AWSClassicLoadBalancerParametersApplyConfiguration `json:"classicLoadBalancer,omitempty"` - NetworkLoadBalancerParameters *v1.AWSNetworkLoadBalancerParameters `json:"networkLoadBalancer,omitempty"` + NetworkLoadBalancerParameters *AWSNetworkLoadBalancerParametersApplyConfiguration `json:"networkLoadBalancer,omitempty"` } // AWSLoadBalancerParametersApplyConfiguration constructs an declarative configuration of the AWSLoadBalancerParameters type for use with @@ -39,7 +39,7 @@ func (b *AWSLoadBalancerParametersApplyConfiguration) WithClassicLoadBalancerPar // WithNetworkLoadBalancerParameters sets the NetworkLoadBalancerParameters field in the declarative configuration to the given value // and returns the receiver, so that objects can be built by chaining "With" function invocations. // If called multiple times, the NetworkLoadBalancerParameters field is set to the value of the last call. -func (b *AWSLoadBalancerParametersApplyConfiguration) WithNetworkLoadBalancerParameters(value v1.AWSNetworkLoadBalancerParameters) *AWSLoadBalancerParametersApplyConfiguration { - b.NetworkLoadBalancerParameters = &value +func (b *AWSLoadBalancerParametersApplyConfiguration) WithNetworkLoadBalancerParameters(value *AWSNetworkLoadBalancerParametersApplyConfiguration) *AWSLoadBalancerParametersApplyConfiguration { + b.NetworkLoadBalancerParameters = value return b } diff --git a/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/awsnetworkloadbalancerparameters.go b/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/awsnetworkloadbalancerparameters.go new file mode 100644 index 000000000..9bc099855 --- /dev/null +++ b/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/awsnetworkloadbalancerparameters.go @@ -0,0 +1,38 @@ +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1 + +import ( + operatorv1 "github.com/openshift/api/operator/v1" +) + +// AWSNetworkLoadBalancerParametersApplyConfiguration represents an declarative configuration of the AWSNetworkLoadBalancerParameters type for use +// with apply. +type AWSNetworkLoadBalancerParametersApplyConfiguration struct { + Subnets *AWSSubnetsApplyConfiguration `json:"subnets,omitempty"` + EIPAllocations []operatorv1.EIPAllocation `json:"eipAllocations,omitempty"` +} + +// AWSNetworkLoadBalancerParametersApplyConfiguration constructs an declarative configuration of the AWSNetworkLoadBalancerParameters type for use with +// apply. +func AWSNetworkLoadBalancerParameters() *AWSNetworkLoadBalancerParametersApplyConfiguration { + return &AWSNetworkLoadBalancerParametersApplyConfiguration{} +} + +// WithSubnets sets the Subnets field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Subnets field is set to the value of the last call. +func (b *AWSNetworkLoadBalancerParametersApplyConfiguration) WithSubnets(value *AWSSubnetsApplyConfiguration) *AWSNetworkLoadBalancerParametersApplyConfiguration { + b.Subnets = value + return b +} + +// WithEIPAllocations adds the given value to the EIPAllocations field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the EIPAllocations field. +func (b *AWSNetworkLoadBalancerParametersApplyConfiguration) WithEIPAllocations(values ...operatorv1.EIPAllocation) *AWSNetworkLoadBalancerParametersApplyConfiguration { + for i := range values { + b.EIPAllocations = append(b.EIPAllocations, values[i]) + } + return b +} diff --git a/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/awssubnets.go b/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/awssubnets.go new file mode 100644 index 000000000..e3d063f08 --- /dev/null +++ b/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/awssubnets.go @@ -0,0 +1,40 @@ +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1 + +import ( + v1 "github.com/openshift/api/operator/v1" +) + +// AWSSubnetsApplyConfiguration represents an declarative configuration of the AWSSubnets type for use +// with apply. +type AWSSubnetsApplyConfiguration struct { + IDs []v1.AWSSubnetID `json:"ids,omitempty"` + Names []v1.AWSSubnetName `json:"names,omitempty"` +} + +// AWSSubnetsApplyConfiguration constructs an declarative configuration of the AWSSubnets type for use with +// apply. +func AWSSubnets() *AWSSubnetsApplyConfiguration { + return &AWSSubnetsApplyConfiguration{} +} + +// WithIDs adds the given value to the IDs field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the IDs field. +func (b *AWSSubnetsApplyConfiguration) WithIDs(values ...v1.AWSSubnetID) *AWSSubnetsApplyConfiguration { + for i := range values { + b.IDs = append(b.IDs, values[i]) + } + return b +} + +// WithNames adds the given value to the Names field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Names field. +func (b *AWSSubnetsApplyConfiguration) WithNames(values ...v1.AWSSubnetName) *AWSSubnetsApplyConfiguration { + for i := range values { + b.Names = append(b.Names, values[i]) + } + return b +} diff --git a/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/capability.go b/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/capability.go new file mode 100644 index 000000000..55aa8415c --- /dev/null +++ b/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/capability.go @@ -0,0 +1,36 @@ +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1 + +import ( + v1 "github.com/openshift/api/operator/v1" +) + +// CapabilityApplyConfiguration represents an declarative configuration of the Capability type for use +// with apply. +type CapabilityApplyConfiguration struct { + Name *v1.ConsoleCapabilityName `json:"name,omitempty"` + Visibility *CapabilityVisibilityApplyConfiguration `json:"visibility,omitempty"` +} + +// CapabilityApplyConfiguration constructs an declarative configuration of the Capability type for use with +// apply. +func Capability() *CapabilityApplyConfiguration { + return &CapabilityApplyConfiguration{} +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *CapabilityApplyConfiguration) WithName(value v1.ConsoleCapabilityName) *CapabilityApplyConfiguration { + b.Name = &value + return b +} + +// WithVisibility sets the Visibility field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Visibility field is set to the value of the last call. +func (b *CapabilityApplyConfiguration) WithVisibility(value *CapabilityVisibilityApplyConfiguration) *CapabilityApplyConfiguration { + b.Visibility = value + return b +} diff --git a/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/capabilityvisibility.go b/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/capabilityvisibility.go new file mode 100644 index 000000000..b230a8f63 --- /dev/null +++ b/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/capabilityvisibility.go @@ -0,0 +1,27 @@ +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1 + +import ( + v1 "github.com/openshift/api/operator/v1" +) + +// CapabilityVisibilityApplyConfiguration represents an declarative configuration of the CapabilityVisibility type for use +// with apply. +type CapabilityVisibilityApplyConfiguration struct { + State *v1.CapabilityState `json:"state,omitempty"` +} + +// CapabilityVisibilityApplyConfiguration constructs an declarative configuration of the CapabilityVisibility type for use with +// apply. +func CapabilityVisibility() *CapabilityVisibilityApplyConfiguration { + return &CapabilityVisibilityApplyConfiguration{} +} + +// WithState sets the State field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the State field is set to the value of the last call. +func (b *CapabilityVisibilityApplyConfiguration) WithState(value v1.CapabilityState) *CapabilityVisibilityApplyConfiguration { + b.State = &value + return b +} diff --git a/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/cloudcredentialstatus.go b/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/cloudcredentialstatus.go index f34194ccd..c6f90775d 100644 --- a/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/cloudcredentialstatus.go +++ b/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/cloudcredentialstatus.go @@ -51,6 +51,14 @@ func (b *CloudCredentialStatusApplyConfiguration) WithReadyReplicas(value int32) return b } +// WithLatestAvailableRevision sets the LatestAvailableRevision field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the LatestAvailableRevision field is set to the value of the last call. +func (b *CloudCredentialStatusApplyConfiguration) WithLatestAvailableRevision(value int32) *CloudCredentialStatusApplyConfiguration { + b.LatestAvailableRevision = &value + return b +} + // WithGenerations adds the given value to the Generations field in the declarative configuration // and returns the receiver, so that objects can be build by chaining "With" function invocations. // If called multiple times, values provided by each call will be appended to the Generations field. diff --git a/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/clustercsidriverstatus.go b/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/clustercsidriverstatus.go index a2404ebd2..a38a57a85 100644 --- a/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/clustercsidriverstatus.go +++ b/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/clustercsidriverstatus.go @@ -51,6 +51,14 @@ func (b *ClusterCSIDriverStatusApplyConfiguration) WithReadyReplicas(value int32 return b } +// WithLatestAvailableRevision sets the LatestAvailableRevision field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the LatestAvailableRevision field is set to the value of the last call. +func (b *ClusterCSIDriverStatusApplyConfiguration) WithLatestAvailableRevision(value int32) *ClusterCSIDriverStatusApplyConfiguration { + b.LatestAvailableRevision = &value + return b +} + // WithGenerations adds the given value to the Generations field in the declarative configuration // and returns the receiver, so that objects can be build by chaining "With" function invocations. // If called multiple times, values provided by each call will be appended to the Generations field. diff --git a/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/configstatus.go b/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/configstatus.go index 3980ba2e8..d8e4c6787 100644 --- a/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/configstatus.go +++ b/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/configstatus.go @@ -51,6 +51,14 @@ func (b *ConfigStatusApplyConfiguration) WithReadyReplicas(value int32) *ConfigS return b } +// WithLatestAvailableRevision sets the LatestAvailableRevision field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the LatestAvailableRevision field is set to the value of the last call. +func (b *ConfigStatusApplyConfiguration) WithLatestAvailableRevision(value int32) *ConfigStatusApplyConfiguration { + b.LatestAvailableRevision = &value + return b +} + // WithGenerations adds the given value to the Generations field in the declarative configuration // and returns the receiver, so that objects can be build by chaining "With" function invocations. // If called multiple times, values provided by each call will be appended to the Generations field. diff --git a/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/consolecustomization.go b/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/consolecustomization.go index c2d95e2b9..123a8aea6 100644 --- a/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/consolecustomization.go +++ b/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/consolecustomization.go @@ -4,13 +4,14 @@ package v1 import ( configv1 "github.com/openshift/api/config/v1" - v1 "github.com/openshift/api/operator/v1" + operatorv1 "github.com/openshift/api/operator/v1" ) // ConsoleCustomizationApplyConfiguration represents an declarative configuration of the ConsoleCustomization type for use // with apply. type ConsoleCustomizationApplyConfiguration struct { - Brand *v1.Brand `json:"brand,omitempty"` + Capabilities []CapabilityApplyConfiguration `json:"capabilities,omitempty"` + Brand *operatorv1.Brand `json:"brand,omitempty"` DocumentationBaseURL *string `json:"documentationBaseURL,omitempty"` CustomProductName *string `json:"customProductName,omitempty"` CustomLogoFile *configv1.ConfigMapFileReference `json:"customLogoFile,omitempty"` @@ -27,10 +28,23 @@ func ConsoleCustomization() *ConsoleCustomizationApplyConfiguration { return &ConsoleCustomizationApplyConfiguration{} } +// WithCapabilities adds the given value to the Capabilities field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Capabilities field. +func (b *ConsoleCustomizationApplyConfiguration) WithCapabilities(values ...*CapabilityApplyConfiguration) *ConsoleCustomizationApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithCapabilities") + } + b.Capabilities = append(b.Capabilities, *values[i]) + } + return b +} + // WithBrand sets the Brand field in the declarative configuration to the given value // and returns the receiver, so that objects can be built by chaining "With" function invocations. // If called multiple times, the Brand field is set to the value of the last call. -func (b *ConsoleCustomizationApplyConfiguration) WithBrand(value v1.Brand) *ConsoleCustomizationApplyConfiguration { +func (b *ConsoleCustomizationApplyConfiguration) WithBrand(value operatorv1.Brand) *ConsoleCustomizationApplyConfiguration { b.Brand = &value return b } diff --git a/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/consolestatus.go b/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/consolestatus.go index f271d9dd2..493b97796 100644 --- a/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/consolestatus.go +++ b/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/consolestatus.go @@ -51,6 +51,14 @@ func (b *ConsoleStatusApplyConfiguration) WithReadyReplicas(value int32) *Consol return b } +// WithLatestAvailableRevision sets the LatestAvailableRevision field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the LatestAvailableRevision field is set to the value of the last call. +func (b *ConsoleStatusApplyConfiguration) WithLatestAvailableRevision(value int32) *ConsoleStatusApplyConfiguration { + b.LatestAvailableRevision = &value + return b +} + // WithGenerations adds the given value to the Generations field in the declarative configuration // and returns the receiver, so that objects can be build by chaining "With" function invocations. // If called multiple times, values provided by each call will be appended to the Generations field. diff --git a/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/csisnapshotcontrollerstatus.go b/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/csisnapshotcontrollerstatus.go index 8f693f1d8..128c48649 100644 --- a/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/csisnapshotcontrollerstatus.go +++ b/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/csisnapshotcontrollerstatus.go @@ -51,6 +51,14 @@ func (b *CSISnapshotControllerStatusApplyConfiguration) WithReadyReplicas(value return b } +// WithLatestAvailableRevision sets the LatestAvailableRevision field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the LatestAvailableRevision field is set to the value of the last call. +func (b *CSISnapshotControllerStatusApplyConfiguration) WithLatestAvailableRevision(value int32) *CSISnapshotControllerStatusApplyConfiguration { + b.LatestAvailableRevision = &value + return b +} + // WithGenerations adds the given value to the Generations field in the declarative configuration // and returns the receiver, so that objects can be build by chaining "With" function invocations. // If called multiple times, values provided by each call will be appended to the Generations field. diff --git a/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/etcdstatus.go b/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/etcdstatus.go index c62f84149..ca86586a8 100644 --- a/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/etcdstatus.go +++ b/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/etcdstatus.go @@ -56,6 +56,14 @@ func (b *EtcdStatusApplyConfiguration) WithReadyReplicas(value int32) *EtcdStatu return b } +// WithLatestAvailableRevision sets the LatestAvailableRevision field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the LatestAvailableRevision field is set to the value of the last call. +func (b *EtcdStatusApplyConfiguration) WithLatestAvailableRevision(value int32) *EtcdStatusApplyConfiguration { + b.LatestAvailableRevision = &value + return b +} + // WithGenerations adds the given value to the Generations field in the declarative configuration // and returns the receiver, so that objects can be build by chaining "With" function invocations. // If called multiple times, values provided by each call will be appended to the Generations field. @@ -69,14 +77,6 @@ func (b *EtcdStatusApplyConfiguration) WithGenerations(values ...*GenerationStat return b } -// WithLatestAvailableRevision sets the LatestAvailableRevision field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the LatestAvailableRevision field is set to the value of the last call. -func (b *EtcdStatusApplyConfiguration) WithLatestAvailableRevision(value int32) *EtcdStatusApplyConfiguration { - b.LatestAvailableRevision = &value - return b -} - // WithLatestAvailableRevisionReason sets the LatestAvailableRevisionReason field in the declarative configuration to the given value // and returns the receiver, so that objects can be built by chaining "With" function invocations. // If called multiple times, the LatestAvailableRevisionReason field is set to the value of the last call. diff --git a/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/insightsoperatorstatus.go b/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/insightsoperatorstatus.go index 75dffab00..388f7108b 100644 --- a/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/insightsoperatorstatus.go +++ b/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/insightsoperatorstatus.go @@ -53,6 +53,14 @@ func (b *InsightsOperatorStatusApplyConfiguration) WithReadyReplicas(value int32 return b } +// WithLatestAvailableRevision sets the LatestAvailableRevision field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the LatestAvailableRevision field is set to the value of the last call. +func (b *InsightsOperatorStatusApplyConfiguration) WithLatestAvailableRevision(value int32) *InsightsOperatorStatusApplyConfiguration { + b.LatestAvailableRevision = &value + return b +} + // WithGenerations adds the given value to the Generations field in the declarative configuration // and returns the receiver, so that objects can be build by chaining "With" function invocations. // If called multiple times, values provided by each call will be appended to the Generations field. diff --git a/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/kubeapiserverstatus.go b/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/kubeapiserverstatus.go index 36475f5f4..562e0ae59 100644 --- a/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/kubeapiserverstatus.go +++ b/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/kubeapiserverstatus.go @@ -52,6 +52,14 @@ func (b *KubeAPIServerStatusApplyConfiguration) WithReadyReplicas(value int32) * return b } +// WithLatestAvailableRevision sets the LatestAvailableRevision field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the LatestAvailableRevision field is set to the value of the last call. +func (b *KubeAPIServerStatusApplyConfiguration) WithLatestAvailableRevision(value int32) *KubeAPIServerStatusApplyConfiguration { + b.LatestAvailableRevision = &value + return b +} + // WithGenerations adds the given value to the Generations field in the declarative configuration // and returns the receiver, so that objects can be build by chaining "With" function invocations. // If called multiple times, values provided by each call will be appended to the Generations field. @@ -65,14 +73,6 @@ func (b *KubeAPIServerStatusApplyConfiguration) WithGenerations(values ...*Gener return b } -// WithLatestAvailableRevision sets the LatestAvailableRevision field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the LatestAvailableRevision field is set to the value of the last call. -func (b *KubeAPIServerStatusApplyConfiguration) WithLatestAvailableRevision(value int32) *KubeAPIServerStatusApplyConfiguration { - b.LatestAvailableRevision = &value - return b -} - // WithLatestAvailableRevisionReason sets the LatestAvailableRevisionReason field in the declarative configuration to the given value // and returns the receiver, so that objects can be built by chaining "With" function invocations. // If called multiple times, the LatestAvailableRevisionReason field is set to the value of the last call. diff --git a/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/kubecontrollermanagerstatus.go b/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/kubecontrollermanagerstatus.go index 78883176a..3f5849b0b 100644 --- a/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/kubecontrollermanagerstatus.go +++ b/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/kubecontrollermanagerstatus.go @@ -51,6 +51,14 @@ func (b *KubeControllerManagerStatusApplyConfiguration) WithReadyReplicas(value return b } +// WithLatestAvailableRevision sets the LatestAvailableRevision field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the LatestAvailableRevision field is set to the value of the last call. +func (b *KubeControllerManagerStatusApplyConfiguration) WithLatestAvailableRevision(value int32) *KubeControllerManagerStatusApplyConfiguration { + b.LatestAvailableRevision = &value + return b +} + // WithGenerations adds the given value to the Generations field in the declarative configuration // and returns the receiver, so that objects can be build by chaining "With" function invocations. // If called multiple times, values provided by each call will be appended to the Generations field. @@ -64,14 +72,6 @@ func (b *KubeControllerManagerStatusApplyConfiguration) WithGenerations(values . return b } -// WithLatestAvailableRevision sets the LatestAvailableRevision field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the LatestAvailableRevision field is set to the value of the last call. -func (b *KubeControllerManagerStatusApplyConfiguration) WithLatestAvailableRevision(value int32) *KubeControllerManagerStatusApplyConfiguration { - b.LatestAvailableRevision = &value - return b -} - // WithLatestAvailableRevisionReason sets the LatestAvailableRevisionReason field in the declarative configuration to the given value // and returns the receiver, so that objects can be built by chaining "With" function invocations. // If called multiple times, the LatestAvailableRevisionReason field is set to the value of the last call. diff --git a/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/kubeschedulerstatus.go b/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/kubeschedulerstatus.go index 4032503f2..02051e525 100644 --- a/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/kubeschedulerstatus.go +++ b/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/kubeschedulerstatus.go @@ -51,6 +51,14 @@ func (b *KubeSchedulerStatusApplyConfiguration) WithReadyReplicas(value int32) * return b } +// WithLatestAvailableRevision sets the LatestAvailableRevision field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the LatestAvailableRevision field is set to the value of the last call. +func (b *KubeSchedulerStatusApplyConfiguration) WithLatestAvailableRevision(value int32) *KubeSchedulerStatusApplyConfiguration { + b.LatestAvailableRevision = &value + return b +} + // WithGenerations adds the given value to the Generations field in the declarative configuration // and returns the receiver, so that objects can be build by chaining "With" function invocations. // If called multiple times, values provided by each call will be appended to the Generations field. @@ -64,14 +72,6 @@ func (b *KubeSchedulerStatusApplyConfiguration) WithGenerations(values ...*Gener return b } -// WithLatestAvailableRevision sets the LatestAvailableRevision field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the LatestAvailableRevision field is set to the value of the last call. -func (b *KubeSchedulerStatusApplyConfiguration) WithLatestAvailableRevision(value int32) *KubeSchedulerStatusApplyConfiguration { - b.LatestAvailableRevision = &value - return b -} - // WithLatestAvailableRevisionReason sets the LatestAvailableRevisionReason field in the declarative configuration to the given value // and returns the receiver, so that objects can be built by chaining "With" function invocations. // If called multiple times, the LatestAvailableRevisionReason field is set to the value of the last call. diff --git a/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/kubestorageversionmigratorstatus.go b/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/kubestorageversionmigratorstatus.go index 2da1eef47..83b95eccd 100644 --- a/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/kubestorageversionmigratorstatus.go +++ b/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/kubestorageversionmigratorstatus.go @@ -51,6 +51,14 @@ func (b *KubeStorageVersionMigratorStatusApplyConfiguration) WithReadyReplicas(v return b } +// WithLatestAvailableRevision sets the LatestAvailableRevision field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the LatestAvailableRevision field is set to the value of the last call. +func (b *KubeStorageVersionMigratorStatusApplyConfiguration) WithLatestAvailableRevision(value int32) *KubeStorageVersionMigratorStatusApplyConfiguration { + b.LatestAvailableRevision = &value + return b +} + // WithGenerations adds the given value to the Generations field in the declarative configuration // and returns the receiver, so that objects can be build by chaining "With" function invocations. // If called multiple times, values provided by each call will be appended to the Generations field. diff --git a/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/networkmigration.go b/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/networkmigration.go index 348af89be..5ad82eb46 100644 --- a/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/networkmigration.go +++ b/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/networkmigration.go @@ -9,8 +9,8 @@ import ( // NetworkMigrationApplyConfiguration represents an declarative configuration of the NetworkMigration type for use // with apply. type NetworkMigrationApplyConfiguration struct { - NetworkType *string `json:"networkType,omitempty"` MTU *MTUMigrationApplyConfiguration `json:"mtu,omitempty"` + NetworkType *string `json:"networkType,omitempty"` Features *FeaturesMigrationApplyConfiguration `json:"features,omitempty"` Mode *operatorv1.NetworkMigrationMode `json:"mode,omitempty"` } @@ -21,14 +21,6 @@ func NetworkMigration() *NetworkMigrationApplyConfiguration { return &NetworkMigrationApplyConfiguration{} } -// WithNetworkType sets the NetworkType field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the NetworkType field is set to the value of the last call. -func (b *NetworkMigrationApplyConfiguration) WithNetworkType(value string) *NetworkMigrationApplyConfiguration { - b.NetworkType = &value - return b -} - // WithMTU sets the MTU field in the declarative configuration to the given value // and returns the receiver, so that objects can be built by chaining "With" function invocations. // If called multiple times, the MTU field is set to the value of the last call. @@ -37,6 +29,14 @@ func (b *NetworkMigrationApplyConfiguration) WithMTU(value *MTUMigrationApplyCon return b } +// WithNetworkType sets the NetworkType field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the NetworkType field is set to the value of the last call. +func (b *NetworkMigrationApplyConfiguration) WithNetworkType(value string) *NetworkMigrationApplyConfiguration { + b.NetworkType = &value + return b +} + // WithFeatures sets the Features field in the declarative configuration to the given value // and returns the receiver, so that objects can be built by chaining "With" function invocations. // If called multiple times, the Features field is set to the value of the last call. diff --git a/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/networkspec.go b/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/networkspec.go index 0bfb95375..13b262623 100644 --- a/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/networkspec.go +++ b/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/networkspec.go @@ -11,17 +11,18 @@ import ( // with apply. type NetworkSpecApplyConfiguration struct { OperatorSpecApplyConfiguration `json:",inline"` - ClusterNetwork []ClusterNetworkEntryApplyConfiguration `json:"clusterNetwork,omitempty"` - ServiceNetwork []string `json:"serviceNetwork,omitempty"` - DefaultNetwork *DefaultNetworkDefinitionApplyConfiguration `json:"defaultNetwork,omitempty"` - AdditionalNetworks []AdditionalNetworkDefinitionApplyConfiguration `json:"additionalNetworks,omitempty"` - DisableMultiNetwork *bool `json:"disableMultiNetwork,omitempty"` - UseMultiNetworkPolicy *bool `json:"useMultiNetworkPolicy,omitempty"` - DeployKubeProxy *bool `json:"deployKubeProxy,omitempty"` - DisableNetworkDiagnostics *bool `json:"disableNetworkDiagnostics,omitempty"` - KubeProxyConfig *ProxyConfigApplyConfiguration `json:"kubeProxyConfig,omitempty"` - ExportNetworkFlows *ExportNetworkFlowsApplyConfiguration `json:"exportNetworkFlows,omitempty"` - Migration *NetworkMigrationApplyConfiguration `json:"migration,omitempty"` + ClusterNetwork []ClusterNetworkEntryApplyConfiguration `json:"clusterNetwork,omitempty"` + ServiceNetwork []string `json:"serviceNetwork,omitempty"` + DefaultNetwork *DefaultNetworkDefinitionApplyConfiguration `json:"defaultNetwork,omitempty"` + AdditionalNetworks []AdditionalNetworkDefinitionApplyConfiguration `json:"additionalNetworks,omitempty"` + DisableMultiNetwork *bool `json:"disableMultiNetwork,omitempty"` + UseMultiNetworkPolicy *bool `json:"useMultiNetworkPolicy,omitempty"` + DeployKubeProxy *bool `json:"deployKubeProxy,omitempty"` + DisableNetworkDiagnostics *bool `json:"disableNetworkDiagnostics,omitempty"` + KubeProxyConfig *ProxyConfigApplyConfiguration `json:"kubeProxyConfig,omitempty"` + ExportNetworkFlows *ExportNetworkFlowsApplyConfiguration `json:"exportNetworkFlows,omitempty"` + Migration *NetworkMigrationApplyConfiguration `json:"migration,omitempty"` + AdditionalRoutingCapabilities *AdditionalRoutingCapabilitiesApplyConfiguration `json:"additionalRoutingCapabilities,omitempty"` } // NetworkSpecApplyConfiguration constructs an declarative configuration of the NetworkSpec type for use with @@ -169,3 +170,11 @@ func (b *NetworkSpecApplyConfiguration) WithMigration(value *NetworkMigrationApp b.Migration = value return b } + +// WithAdditionalRoutingCapabilities sets the AdditionalRoutingCapabilities field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the AdditionalRoutingCapabilities field is set to the value of the last call. +func (b *NetworkSpecApplyConfiguration) WithAdditionalRoutingCapabilities(value *AdditionalRoutingCapabilitiesApplyConfiguration) *NetworkSpecApplyConfiguration { + b.AdditionalRoutingCapabilities = value + return b +} diff --git a/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/networkstatus.go b/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/networkstatus.go index 189a15972..4015f7ddc 100644 --- a/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/networkstatus.go +++ b/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/networkstatus.go @@ -51,6 +51,14 @@ func (b *NetworkStatusApplyConfiguration) WithReadyReplicas(value int32) *Networ return b } +// WithLatestAvailableRevision sets the LatestAvailableRevision field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the LatestAvailableRevision field is set to the value of the last call. +func (b *NetworkStatusApplyConfiguration) WithLatestAvailableRevision(value int32) *NetworkStatusApplyConfiguration { + b.LatestAvailableRevision = &value + return b +} + // WithGenerations adds the given value to the Generations field in the declarative configuration // and returns the receiver, so that objects can be build by chaining "With" function invocations. // If called multiple times, values provided by each call will be appended to the Generations field. diff --git a/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/openshiftapiserverstatus.go b/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/openshiftapiserverstatus.go index 8c3a04630..619be3c71 100644 --- a/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/openshiftapiserverstatus.go +++ b/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/openshiftapiserverstatus.go @@ -6,7 +6,6 @@ package v1 // with apply. type OpenShiftAPIServerStatusApplyConfiguration struct { OperatorStatusApplyConfiguration `json:",inline"` - LatestAvailableRevision *int32 `json:"latestAvailableRevision,omitempty"` } // OpenShiftAPIServerStatusApplyConfiguration constructs an declarative configuration of the OpenShiftAPIServerStatus type for use with @@ -52,6 +51,14 @@ func (b *OpenShiftAPIServerStatusApplyConfiguration) WithReadyReplicas(value int return b } +// WithLatestAvailableRevision sets the LatestAvailableRevision field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the LatestAvailableRevision field is set to the value of the last call. +func (b *OpenShiftAPIServerStatusApplyConfiguration) WithLatestAvailableRevision(value int32) *OpenShiftAPIServerStatusApplyConfiguration { + b.LatestAvailableRevision = &value + return b +} + // WithGenerations adds the given value to the Generations field in the declarative configuration // and returns the receiver, so that objects can be build by chaining "With" function invocations. // If called multiple times, values provided by each call will be appended to the Generations field. @@ -64,11 +71,3 @@ func (b *OpenShiftAPIServerStatusApplyConfiguration) WithGenerations(values ...* } return b } - -// WithLatestAvailableRevision sets the LatestAvailableRevision field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the LatestAvailableRevision field is set to the value of the last call. -func (b *OpenShiftAPIServerStatusApplyConfiguration) WithLatestAvailableRevision(value int32) *OpenShiftAPIServerStatusApplyConfiguration { - b.LatestAvailableRevision = &value - return b -} diff --git a/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/openshiftcontrollermanagerstatus.go b/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/openshiftcontrollermanagerstatus.go index 01fc11e18..29f0f059d 100644 --- a/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/openshiftcontrollermanagerstatus.go +++ b/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/openshiftcontrollermanagerstatus.go @@ -51,6 +51,14 @@ func (b *OpenShiftControllerManagerStatusApplyConfiguration) WithReadyReplicas(v return b } +// WithLatestAvailableRevision sets the LatestAvailableRevision field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the LatestAvailableRevision field is set to the value of the last call. +func (b *OpenShiftControllerManagerStatusApplyConfiguration) WithLatestAvailableRevision(value int32) *OpenShiftControllerManagerStatusApplyConfiguration { + b.LatestAvailableRevision = &value + return b +} + // WithGenerations adds the given value to the Generations field in the declarative configuration // and returns the receiver, so that objects can be build by chaining "With" function invocations. // If called multiple times, values provided by each call will be appended to the Generations field. diff --git a/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/operatorstatus.go b/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/operatorstatus.go index 442a273c8..352e9b0da 100644 --- a/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/operatorstatus.go +++ b/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/operatorstatus.go @@ -5,11 +5,12 @@ package v1 // OperatorStatusApplyConfiguration represents an declarative configuration of the OperatorStatus type for use // with apply. type OperatorStatusApplyConfiguration struct { - ObservedGeneration *int64 `json:"observedGeneration,omitempty"` - Conditions []OperatorConditionApplyConfiguration `json:"conditions,omitempty"` - Version *string `json:"version,omitempty"` - ReadyReplicas *int32 `json:"readyReplicas,omitempty"` - Generations []GenerationStatusApplyConfiguration `json:"generations,omitempty"` + ObservedGeneration *int64 `json:"observedGeneration,omitempty"` + Conditions []OperatorConditionApplyConfiguration `json:"conditions,omitempty"` + Version *string `json:"version,omitempty"` + ReadyReplicas *int32 `json:"readyReplicas,omitempty"` + LatestAvailableRevision *int32 `json:"latestAvailableRevision,omitempty"` + Generations []GenerationStatusApplyConfiguration `json:"generations,omitempty"` } // OperatorStatusApplyConfiguration constructs an declarative configuration of the OperatorStatus type for use with @@ -55,6 +56,14 @@ func (b *OperatorStatusApplyConfiguration) WithReadyReplicas(value int32) *Opera return b } +// WithLatestAvailableRevision sets the LatestAvailableRevision field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the LatestAvailableRevision field is set to the value of the last call. +func (b *OperatorStatusApplyConfiguration) WithLatestAvailableRevision(value int32) *OperatorStatusApplyConfiguration { + b.LatestAvailableRevision = &value + return b +} + // WithGenerations adds the given value to the Generations field in the declarative configuration // and returns the receiver, so that objects can be build by chaining "With" function invocations. // If called multiple times, values provided by each call will be appended to the Generations field. diff --git a/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/ovnkubernetesconfig.go b/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/ovnkubernetesconfig.go index 625549d73..b072c16ef 100644 --- a/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/ovnkubernetesconfig.go +++ b/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/ovnkubernetesconfig.go @@ -2,6 +2,10 @@ package v1 +import ( + operatorv1 "github.com/openshift/api/operator/v1" +) + // OVNKubernetesConfigApplyConfiguration represents an declarative configuration of the OVNKubernetesConfig type for use // with apply. type OVNKubernetesConfigApplyConfiguration struct { @@ -16,6 +20,7 @@ type OVNKubernetesConfigApplyConfiguration struct { EgressIPConfig *EgressIPConfigApplyConfiguration `json:"egressIPConfig,omitempty"` IPv4 *IPv4OVNKubernetesConfigApplyConfiguration `json:"ipv4,omitempty"` IPv6 *IPv6OVNKubernetesConfigApplyConfiguration `json:"ipv6,omitempty"` + RouteAdvertisements *operatorv1.RouteAdvertisementsEnablement `json:"routeAdvertisements,omitempty"` } // OVNKubernetesConfigApplyConfiguration constructs an declarative configuration of the OVNKubernetesConfig type for use with @@ -111,3 +116,11 @@ func (b *OVNKubernetesConfigApplyConfiguration) WithIPv6(value *IPv6OVNKubernete b.IPv6 = value return b } + +// WithRouteAdvertisements sets the RouteAdvertisements field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the RouteAdvertisements field is set to the value of the last call. +func (b *OVNKubernetesConfigApplyConfiguration) WithRouteAdvertisements(value operatorv1.RouteAdvertisementsEnablement) *OVNKubernetesConfigApplyConfiguration { + b.RouteAdvertisements = &value + return b +} diff --git a/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/servicecastatus.go b/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/servicecastatus.go index 846473529..ef61bd433 100644 --- a/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/servicecastatus.go +++ b/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/servicecastatus.go @@ -51,6 +51,14 @@ func (b *ServiceCAStatusApplyConfiguration) WithReadyReplicas(value int32) *Serv return b } +// WithLatestAvailableRevision sets the LatestAvailableRevision field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the LatestAvailableRevision field is set to the value of the last call. +func (b *ServiceCAStatusApplyConfiguration) WithLatestAvailableRevision(value int32) *ServiceCAStatusApplyConfiguration { + b.LatestAvailableRevision = &value + return b +} + // WithGenerations adds the given value to the Generations field in the declarative configuration // and returns the receiver, so that objects can be build by chaining "With" function invocations. // If called multiple times, values provided by each call will be appended to the Generations field. diff --git a/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/servicecatalogapiserverstatus.go b/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/servicecatalogapiserverstatus.go index 60f41f865..b3adfee16 100644 --- a/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/servicecatalogapiserverstatus.go +++ b/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/servicecatalogapiserverstatus.go @@ -51,6 +51,14 @@ func (b *ServiceCatalogAPIServerStatusApplyConfiguration) WithReadyReplicas(valu return b } +// WithLatestAvailableRevision sets the LatestAvailableRevision field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the LatestAvailableRevision field is set to the value of the last call. +func (b *ServiceCatalogAPIServerStatusApplyConfiguration) WithLatestAvailableRevision(value int32) *ServiceCatalogAPIServerStatusApplyConfiguration { + b.LatestAvailableRevision = &value + return b +} + // WithGenerations adds the given value to the Generations field in the declarative configuration // and returns the receiver, so that objects can be build by chaining "With" function invocations. // If called multiple times, values provided by each call will be appended to the Generations field. diff --git a/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/servicecatalogcontrollermanagerstatus.go b/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/servicecatalogcontrollermanagerstatus.go index c6ce6604e..29aa0a205 100644 --- a/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/servicecatalogcontrollermanagerstatus.go +++ b/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/servicecatalogcontrollermanagerstatus.go @@ -51,6 +51,14 @@ func (b *ServiceCatalogControllerManagerStatusApplyConfiguration) WithReadyRepli return b } +// WithLatestAvailableRevision sets the LatestAvailableRevision field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the LatestAvailableRevision field is set to the value of the last call. +func (b *ServiceCatalogControllerManagerStatusApplyConfiguration) WithLatestAvailableRevision(value int32) *ServiceCatalogControllerManagerStatusApplyConfiguration { + b.LatestAvailableRevision = &value + return b +} + // WithGenerations adds the given value to the Generations field in the declarative configuration // and returns the receiver, so that objects can be build by chaining "With" function invocations. // If called multiple times, values provided by each call will be appended to the Generations field. diff --git a/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/staticpodoperatorstatus.go b/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/staticpodoperatorstatus.go index c85ff270a..3023ef8e9 100644 --- a/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/staticpodoperatorstatus.go +++ b/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/staticpodoperatorstatus.go @@ -6,7 +6,6 @@ package v1 // with apply. type StaticPodOperatorStatusApplyConfiguration struct { OperatorStatusApplyConfiguration `json:",inline"` - LatestAvailableRevision *int32 `json:"latestAvailableRevision,omitempty"` LatestAvailableRevisionReason *string `json:"latestAvailableRevisionReason,omitempty"` NodeStatuses []NodeStatusApplyConfiguration `json:"nodeStatuses,omitempty"` } @@ -54,6 +53,14 @@ func (b *StaticPodOperatorStatusApplyConfiguration) WithReadyReplicas(value int3 return b } +// WithLatestAvailableRevision sets the LatestAvailableRevision field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the LatestAvailableRevision field is set to the value of the last call. +func (b *StaticPodOperatorStatusApplyConfiguration) WithLatestAvailableRevision(value int32) *StaticPodOperatorStatusApplyConfiguration { + b.LatestAvailableRevision = &value + return b +} + // WithGenerations adds the given value to the Generations field in the declarative configuration // and returns the receiver, so that objects can be build by chaining "With" function invocations. // If called multiple times, values provided by each call will be appended to the Generations field. @@ -67,14 +74,6 @@ func (b *StaticPodOperatorStatusApplyConfiguration) WithGenerations(values ...*G return b } -// WithLatestAvailableRevision sets the LatestAvailableRevision field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the LatestAvailableRevision field is set to the value of the last call. -func (b *StaticPodOperatorStatusApplyConfiguration) WithLatestAvailableRevision(value int32) *StaticPodOperatorStatusApplyConfiguration { - b.LatestAvailableRevision = &value - return b -} - // WithLatestAvailableRevisionReason sets the LatestAvailableRevisionReason field in the declarative configuration to the given value // and returns the receiver, so that objects can be built by chaining "With" function invocations. // If called multiple times, the LatestAvailableRevisionReason field is set to the value of the last call. diff --git a/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/storagestatus.go b/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/storagestatus.go index 5e72702c5..4608dcddc 100644 --- a/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/storagestatus.go +++ b/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/storagestatus.go @@ -51,6 +51,14 @@ func (b *StorageStatusApplyConfiguration) WithReadyReplicas(value int32) *Storag return b } +// WithLatestAvailableRevision sets the LatestAvailableRevision field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the LatestAvailableRevision field is set to the value of the last call. +func (b *StorageStatusApplyConfiguration) WithLatestAvailableRevision(value int32) *StorageStatusApplyConfiguration { + b.LatestAvailableRevision = &value + return b +} + // WithGenerations adds the given value to the Generations field in the declarative configuration // and returns the receiver, so that objects can be build by chaining "With" function invocations. // If called multiple times, values provided by each call will be appended to the Generations field. diff --git a/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1alpha1/olmstatus.go b/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1alpha1/olmstatus.go index 7dc9a5c86..3bc40fd80 100644 --- a/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1alpha1/olmstatus.go +++ b/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1alpha1/olmstatus.go @@ -55,6 +55,14 @@ func (b *OLMStatusApplyConfiguration) WithReadyReplicas(value int32) *OLMStatusA return b } +// WithLatestAvailableRevision sets the LatestAvailableRevision field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the LatestAvailableRevision field is set to the value of the last call. +func (b *OLMStatusApplyConfiguration) WithLatestAvailableRevision(value int32) *OLMStatusApplyConfiguration { + b.LatestAvailableRevision = &value + return b +} + // WithGenerations adds the given value to the Generations field in the declarative configuration // and returns the receiver, so that objects can be build by chaining "With" function invocations. // If called multiple times, values provided by each call will be appended to the Generations field. diff --git a/vendor/github.com/openshift/library-go/pkg/controller/factory/base_controller.go b/vendor/github.com/openshift/library-go/pkg/controller/factory/base_controller.go index 722d95d5e..e045bd7c8 100644 --- a/vendor/github.com/openshift/library-go/pkg/controller/factory/base_controller.go +++ b/vendor/github.com/openshift/library-go/pkg/controller/factory/base_controller.go @@ -7,6 +7,8 @@ import ( "sync" "time" + applyoperatorv1 "github.com/openshift/client-go/operator/applyconfigurations/operator/v1" + "github.com/robfig/cron" apierrors "k8s.io/apimachinery/pkg/api/errors" utilruntime "k8s.io/apimachinery/pkg/util/runtime" @@ -17,7 +19,6 @@ import ( operatorv1 "github.com/openshift/api/operator/v1" "github.com/openshift/library-go/pkg/operator/management" - "github.com/openshift/library-go/pkg/operator/v1helpers" operatorv1helpers "github.com/openshift/library-go/pkg/operator/v1helpers" ) @@ -222,23 +223,25 @@ func (c *baseController) reportDegraded(ctx context.Context, reportedError error return reportedError } if reportedError != nil { - _, _, updateErr := v1helpers.UpdateStatus(ctx, c.syncDegradedClient, v1helpers.UpdateConditionFn(operatorv1.OperatorCondition{ - Type: c.name + "Degraded", - Status: operatorv1.ConditionTrue, - Reason: "SyncError", - Message: reportedError.Error(), - })) + condition := applyoperatorv1.OperatorStatus(). + WithConditions(applyoperatorv1.OperatorCondition(). + WithType(c.name + "Degraded"). + WithStatus(operatorv1.ConditionTrue). + WithReason("SyncError"). + WithMessage(reportedError.Error())) + updateErr := c.syncDegradedClient.ApplyOperatorStatus(ctx, ControllerFieldManager(c.name, "reportDegraded"), condition) if updateErr != nil { klog.Warningf("Updating status of %q failed: %v", c.Name(), updateErr) } return reportedError } - _, _, updateErr := v1helpers.UpdateStatus(ctx, c.syncDegradedClient, - v1helpers.UpdateConditionFn(operatorv1.OperatorCondition{ - Type: c.name + "Degraded", - Status: operatorv1.ConditionFalse, - Reason: "AsExpected", - })) + + condition := applyoperatorv1.OperatorStatus(). + WithConditions(applyoperatorv1.OperatorCondition(). + WithType(c.name + "Degraded"). + WithStatus(operatorv1.ConditionFalse). + WithReason("AsExpected")) + updateErr := c.syncDegradedClient.ApplyOperatorStatus(ctx, ControllerFieldManager(c.name, "reportDegraded"), condition) return updateErr } diff --git a/vendor/github.com/openshift/library-go/pkg/controller/factory/interfaces.go b/vendor/github.com/openshift/library-go/pkg/controller/factory/interfaces.go index 0ef98c670..5eca981e2 100644 --- a/vendor/github.com/openshift/library-go/pkg/controller/factory/interfaces.go +++ b/vendor/github.com/openshift/library-go/pkg/controller/factory/interfaces.go @@ -2,6 +2,7 @@ package factory import ( "context" + "fmt" "k8s.io/client-go/util/workqueue" @@ -45,3 +46,7 @@ type SyncContext interface { // The syncContext.syncContext passed is the main controller syncContext, when cancelled it means the controller is being shut down. // The syncContext provides access to controller name, queue and event recorder. type SyncFunc func(ctx context.Context, controllerContext SyncContext) error + +func ControllerFieldManager(controllerName, usageName string) string { + return fmt.Sprintf("%s-%s", controllerName, usageName) +} diff --git a/vendor/github.com/openshift/library-go/pkg/operator/certrotation/cabundle.go b/vendor/github.com/openshift/library-go/pkg/operator/certrotation/cabundle.go index bf8cd95a7..1cb4685b1 100644 --- a/vendor/github.com/openshift/library-go/pkg/operator/certrotation/cabundle.go +++ b/vendor/github.com/openshift/library-go/pkg/operator/certrotation/cabundle.go @@ -21,7 +21,7 @@ import ( "github.com/openshift/library-go/pkg/certs" "github.com/openshift/library-go/pkg/crypto" "github.com/openshift/library-go/pkg/operator/events" - "github.com/openshift/library-go/pkg/operator/resource/resourceapply" + "github.com/openshift/library-go/pkg/operator/resource/resourcehelper" ) // CABundleConfigMap maintains a CA bundle config map, by adding new CA certs coming from RotatedSigningCASecret, and by removing expired old ones. @@ -44,7 +44,8 @@ type CABundleConfigMap struct { func (c CABundleConfigMap) EnsureConfigMapCABundle(ctx context.Context, signingCertKeyPair *crypto.CA, signingCertKeyPairLocation string) ([]*x509.Certificate, error) { // by this point we have current signing cert/key pair. We now need to make sure that the ca-bundle configmap has this cert and // doesn't have any expired certs - modified := false + updateRequired := false + creationRequired := false originalCABundleConfigMap, err := c.Lister.ConfigMaps(c.Namespace).Get(c.Name) if err != nil && !apierrors.IsNotFound(err) { @@ -58,7 +59,7 @@ func (c CABundleConfigMap) EnsureConfigMapCABundle(ctx context.Context, signingC c.Namespace, c.AdditionalAnnotations, )} - modified = true + creationRequired = true } needsOwnerUpdate := false @@ -66,7 +67,7 @@ func (c CABundleConfigMap) EnsureConfigMapCABundle(ctx context.Context, signingC needsOwnerUpdate = ensureOwnerReference(&caBundleConfigMap.ObjectMeta, c.Owner) } needsMetadataUpdate := c.AdditionalAnnotations.EnsureTLSMetadataUpdate(&caBundleConfigMap.ObjectMeta) - modified = needsOwnerUpdate || needsMetadataUpdate || modified + updateRequired = needsOwnerUpdate || needsMetadataUpdate updatedCerts, err := manageCABundleConfigMap(caBundleConfigMap, signingCertKeyPair.Config.Certs[0]) if err != nil { @@ -74,7 +75,7 @@ func (c CABundleConfigMap) EnsureConfigMapCABundle(ctx context.Context, signingC } if originalCABundleConfigMap == nil || originalCABundleConfigMap.Data == nil || !equality.Semantic.DeepEqual(originalCABundleConfigMap.Data, caBundleConfigMap.Data) { reason := "" - if originalCABundleConfigMap == nil { + if creationRequired { reason = "configmap doesn't exist" } else if originalCABundleConfigMap.Data == nil { reason = "configmap is empty" @@ -84,18 +85,24 @@ func (c CABundleConfigMap) EnsureConfigMapCABundle(ctx context.Context, signingC c.EventRecorder.Eventf("CABundleUpdateRequired", "%q in %q requires a new cert: %s", c.Name, c.Namespace, reason) LabelAsManagedConfigMap(caBundleConfigMap, CertificateTypeCABundle) - modified = true + updateRequired = true } - if modified { - - actualCABundleConfigMap, updated, err := resourceapply.ApplyConfigMap(ctx, c.Client, c.EventRecorder, caBundleConfigMap) + if creationRequired { + actualCABundleConfigMap, err := c.Client.ConfigMaps(c.Namespace).Create(ctx, caBundleConfigMap, metav1.CreateOptions{}) + resourcehelper.ReportCreateEvent(c.EventRecorder, actualCABundleConfigMap, err) if err != nil { return nil, err } - if updated { - klog.V(2).Infof("Updated ca-bundle.crt configmap %s/%s with:\n%s", certs.CertificateBundleToString(updatedCerts), caBundleConfigMap.Namespace, caBundleConfigMap.Name) + klog.V(2).Infof("Created ca-bundle.crt configmap %s/%s with:\n%s", certs.CertificateBundleToString(updatedCerts), caBundleConfigMap.Namespace, caBundleConfigMap.Name) + caBundleConfigMap = actualCABundleConfigMap + } else if updateRequired { + actualCABundleConfigMap, err := c.Client.ConfigMaps(c.Namespace).Update(ctx, caBundleConfigMap, metav1.UpdateOptions{}) + resourcehelper.ReportUpdateEvent(c.EventRecorder, actualCABundleConfigMap, err) + if err != nil { + return nil, err } + klog.V(2).Infof("Updated ca-bundle.crt configmap %s/%s with:\n%s", certs.CertificateBundleToString(updatedCerts), caBundleConfigMap.Namespace, caBundleConfigMap.Name) caBundleConfigMap = actualCABundleConfigMap } diff --git a/vendor/github.com/openshift/library-go/pkg/operator/certrotation/signer.go b/vendor/github.com/openshift/library-go/pkg/operator/certrotation/signer.go index 5ec56273a..2eb761bbb 100644 --- a/vendor/github.com/openshift/library-go/pkg/operator/certrotation/signer.go +++ b/vendor/github.com/openshift/library-go/pkg/operator/certrotation/signer.go @@ -8,13 +8,14 @@ import ( "github.com/openshift/library-go/pkg/crypto" "github.com/openshift/library-go/pkg/operator/events" - "github.com/openshift/library-go/pkg/operator/resource/resourceapply" + "github.com/openshift/library-go/pkg/operator/resource/resourcehelper" corev1 "k8s.io/api/core/v1" apierrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" corev1informers "k8s.io/client-go/informers/core/v1" corev1client "k8s.io/client-go/kubernetes/typed/core/v1" corev1listers "k8s.io/client-go/listers/core/v1" + "k8s.io/klog/v2" ) // RotatedSigningCASecret rotates a self-signed signing CA stored in a secret. It creates a new one when @@ -52,23 +53,17 @@ type RotatedSigningCASecret struct { Lister corev1listers.SecretLister Client corev1client.SecretsGetter EventRecorder events.Recorder - - // Deprecated: DO NOT enable, it is intended as a short term hack for a very specific use case, - // and it works in tandem with a particular carry patch applied to the openshift kube-apiserver. - // we will remove this when we migrate all of the affected secret - // objects to their intended type: https://issues.redhat.com/browse/API-1800 - UseSecretUpdateOnly bool } // EnsureSigningCertKeyPair manages the entire lifecycle of a signer cert as a secret, from creation to continued rotation. // It always returns the currently used CA pair, a bool indicating whether it was created/updated within this function call and an error. func (c RotatedSigningCASecret) EnsureSigningCertKeyPair(ctx context.Context) (*crypto.CA, bool, error) { - modified := false + creationRequired := false + updateRequired := false originalSigningCertKeyPairSecret, err := c.Lister.Secrets(c.Namespace).Get(c.Name) if err != nil && !apierrors.IsNotFound(err) { return nil, false, err } - var signerExists = true signingCertKeyPairSecret := originalSigningCertKeyPairSecret.DeepCopy() if apierrors.IsNotFound(err) { // create an empty one @@ -80,23 +75,18 @@ func (c RotatedSigningCASecret) EnsureSigningCertKeyPair(ctx context.Context) (* ), Type: corev1.SecretTypeTLS, } - signerExists = false - } - - applyFn := resourceapply.ApplySecret - if c.UseSecretUpdateOnly { - applyFn = resourceapply.ApplySecretDoNotUse + creationRequired = true } - // apply necessary metadata (possibly via delete+recreate) if secret exists - // this is done before content update to prevent unexpected rollouts + // run Update if metadata needs changing needsMetadataUpdate := ensureMetadataUpdate(signingCertKeyPairSecret, c.Owner, c.AdditionalAnnotations) needsTypeChange := ensureSecretTLSTypeSet(signingCertKeyPairSecret) - modified = needsMetadataUpdate || needsTypeChange || modified + updateRequired = needsMetadataUpdate || needsTypeChange + // run Update if signer content needs changing signerUpdated := false - if needed, reason := needNewSigningCertKeyPair(signingCertKeyPairSecret, c.Refresh, c.RefreshOnlyWhenExpired); needed || !signerExists { - if !signerExists { + if needed, reason := needNewSigningCertKeyPair(signingCertKeyPairSecret, c.Refresh, c.RefreshOnlyWhenExpired); needed || creationRequired { + if creationRequired { reason = "secret doesn't exist" } c.EventRecorder.Eventf("SignerUpdateRequired", "%q in %q requires a new signing cert/key pair: %v", c.Name, c.Namespace, reason) @@ -106,15 +96,25 @@ func (c RotatedSigningCASecret) EnsureSigningCertKeyPair(ctx context.Context) (* LabelAsManagedSecret(signingCertKeyPairSecret, CertificateTypeSigner) - modified = true + updateRequired = true signerUpdated = true } - if modified { - actualSigningCertKeyPairSecret, _, err := applyFn(ctx, c.Client, c.EventRecorder, signingCertKeyPairSecret) + if creationRequired { + actualSigningCertKeyPairSecret, err := c.Client.Secrets(c.Namespace).Create(ctx, signingCertKeyPairSecret, metav1.CreateOptions{}) + resourcehelper.ReportCreateEvent(c.EventRecorder, actualSigningCertKeyPairSecret, err) + if err != nil { + return nil, false, err + } + klog.V(2).Infof("Created secret %s/%s", actualSigningCertKeyPairSecret.Namespace, actualSigningCertKeyPairSecret.Name) + signingCertKeyPairSecret = actualSigningCertKeyPairSecret + } else if updateRequired { + actualSigningCertKeyPairSecret, err := c.Client.Secrets(c.Namespace).Update(ctx, signingCertKeyPairSecret, metav1.UpdateOptions{}) + resourcehelper.ReportUpdateEvent(c.EventRecorder, actualSigningCertKeyPairSecret, err) if err != nil { return nil, false, err } + klog.V(2).Infof("Updated secret %s/%s", actualSigningCertKeyPairSecret.Namespace, actualSigningCertKeyPairSecret.Name) signingCertKeyPairSecret = actualSigningCertKeyPairSecret } diff --git a/vendor/github.com/openshift/library-go/pkg/operator/certrotation/target.go b/vendor/github.com/openshift/library-go/pkg/operator/certrotation/target.go index 7dda23893..b68aea163 100644 --- a/vendor/github.com/openshift/library-go/pkg/operator/certrotation/target.go +++ b/vendor/github.com/openshift/library-go/pkg/operator/certrotation/target.go @@ -12,11 +12,12 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/util/sets" "k8s.io/apiserver/pkg/authentication/user" + "k8s.io/klog/v2" "github.com/openshift/library-go/pkg/certs" "github.com/openshift/library-go/pkg/crypto" "github.com/openshift/library-go/pkg/operator/events" - "github.com/openshift/library-go/pkg/operator/resource/resourceapply" + "github.com/openshift/library-go/pkg/operator/resource/resourcehelper" corev1informers "k8s.io/client-go/informers/core/v1" corev1client "k8s.io/client-go/kubernetes/typed/core/v1" corev1listers "k8s.io/client-go/listers/core/v1" @@ -68,19 +69,13 @@ type RotatedSelfSignedCertKeySecret struct { Lister corev1listers.SecretLister Client corev1client.SecretsGetter EventRecorder events.Recorder - - // Deprecated: DO NOT eanble, it is intended as a short term hack for a very specific use case, - // and it works in tandem with a particular carry patch applied to the openshift kube-apiserver. - // we will remove this when we migrate all of the affected secret - // objects to their intended type: https://issues.redhat.com/browse/API-1800 - UseSecretUpdateOnly bool } type TargetCertCreator interface { // NewCertificate creates a new key-cert pair with the given signer. NewCertificate(signer *crypto.CA, validity time.Duration) (*crypto.TLSCertificateConfig, error) // NeedNewTargetCertKeyPair decides whether a new cert-key pair is needed. It returns a non-empty reason if it is the case. - NeedNewTargetCertKeyPair(currentCertSecret *corev1.Secret, signer *crypto.CA, caBundleCerts []*x509.Certificate, refresh time.Duration, refreshOnlyWhenExpired, secretDoesntExist bool) string + NeedNewTargetCertKeyPair(currentCertSecret *corev1.Secret, signer *crypto.CA, caBundleCerts []*x509.Certificate, refresh time.Duration, refreshOnlyWhenExpired, creationRequired bool) string // SetAnnotations gives an option to override or set additional annotations SetAnnotations(cert *crypto.TLSCertificateConfig, annotations map[string]string) map[string]string } @@ -97,8 +92,8 @@ func (c RotatedSelfSignedCertKeySecret) EnsureTargetCertKeyPair(ctx context.Cont // and need to mint one // TODO do the cross signing thing, but this shows the API consumers want and a very simple impl. - secretDoesntExist := false - modified := false + creationRequired := false + updateRequired := false originalTargetCertKeyPairSecret, err := c.Lister.Secrets(c.Namespace).Get(c.Name) if err != nil && !apierrors.IsNotFound(err) { return nil, err @@ -114,22 +109,14 @@ func (c RotatedSelfSignedCertKeySecret) EnsureTargetCertKeyPair(ctx context.Cont ), Type: corev1.SecretTypeTLS, } - modified = true - secretDoesntExist = true - } - - applyFn := resourceapply.ApplySecret - if c.UseSecretUpdateOnly { - applyFn = resourceapply.ApplySecretDoNotUse + creationRequired = true } - // apply necessary metadata (possibly via delete+recreate) if secret exists - // this is done before content update to prevent unexpected rollouts needsMetadataUpdate := ensureMetadataUpdate(targetCertKeyPairSecret, c.Owner, c.AdditionalAnnotations) - needsSecretTypeUpdate := ensureSecretTLSTypeSet(targetCertKeyPairSecret) - modified = needsMetadataUpdate || needsSecretTypeUpdate || modified + needsTypeChange := ensureSecretTLSTypeSet(targetCertKeyPairSecret) + updateRequired = needsMetadataUpdate || needsTypeChange - if reason := c.CertCreator.NeedNewTargetCertKeyPair(targetCertKeyPairSecret, signingCertKeyPair, caBundleCerts, c.Refresh, c.RefreshOnlyWhenExpired, secretDoesntExist); len(reason) > 0 { + if reason := c.CertCreator.NeedNewTargetCertKeyPair(targetCertKeyPairSecret, signingCertKeyPair, caBundleCerts, c.Refresh, c.RefreshOnlyWhenExpired, creationRequired); len(reason) > 0 { c.EventRecorder.Eventf("TargetUpdateRequired", "%q in %q requires a new target cert/key pair: %v", c.Name, c.Namespace, reason) if err := setTargetCertKeyPairSecret(targetCertKeyPairSecret, c.Validity, signingCertKeyPair, c.CertCreator, c.AdditionalAnnotations); err != nil { return nil, err @@ -137,22 +124,31 @@ func (c RotatedSelfSignedCertKeySecret) EnsureTargetCertKeyPair(ctx context.Cont LabelAsManagedSecret(targetCertKeyPairSecret, CertificateTypeTarget) - modified = true + updateRequired = true } - - if modified { - actualTargetCertKeyPairSecret, _, err := applyFn(ctx, c.Client, c.EventRecorder, targetCertKeyPairSecret) + if creationRequired { + actualTargetCertKeyPairSecret, err := c.Client.Secrets(c.Namespace).Create(ctx, targetCertKeyPairSecret, metav1.CreateOptions{}) + resourcehelper.ReportCreateEvent(c.EventRecorder, actualTargetCertKeyPairSecret, err) + if err != nil { + return nil, err + } + klog.V(2).Infof("Created secret %s/%s", actualTargetCertKeyPairSecret.Namespace, actualTargetCertKeyPairSecret.Name) + targetCertKeyPairSecret = actualTargetCertKeyPairSecret + } else if updateRequired { + actualTargetCertKeyPairSecret, err := c.Client.Secrets(c.Namespace).Update(ctx, targetCertKeyPairSecret, metav1.UpdateOptions{}) + resourcehelper.ReportUpdateEvent(c.EventRecorder, actualTargetCertKeyPairSecret, err) if err != nil { return nil, err } + klog.V(2).Infof("Updated secret %s/%s", actualTargetCertKeyPairSecret.Namespace, actualTargetCertKeyPairSecret.Name) targetCertKeyPairSecret = actualTargetCertKeyPairSecret } return targetCertKeyPairSecret, nil } -func needNewTargetCertKeyPair(secret *corev1.Secret, signer *crypto.CA, caBundleCerts []*x509.Certificate, refresh time.Duration, refreshOnlyWhenExpired, secretDoesntExist bool) string { - if secretDoesntExist { +func needNewTargetCertKeyPair(secret *corev1.Secret, signer *crypto.CA, caBundleCerts []*x509.Certificate, refresh time.Duration, refreshOnlyWhenExpired, creationRequired bool) string { + if creationRequired { return "secret doesn't exist" } @@ -273,8 +269,8 @@ func (r *ClientRotation) NewCertificate(signer *crypto.CA, validity time.Duratio return signer.MakeClientCertificateForDuration(r.UserInfo, validity) } -func (r *ClientRotation) NeedNewTargetCertKeyPair(currentCertSecret *corev1.Secret, signer *crypto.CA, caBundleCerts []*x509.Certificate, refresh time.Duration, refreshOnlyWhenExpired, secretDoesntExist bool) string { - return needNewTargetCertKeyPair(currentCertSecret, signer, caBundleCerts, refresh, refreshOnlyWhenExpired, secretDoesntExist) +func (r *ClientRotation) NeedNewTargetCertKeyPair(currentCertSecret *corev1.Secret, signer *crypto.CA, caBundleCerts []*x509.Certificate, refresh time.Duration, refreshOnlyWhenExpired, exists bool) string { + return needNewTargetCertKeyPair(currentCertSecret, signer, caBundleCerts, refresh, refreshOnlyWhenExpired, exists) } func (r *ClientRotation) SetAnnotations(cert *crypto.TLSCertificateConfig, annotations map[string]string) map[string]string { @@ -298,8 +294,8 @@ func (r *ServingRotation) RecheckChannel() <-chan struct{} { return r.HostnamesChanged } -func (r *ServingRotation) NeedNewTargetCertKeyPair(currentCertSecret *corev1.Secret, signer *crypto.CA, caBundleCerts []*x509.Certificate, refresh time.Duration, refreshOnlyWhenExpired, secretDoesntExist bool) string { - reason := needNewTargetCertKeyPair(currentCertSecret, signer, caBundleCerts, refresh, refreshOnlyWhenExpired, secretDoesntExist) +func (r *ServingRotation) NeedNewTargetCertKeyPair(currentCertSecret *corev1.Secret, signer *crypto.CA, caBundleCerts []*x509.Certificate, refresh time.Duration, refreshOnlyWhenExpired, creationRequired bool) string { + reason := needNewTargetCertKeyPair(currentCertSecret, signer, caBundleCerts, refresh, refreshOnlyWhenExpired, creationRequired) if len(reason) > 0 { return reason } @@ -344,8 +340,8 @@ func (r *SignerRotation) NewCertificate(signer *crypto.CA, validity time.Duratio return crypto.MakeCAConfigForDuration(signerName, validity, signer) } -func (r *SignerRotation) NeedNewTargetCertKeyPair(currentCertSecret *corev1.Secret, signer *crypto.CA, caBundleCerts []*x509.Certificate, refresh time.Duration, refreshOnlyWhenExpired, secretDoesntExist bool) string { - return needNewTargetCertKeyPair(currentCertSecret, signer, caBundleCerts, refresh, refreshOnlyWhenExpired, secretDoesntExist) +func (r *SignerRotation) NeedNewTargetCertKeyPair(currentCertSecret *corev1.Secret, signer *crypto.CA, caBundleCerts []*x509.Certificate, refresh time.Duration, refreshOnlyWhenExpired, exists bool) string { + return needNewTargetCertKeyPair(currentCertSecret, signer, caBundleCerts, refresh, refreshOnlyWhenExpired, exists) } func (r *SignerRotation) SetAnnotations(cert *crypto.TLSCertificateConfig, annotations map[string]string) map[string]string { diff --git a/vendor/github.com/openshift/library-go/pkg/operator/csi/csidrivercontrollerservicecontroller/helpers.go b/vendor/github.com/openshift/library-go/pkg/operator/csi/csidrivercontrollerservicecontroller/helpers.go index 4020735b5..985949a50 100644 --- a/vendor/github.com/openshift/library-go/pkg/operator/csi/csidrivercontrollerservicecontroller/helpers.go +++ b/vendor/github.com/openshift/library-go/pkg/operator/csi/csidrivercontrollerservicecontroller/helpers.go @@ -35,6 +35,7 @@ const ( snapshotterImageEnvName = "SNAPSHOTTER_IMAGE" livenessProbeImageEnvName = "LIVENESS_PROBE_IMAGE" kubeRBACProxyImageEnvName = "KUBE_RBAC_PROXY_IMAGE" + toolsImageEnvName = "TOOLS_IMAGE" infraConfigName = "cluster" ) @@ -208,6 +209,11 @@ func WithPlaceholdersHook(configInformer configinformers.SharedInformerFactory) pairs = append(pairs, []string{"${KUBE_RBAC_PROXY_IMAGE}", kubeRBACProxy}...) } + tools := os.Getenv(toolsImageEnvName) + if tools != "" { + pairs = append(pairs, []string{"${TOOLS_IMAGE}", tools}...) + } + // Cluster ID pairs = append(pairs, []string{"${CLUSTER_ID}", clusterID}...) diff --git a/vendor/github.com/openshift/library-go/pkg/operator/deploymentcontroller/deployment_controller.go b/vendor/github.com/openshift/library-go/pkg/operator/deploymentcontroller/deployment_controller.go index 307d91dba..6427c43c7 100644 --- a/vendor/github.com/openshift/library-go/pkg/operator/deploymentcontroller/deployment_controller.go +++ b/vendor/github.com/openshift/library-go/pkg/operator/deploymentcontroller/deployment_controller.go @@ -7,7 +7,15 @@ import ( "strings" "time" + opv1 "github.com/openshift/api/operator/v1" + applyoperatorv1 "github.com/openshift/client-go/operator/applyconfigurations/operator/v1" + "github.com/openshift/library-go/pkg/controller/factory" + "github.com/openshift/library-go/pkg/operator/events" "github.com/openshift/library-go/pkg/operator/management" + "github.com/openshift/library-go/pkg/operator/resource/resourceapply" + "github.com/openshift/library-go/pkg/operator/resource/resourcemerge" + "github.com/openshift/library-go/pkg/operator/resource/resourceread" + "github.com/openshift/library-go/pkg/operator/v1helpers" appsv1 "k8s.io/api/apps/v1" apierrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -16,14 +24,7 @@ import ( appsinformersv1 "k8s.io/client-go/informers/apps/v1" "k8s.io/client-go/kubernetes" "k8s.io/klog/v2" - - opv1 "github.com/openshift/api/operator/v1" - "github.com/openshift/library-go/pkg/controller/factory" - "github.com/openshift/library-go/pkg/operator/events" - "github.com/openshift/library-go/pkg/operator/resource/resourceapply" - "github.com/openshift/library-go/pkg/operator/resource/resourcemerge" - "github.com/openshift/library-go/pkg/operator/resource/resourceread" - "github.com/openshift/library-go/pkg/operator/v1helpers" + "k8s.io/utils/ptr" ) // DeploymentHookFunc is a hook function to modify the Deployment. @@ -251,51 +252,50 @@ func (c *DeploymentController) syncManaged(ctx context.Context, opSpec *opv1.Ope return err } - updateStatusFuncs := []v1helpers.UpdateStatusFunc{ - func(newStatus *opv1.OperatorStatus) error { - // TODO: set ObservedGeneration (the last stable generation change we dealt with) - resourcemerge.SetDeploymentGeneration(&newStatus.Generations, deployment) - return nil - }, - } - - // Set Available Condition + // Create an OperatorStatusApplyConfiguration with generations + status := applyoperatorv1.OperatorStatus(). + WithGenerations(&applyoperatorv1.GenerationStatusApplyConfiguration{ + Group: ptr.To("apps"), + Resource: ptr.To("deployments"), + Namespace: ptr.To(deployment.Namespace), + Name: ptr.To(deployment.Name), + LastGeneration: ptr.To(deployment.Generation), + }) + + // Set Available condition if slices.Contains(c.conditions, opv1.OperatorStatusTypeAvailable) { - availableCondition := opv1.OperatorCondition{ - Type: c.name + opv1.OperatorStatusTypeAvailable, - Status: opv1.ConditionTrue, - } + availableCondition := applyoperatorv1. + OperatorCondition().WithType(c.name + opv1.OperatorStatusTypeAvailable) if deployment.Status.AvailableReplicas > 0 { - availableCondition.Status = opv1.ConditionTrue + availableCondition = availableCondition.WithStatus(opv1.ConditionTrue) } else { - availableCondition.Status = opv1.ConditionFalse - availableCondition.Message = "Waiting for Deployment" - availableCondition.Reason = "Deploying" + availableCondition = availableCondition. + WithStatus(opv1.ConditionFalse). + WithMessage("Waiting for Deployment"). + WithReason("Deploying") } - updateStatusFuncs = append(updateStatusFuncs, v1helpers.UpdateConditionFn(availableCondition)) + status = status.WithConditions(availableCondition) } - // Set Progressing Condition + // Set Progressing condition if slices.Contains(c.conditions, opv1.OperatorStatusTypeProgressing) { - progressingCondition := opv1.OperatorCondition{ - Type: c.name + opv1.OperatorStatusTypeProgressing, - Status: opv1.ConditionFalse, - } + progressingCondition := applyoperatorv1.OperatorCondition(). + WithType(c.name + opv1.OperatorStatusTypeProgressing). + WithStatus(opv1.ConditionFalse) if ok, msg := isProgressing(deployment); ok { - progressingCondition.Status = opv1.ConditionTrue - progressingCondition.Message = msg - progressingCondition.Reason = "Deploying" + progressingCondition = progressingCondition. + WithStatus(opv1.ConditionTrue). + WithMessage(msg). + WithReason("Deploying") } - updateStatusFuncs = append(updateStatusFuncs, v1helpers.UpdateConditionFn(progressingCondition)) + status = status.WithConditions(progressingCondition) } - _, _, err = v1helpers.UpdateStatus( + return c.operatorClient.ApplyOperatorStatus( ctx, - c.operatorClient, - updateStatusFuncs..., + factory.ControllerFieldManager(c.name, "updateOperatorStatus"), + status, ) - - return err } func (c *DeploymentController) syncDeleting(ctx context.Context, opSpec *opv1.OperatorSpec, opStatus *opv1.OperatorStatus, syncContext factory.SyncContext) error { diff --git a/vendor/github.com/openshift/library-go/pkg/operator/genericoperatorclient/dynamic_operator_client.go b/vendor/github.com/openshift/library-go/pkg/operator/genericoperatorclient/dynamic_operator_client.go new file mode 100644 index 000000000..665a4af20 --- /dev/null +++ b/vendor/github.com/openshift/library-go/pkg/operator/genericoperatorclient/dynamic_operator_client.go @@ -0,0 +1,539 @@ +package genericoperatorclient + +import ( + "context" + "fmt" + "reflect" + "strings" + "time" + + operatorv1 "github.com/openshift/api/operator/v1" + applyoperatorv1 "github.com/openshift/client-go/operator/applyconfigurations/operator/v1" + "github.com/openshift/library-go/pkg/operator/v1helpers" + "k8s.io/apimachinery/pkg/api/equality" + apierrors "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" + "k8s.io/client-go/dynamic" + "k8s.io/client-go/dynamic/dynamicinformer" + "k8s.io/client-go/informers" + "k8s.io/client-go/rest" + "k8s.io/client-go/tools/cache" + "k8s.io/klog/v2" +) + +const defaultConfigName = "cluster" + +type StaticPodOperatorSpecExtractorFunc func(obj *unstructured.Unstructured, fieldManager string) (*applyoperatorv1.StaticPodOperatorSpecApplyConfiguration, error) +type StaticPodOperatorStatusExtractorFunc func(obj *unstructured.Unstructured, fieldManager string) (*applyoperatorv1.StaticPodOperatorStatusApplyConfiguration, error) +type OperatorSpecExtractorFunc func(obj *unstructured.Unstructured, fieldManager string) (*applyoperatorv1.OperatorSpecApplyConfiguration, error) +type OperatorStatusExtractorFunc func(obj *unstructured.Unstructured, fieldManager string) (*applyoperatorv1.OperatorStatusApplyConfiguration, error) + +func newClusterScopedOperatorClient(config *rest.Config, gvr schema.GroupVersionResource, gvk schema.GroupVersionKind, extractApplySpec StaticPodOperatorSpecExtractorFunc, extractApplyStatus StaticPodOperatorStatusExtractorFunc) (*dynamicOperatorClient, dynamicinformer.DynamicSharedInformerFactory, error) { + dynamicClient, err := dynamic.NewForConfig(config) + if err != nil { + return nil, nil, err + } + client := dynamicClient.Resource(gvr) + + informers := dynamicinformer.NewDynamicSharedInformerFactory(dynamicClient, 12*time.Hour) + informer := informers.ForResource(gvr) + + return &dynamicOperatorClient{ + gvk: gvk, + informer: informer, + client: client, + extractApplySpec: extractApplySpec, + extractApplyStatus: extractApplyStatus, + }, informers, nil +} + +func convertOperatorSpecToStaticPodOperatorSpec(extractApplySpec OperatorSpecExtractorFunc) StaticPodOperatorSpecExtractorFunc { + return func(obj *unstructured.Unstructured, fieldManager string) (*applyoperatorv1.StaticPodOperatorSpecApplyConfiguration, error) { + operatorSpec, err := extractApplySpec(obj, fieldManager) + if err != nil { + return nil, err + } + if operatorSpec == nil { + return nil, nil + } + return &applyoperatorv1.StaticPodOperatorSpecApplyConfiguration{ + OperatorSpecApplyConfiguration: *operatorSpec, + }, nil + } +} + +func convertOperatorStatusToStaticPodOperatorStatus(extractApplyStatus OperatorStatusExtractorFunc) StaticPodOperatorStatusExtractorFunc { + return func(obj *unstructured.Unstructured, fieldManager string) (*applyoperatorv1.StaticPodOperatorStatusApplyConfiguration, error) { + operatorStatus, err := extractApplyStatus(obj, fieldManager) + if err != nil { + return nil, err + } + if operatorStatus == nil { + return nil, nil + } + return &applyoperatorv1.StaticPodOperatorStatusApplyConfiguration{ + OperatorStatusApplyConfiguration: *operatorStatus, + }, nil + } +} + +func NewClusterScopedOperatorClient(config *rest.Config, gvr schema.GroupVersionResource, gvk schema.GroupVersionKind, extractApplySpec OperatorSpecExtractorFunc, extractApplyStatus OperatorStatusExtractorFunc) (v1helpers.OperatorClientWithFinalizers, dynamicinformer.DynamicSharedInformerFactory, error) { + d, informers, err := newClusterScopedOperatorClient(config, gvr, gvk, + convertOperatorSpecToStaticPodOperatorSpec(extractApplySpec), convertOperatorStatusToStaticPodOperatorStatus(extractApplyStatus)) + if err != nil { + return nil, nil, err + } + d.configName = defaultConfigName + return d, informers, nil + +} + +func NewClusterScopedOperatorClientWithConfigName(config *rest.Config, gvr schema.GroupVersionResource, gvk schema.GroupVersionKind, configName string, extractApplySpec OperatorSpecExtractorFunc, extractApplyStatus OperatorStatusExtractorFunc) (v1helpers.OperatorClientWithFinalizers, dynamicinformer.DynamicSharedInformerFactory, error) { + if len(configName) < 1 { + return nil, nil, fmt.Errorf("config name cannot be empty") + } + d, informers, err := newClusterScopedOperatorClient(config, gvr, gvk, + convertOperatorSpecToStaticPodOperatorSpec(extractApplySpec), convertOperatorStatusToStaticPodOperatorStatus(extractApplyStatus)) + if err != nil { + return nil, nil, err + } + d.configName = configName + return d, informers, nil + +} + +type dynamicOperatorClient struct { + gvk schema.GroupVersionKind + configName string + informer informers.GenericInformer + client dynamic.ResourceInterface + + extractApplySpec StaticPodOperatorSpecExtractorFunc + extractApplyStatus StaticPodOperatorStatusExtractorFunc +} + +func (c dynamicOperatorClient) Informer() cache.SharedIndexInformer { + return c.informer.Informer() +} + +func (c dynamicOperatorClient) GetObjectMeta() (*metav1.ObjectMeta, error) { + uncastInstance, err := c.informer.Lister().Get(c.configName) + if err != nil { + return nil, err + } + instance := uncastInstance.(*unstructured.Unstructured) + return getObjectMetaFromUnstructured(instance.UnstructuredContent()) +} + +func (c dynamicOperatorClient) GetOperatorState() (*operatorv1.OperatorSpec, *operatorv1.OperatorStatus, string, error) { + uncastInstance, err := c.informer.Lister().Get(c.configName) + if err != nil { + return nil, nil, "", err + } + instance := uncastInstance.(*unstructured.Unstructured) + + return getOperatorStateFromInstance(instance) +} + +func (c dynamicOperatorClient) GetOperatorStateWithQuorum(ctx context.Context) (*operatorv1.OperatorSpec, *operatorv1.OperatorStatus, string, error) { + instance, err := c.client.Get(ctx, c.configName, metav1.GetOptions{}) + if err != nil { + return nil, nil, "", err + } + + return getOperatorStateFromInstance(instance) +} + +func getOperatorStateFromInstance(instance *unstructured.Unstructured) (*operatorv1.OperatorSpec, *operatorv1.OperatorStatus, string, error) { + spec, err := getOperatorSpecFromUnstructured(instance.UnstructuredContent()) + if err != nil { + return nil, nil, "", err + } + status, err := getOperatorStatusFromUnstructured(instance.UnstructuredContent()) + if err != nil { + return nil, nil, "", err + } + + return spec, status, instance.GetResourceVersion(), nil +} + +// UpdateOperatorSpec overwrites the operator object spec with the values given +// in operatorv1.OperatorSpec while preserving pre-existing spec fields that have +// no correspondence in operatorv1.OperatorSpec. +func (c dynamicOperatorClient) UpdateOperatorSpec(ctx context.Context, resourceVersion string, spec *operatorv1.OperatorSpec) (*operatorv1.OperatorSpec, string, error) { + uncastOriginal, err := c.informer.Lister().Get(c.configName) + if err != nil { + return nil, "", err + } + original := uncastOriginal.(*unstructured.Unstructured) + + copy := original.DeepCopy() + copy.SetResourceVersion(resourceVersion) + if err := setOperatorSpecFromUnstructured(copy.UnstructuredContent(), spec); err != nil { + return nil, "", err + } + + ret, err := c.client.Update(ctx, copy, metav1.UpdateOptions{}) + if err != nil { + return nil, "", err + } + retSpec, err := getOperatorSpecFromUnstructured(ret.UnstructuredContent()) + if err != nil { + return nil, "", err + } + + return retSpec, ret.GetResourceVersion(), nil +} + +// UpdateOperatorStatus overwrites the operator object status with the values given +// in operatorv1.OperatorStatus while preserving pre-existing status fields that have +// no correspondence in operatorv1.OperatorStatus. +func (c dynamicOperatorClient) UpdateOperatorStatus(ctx context.Context, resourceVersion string, status *operatorv1.OperatorStatus) (*operatorv1.OperatorStatus, error) { + uncastOriginal, err := c.informer.Lister().Get(c.configName) + if err != nil { + return nil, err + } + original := uncastOriginal.(*unstructured.Unstructured) + + copy := original.DeepCopy() + copy.SetResourceVersion(resourceVersion) + if err := setOperatorStatusFromUnstructured(copy.UnstructuredContent(), status); err != nil { + return nil, err + } + + ret, err := c.client.UpdateStatus(ctx, copy, metav1.UpdateOptions{}) + if err != nil { + return nil, err + } + retStatus, err := getOperatorStatusFromUnstructured(ret.UnstructuredContent()) + if err != nil { + return nil, err + } + + return retStatus, nil +} + +func (c dynamicOperatorClient) ApplyOperatorSpec(ctx context.Context, fieldManager string, desiredConfiguration *applyoperatorv1.OperatorSpecApplyConfiguration) (err error) { + if desiredConfiguration == nil { + return fmt.Errorf("desiredConfiguration must have value") + } + desiredConfigurationAsStaticPod := applyoperatorv1.StaticPodOperatorSpec() + desiredConfigurationAsStaticPod.OperatorSpecApplyConfiguration = *desiredConfiguration + return c.applyOperatorSpec(ctx, fieldManager, desiredConfigurationAsStaticPod) +} + +func (c dynamicOperatorClient) applyOperatorSpec(ctx context.Context, fieldManager string, desiredConfiguration *applyoperatorv1.StaticPodOperatorSpecApplyConfiguration) (err error) { + uncastOriginal, err := c.informer.Lister().Get(c.configName) + switch { + case apierrors.IsNotFound(err): + // do nothing and proceed with the apply + case err != nil: + return fmt.Errorf("unable to read existing %q: %w", c.configName, err) + default: + original := uncastOriginal.(*unstructured.Unstructured) + if c.extractApplySpec == nil { + return fmt.Errorf("extractApplySpec is nil") + } + previouslyDesiredConfiguration, err := c.extractApplySpec(original, fieldManager) + if err != nil { + return fmt.Errorf("unable to extract status for %q: %w", fieldManager, err) + } + if equality.Semantic.DeepEqual(previouslyDesiredConfiguration, desiredConfiguration) { + // nothing to apply, so return early + return nil + } + } + + desiredSpec, err := runtime.DefaultUnstructuredConverter.ToUnstructured(desiredConfiguration) + if err != nil { + return fmt.Errorf("failed to convert to unstructured: %w", err) + } + desiredConfigurationAsUnstructured := &unstructured.Unstructured{ + Object: map[string]interface{}{ + "spec": desiredSpec, + }, + } + desiredConfigurationAsUnstructured.SetGroupVersionKind(c.gvk) + desiredConfigurationAsUnstructured.SetName(c.configName) + _, err = c.client.Apply(ctx, c.configName, desiredConfigurationAsUnstructured, metav1.ApplyOptions{ + Force: true, + FieldManager: fieldManager, + }) + if err != nil { + return fmt.Errorf("unable to Apply for operator using fieldManager %q: %w", fieldManager, err) + } + + return nil +} + +func (c dynamicOperatorClient) ApplyOperatorStatus(ctx context.Context, fieldManager string, desiredConfiguration *applyoperatorv1.OperatorStatusApplyConfiguration) (err error) { + if desiredConfiguration == nil { + return fmt.Errorf("desiredConfiguration must have value") + } + desiredConfigurationAsStaticPod := applyoperatorv1.StaticPodOperatorStatus() + desiredConfigurationAsStaticPod.OperatorStatusApplyConfiguration = *desiredConfiguration + return c.applyOperatorStatus(ctx, fieldManager, desiredConfigurationAsStaticPod) +} + +func (c dynamicOperatorClient) applyOperatorStatus(ctx context.Context, fieldManager string, desiredConfiguration *applyoperatorv1.StaticPodOperatorStatusApplyConfiguration) (err error) { + uncastOriginal, err := c.informer.Lister().Get(c.configName) + switch { + case apierrors.IsNotFound(err): + // set last transitionTimes and then apply + // If our cache improperly 404's (the lister wasn't synchronized), then we will improperly reset all the last transition times. + // This isn't ideal, but we shouldn't hit this case unless a loop isn't waiting for HasSynced. + v1helpers.SetApplyConditionsLastTransitionTime(&desiredConfiguration.Conditions, nil) + + case err != nil: + return fmt.Errorf("unable to read existing %q: %w", c.configName, err) + default: + original := uncastOriginal.(*unstructured.Unstructured) + if c.extractApplyStatus == nil { + return fmt.Errorf("extractApplyStatus is nil") + } + previouslyDesiredConfiguration, err := c.extractApplyStatus(original, fieldManager) + if err != nil { + return fmt.Errorf("unable to extract status for %q: %w", fieldManager, err) + } + + // set last transitionTimes to properly calculate a difference + // It is possible for last transition time to shift a couple times until the cache updates to have the condition[*].status match, + // but it will eventually settle. The failing sequence looks like + /* + 1. type=foo, status=false, time=t0.Now + 2. type=foo, status=true, time=t1.Now + 3. rapid update happens and the cache still indicates #1 + 4. type=foo, status=true, time=t2.Now (this *should* be t1.Now) + */ + // Eventually the cache updates to see at #2 and we stop applying new times. + // This only becomes pathological if the condition is also flapping, but if that happens the time should also update. + switch { + case desiredConfiguration != nil && desiredConfiguration.Conditions != nil && previouslyDesiredConfiguration != nil: + v1helpers.SetApplyConditionsLastTransitionTime(&desiredConfiguration.Conditions, previouslyDesiredConfiguration.Conditions) + case desiredConfiguration != nil && desiredConfiguration.Conditions != nil && previouslyDesiredConfiguration == nil: + v1helpers.SetApplyConditionsLastTransitionTime(&desiredConfiguration.Conditions, nil) + } + + // canonicalize so the DeepEqual works consistently + v1helpers.CanonicalizeStaticPodOperatorStatus(previouslyDesiredConfiguration) + v1helpers.CanonicalizeStaticPodOperatorStatus(desiredConfiguration) + previouslyDesiredObj, err := v1helpers.ToStaticPodOperator(previouslyDesiredConfiguration) + if err != nil { + return err + } + desiredObj, err := v1helpers.ToStaticPodOperator(desiredConfiguration) + if err != nil { + return err + } + if equality.Semantic.DeepEqual(previouslyDesiredObj, desiredObj) { + // nothing to apply, so return early + return nil + } + } + + desiredStatus, err := runtime.DefaultUnstructuredConverter.ToUnstructured(desiredConfiguration) + if err != nil { + return fmt.Errorf("failed to convert to unstructured: %w", err) + } + desiredConfigurationAsUnstructured := &unstructured.Unstructured{ + Object: map[string]interface{}{ + "status": desiredStatus, + }, + } + desiredConfigurationAsUnstructured.SetGroupVersionKind(c.gvk) + desiredConfigurationAsUnstructured.SetName(c.configName) + + _, err = c.client.ApplyStatus(ctx, c.configName, desiredConfigurationAsUnstructured, metav1.ApplyOptions{ + Force: true, + FieldManager: fieldManager, + }) + if err != nil { + return fmt.Errorf("unable to ApplyStatus for operator using fieldManager %q: %w", fieldManager, err) + } + + return nil +} + +func (c dynamicOperatorClient) EnsureFinalizer(ctx context.Context, finalizer string) error { + uncastInstance, err := c.informer.Lister().Get(c.configName) + if err != nil { + return err + } + + instance := uncastInstance.(*unstructured.Unstructured) + finalizers := instance.GetFinalizers() + for _, f := range finalizers { + if f == finalizer { + return nil + } + } + + // Change is needed + klog.V(4).Infof("Adding finalizer %q", finalizer) + newFinalizers := append(finalizers, finalizer) + err = c.saveFinalizers(ctx, instance, newFinalizers) + if err != nil { + return err + } + klog.V(2).Infof("Added finalizer %q", finalizer) + return err +} + +func (c dynamicOperatorClient) RemoveFinalizer(ctx context.Context, finalizer string) error { + uncastInstance, err := c.informer.Lister().Get(c.configName) + if err != nil { + return err + } + + instance := uncastInstance.(*unstructured.Unstructured) + finalizers := instance.GetFinalizers() + found := false + newFinalizers := make([]string, 0, len(finalizers)) + for _, f := range finalizers { + if f == finalizer { + found = true + continue + } + newFinalizers = append(newFinalizers, f) + } + if !found { + return nil + } + + klog.V(4).Infof("Removing finalizer %q: %v", finalizer, newFinalizers) + err = c.saveFinalizers(ctx, instance, newFinalizers) + if err != nil { + return err + } + klog.V(2).Infof("Removed finalizer %q", finalizer) + return nil +} + +func (c dynamicOperatorClient) saveFinalizers(ctx context.Context, instance *unstructured.Unstructured, finalizers []string) error { + clone := instance.DeepCopy() + clone.SetFinalizers(finalizers) + _, err := c.client.Update(ctx, clone, metav1.UpdateOptions{}) + return err +} + +func getObjectMetaFromUnstructured(obj map[string]interface{}) (*metav1.ObjectMeta, error) { + uncastMeta, exists, err := unstructured.NestedMap(obj, "metadata") + if !exists { + return &metav1.ObjectMeta{}, nil + } + if err != nil { + return nil, err + } + + ret := &metav1.ObjectMeta{} + if err := runtime.DefaultUnstructuredConverter.FromUnstructured(uncastMeta, ret); err != nil { + return nil, err + } + return ret, nil +} + +func getOperatorSpecFromUnstructured(obj map[string]interface{}) (*operatorv1.OperatorSpec, error) { + uncastSpec, exists, err := unstructured.NestedMap(obj, "spec") + if !exists { + return &operatorv1.OperatorSpec{}, nil + } + if err != nil { + return nil, err + } + + ret := &operatorv1.OperatorSpec{} + if err := runtime.DefaultUnstructuredConverter.FromUnstructured(uncastSpec, ret); err != nil { + return nil, err + } + return ret, nil +} + +func setOperatorSpecFromUnstructured(obj map[string]interface{}, spec *operatorv1.OperatorSpec) error { + // we cannot simply set the entire map because doing so would stomp unknown fields, + // like say a static pod operator spec when cast as an operator spec + newSpec, err := runtime.DefaultUnstructuredConverter.ToUnstructured(spec) + if err != nil { + return err + } + + origSpec, preExistingSpec, err := unstructured.NestedMap(obj, "spec") + if err != nil { + return err + } + if preExistingSpec { + flds := topLevelFields(*spec) + for k, v := range origSpec { + if !flds[k] { + if err := unstructured.SetNestedField(newSpec, v, k); err != nil { + return err + } + } + } + } + return unstructured.SetNestedMap(obj, newSpec, "spec") +} + +func getOperatorStatusFromUnstructured(obj map[string]interface{}) (*operatorv1.OperatorStatus, error) { + uncastStatus, exists, err := unstructured.NestedMap(obj, "status") + if !exists { + return &operatorv1.OperatorStatus{}, nil + } + if err != nil { + return nil, err + } + + ret := &operatorv1.OperatorStatus{} + if err := runtime.DefaultUnstructuredConverter.FromUnstructured(uncastStatus, ret); err != nil { + return nil, err + } + return ret, nil +} + +func setOperatorStatusFromUnstructured(obj map[string]interface{}, status *operatorv1.OperatorStatus) error { + // we cannot simply set the entire map because doing so would stomp unknown fields, + // like say a static pod operator status when cast as an operator status + newStatus, err := runtime.DefaultUnstructuredConverter.ToUnstructured(status) + if err != nil { + return err + } + + origStatus, preExistingStatus, err := unstructured.NestedMap(obj, "status") + if err != nil { + return err + } + if preExistingStatus { + flds := topLevelFields(*status) + for k, v := range origStatus { + if !flds[k] { + if err := unstructured.SetNestedField(newStatus, v, k); err != nil { + return err + } + } + } + } + return unstructured.SetNestedMap(obj, newStatus, "status") +} + +func topLevelFields(obj interface{}) map[string]bool { + ret := map[string]bool{} + t := reflect.TypeOf(obj) + for i := 0; i < t.NumField(); i++ { + fld := t.Field(i) + fieldName := fld.Name + if jsonTag := fld.Tag.Get("json"); jsonTag == "-" { + continue + } else if jsonTag != "" { + // check for possible comma as in "...,omitempty" + var commaIdx int + if commaIdx = strings.Index(jsonTag, ","); commaIdx < 0 { + commaIdx = len(jsonTag) + } + fieldName = jsonTag[:commaIdx] + } + ret[fieldName] = true + } + return ret +} diff --git a/vendor/github.com/openshift/library-go/pkg/operator/genericoperatorclient/dynamic_staticpod_operator_client.go b/vendor/github.com/openshift/library-go/pkg/operator/genericoperatorclient/dynamic_staticpod_operator_client.go new file mode 100644 index 000000000..77b782416 --- /dev/null +++ b/vendor/github.com/openshift/library-go/pkg/operator/genericoperatorclient/dynamic_staticpod_operator_client.go @@ -0,0 +1,211 @@ +package genericoperatorclient + +import ( + "context" + "time" + + applyoperatorv1 "github.com/openshift/client-go/operator/applyconfigurations/operator/v1" + + "github.com/imdario/mergo" + + "k8s.io/apimachinery/pkg/runtime" + + operatorv1 "github.com/openshift/api/operator/v1" + "github.com/openshift/library-go/pkg/operator/v1helpers" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" + "k8s.io/apimachinery/pkg/runtime/schema" + "k8s.io/client-go/dynamic" + "k8s.io/client-go/dynamic/dynamicinformer" + "k8s.io/client-go/rest" +) + +func NewStaticPodOperatorClient(config *rest.Config, gvr schema.GroupVersionResource, gvk schema.GroupVersionKind, extractApplySpec StaticPodOperatorSpecExtractorFunc, extractApplyStatus StaticPodOperatorStatusExtractorFunc) (v1helpers.StaticPodOperatorClient, dynamicinformer.DynamicSharedInformerFactory, error) { + dynamicClient, err := dynamic.NewForConfig(config) + if err != nil { + return nil, nil, err + } + client := dynamicClient.Resource(gvr) + + informers := dynamicinformer.NewDynamicSharedInformerFactory(dynamicClient, 12*time.Hour) + informer := informers.ForResource(gvr) + + return &dynamicStaticPodOperatorClient{ + dynamicOperatorClient: dynamicOperatorClient{ + gvk: gvk, + configName: defaultConfigName, + informer: informer, + client: client, + extractApplySpec: extractApplySpec, + extractApplyStatus: extractApplyStatus, + }, + }, informers, nil +} + +type dynamicStaticPodOperatorClient struct { + dynamicOperatorClient +} + +func (c dynamicStaticPodOperatorClient) GetStaticPodOperatorState() (*operatorv1.StaticPodOperatorSpec, *operatorv1.StaticPodOperatorStatus, string, error) { + uncastInstance, err := c.informer.Lister().Get("cluster") + if err != nil { + return nil, nil, "", err + } + instance := uncastInstance.(*unstructured.Unstructured) + + return getStaticPodOperatorStateFromInstance(instance) +} + +func getStaticPodOperatorStateFromInstance(instance *unstructured.Unstructured) (*operatorv1.StaticPodOperatorSpec, *operatorv1.StaticPodOperatorStatus, string, error) { + spec, err := getStaticPodOperatorSpecFromUnstructured(instance.UnstructuredContent()) + if err != nil { + return nil, nil, "", err + } + status, err := getStaticPodOperatorStatusFromUnstructured(instance.UnstructuredContent()) + if err != nil { + return nil, nil, "", err + } + + return spec, status, instance.GetResourceVersion(), nil +} + +func (c dynamicStaticPodOperatorClient) GetStaticPodOperatorStateWithQuorum(ctx context.Context) (*operatorv1.StaticPodOperatorSpec, *operatorv1.StaticPodOperatorStatus, string, error) { + instance, err := c.client.Get(ctx, "cluster", metav1.GetOptions{}) + if err != nil { + return nil, nil, "", err + } + + return getStaticPodOperatorStateFromInstance(instance) +} + +func (c dynamicStaticPodOperatorClient) UpdateStaticPodOperatorSpec(ctx context.Context, resourceVersion string, spec *operatorv1.StaticPodOperatorSpec) (*operatorv1.StaticPodOperatorSpec, string, error) { + uncastOriginal, err := c.informer.Lister().Get("cluster") + if err != nil { + return nil, "", err + } + original := uncastOriginal.(*unstructured.Unstructured) + + copy := original.DeepCopy() + copy.SetResourceVersion(resourceVersion) + if err := setStaticPodOperatorSpecFromUnstructured(copy.UnstructuredContent(), spec); err != nil { + return nil, "", err + } + + ret, err := c.client.Update(ctx, copy, metav1.UpdateOptions{}) + if err != nil { + return nil, "", err + } + retSpec, err := getStaticPodOperatorSpecFromUnstructured(ret.UnstructuredContent()) + if err != nil { + return nil, "", err + } + + return retSpec, ret.GetResourceVersion(), nil +} + +func (c dynamicStaticPodOperatorClient) UpdateStaticPodOperatorStatus(ctx context.Context, resourceVersion string, status *operatorv1.StaticPodOperatorStatus) (*operatorv1.StaticPodOperatorStatus, error) { + uncastOriginal, err := c.informer.Lister().Get("cluster") + if err != nil { + return nil, err + } + original := uncastOriginal.(*unstructured.Unstructured) + + copy := original.DeepCopy() + copy.SetResourceVersion(resourceVersion) + if err := setStaticPodOperatorStatusFromUnstructured(copy.UnstructuredContent(), status); err != nil { + return nil, err + } + + ret, err := c.client.UpdateStatus(ctx, copy, metav1.UpdateOptions{}) + if err != nil { + return nil, err + } + retStatus, err := getStaticPodOperatorStatusFromUnstructured(ret.UnstructuredContent()) + if err != nil { + return nil, err + } + + return retStatus, nil +} + +func (c dynamicOperatorClient) ApplyStaticPodOperatorSpec(ctx context.Context, fieldManager string, desiredConfiguration *applyoperatorv1.StaticPodOperatorSpecApplyConfiguration) (err error) { + return c.applyOperatorSpec(ctx, fieldManager, desiredConfiguration) +} + +func (c dynamicOperatorClient) ApplyStaticPodOperatorStatus(ctx context.Context, fieldManager string, desiredConfiguration *applyoperatorv1.StaticPodOperatorStatusApplyConfiguration) (err error) { + return c.applyOperatorStatus(ctx, fieldManager, desiredConfiguration) +} + +func getStaticPodOperatorSpecFromUnstructured(obj map[string]interface{}) (*operatorv1.StaticPodOperatorSpec, error) { + uncastSpec, exists, err := unstructured.NestedMap(obj, "spec") + if !exists { + return &operatorv1.StaticPodOperatorSpec{}, nil + } + if err != nil { + return nil, err + } + + ret := &operatorv1.StaticPodOperatorSpec{} + if err := runtime.DefaultUnstructuredConverter.FromUnstructured(uncastSpec, ret); err != nil { + return nil, err + } + return ret, nil +} + +func setStaticPodOperatorSpecFromUnstructured(obj map[string]interface{}, spec *operatorv1.StaticPodOperatorSpec) error { + // we cannot simply set the entire map because doing so would stomp unknown fields, like say a static pod operator spec when cast as an operator spec + newUnstructuredSpec, err := runtime.DefaultUnstructuredConverter.ToUnstructured(spec) + if err != nil { + return err + } + + originalUnstructuredSpec, exists, err := unstructured.NestedMap(obj, "spec") + if !exists { + return unstructured.SetNestedMap(obj, newUnstructuredSpec, "spec") + } + if err != nil { + return err + } + if err := mergo.Merge(&originalUnstructuredSpec, newUnstructuredSpec, mergo.WithOverride); err != nil { + return err + } + + return unstructured.SetNestedMap(obj, originalUnstructuredSpec, "spec") +} + +func getStaticPodOperatorStatusFromUnstructured(obj map[string]interface{}) (*operatorv1.StaticPodOperatorStatus, error) { + uncastStatus, exists, err := unstructured.NestedMap(obj, "status") + if !exists { + return &operatorv1.StaticPodOperatorStatus{}, nil + } + if err != nil { + return nil, err + } + + ret := &operatorv1.StaticPodOperatorStatus{} + if err := runtime.DefaultUnstructuredConverter.FromUnstructured(uncastStatus, ret); err != nil { + return nil, err + } + return ret, nil +} + +func setStaticPodOperatorStatusFromUnstructured(obj map[string]interface{}, spec *operatorv1.StaticPodOperatorStatus) error { + // we cannot simply set the entire map because doing so would stomp unknown fields, like say a static pod operator spec when cast as an operator spec + newUnstructuredStatus, err := runtime.DefaultUnstructuredConverter.ToUnstructured(spec) + if err != nil { + return err + } + + originalUnstructuredStatus, exists, err := unstructured.NestedMap(obj, "status") + if !exists { + return unstructured.SetNestedMap(obj, newUnstructuredStatus, "status") + } + if err != nil { + return err + } + if err := mergo.Merge(&originalUnstructuredStatus, newUnstructuredStatus, mergo.WithOverride); err != nil { + return err + } + + return unstructured.SetNestedMap(obj, originalUnstructuredStatus, "status") +} diff --git a/vendor/github.com/openshift/library-go/pkg/operator/resource/resourceapply/admissionregistration.go b/vendor/github.com/openshift/library-go/pkg/operator/resource/resourceapply/admissionregistration.go index b6bcad5e0..88bd00b25 100644 --- a/vendor/github.com/openshift/library-go/pkg/operator/resource/resourceapply/admissionregistration.go +++ b/vendor/github.com/openshift/library-go/pkg/operator/resource/resourceapply/admissionregistration.go @@ -5,6 +5,7 @@ import ( "fmt" "github.com/openshift/library-go/pkg/operator/events" + "github.com/openshift/library-go/pkg/operator/resource/resourcehelper" "github.com/openshift/library-go/pkg/operator/resource/resourcemerge" admissionregistrationv1 "k8s.io/api/admissionregistration/v1" admissionregistrationv1beta1 "k8s.io/api/admissionregistration/v1beta1" @@ -34,7 +35,7 @@ func ApplyMutatingWebhookConfigurationImproved(ctx context.Context, client admis required := requiredOriginal.DeepCopy() actual, err := client.MutatingWebhookConfigurations().Create( ctx, resourcemerge.WithCleanLabelsAndAnnotations(required).(*admissionregistrationv1.MutatingWebhookConfiguration), metav1.CreateOptions{}) - reportCreateEvent(recorder, required, err) + resourcehelper.ReportCreateEvent(recorder, required, err) if err != nil { return nil, false, err } @@ -68,7 +69,7 @@ func ApplyMutatingWebhookConfigurationImproved(ctx context.Context, client admis klog.V(2).Infof("MutatingWebhookConfiguration %q changes: %v", required.GetNamespace()+"/"+required.GetName(), JSONPatchNoError(existing, toWrite)) actual, err := client.MutatingWebhookConfigurations().Update(ctx, toWrite, metav1.UpdateOptions{}) - reportUpdateEvent(recorder, required, err) + resourcehelper.ReportUpdateEvent(recorder, required, err) if err != nil { return nil, false, err } @@ -109,7 +110,7 @@ func ApplyValidatingWebhookConfigurationImproved(ctx context.Context, client adm required := requiredOriginal.DeepCopy() actual, err := client.ValidatingWebhookConfigurations().Create( ctx, resourcemerge.WithCleanLabelsAndAnnotations(required).(*admissionregistrationv1.ValidatingWebhookConfiguration), metav1.CreateOptions{}) - reportCreateEvent(recorder, required, err) + resourcehelper.ReportCreateEvent(recorder, required, err) if err != nil { return nil, false, err } @@ -143,7 +144,7 @@ func ApplyValidatingWebhookConfigurationImproved(ctx context.Context, client adm klog.V(2).Infof("ValidatingWebhookConfiguration %q changes: %v", required.GetNamespace()+"/"+required.GetName(), JSONPatchNoError(existing, toWrite)) actual, err := client.ValidatingWebhookConfigurations().Update(ctx, toWrite, metav1.UpdateOptions{}) - reportUpdateEvent(recorder, required, err) + resourcehelper.ReportUpdateEvent(recorder, required, err) if err != nil { return nil, false, err } @@ -160,7 +161,7 @@ func DeleteValidatingWebhookConfiguration(ctx context.Context, client admissionr if err != nil { return nil, false, err } - reportDeleteEvent(recorder, required, err) + resourcehelper.ReportDeleteEvent(recorder, required, err) return nil, true, nil } @@ -196,7 +197,7 @@ func ApplyValidatingAdmissionPolicyV1beta1(ctx context.Context, client admission required := requiredOriginal.DeepCopy() actual, err := client.ValidatingAdmissionPolicies().Create( ctx, resourcemerge.WithCleanLabelsAndAnnotations(required).(*admissionregistrationv1beta1.ValidatingAdmissionPolicy), metav1.CreateOptions{}) - reportCreateEvent(recorder, required, err) + resourcehelper.ReportCreateEvent(recorder, required, err) if err != nil { return nil, false, err } @@ -229,7 +230,7 @@ func ApplyValidatingAdmissionPolicyV1beta1(ctx context.Context, client admission klog.V(2).Infof("ValidatingAdmissionPolicyConfigurationV1beta1 %q changes: %v", required.GetNamespace()+"/"+required.GetName(), JSONPatchNoError(existing, toWrite)) actual, err := client.ValidatingAdmissionPolicies().Update(ctx, toWrite, metav1.UpdateOptions{}) - reportUpdateEvent(recorder, required, err) + resourcehelper.ReportUpdateEvent(recorder, required, err) if err != nil { return nil, false, err } @@ -255,7 +256,7 @@ func ApplyValidatingAdmissionPolicyV1(ctx context.Context, client admissionregis required := requiredOriginal.DeepCopy() actual, err := client.ValidatingAdmissionPolicies().Create( ctx, resourcemerge.WithCleanLabelsAndAnnotations(required).(*admissionregistrationv1.ValidatingAdmissionPolicy), metav1.CreateOptions{}) - reportCreateEvent(recorder, required, err) + resourcehelper.ReportCreateEvent(recorder, required, err) if err != nil { return nil, false, err } @@ -288,7 +289,7 @@ func ApplyValidatingAdmissionPolicyV1(ctx context.Context, client admissionregis klog.V(2).Infof("ValidatingAdmissionPolicyConfigurationV1 %q changes: %v", required.GetNamespace()+"/"+required.GetName(), JSONPatchNoError(existing, toWrite)) actual, err := client.ValidatingAdmissionPolicies().Update(ctx, toWrite, metav1.UpdateOptions{}) - reportUpdateEvent(recorder, required, err) + resourcehelper.ReportUpdateEvent(recorder, required, err) if err != nil { return nil, false, err } @@ -314,7 +315,7 @@ func ApplyValidatingAdmissionPolicyBindingV1beta1(ctx context.Context, client ad required := requiredOriginal.DeepCopy() actual, err := client.ValidatingAdmissionPolicyBindings().Create( ctx, resourcemerge.WithCleanLabelsAndAnnotations(required).(*admissionregistrationv1beta1.ValidatingAdmissionPolicyBinding), metav1.CreateOptions{}) - reportCreateEvent(recorder, required, err) + resourcehelper.ReportCreateEvent(recorder, required, err) if err != nil { return nil, false, err } @@ -347,7 +348,7 @@ func ApplyValidatingAdmissionPolicyBindingV1beta1(ctx context.Context, client ad klog.V(2).Infof("ValidatingAdmissionPolicyBindingConfigurationV1beta1 %q changes: %v", required.GetNamespace()+"/"+required.GetName(), JSONPatchNoError(existing, toWrite)) actual, err := client.ValidatingAdmissionPolicyBindings().Update(ctx, toWrite, metav1.UpdateOptions{}) - reportUpdateEvent(recorder, required, err) + resourcehelper.ReportUpdateEvent(recorder, required, err) if err != nil { return nil, false, err } @@ -373,7 +374,7 @@ func ApplyValidatingAdmissionPolicyBindingV1(ctx context.Context, client admissi required := requiredOriginal.DeepCopy() actual, err := client.ValidatingAdmissionPolicyBindings().Create( ctx, resourcemerge.WithCleanLabelsAndAnnotations(required).(*admissionregistrationv1.ValidatingAdmissionPolicyBinding), metav1.CreateOptions{}) - reportCreateEvent(recorder, required, err) + resourcehelper.ReportCreateEvent(recorder, required, err) if err != nil { return nil, false, err } @@ -406,7 +407,7 @@ func ApplyValidatingAdmissionPolicyBindingV1(ctx context.Context, client admissi klog.V(2).Infof("ValidatingAdmissionPolicyBindingConfigurationV1 %q changes: %v", required.GetNamespace()+"/"+required.GetName(), JSONPatchNoError(existing, toWrite)) actual, err := client.ValidatingAdmissionPolicyBindings().Update(ctx, toWrite, metav1.UpdateOptions{}) - reportUpdateEvent(recorder, required, err) + resourcehelper.ReportUpdateEvent(recorder, required, err) if err != nil { return nil, false, err } diff --git a/vendor/github.com/openshift/library-go/pkg/operator/resource/resourceapply/apiextensions.go b/vendor/github.com/openshift/library-go/pkg/operator/resource/resourceapply/apiextensions.go index 587c9bd55..0e76cf834 100644 --- a/vendor/github.com/openshift/library-go/pkg/operator/resource/resourceapply/apiextensions.go +++ b/vendor/github.com/openshift/library-go/pkg/operator/resource/resourceapply/apiextensions.go @@ -4,6 +4,7 @@ import ( "context" "github.com/openshift/library-go/pkg/operator/events" + "github.com/openshift/library-go/pkg/operator/resource/resourcehelper" "github.com/openshift/library-go/pkg/operator/resource/resourcemerge" apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" apiextclientv1 "k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/typed/apiextensions/v1" @@ -19,7 +20,7 @@ func ApplyCustomResourceDefinitionV1(ctx context.Context, client apiextclientv1. requiredCopy := required.DeepCopy() actual, err := client.CustomResourceDefinitions().Create( ctx, resourcemerge.WithCleanLabelsAndAnnotations(requiredCopy).(*apiextensionsv1.CustomResourceDefinition), metav1.CreateOptions{}) - reportCreateEvent(recorder, required, err) + resourcehelper.ReportCreateEvent(recorder, required, err) return actual, true, err } if err != nil { @@ -38,7 +39,7 @@ func ApplyCustomResourceDefinitionV1(ctx context.Context, client apiextclientv1. } actual, err := client.CustomResourceDefinitions().Update(ctx, existingCopy, metav1.UpdateOptions{}) - reportUpdateEvent(recorder, required, err) + resourcehelper.ReportUpdateEvent(recorder, required, err) return actual, true, err } @@ -51,6 +52,6 @@ func DeleteCustomResourceDefinitionV1(ctx context.Context, client apiextclientv1 if err != nil { return nil, false, err } - reportDeleteEvent(recorder, required, err) + resourcehelper.ReportDeleteEvent(recorder, required, err) return nil, true, nil } diff --git a/vendor/github.com/openshift/library-go/pkg/operator/resource/resourceapply/apiregistration.go b/vendor/github.com/openshift/library-go/pkg/operator/resource/resourceapply/apiregistration.go index 931a6c0e1..e465438f6 100644 --- a/vendor/github.com/openshift/library-go/pkg/operator/resource/resourceapply/apiregistration.go +++ b/vendor/github.com/openshift/library-go/pkg/operator/resource/resourceapply/apiregistration.go @@ -11,6 +11,7 @@ import ( apiregistrationv1client "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/typed/apiregistration/v1" "github.com/openshift/library-go/pkg/operator/events" + "github.com/openshift/library-go/pkg/operator/resource/resourcehelper" "github.com/openshift/library-go/pkg/operator/resource/resourcemerge" ) @@ -21,7 +22,7 @@ func ApplyAPIService(ctx context.Context, client apiregistrationv1client.APIServ requiredCopy := required.DeepCopy() actual, err := client.APIServices().Create( ctx, resourcemerge.WithCleanLabelsAndAnnotations(requiredCopy).(*apiregistrationv1.APIService), metav1.CreateOptions{}) - reportCreateEvent(recorder, required, err) + resourcehelper.ReportCreateEvent(recorder, required, err) return actual, true, err } if err != nil { @@ -46,6 +47,6 @@ func ApplyAPIService(ctx context.Context, client apiregistrationv1client.APIServ klog.Infof("APIService %q changes: %s", existing.Name, JSONPatchNoError(existing, existingCopy)) } actual, err := client.APIServices().Update(ctx, existingCopy, metav1.UpdateOptions{}) - reportUpdateEvent(recorder, required, err) + resourcehelper.ReportUpdateEvent(recorder, required, err) return actual, true, err } diff --git a/vendor/github.com/openshift/library-go/pkg/operator/resource/resourceapply/apps.go b/vendor/github.com/openshift/library-go/pkg/operator/resource/resourceapply/apps.go index 0560c66ab..c53e370de 100644 --- a/vendor/github.com/openshift/library-go/pkg/operator/resource/resourceapply/apps.go +++ b/vendor/github.com/openshift/library-go/pkg/operator/resource/resourceapply/apps.go @@ -15,6 +15,7 @@ import ( appsclientv1 "k8s.io/client-go/kubernetes/typed/apps/v1" "github.com/openshift/library-go/pkg/operator/events" + "github.com/openshift/library-go/pkg/operator/resource/resourcehelper" "github.com/openshift/library-go/pkg/operator/resource/resourcemerge" ) @@ -118,7 +119,7 @@ func ApplyDeploymentWithForce(ctx context.Context, client appsclientv1.Deploymen existing, err := client.Deployments(required.Namespace).Get(ctx, required.Name, metav1.GetOptions{}) if apierrors.IsNotFound(err) { actual, err := client.Deployments(required.Namespace).Create(ctx, required, metav1.CreateOptions{}) - reportCreateEvent(recorder, required, err) + resourcehelper.ReportCreateEvent(recorder, required, err) return actual, true, err } if err != nil { @@ -155,7 +156,7 @@ func ApplyDeploymentWithForce(ctx context.Context, client appsclientv1.Deploymen } actual, err := client.Deployments(required.Namespace).Update(ctx, toWrite, metav1.UpdateOptions{}) - reportUpdateEvent(recorder, required, err) + resourcehelper.ReportUpdateEvent(recorder, required, err) return actual, true, err } @@ -205,7 +206,7 @@ func ApplyDaemonSetWithForce(ctx context.Context, client appsclientv1.DaemonSets existing, err := client.DaemonSets(required.Namespace).Get(ctx, required.Name, metav1.GetOptions{}) if apierrors.IsNotFound(err) { actual, err := client.DaemonSets(required.Namespace).Create(ctx, required, metav1.CreateOptions{}) - reportCreateEvent(recorder, required, err) + resourcehelper.ReportCreateEvent(recorder, required, err) return actual, true, err } if err != nil { @@ -241,6 +242,30 @@ func ApplyDaemonSetWithForce(ctx context.Context, client appsclientv1.DaemonSets klog.Infof("DaemonSet %q changes: %v", required.Namespace+"/"+required.Name, JSONPatchNoError(existing, toWrite)) } actual, err := client.DaemonSets(required.Namespace).Update(ctx, toWrite, metav1.UpdateOptions{}) - reportUpdateEvent(recorder, required, err) + resourcehelper.ReportUpdateEvent(recorder, required, err) return actual, true, err } + +func DeleteDeployment(ctx context.Context, client appsclientv1.DeploymentsGetter, recorder events.Recorder, required *appsv1.Deployment) (*appsv1.Deployment, bool, error) { + err := client.Deployments(required.Namespace).Delete(ctx, required.Name, metav1.DeleteOptions{}) + if err != nil && apierrors.IsNotFound(err) { + return nil, false, nil + } + if err != nil { + return nil, false, err + } + resourcehelper.ReportDeleteEvent(recorder, required, err) + return nil, true, nil +} + +func DeleteDaemonSet(ctx context.Context, client appsclientv1.DaemonSetsGetter, recorder events.Recorder, required *appsv1.DaemonSet) (*appsv1.DaemonSet, bool, error) { + err := client.DaemonSets(required.Namespace).Delete(ctx, required.Name, metav1.DeleteOptions{}) + if err != nil && apierrors.IsNotFound(err) { + return nil, false, nil + } + if err != nil { + return nil, false, err + } + resourcehelper.ReportDeleteEvent(recorder, required, err) + return nil, true, nil +} diff --git a/vendor/github.com/openshift/library-go/pkg/operator/resource/resourceapply/core.go b/vendor/github.com/openshift/library-go/pkg/operator/resource/resourceapply/core.go index ba20f7b1c..f954d48cc 100644 --- a/vendor/github.com/openshift/library-go/pkg/operator/resource/resourceapply/core.go +++ b/vendor/github.com/openshift/library-go/pkg/operator/resource/resourceapply/core.go @@ -8,6 +8,7 @@ import ( "strings" "github.com/openshift/library-go/pkg/operator/events" + "github.com/openshift/library-go/pkg/operator/resource/resourcehelper" "github.com/openshift/library-go/pkg/operator/resource/resourcemerge" corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/equality" @@ -85,15 +86,7 @@ func ApplyConfigMap(ctx context.Context, client coreclientv1.ConfigMapsGetter, r // ApplySecret merges objectmeta, requires data func ApplySecret(ctx context.Context, client coreclientv1.SecretsGetter, recorder events.Recorder, required *corev1.Secret) (*corev1.Secret, bool, error) { - return applySecretImproved(ctx, client, recorder, required, noCache, false) -} - -// ApplySecretDoNotUse is depreated and will be removed -// Deprecated: DO NOT USE, it is intended as a short term hack for a very specific use case, -// and it works in tandem with a particular carry patch applied to the openshift kube-apiserver. -// Use ApplySecret instead. -func ApplySecretDoNotUse(ctx context.Context, client coreclientv1.SecretsGetter, recorder events.Recorder, required *corev1.Secret) (*corev1.Secret, bool, error) { - return applySecretImproved(ctx, client, recorder, required, noCache, true) + return ApplySecretImproved(ctx, client, recorder, required, noCache) } // ApplyNamespace merges objectmeta, does not worry about anything else @@ -103,7 +96,7 @@ func ApplyNamespaceImproved(ctx context.Context, client coreclientv1.NamespacesG requiredCopy := required.DeepCopy() actual, err := client.Namespaces(). Create(ctx, resourcemerge.WithCleanLabelsAndAnnotations(requiredCopy).(*corev1.Namespace), metav1.CreateOptions{}) - reportCreateEvent(recorder, requiredCopy, err) + resourcehelper.ReportCreateEvent(recorder, requiredCopy, err) cache.UpdateCachedResourceMetadata(required, actual) return actual, true, err } @@ -129,7 +122,7 @@ func ApplyNamespaceImproved(ctx context.Context, client coreclientv1.NamespacesG } actual, err := client.Namespaces().Update(ctx, existingCopy, metav1.UpdateOptions{}) - reportUpdateEvent(recorder, required, err) + resourcehelper.ReportUpdateEvent(recorder, required, err) cache.UpdateCachedResourceMetadata(required, actual) return actual, true, err } @@ -150,7 +143,7 @@ func ApplyServiceImproved(ctx context.Context, client coreclientv1.ServicesGette requiredCopy := required.DeepCopy() actual, err := client.Services(requiredCopy.Namespace). Create(ctx, resourcemerge.WithCleanLabelsAndAnnotations(requiredCopy).(*corev1.Service), metav1.CreateOptions{}) - reportCreateEvent(recorder, requiredCopy, err) + resourcehelper.ReportCreateEvent(recorder, requiredCopy, err) cache.UpdateCachedResourceMetadata(required, actual) return actual, true, err } @@ -190,7 +183,7 @@ func ApplyServiceImproved(ctx context.Context, client coreclientv1.ServicesGette } actual, err := client.Services(required.Namespace).Update(ctx, existingCopy, metav1.UpdateOptions{}) - reportUpdateEvent(recorder, required, err) + resourcehelper.ReportUpdateEvent(recorder, required, err) cache.UpdateCachedResourceMetadata(required, actual) return actual, true, err } @@ -202,7 +195,7 @@ func ApplyPodImproved(ctx context.Context, client coreclientv1.PodsGetter, recor requiredCopy := required.DeepCopy() actual, err := client.Pods(requiredCopy.Namespace). Create(ctx, resourcemerge.WithCleanLabelsAndAnnotations(requiredCopy).(*corev1.Pod), metav1.CreateOptions{}) - reportCreateEvent(recorder, requiredCopy, err) + resourcehelper.ReportCreateEvent(recorder, requiredCopy, err) cache.UpdateCachedResourceMetadata(required, actual) return actual, true, err } @@ -228,7 +221,7 @@ func ApplyPodImproved(ctx context.Context, client coreclientv1.PodsGetter, recor } actual, err := client.Pods(required.Namespace).Update(ctx, existingCopy, metav1.UpdateOptions{}) - reportUpdateEvent(recorder, required, err) + resourcehelper.ReportUpdateEvent(recorder, required, err) cache.UpdateCachedResourceMetadata(required, actual) return actual, true, err } @@ -240,7 +233,7 @@ func ApplyServiceAccountImproved(ctx context.Context, client coreclientv1.Servic requiredCopy := required.DeepCopy() actual, err := client.ServiceAccounts(requiredCopy.Namespace). Create(ctx, resourcemerge.WithCleanLabelsAndAnnotations(requiredCopy).(*corev1.ServiceAccount), metav1.CreateOptions{}) - reportCreateEvent(recorder, requiredCopy, err) + resourcehelper.ReportCreateEvent(recorder, requiredCopy, err) cache.UpdateCachedResourceMetadata(required, actual) return actual, true, err } @@ -264,7 +257,7 @@ func ApplyServiceAccountImproved(ctx context.Context, client coreclientv1.Servic klog.Infof("ServiceAccount %q changes: %v", required.Namespace+"/"+required.Name, JSONPatchNoError(existing, required)) } actual, err := client.ServiceAccounts(required.Namespace).Update(ctx, existingCopy, metav1.UpdateOptions{}) - reportUpdateEvent(recorder, required, err) + resourcehelper.ReportUpdateEvent(recorder, required, err) cache.UpdateCachedResourceMetadata(required, actual) return actual, true, err } @@ -276,7 +269,7 @@ func ApplyConfigMapImproved(ctx context.Context, client coreclientv1.ConfigMapsG requiredCopy := required.DeepCopy() actual, err := client.ConfigMaps(requiredCopy.Namespace). Create(ctx, resourcemerge.WithCleanLabelsAndAnnotations(requiredCopy).(*corev1.ConfigMap), metav1.CreateOptions{}) - reportCreateEvent(recorder, requiredCopy, err) + resourcehelper.ReportCreateEvent(recorder, requiredCopy, err) cache.UpdateCachedResourceMetadata(required, actual) return actual, true, err } @@ -358,17 +351,13 @@ func ApplyConfigMapImproved(ctx context.Context, client coreclientv1.ConfigMapsG if klog.V(2).Enabled() { klog.Infof("ConfigMap %q changes: %v", required.Namespace+"/"+required.Name, JSONPatchNoError(existing, required)) } - reportUpdateEvent(recorder, required, err, details) + resourcehelper.ReportUpdateEvent(recorder, required, err, details) cache.UpdateCachedResourceMetadata(required, actual) return actual, true, err } // ApplySecret merges objectmeta, requires data func ApplySecretImproved(ctx context.Context, client coreclientv1.SecretsGetter, recorder events.Recorder, requiredInput *corev1.Secret, cache ResourceCache) (*corev1.Secret, bool, error) { - return applySecretImproved(ctx, client, recorder, requiredInput, cache, false) -} - -func applySecretImproved(ctx context.Context, client coreclientv1.SecretsGetter, recorder events.Recorder, requiredInput *corev1.Secret, cache ResourceCache, updateOnly bool) (*corev1.Secret, bool, error) { // copy the stringData to data. Error on a data content conflict inside required. This is usually a bug. existing, err := client.Secrets(requiredInput.Namespace).Get(ctx, requiredInput.Name, metav1.GetOptions{}) @@ -398,7 +387,7 @@ func applySecretImproved(ctx context.Context, client coreclientv1.SecretsGetter, requiredCopy := required.DeepCopy() actual, err := client.Secrets(requiredCopy.Namespace). Create(ctx, resourcemerge.WithCleanLabelsAndAnnotations(requiredCopy).(*corev1.Secret), metav1.CreateOptions{}) - reportCreateEvent(recorder, requiredCopy, err) + resourcehelper.ReportCreateEvent(recorder, requiredCopy, err) cache.UpdateCachedResourceMetadata(requiredInput, actual) return actual, true, err } @@ -448,15 +437,9 @@ func applySecretImproved(ctx context.Context, client coreclientv1.SecretsGetter, * https://github.com/kubernetes/kubernetes/blob/98e65951dccfd40d3b4f31949c2ab8df5912d93e/pkg/apis/core/validation/validation.go#L5048 * We need to explicitly opt for delete+create in that case. */ - if updateOnly { - actual, err = client.Secrets(required.Namespace).Update(ctx, existingCopy, metav1.UpdateOptions{}) - reportUpdateEvent(recorder, existingCopy, err) - return actual, err == nil, err - } - if existingCopy.Type == existing.Type { actual, err = client.Secrets(required.Namespace).Update(ctx, existingCopy, metav1.UpdateOptions{}) - reportUpdateEvent(recorder, existingCopy, err) + resourcehelper.ReportUpdateEvent(recorder, existingCopy, err) if err == nil { return actual, true, err @@ -468,12 +451,12 @@ func applySecretImproved(ctx context.Context, client coreclientv1.SecretsGetter, // if the field was immutable on a secret, we're going to be stuck until we delete it. Try to delete and then create deleteErr := client.Secrets(required.Namespace).Delete(ctx, existingCopy.Name, metav1.DeleteOptions{}) - reportDeleteEvent(recorder, existingCopy, deleteErr) + resourcehelper.ReportDeleteEvent(recorder, existingCopy, deleteErr) // clear the RV and track the original actual and error for the return like our create value. existingCopy.ResourceVersion = "" actual, err = client.Secrets(required.Namespace).Create(ctx, existingCopy, metav1.CreateOptions{}) - reportCreateEvent(recorder, existingCopy, err) + resourcehelper.ReportCreateEvent(recorder, existingCopy, err) cache.UpdateCachedResourceMetadata(requiredInput, actual) return actual, true, err } @@ -620,7 +603,7 @@ func DeleteNamespace(ctx context.Context, client coreclientv1.NamespacesGetter, if err != nil { return nil, false, err } - reportDeleteEvent(recorder, required, err) + resourcehelper.ReportDeleteEvent(recorder, required, err) return nil, true, nil } @@ -632,7 +615,7 @@ func DeleteService(ctx context.Context, client coreclientv1.ServicesGetter, reco if err != nil { return nil, false, err } - reportDeleteEvent(recorder, required, err) + resourcehelper.ReportDeleteEvent(recorder, required, err) return nil, true, nil } @@ -644,7 +627,7 @@ func DeletePod(ctx context.Context, client coreclientv1.PodsGetter, recorder eve if err != nil { return nil, false, err } - reportDeleteEvent(recorder, required, err) + resourcehelper.ReportDeleteEvent(recorder, required, err) return nil, true, nil } @@ -656,7 +639,7 @@ func DeleteServiceAccount(ctx context.Context, client coreclientv1.ServiceAccoun if err != nil { return nil, false, err } - reportDeleteEvent(recorder, required, err) + resourcehelper.ReportDeleteEvent(recorder, required, err) return nil, true, nil } @@ -668,7 +651,7 @@ func DeleteConfigMap(ctx context.Context, client coreclientv1.ConfigMapsGetter, if err != nil { return nil, false, err } - reportDeleteEvent(recorder, required, err) + resourcehelper.ReportDeleteEvent(recorder, required, err) return nil, true, nil } @@ -680,6 +663,6 @@ func DeleteSecret(ctx context.Context, client coreclientv1.SecretsGetter, record if err != nil { return nil, false, err } - reportDeleteEvent(recorder, required, err) + resourcehelper.ReportDeleteEvent(recorder, required, err) return nil, true, nil } diff --git a/vendor/github.com/openshift/library-go/pkg/operator/resource/resourceapply/event_helpers.go b/vendor/github.com/openshift/library-go/pkg/operator/resource/resourceapply/event_helpers.go deleted file mode 100644 index af598993f..000000000 --- a/vendor/github.com/openshift/library-go/pkg/operator/resource/resourceapply/event_helpers.go +++ /dev/null @@ -1,56 +0,0 @@ -package resourceapply - -import ( - "fmt" - "strings" - - "k8s.io/apimachinery/pkg/runtime" - - openshiftapi "github.com/openshift/api" - - "github.com/openshift/library-go/pkg/operator/events" - "github.com/openshift/library-go/pkg/operator/resource/resourcehelper" -) - -var ( - openshiftScheme = runtime.NewScheme() -) - -func init() { - if err := openshiftapi.Install(openshiftScheme); err != nil { - panic(err) - } -} - -func reportCreateEvent(recorder events.Recorder, obj runtime.Object, originalErr error) { - gvk := resourcehelper.GuessObjectGroupVersionKind(obj) - if originalErr == nil { - recorder.Eventf(fmt.Sprintf("%sCreated", gvk.Kind), "Created %s because it was missing", resourcehelper.FormatResourceForCLIWithNamespace(obj)) - return - } - recorder.Warningf(fmt.Sprintf("%sCreateFailed", gvk.Kind), "Failed to create %s: %v", resourcehelper.FormatResourceForCLIWithNamespace(obj), originalErr) -} - -func reportUpdateEvent(recorder events.Recorder, obj runtime.Object, originalErr error, details ...string) { - gvk := resourcehelper.GuessObjectGroupVersionKind(obj) - switch { - case originalErr != nil: - recorder.Warningf(fmt.Sprintf("%sUpdateFailed", gvk.Kind), "Failed to update %s: %v", resourcehelper.FormatResourceForCLIWithNamespace(obj), originalErr) - case len(details) == 0: - recorder.Eventf(fmt.Sprintf("%sUpdated", gvk.Kind), "Updated %s because it changed", resourcehelper.FormatResourceForCLIWithNamespace(obj)) - default: - recorder.Eventf(fmt.Sprintf("%sUpdated", gvk.Kind), "Updated %s:\n%s", resourcehelper.FormatResourceForCLIWithNamespace(obj), strings.Join(details, "\n")) - } -} - -func reportDeleteEvent(recorder events.Recorder, obj runtime.Object, originalErr error, details ...string) { - gvk := resourcehelper.GuessObjectGroupVersionKind(obj) - switch { - case originalErr != nil: - recorder.Warningf(fmt.Sprintf("%sDeleteFailed", gvk.Kind), "Failed to delete %s: %v", resourcehelper.FormatResourceForCLIWithNamespace(obj), originalErr) - case len(details) == 0: - recorder.Eventf(fmt.Sprintf("%sDeleted", gvk.Kind), "Deleted %s", resourcehelper.FormatResourceForCLIWithNamespace(obj)) - default: - recorder.Eventf(fmt.Sprintf("%sDeleted", gvk.Kind), "Deleted %s:\n%s", resourcehelper.FormatResourceForCLIWithNamespace(obj), strings.Join(details, "\n")) - } -} diff --git a/vendor/github.com/openshift/library-go/pkg/operator/resource/resourceapply/generic.go b/vendor/github.com/openshift/library-go/pkg/operator/resource/resourceapply/generic.go index d812254dc..357efad61 100644 --- a/vendor/github.com/openshift/library-go/pkg/operator/resource/resourceapply/generic.go +++ b/vendor/github.com/openshift/library-go/pkg/operator/resource/resourceapply/generic.go @@ -6,6 +6,8 @@ import ( admissionregistrationv1 "k8s.io/api/admissionregistration/v1" admissionregistrationv1beta1 "k8s.io/api/admissionregistration/v1beta1" + appsv1 "k8s.io/api/apps/v1" + corev1 "k8s.io/api/core/v1" policyv1 "k8s.io/api/policy/v1" rbacv1 "k8s.io/api/rbac/v1" @@ -317,6 +319,18 @@ func DeleteAll(ctx context.Context, clients *ClientHolder, recorder events.Recor } else { _, result.Changed, result.Error = DeleteRoleBinding(ctx, clients.kubeClient.RbacV1(), recorder, t) } + case *appsv1.Deployment: + if clients.kubeClient == nil { + result.Error = fmt.Errorf("missing kubeClient") + } else { + _, result.Changed, result.Error = DeleteDeployment(ctx, clients.kubeClient.AppsV1(), recorder, t) + } + case *appsv1.DaemonSet: + if clients.kubeClient == nil { + result.Error = fmt.Errorf("missing kubeClient") + } else { + _, result.Changed, result.Error = DeleteDaemonSet(ctx, clients.kubeClient.AppsV1(), recorder, t) + } case *policyv1.PodDisruptionBudget: if clients.kubeClient == nil { result.Error = fmt.Errorf("missing kubeClient") diff --git a/vendor/github.com/openshift/library-go/pkg/operator/resource/resourceapply/migration.go b/vendor/github.com/openshift/library-go/pkg/operator/resource/resourceapply/migration.go index 7c0dcf605..2bf3d74b6 100644 --- a/vendor/github.com/openshift/library-go/pkg/operator/resource/resourceapply/migration.go +++ b/vendor/github.com/openshift/library-go/pkg/operator/resource/resourceapply/migration.go @@ -5,6 +5,7 @@ import ( "reflect" "github.com/openshift/library-go/pkg/operator/events" + "github.com/openshift/library-go/pkg/operator/resource/resourcehelper" "github.com/openshift/library-go/pkg/operator/resource/resourcemerge" apierrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -21,7 +22,7 @@ func ApplyStorageVersionMigration(ctx context.Context, client migrationclientv1a if apierrors.IsNotFound(err) { requiredCopy := required.DeepCopy() actual, err := clientInterface.Create(ctx, resourcemerge.WithCleanLabelsAndAnnotations(requiredCopy).(*v1alpha1.StorageVersionMigration), metav1.CreateOptions{}) - reportCreateEvent(recorder, requiredCopy, err) + resourcehelper.ReportCreateEvent(recorder, requiredCopy, err) return actual, true, err } if err != nil { @@ -41,7 +42,7 @@ func ApplyStorageVersionMigration(ctx context.Context, client migrationclientv1a required.Spec.Resource.DeepCopyInto(&existingCopy.Spec.Resource) actual, err := clientInterface.Update(ctx, existingCopy, metav1.UpdateOptions{}) - reportUpdateEvent(recorder, required, err) + resourcehelper.ReportUpdateEvent(recorder, required, err) return actual, true, err } @@ -54,6 +55,6 @@ func DeleteStorageVersionMigration(ctx context.Context, client migrationclientv1 if err != nil { return nil, false, err } - reportDeleteEvent(recorder, required, err) + resourcehelper.ReportDeleteEvent(recorder, required, err) return nil, true, nil } diff --git a/vendor/github.com/openshift/library-go/pkg/operator/resource/resourceapply/monitoring.go b/vendor/github.com/openshift/library-go/pkg/operator/resource/resourceapply/monitoring.go index 555f7a382..99f3ecb73 100644 --- a/vendor/github.com/openshift/library-go/pkg/operator/resource/resourceapply/monitoring.go +++ b/vendor/github.com/openshift/library-go/pkg/operator/resource/resourceapply/monitoring.go @@ -2,167 +2,220 @@ package resourceapply import ( "context" + errorsstdlib "errors" + "fmt" - "github.com/openshift/library-go/pkg/operator/events" "k8s.io/apimachinery/pkg/api/equality" "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" + "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/client-go/dynamic" "k8s.io/klog/v2" + "k8s.io/utils/ptr" + + "github.com/openshift/library-go/pkg/operator/events" + "github.com/openshift/library-go/pkg/operator/resource/resourcehelper" + + "github.com/openshift/library-go/pkg/operator/resource/resourcemerge" ) +var alertmanagerGVR = schema.GroupVersionResource{Group: "monitoring.coreos.com", Version: "v1", Resource: "alertmanagers"} +var prometheusGVR = schema.GroupVersionResource{Group: "monitoring.coreos.com", Version: "v1", Resource: "prometheuses"} +var prometheusRuleGVR = schema.GroupVersionResource{Group: "monitoring.coreos.com", Version: "v1", Resource: "prometheusrules"} var serviceMonitorGVR = schema.GroupVersionResource{Group: "monitoring.coreos.com", Version: "v1", Resource: "servicemonitors"} -func ensureGenericSpec(required, existing *unstructured.Unstructured, mimicDefaultingFn mimicDefaultingFunc, equalityChecker equalityChecker) (*unstructured.Unstructured, bool, error) { - requiredCopy := required.DeepCopy() - mimicDefaultingFn(requiredCopy) - requiredSpec, _, err := unstructured.NestedMap(requiredCopy.UnstructuredContent(), "spec") - if err != nil { - return nil, false, err - } - existingSpec, _, err := unstructured.NestedMap(existing.UnstructuredContent(), "spec") - if err != nil { - return nil, false, err - } - - if equalityChecker.DeepEqual(existingSpec, requiredSpec) { - return existing, false, nil - } +// ApplyAlertmanager applies the Alertmanager. +func ApplyAlertmanager(ctx context.Context, client dynamic.Interface, recorder events.Recorder, required *unstructured.Unstructured) (*unstructured.Unstructured, bool, error) { + return ApplyUnstructuredResourceImproved(ctx, client, recorder, required, noCache, alertmanagerGVR, nil, nil) +} - existingCopy := existing.DeepCopy() - if err := unstructured.SetNestedMap(existingCopy.UnstructuredContent(), requiredSpec, "spec"); err != nil { - return nil, true, err - } +// DeleteAlertmanager deletes the Alertmanager. +func DeleteAlertmanager(ctx context.Context, client dynamic.Interface, recorder events.Recorder, required *unstructured.Unstructured) (*unstructured.Unstructured, bool, error) { + return DeleteUnstructuredResource(ctx, client, recorder, required, alertmanagerGVR) +} - return existingCopy, true, nil +// ApplyPrometheus applies the Prometheus. +func ApplyPrometheus(ctx context.Context, client dynamic.Interface, recorder events.Recorder, required *unstructured.Unstructured) (*unstructured.Unstructured, bool, error) { + return ApplyUnstructuredResourceImproved(ctx, client, recorder, required, noCache, prometheusGVR, nil, nil) } -// mimicDefaultingFunc is used to set fields that are defaulted. This allows for sparse manifests to apply correctly. -// For instance, if field .spec.foo is set to 10 if not set, then a function of this type could be used to set -// the field to 10 to match the comparison. This is soemtimes (often?) easier than updating the semantic equality. -// We often see this in places like RBAC and CRD. Logically it can happen generically too. -type mimicDefaultingFunc func(obj *unstructured.Unstructured) +// DeletePrometheus deletes the Prometheus. +func DeletePrometheus(ctx context.Context, client dynamic.Interface, recorder events.Recorder, required *unstructured.Unstructured) (*unstructured.Unstructured, bool, error) { + return DeleteUnstructuredResource(ctx, client, recorder, required, prometheusGVR) +} -func noDefaulting(obj *unstructured.Unstructured) {} +// ApplyPrometheusRule applies the PrometheusRule. +func ApplyPrometheusRule(ctx context.Context, client dynamic.Interface, recorder events.Recorder, required *unstructured.Unstructured) (*unstructured.Unstructured, bool, error) { + return ApplyUnstructuredResourceImproved(ctx, client, recorder, required, noCache, prometheusRuleGVR, nil, nil) +} -// equalityChecker allows for custom equality comparisons. This can be used to allow equality checks to skip certain -// operator managed fields. This capability allows something like .spec.scale to be specified or changed by a component -// like HPA. Use this capability sparingly. Most places ought to just use `equality.Semantic` -type equalityChecker interface { - DeepEqual(a1, a2 interface{}) bool +// DeletePrometheusRule deletes the PrometheusRule. +func DeletePrometheusRule(ctx context.Context, client dynamic.Interface, recorder events.Recorder, required *unstructured.Unstructured) (*unstructured.Unstructured, bool, error) { + return DeleteUnstructuredResource(ctx, client, recorder, required, prometheusRuleGVR) } -// ApplyServiceMonitor applies the Prometheus service monitor. +// ApplyServiceMonitor applies the ServiceMonitor. func ApplyServiceMonitor(ctx context.Context, client dynamic.Interface, recorder events.Recorder, required *unstructured.Unstructured) (*unstructured.Unstructured, bool, error) { + return ApplyUnstructuredResourceImproved(ctx, client, recorder, required, noCache, serviceMonitorGVR, nil, nil) +} + +// DeleteServiceMonitor deletes the ServiceMonitor. +func DeleteServiceMonitor(ctx context.Context, client dynamic.Interface, recorder events.Recorder, required *unstructured.Unstructured) (*unstructured.Unstructured, bool, error) { + return DeleteUnstructuredResource(ctx, client, recorder, required, serviceMonitorGVR) +} + +// ApplyUnstructuredResourceImproved can utilize the cache to reconcile the existing resource to the desired state. +// NOTE: A `nil` defaultingFunc and equalityChecker are assigned resourceapply.noDefaulting and equality.Semantic, +// respectively. Users are recommended to instantiate a cache to benefit from the memoization machinery. +func ApplyUnstructuredResourceImproved( + ctx context.Context, + client dynamic.Interface, + recorder events.Recorder, + required *unstructured.Unstructured, + cache ResourceCache, + resourceGVR schema.GroupVersionResource, + defaultingFunc mimicDefaultingFunc, + equalityChecker equalityChecker, +) (*unstructured.Unstructured, bool, error) { + name := required.GetName() namespace := required.GetNamespace() - existing, err := client.Resource(serviceMonitorGVR).Namespace(namespace).Get(ctx, required.GetName(), metav1.GetOptions{}) + + // Create if resource does not exist, and update cache with new metadata. + if cache == nil { + cache = noCache + } + existing, err := client.Resource(resourceGVR).Namespace(namespace).Get(ctx, name, metav1.GetOptions{}) if errors.IsNotFound(err) { - newObj, createErr := client.Resource(serviceMonitorGVR).Namespace(namespace).Create(ctx, required, metav1.CreateOptions{}) - if createErr != nil { - recorder.Warningf("ServiceMonitorCreateFailed", "Failed to create ServiceMonitor.monitoring.coreos.com/v1: %v", createErr) - return nil, true, createErr - } - recorder.Eventf("ServiceMonitorCreated", "Created ServiceMonitor.monitoring.coreos.com/v1 because it was missing") - return newObj, true, nil + want, err := client.Resource(resourceGVR).Namespace(namespace).Create(ctx, required, metav1.CreateOptions{}) + resourcehelper.ReportCreateEvent(recorder, required, err) + cache.UpdateCachedResourceMetadata(required, want) + return want, true, err } if err != nil { return nil, false, err } - existingCopy := existing.DeepCopy() + // Skip if the cache is non-nil, and the metadata hashes and resource version hashes match. + if cache.SafeToSkipApply(required, existing) { + return existing, false, nil + } - toUpdate, modified, err := ensureGenericSpec(required, existingCopy, noDefaulting, equality.Semantic) + // Ensure metadata field is present on the object. + existingCopy := existing.DeepCopy() + existingObjectMeta, found, err := unstructured.NestedMap(existingCopy.Object, "metadata") if err != nil { return nil, false, err } - - if !modified { - return nil, false, nil - } - - if klog.V(2).Enabled() { - klog.Infof("ServiceMonitor %q changes: %v", namespace+"/"+required.GetName(), JSONPatchNoError(existing, toUpdate)) + if !found { + return nil, false, errorsstdlib.New(fmt.Sprintf("metadata not found in the existing object: %s/%s", existing.GetNamespace(), existingCopy.GetName())) } - - newObj, err := client.Resource(serviceMonitorGVR).Namespace(namespace).Update(ctx, toUpdate, metav1.UpdateOptions{}) + requiredObjectMeta, found, err := unstructured.NestedMap(required.Object, "metadata") if err != nil { - recorder.Warningf("ServiceMonitorUpdateFailed", "Failed to update ServiceMonitor.monitoring.coreos.com/v1: %v", err) - return nil, true, err + return nil, false, err } - - recorder.Eventf("ServiceMonitorUpdated", "Updated ServiceMonitor.monitoring.coreos.com/v1 because it changed") - return newObj, true, err -} - -var prometheusRuleGVR = schema.GroupVersionResource{Group: "monitoring.coreos.com", Version: "v1", Resource: "prometheusrules"} - -// ApplyPrometheusRule applies the PrometheusRule -func ApplyPrometheusRule(ctx context.Context, client dynamic.Interface, recorder events.Recorder, required *unstructured.Unstructured) (*unstructured.Unstructured, bool, error) { - namespace := required.GetNamespace() - - existing, err := client.Resource(prometheusRuleGVR).Namespace(namespace).Get(ctx, required.GetName(), metav1.GetOptions{}) - if errors.IsNotFound(err) { - newObj, createErr := client.Resource(prometheusRuleGVR).Namespace(namespace).Create(ctx, required, metav1.CreateOptions{}) - if createErr != nil { - recorder.Warningf("PrometheusRuleCreateFailed", "Failed to create PrometheusRule.monitoring.coreos.com/v1: %v", createErr) - return nil, true, createErr - } - recorder.Eventf("PrometheusRuleCreated", "Created PrometheusRule.monitoring.coreos.com/v1 because it was missing") - return newObj, true, nil + if !found { + return nil, false, errorsstdlib.New(fmt.Sprintf("metadata not found in the required object: %s/%s", required.GetNamespace(), required.GetName())) } + + // Cast the metadata to the correct type. + var existingObjectMetaTyped, requiredObjectMetaTyped metav1.ObjectMeta + err = runtime.DefaultUnstructuredConverter.FromUnstructured(existingObjectMeta, &existingObjectMetaTyped) if err != nil { return nil, false, err } - - existingCopy := existing.DeepCopy() - - toUpdate, modified, err := ensureGenericSpec(required, existingCopy, noDefaulting, equality.Semantic) + err = runtime.DefaultUnstructuredConverter.FromUnstructured(requiredObjectMeta, &requiredObjectMetaTyped) if err != nil { return nil, false, err } - if !modified { - return nil, false, nil + // Fail-fast if the resource versions differ. + if requiredObjectMetaTyped.ResourceVersion != "" && existingObjectMetaTyped.ResourceVersion != requiredObjectMetaTyped.ResourceVersion { + err = errors.NewConflict(resourceGVR.GroupResource(), name, fmt.Errorf("rejected to update %s %s because the object has been modified: desired/actual ResourceVersion: %v/%v", existing.GetKind(), existing.GetName(), requiredObjectMetaTyped.ResourceVersion, existingObjectMetaTyped.ResourceVersion)) + return nil, false, err } - if klog.V(2).Enabled() { - klog.Infof("PrometheusRule %q changes: %v", namespace+"/"+required.GetName(), JSONPatchNoError(existing, toUpdate)) - } + // Check if the metadata objects differ. + didMetadataModify := ptr.To(false) + resourcemerge.EnsureObjectMeta(didMetadataModify, &existingObjectMetaTyped, requiredObjectMetaTyped) - newObj, err := client.Resource(prometheusRuleGVR).Namespace(namespace).Update(ctx, toUpdate, metav1.UpdateOptions{}) + // Deep-check the spec objects for equality, and update the cache in either case. + if defaultingFunc == nil { + defaultingFunc = noDefaulting + } + if equalityChecker == nil { + equalityChecker = equality.Semantic + } + existingCopy, didSpecModify, err := ensureGenericSpec(required, existingCopy, defaultingFunc, equalityChecker) if err != nil { - recorder.Warningf("PrometheusRuleUpdateFailed", "Failed to update PrometheusRule.monitoring.coreos.com/v1: %v", err) - return nil, true, err + return nil, false, err + } + if !didSpecModify && !*didMetadataModify { + // Update cache even if certain fields are not modified, in order to maintain a consistent cache based on the + // resource hash. The resource hash depends on the entire metadata, not just the fields that were checked above, + cache.UpdateCachedResourceMetadata(required, existingCopy) + return existingCopy, false, nil + } + + if klog.V(4).Enabled() { + klog.Infof("%s %q changes: %v", resourceGVR.String(), namespace+"/"+name, JSONPatchNoError(existing, existingCopy)) } - recorder.Eventf("PrometheusRuleUpdated", "Updated PrometheusRule.monitoring.coreos.com/v1 because it changed") - return newObj, true, err + // Perform update if resource exists but different from the required (desired) one. + actual, err := client.Resource(resourceGVR).Namespace(namespace).Update(ctx, required, metav1.UpdateOptions{}) + resourcehelper.ReportUpdateEvent(recorder, required, err) + cache.UpdateCachedResourceMetadata(required, actual) + return actual, true, err } -func DeletePrometheusRule(ctx context.Context, client dynamic.Interface, recorder events.Recorder, required *unstructured.Unstructured) (*unstructured.Unstructured, bool, error) { - namespace := required.GetNamespace() - err := client.Resource(prometheusRuleGVR).Namespace(namespace).Delete(ctx, required.GetName(), metav1.DeleteOptions{}) +// DeleteUnstructuredResource deletes the unstructured resource. +func DeleteUnstructuredResource(ctx context.Context, client dynamic.Interface, recorder events.Recorder, required *unstructured.Unstructured, resourceGVR schema.GroupVersionResource) (*unstructured.Unstructured, bool, error) { + err := client.Resource(resourceGVR).Namespace(required.GetNamespace()).Delete(ctx, required.GetName(), metav1.DeleteOptions{}) if err != nil && errors.IsNotFound(err) { return nil, false, nil } if err != nil { return nil, false, err } - reportDeleteEvent(recorder, required, err) + resourcehelper.ReportDeleteEvent(recorder, required, err) return nil, true, nil } -func DeleteServiceMonitor(ctx context.Context, client dynamic.Interface, recorder events.Recorder, required *unstructured.Unstructured) (*unstructured.Unstructured, bool, error) { - namespace := required.GetNamespace() - err := client.Resource(serviceMonitorGVR).Namespace(namespace).Delete(ctx, required.GetName(), metav1.DeleteOptions{}) - if err != nil && errors.IsNotFound(err) { - return nil, false, nil +func ensureGenericSpec(required, existing *unstructured.Unstructured, mimicDefaultingFn mimicDefaultingFunc, equalityChecker equalityChecker) (*unstructured.Unstructured, bool, error) { + mimicDefaultingFn(required) + requiredSpec, _, err := unstructured.NestedMap(required.UnstructuredContent(), "spec") + if err != nil { + return nil, false, err } + existingSpec, _, err := unstructured.NestedMap(existing.UnstructuredContent(), "spec") if err != nil { return nil, false, err } - reportDeleteEvent(recorder, required, err) - return nil, true, nil + + if equalityChecker.DeepEqual(existingSpec, requiredSpec) { + return existing, false, nil + } + + existingCopy := existing.DeepCopy() + if err := unstructured.SetNestedMap(existingCopy.UnstructuredContent(), requiredSpec, "spec"); err != nil { + return nil, true, err + } + + return existingCopy, true, nil +} + +// mimicDefaultingFunc is used to set fields that are defaulted. This allows for sparse manifests to apply correctly. +// For instance, if field .spec.foo is set to 10 if not set, then a function of this type could be used to set +// the field to 10 to match the comparison. This is sometimes (often?) easier than updating the semantic equality. +// We often see this in places like RBAC and CRD. Logically it can happen generically too. +type mimicDefaultingFunc func(obj *unstructured.Unstructured) + +func noDefaulting(*unstructured.Unstructured) {} + +// equalityChecker allows for custom equality comparisons. This can be used to allow equality checks to skip certain +// operator managed fields. This capability allows something like .spec.scale to be specified or changed by a component +// like HPA. Use this capability sparingly. Most places ought to just use `equality.Semantic` +type equalityChecker interface { + DeepEqual(existing, required interface{}) bool } diff --git a/vendor/github.com/openshift/library-go/pkg/operator/resource/resourceapply/policy.go b/vendor/github.com/openshift/library-go/pkg/operator/resource/resourceapply/policy.go index 6cf479325..86d45fad0 100644 --- a/vendor/github.com/openshift/library-go/pkg/operator/resource/resourceapply/policy.go +++ b/vendor/github.com/openshift/library-go/pkg/operator/resource/resourceapply/policy.go @@ -11,6 +11,7 @@ import ( "k8s.io/klog/v2" "github.com/openshift/library-go/pkg/operator/events" + "github.com/openshift/library-go/pkg/operator/resource/resourcehelper" "github.com/openshift/library-go/pkg/operator/resource/resourcemerge" ) @@ -20,7 +21,7 @@ func ApplyPodDisruptionBudget(ctx context.Context, client policyclientv1.PodDisr requiredCopy := required.DeepCopy() actual, err := client.PodDisruptionBudgets(required.Namespace).Create( ctx, resourcemerge.WithCleanLabelsAndAnnotations(requiredCopy).(*policyv1.PodDisruptionBudget), metav1.CreateOptions{}) - reportCreateEvent(recorder, required, err) + resourcehelper.ReportCreateEvent(recorder, required, err) return actual, true, err } if err != nil { @@ -43,7 +44,7 @@ func ApplyPodDisruptionBudget(ctx context.Context, client policyclientv1.PodDisr } actual, err := client.PodDisruptionBudgets(required.Namespace).Update(ctx, existingCopy, metav1.UpdateOptions{}) - reportUpdateEvent(recorder, required, err) + resourcehelper.ReportUpdateEvent(recorder, required, err) return actual, true, err } @@ -55,6 +56,6 @@ func DeletePodDisruptionBudget(ctx context.Context, client policyclientv1.PodDis if err != nil { return nil, false, err } - reportDeleteEvent(recorder, required, err) + resourcehelper.ReportDeleteEvent(recorder, required, err) return nil, true, nil } diff --git a/vendor/github.com/openshift/library-go/pkg/operator/resource/resourceapply/rbac.go b/vendor/github.com/openshift/library-go/pkg/operator/resource/resourceapply/rbac.go index 4b45c8818..223c64d4f 100644 --- a/vendor/github.com/openshift/library-go/pkg/operator/resource/resourceapply/rbac.go +++ b/vendor/github.com/openshift/library-go/pkg/operator/resource/resourceapply/rbac.go @@ -11,6 +11,7 @@ import ( "k8s.io/klog/v2" "github.com/openshift/library-go/pkg/operator/events" + "github.com/openshift/library-go/pkg/operator/resource/resourcehelper" "github.com/openshift/library-go/pkg/operator/resource/resourcemerge" ) @@ -21,7 +22,7 @@ func ApplyClusterRole(ctx context.Context, client rbacclientv1.ClusterRolesGette requiredCopy := required.DeepCopy() actual, err := client.ClusterRoles().Create( ctx, resourcemerge.WithCleanLabelsAndAnnotations(requiredCopy).(*rbacv1.ClusterRole), metav1.CreateOptions{}) - reportCreateEvent(recorder, required, err) + resourcehelper.ReportCreateEvent(recorder, required, err) return actual, true, err } if err != nil { @@ -55,7 +56,7 @@ func ApplyClusterRole(ctx context.Context, client rbacclientv1.ClusterRolesGette } actual, err := client.ClusterRoles().Update(ctx, existingCopy, metav1.UpdateOptions{}) - reportUpdateEvent(recorder, required, err) + resourcehelper.ReportUpdateEvent(recorder, required, err) return actual, true, err } @@ -67,7 +68,7 @@ func ApplyClusterRoleBinding(ctx context.Context, client rbacclientv1.ClusterRol requiredCopy := required.DeepCopy() actual, err := client.ClusterRoleBindings().Create( ctx, resourcemerge.WithCleanLabelsAndAnnotations(requiredCopy).(*rbacv1.ClusterRoleBinding), metav1.CreateOptions{}) - reportCreateEvent(recorder, required, err) + resourcehelper.ReportCreateEvent(recorder, required, err) return actual, true, err } if err != nil { @@ -110,7 +111,7 @@ func ApplyClusterRoleBinding(ctx context.Context, client rbacclientv1.ClusterRol } actual, err := client.ClusterRoleBindings().Update(ctx, existingCopy, metav1.UpdateOptions{}) - reportUpdateEvent(recorder, requiredCopy, err) + resourcehelper.ReportUpdateEvent(recorder, requiredCopy, err) return actual, true, err } @@ -121,7 +122,7 @@ func ApplyRole(ctx context.Context, client rbacclientv1.RolesGetter, recorder ev requiredCopy := required.DeepCopy() actual, err := client.Roles(required.Namespace).Create( ctx, resourcemerge.WithCleanLabelsAndAnnotations(requiredCopy).(*rbacv1.Role), metav1.CreateOptions{}) - reportCreateEvent(recorder, required, err) + resourcehelper.ReportCreateEvent(recorder, required, err) return actual, true, err } if err != nil { @@ -143,7 +144,7 @@ func ApplyRole(ctx context.Context, client rbacclientv1.RolesGetter, recorder ev klog.Infof("Role %q changes: %v", required.Namespace+"/"+required.Name, JSONPatchNoError(existing, existingCopy)) } actual, err := client.Roles(required.Namespace).Update(ctx, existingCopy, metav1.UpdateOptions{}) - reportUpdateEvent(recorder, required, err) + resourcehelper.ReportUpdateEvent(recorder, required, err) return actual, true, err } @@ -155,7 +156,7 @@ func ApplyRoleBinding(ctx context.Context, client rbacclientv1.RoleBindingsGette requiredCopy := required.DeepCopy() actual, err := client.RoleBindings(required.Namespace).Create( ctx, resourcemerge.WithCleanLabelsAndAnnotations(requiredCopy).(*rbacv1.RoleBinding), metav1.CreateOptions{}) - reportCreateEvent(recorder, required, err) + resourcehelper.ReportCreateEvent(recorder, required, err) return actual, true, err } if err != nil { @@ -198,7 +199,7 @@ func ApplyRoleBinding(ctx context.Context, client rbacclientv1.RoleBindingsGette } actual, err := client.RoleBindings(requiredCopy.Namespace).Update(ctx, existingCopy, metav1.UpdateOptions{}) - reportUpdateEvent(recorder, requiredCopy, err) + resourcehelper.ReportUpdateEvent(recorder, requiredCopy, err) return actual, true, err } @@ -210,7 +211,7 @@ func DeleteClusterRole(ctx context.Context, client rbacclientv1.ClusterRolesGett if err != nil { return nil, false, err } - reportDeleteEvent(recorder, required, err) + resourcehelper.ReportDeleteEvent(recorder, required, err) return nil, true, nil } @@ -222,7 +223,7 @@ func DeleteClusterRoleBinding(ctx context.Context, client rbacclientv1.ClusterRo if err != nil { return nil, false, err } - reportDeleteEvent(recorder, required, err) + resourcehelper.ReportDeleteEvent(recorder, required, err) return nil, true, nil } @@ -234,7 +235,7 @@ func DeleteRole(ctx context.Context, client rbacclientv1.RolesGetter, recorder e if err != nil { return nil, false, err } - reportDeleteEvent(recorder, required, err) + resourcehelper.ReportDeleteEvent(recorder, required, err) return nil, true, nil } @@ -246,6 +247,6 @@ func DeleteRoleBinding(ctx context.Context, client rbacclientv1.RoleBindingsGett if err != nil { return nil, false, err } - reportDeleteEvent(recorder, required, err) + resourcehelper.ReportDeleteEvent(recorder, required, err) return nil, true, nil } diff --git a/vendor/github.com/openshift/library-go/pkg/operator/resource/resourceapply/storage.go b/vendor/github.com/openshift/library-go/pkg/operator/resource/resourceapply/storage.go index 1d08e4cca..3199d2db0 100644 --- a/vendor/github.com/openshift/library-go/pkg/operator/resource/resourceapply/storage.go +++ b/vendor/github.com/openshift/library-go/pkg/operator/resource/resourceapply/storage.go @@ -12,6 +12,7 @@ import ( "k8s.io/klog/v2" "github.com/openshift/library-go/pkg/operator/events" + "github.com/openshift/library-go/pkg/operator/resource/resourcehelper" "github.com/openshift/library-go/pkg/operator/resource/resourcemerge" ) @@ -37,7 +38,7 @@ func ApplyStorageClass(ctx context.Context, client storageclientv1.StorageClasse requiredCopy := required.DeepCopy() actual, err := client.StorageClasses().Create( ctx, resourcemerge.WithCleanLabelsAndAnnotations(requiredCopy).(*storagev1.StorageClass), metav1.CreateOptions{}) - reportCreateEvent(recorder, required, err) + resourcehelper.ReportCreateEvent(recorder, required, err) return actual, true, err } if err != nil { @@ -84,7 +85,7 @@ func ApplyStorageClass(ctx context.Context, client storageclientv1.StorageClasse if storageClassNeedsRecreate(existingCopy, requiredCopy) { requiredCopy.ObjectMeta.ResourceVersion = "" err = client.StorageClasses().Delete(ctx, existingCopy.Name, metav1.DeleteOptions{}) - reportDeleteEvent(recorder, requiredCopy, err, "Deleting StorageClass to re-create it with updated parameters") + resourcehelper.ReportDeleteEvent(recorder, requiredCopy, err, "Deleting StorageClass to re-create it with updated parameters") if err != nil && !apierrors.IsNotFound(err) { return existing, false, err } @@ -99,13 +100,13 @@ func ApplyStorageClass(ctx context.Context, client storageclientv1.StorageClasse } else if err != nil { err = fmt.Errorf("failed to re-create StorageClass %s: %s", existingCopy.Name, err) } - reportCreateEvent(recorder, actual, err) + resourcehelper.ReportCreateEvent(recorder, actual, err) return actual, true, err } // Only mutable fields need a change actual, err := client.StorageClasses().Update(ctx, requiredCopy, metav1.UpdateOptions{}) - reportUpdateEvent(recorder, required, err) + resourcehelper.ReportUpdateEvent(recorder, required, err) return actual, true, err } @@ -153,7 +154,7 @@ func ApplyCSIDriver(ctx context.Context, client storageclientv1.CSIDriversGetter requiredCopy := required.DeepCopy() actual, err := client.CSIDrivers().Create( ctx, resourcemerge.WithCleanLabelsAndAnnotations(requiredCopy).(*storagev1.CSIDriver), metav1.CreateOptions{}) - reportCreateEvent(recorder, required, err) + resourcehelper.ReportCreateEvent(recorder, required, err) return actual, true, err } if err != nil { @@ -187,7 +188,7 @@ func ApplyCSIDriver(ctx context.Context, client storageclientv1.CSIDriversGetter if sameSpec { // Update metadata by a simple Update call actual, err := client.CSIDrivers().Update(ctx, existingCopy, metav1.UpdateOptions{}) - reportUpdateEvent(recorder, required, err) + resourcehelper.ReportUpdateEvent(recorder, required, err) return actual, true, err } @@ -195,7 +196,7 @@ func ApplyCSIDriver(ctx context.Context, client storageclientv1.CSIDriversGetter existingCopy.ObjectMeta.ResourceVersion = "" // Spec is read-only after creation. Delete and re-create the object err = client.CSIDrivers().Delete(ctx, existingCopy.Name, metav1.DeleteOptions{}) - reportDeleteEvent(recorder, existingCopy, err, "Deleting CSIDriver to re-create it with updated parameters") + resourcehelper.ReportDeleteEvent(recorder, existingCopy, err, "Deleting CSIDriver to re-create it with updated parameters") if err != nil && !apierrors.IsNotFound(err) { return existing, false, err } @@ -210,7 +211,7 @@ func ApplyCSIDriver(ctx context.Context, client storageclientv1.CSIDriversGetter } else if err != nil { err = fmt.Errorf("failed to re-create CSIDriver %s: %s", existingCopy.Name, err) } - reportCreateEvent(recorder, existingCopy, err) + resourcehelper.ReportCreateEvent(recorder, existingCopy, err) return actual, true, err } @@ -242,7 +243,7 @@ func DeleteStorageClass(ctx context.Context, client storageclientv1.StorageClass if err != nil { return nil, false, err } - reportDeleteEvent(recorder, required, err) + resourcehelper.ReportDeleteEvent(recorder, required, err) return nil, true, nil } @@ -254,6 +255,6 @@ func DeleteCSIDriver(ctx context.Context, client storageclientv1.CSIDriversGette if err != nil { return nil, false, err } - reportDeleteEvent(recorder, required, err) + resourcehelper.ReportDeleteEvent(recorder, required, err) return nil, true, nil } diff --git a/vendor/github.com/openshift/library-go/pkg/operator/resource/resourceapply/unstructured.go b/vendor/github.com/openshift/library-go/pkg/operator/resource/resourceapply/unstructured.go index 1adb01aee..b17e484a8 100644 --- a/vendor/github.com/openshift/library-go/pkg/operator/resource/resourceapply/unstructured.go +++ b/vendor/github.com/openshift/library-go/pkg/operator/resource/resourceapply/unstructured.go @@ -4,10 +4,11 @@ import ( "context" "fmt" - "github.com/openshift/library-go/pkg/operator/events" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/client-go/dynamic" + + "github.com/openshift/library-go/pkg/operator/events" ) // ApplyKnownUnstructured applies few selected Unstructured types, where it semantic knowledge @@ -20,6 +21,10 @@ func ApplyKnownUnstructured(ctx context.Context, client dynamic.Interface, recor return ApplyPrometheusRule(ctx, client, recorder, obj) case schema.GroupKind{Group: "snapshot.storage.k8s.io", Kind: "VolumeSnapshotClass"}: return ApplyVolumeSnapshotClass(ctx, client, recorder, obj) + case schema.GroupKind{Group: "monitoring.coreos.com", Kind: "Alertmanager"}: + return ApplyAlertmanager(ctx, client, recorder, obj) + case schema.GroupKind{Group: "monitoring.coreos.com", Kind: "Prometheus"}: + return ApplyPrometheus(ctx, client, recorder, obj) } @@ -35,6 +40,10 @@ func DeleteKnownUnstructured(ctx context.Context, client dynamic.Interface, reco return DeletePrometheusRule(ctx, client, recorder, obj) case schema.GroupKind{Group: "snapshot.storage.k8s.io", Kind: "VolumeSnapshotClass"}: return DeleteVolumeSnapshotClass(ctx, client, recorder, obj) + case schema.GroupKind{Group: "monitoring.coreos.com", Kind: "Alertmanager"}: + return DeleteAlertmanager(ctx, client, recorder, obj) + case schema.GroupKind{Group: "monitoring.coreos.com", Kind: "Prometheus"}: + return DeletePrometheus(ctx, client, recorder, obj) } diff --git a/vendor/github.com/openshift/library-go/pkg/operator/resource/resourceapply/volumesnapshotclass.go b/vendor/github.com/openshift/library-go/pkg/operator/resource/resourceapply/volumesnapshotclass.go index 4c89e6529..763e03d5d 100644 --- a/vendor/github.com/openshift/library-go/pkg/operator/resource/resourceapply/volumesnapshotclass.go +++ b/vendor/github.com/openshift/library-go/pkg/operator/resource/resourceapply/volumesnapshotclass.go @@ -13,6 +13,7 @@ import ( "k8s.io/client-go/dynamic" "github.com/openshift/library-go/pkg/operator/events" + "github.com/openshift/library-go/pkg/operator/resource/resourcehelper" ) const ( @@ -124,6 +125,6 @@ func DeleteVolumeSnapshotClass(ctx context.Context, client dynamic.Interface, re if err != nil { return nil, false, err } - reportDeleteEvent(recorder, required, err) + resourcehelper.ReportDeleteEvent(recorder, required, err) return nil, true, nil } diff --git a/vendor/github.com/openshift/library-go/pkg/operator/resource/resourcehelper/event_helpers.go b/vendor/github.com/openshift/library-go/pkg/operator/resource/resourcehelper/event_helpers.go new file mode 100644 index 000000000..8e8ebbe96 --- /dev/null +++ b/vendor/github.com/openshift/library-go/pkg/operator/resource/resourcehelper/event_helpers.go @@ -0,0 +1,43 @@ +package resourcehelper + +import ( + "fmt" + "strings" + + "k8s.io/apimachinery/pkg/runtime" + + "github.com/openshift/library-go/pkg/operator/events" +) + +func ReportCreateEvent(recorder events.Recorder, obj runtime.Object, originalErr error) { + gvk := GuessObjectGroupVersionKind(obj) + if originalErr == nil { + recorder.Eventf(fmt.Sprintf("%sCreated", gvk.Kind), "Created %s because it was missing", FormatResourceForCLIWithNamespace(obj)) + return + } + recorder.Warningf(fmt.Sprintf("%sCreateFailed", gvk.Kind), "Failed to create %s: %v", FormatResourceForCLIWithNamespace(obj), originalErr) +} + +func ReportUpdateEvent(recorder events.Recorder, obj runtime.Object, originalErr error, details ...string) { + gvk := GuessObjectGroupVersionKind(obj) + switch { + case originalErr != nil: + recorder.Warningf(fmt.Sprintf("%sUpdateFailed", gvk.Kind), "Failed to update %s: %v", FormatResourceForCLIWithNamespace(obj), originalErr) + case len(details) == 0: + recorder.Eventf(fmt.Sprintf("%sUpdated", gvk.Kind), "Updated %s because it changed", FormatResourceForCLIWithNamespace(obj)) + default: + recorder.Eventf(fmt.Sprintf("%sUpdated", gvk.Kind), "Updated %s:\n%s", FormatResourceForCLIWithNamespace(obj), strings.Join(details, "\n")) + } +} + +func ReportDeleteEvent(recorder events.Recorder, obj runtime.Object, originalErr error, details ...string) { + gvk := GuessObjectGroupVersionKind(obj) + switch { + case originalErr != nil: + recorder.Warningf(fmt.Sprintf("%sDeleteFailed", gvk.Kind), "Failed to delete %s: %v", FormatResourceForCLIWithNamespace(obj), originalErr) + case len(details) == 0: + recorder.Eventf(fmt.Sprintf("%sDeleted", gvk.Kind), "Deleted %s", FormatResourceForCLIWithNamespace(obj)) + default: + recorder.Eventf(fmt.Sprintf("%sDeleted", gvk.Kind), "Deleted %s:\n%s", FormatResourceForCLIWithNamespace(obj), strings.Join(details, "\n")) + } +} diff --git a/vendor/github.com/openshift/library-go/pkg/operator/resource/resourcehelper/resource_helpers.go b/vendor/github.com/openshift/library-go/pkg/operator/resource/resourcehelper/resource_helpers.go index 43ea9111c..e89974790 100644 --- a/vendor/github.com/openshift/library-go/pkg/operator/resource/resourcehelper/resource_helpers.go +++ b/vendor/github.com/openshift/library-go/pkg/operator/resource/resourcehelper/resource_helpers.go @@ -63,6 +63,9 @@ func FormatResourceForCLI(obj runtime.Object) string { // GuessObjectGroupVersionKind returns a human readable for the passed runtime object. func GuessObjectGroupVersionKind(object runtime.Object) schema.GroupVersionKind { + if object == nil { + return schema.GroupVersionKind{Kind: ""} + } if gvk := object.GetObjectKind().GroupVersionKind(); len(gvk.Kind) > 0 { return gvk } diff --git a/vendor/github.com/openshift/library-go/pkg/operator/resourcesynccontroller/resourcesync_controller.go b/vendor/github.com/openshift/library-go/pkg/operator/resourcesynccontroller/resourcesync_controller.go index 030fce823..a9a512f88 100644 --- a/vendor/github.com/openshift/library-go/pkg/operator/resourcesynccontroller/resourcesync_controller.go +++ b/vendor/github.com/openshift/library-go/pkg/operator/resourcesynccontroller/resourcesync_controller.go @@ -4,6 +4,7 @@ import ( "context" "encoding/json" "fmt" + applyoperatorv1 "github.com/openshift/client-go/operator/applyconfigurations/operator/v1" "net/http" "sort" "strings" @@ -250,24 +251,26 @@ func (c *ResourceSyncController) Sync(ctx context.Context, syncCtx factory.SyncC } if len(errors) > 0 { - cond := operatorv1.OperatorCondition{ - Type: condition.ResourceSyncControllerDegradedConditionType, - Status: operatorv1.ConditionTrue, - Reason: "Error", - Message: v1helpers.NewMultiLineAggregate(errors).Error(), - } - if _, _, updateError := v1helpers.UpdateStatus(ctx, c.operatorConfigClient, v1helpers.UpdateConditionFn(cond)); updateError != nil { - return updateError + condition := applyoperatorv1.OperatorStatus(). + WithConditions(applyoperatorv1.OperatorCondition(). + WithType(condition.ResourceSyncControllerDegradedConditionType). + WithStatus(operatorv1.ConditionTrue). + WithReason("Error"). + WithMessage(v1helpers.NewMultiLineAggregate(errors).Error())) + updateErr := c.operatorConfigClient.ApplyOperatorStatus(ctx, factory.ControllerFieldManager(c.name, "reportDegraded"), condition) + if updateErr != nil { + return updateErr } return nil } - cond := operatorv1.OperatorCondition{ - Type: condition.ResourceSyncControllerDegradedConditionType, - Status: operatorv1.ConditionFalse, - } - if _, _, updateError := v1helpers.UpdateStatus(ctx, c.operatorConfigClient, v1helpers.UpdateConditionFn(cond)); updateError != nil { - return updateError + condition := applyoperatorv1.OperatorStatus(). + WithConditions(applyoperatorv1.OperatorCondition(). + WithType(condition.ResourceSyncControllerDegradedConditionType). + WithStatus(operatorv1.ConditionFalse)) + updateErr := c.operatorConfigClient.ApplyOperatorStatus(ctx, factory.ControllerFieldManager(c.name, "reportDegraded"), condition) + if updateErr != nil { + return updateErr } return nil } diff --git a/vendor/github.com/openshift/library-go/pkg/operator/staticresourcecontroller/static_resource_controller.go b/vendor/github.com/openshift/library-go/pkg/operator/staticresourcecontroller/static_resource_controller.go index ce1641dea..14d046f66 100644 --- a/vendor/github.com/openshift/library-go/pkg/operator/staticresourcecontroller/static_resource_controller.go +++ b/vendor/github.com/openshift/library-go/pkg/operator/staticresourcecontroller/static_resource_controller.go @@ -7,6 +7,8 @@ import ( "strings" "time" + applyoperatorv1 "github.com/openshift/client-go/operator/applyconfigurations/operator/v1" + configv1 "github.com/openshift/api/config/v1" "github.com/openshift/library-go/pkg/operator/resource/resourceread" admissionregistrationv1 "k8s.io/api/admissionregistration/v1" @@ -296,12 +298,14 @@ func (c *StaticResourceController) Sync(ctx context.Context, syncContext factory } else { message = "the operator didn't specify what preconditions are missing" } - if _, _, updateErr := v1helpers.UpdateStatus(ctx, c.operatorClient, v1helpers.UpdateConditionFn(operatorv1.OperatorCondition{ - Type: fmt.Sprintf("%sDegraded", c.name), - Status: operatorv1.ConditionTrue, - Reason: "PreconditionNotReady", - Message: message, - })); updateErr != nil { + condition := applyoperatorv1.OperatorStatus(). + WithConditions(applyoperatorv1.OperatorCondition(). + WithType(fmt.Sprintf("%sDegraded", c.name)). + WithStatus(operatorv1.ConditionTrue). + WithReason("PreconditionNotReady"). + WithMessage(message)) + updateErr := c.operatorClient.ApplyOperatorStatus(ctx, factory.ControllerFieldManager(c.name, "reportDegraded"), condition) + if updateErr != nil { return updateErr } return err @@ -341,28 +345,30 @@ func (c *StaticResourceController) Sync(ctx context.Context, syncContext factory } } - cnd := operatorv1.OperatorCondition{ - Type: fmt.Sprintf("%sDegraded", c.name), - Status: operatorv1.ConditionFalse, - Reason: "AsExpected", - Message: "", - } + cnd := applyoperatorv1.OperatorCondition(). + WithType(fmt.Sprintf("%sDegraded", c.name)). + WithStatus(operatorv1.ConditionFalse). + WithReason("AsExpected"). + WithMessage("") + if len(errors) > 0 { message := "" for _, err := range errors { message = message + err.Error() + "\n" } - cnd.Status = operatorv1.ConditionTrue - cnd.Message = message - cnd.Reason = "SyncError" + cnd = cnd. + WithStatus(operatorv1.ConditionTrue). + WithMessage(message). + WithReason("SyncError") if c.ignoreNotFoundOnCreate && len(errors) == notFoundErrorsCount { // all errors were NotFound - cnd.Status = operatorv1.ConditionFalse + cnd = cnd.WithStatus(operatorv1.ConditionFalse) } } - _, _, err = v1helpers.UpdateStatus(ctx, c.operatorClient, v1helpers.UpdateConditionFn(cnd)) + status := applyoperatorv1.OperatorStatus().WithConditions(cnd) + err = c.operatorClient.ApplyOperatorStatus(ctx, factory.ControllerFieldManager(c.name, "reportDegraded"), status) if err != nil { errors = append(errors, err) } diff --git a/vendor/github.com/openshift/library-go/pkg/operator/v1helpers/canonicalize.go b/vendor/github.com/openshift/library-go/pkg/operator/v1helpers/canonicalize.go new file mode 100644 index 000000000..d4747ef4c --- /dev/null +++ b/vendor/github.com/openshift/library-go/pkg/operator/v1helpers/canonicalize.go @@ -0,0 +1,108 @@ +package v1helpers + +import ( + "fmt" + operatorv1 "github.com/openshift/api/operator/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/util/json" + "k8s.io/utils/ptr" + "slices" + "strings" + + applyoperatorv1 "github.com/openshift/client-go/operator/applyconfigurations/operator/v1" +) + +// ToStaticPodOperator returns the equivalent typed kind for the applyconfiguration. Due to differences in serialization like +// omitempty on strings versus pointers, the returned values can be slightly different. This is an expensive way to diff the +// result, but it is an effective one. +func ToStaticPodOperator(in *applyoperatorv1.StaticPodOperatorStatusApplyConfiguration) (*operatorv1.StaticPodOperatorStatus, error) { + if in == nil { + return nil, nil + } + jsonBytes, err := json.Marshal(in) + if err != nil { + return nil, fmt.Errorf("unable to serialize: %w", err) + } + + ret := &operatorv1.StaticPodOperatorStatus{} + if err := json.Unmarshal(jsonBytes, ret); err != nil { + return nil, fmt.Errorf("unable to deserialize: %w", err) + } + + return ret, nil +} + +func SetApplyConditionsLastTransitionTime(newConditions *[]applyoperatorv1.OperatorConditionApplyConfiguration, oldConditions []applyoperatorv1.OperatorConditionApplyConfiguration) { + if newConditions == nil { + return + } + + now := metav1.Now() + for i := range *newConditions { + newCondition := (*newConditions)[i] + + // if the condition status is the same, then the lastTransitionTime doesn't change + if existingCondition := FindApplyCondition(oldConditions, newCondition.Type); existingCondition != nil && ptr.Equal(existingCondition.Status, newCondition.Status) { + newCondition.LastTransitionTime = existingCondition.LastTransitionTime + } + + // backstop to handle upgrade case too. If the newCondition doesn't have a lastTransitionTime it needs something + if newCondition.LastTransitionTime == nil { + newCondition.LastTransitionTime = &now + } + + (*newConditions)[i] = newCondition + } +} + +func FindApplyCondition(haystack []applyoperatorv1.OperatorConditionApplyConfiguration, conditionType *string) *applyoperatorv1.OperatorConditionApplyConfiguration { + for i := range haystack { + curr := haystack[i] + if ptr.Equal(curr.Type, conditionType) { + return &curr + } + } + + return nil +} + +func CanonicalizeStaticPodOperatorStatus(obj *applyoperatorv1.StaticPodOperatorStatusApplyConfiguration) { + if obj == nil { + return + } + CanonicalizeOperatorStatus(&obj.OperatorStatusApplyConfiguration) + slices.SortStableFunc(obj.NodeStatuses, CompareNodeStatusByNode) +} + +func CanonicalizeOperatorStatus(obj *applyoperatorv1.OperatorStatusApplyConfiguration) { + if obj == nil { + return + } + slices.SortStableFunc(obj.Conditions, CompareOperatorConditionByType) + slices.SortStableFunc(obj.Generations, CompareGenerationStatusByKeys) +} + +func CompareOperatorConditionByType(a, b applyoperatorv1.OperatorConditionApplyConfiguration) int { + return strings.Compare(ptr.Deref(a.Type, ""), ptr.Deref(b.Type, "")) +} + +func CompareGenerationStatusByKeys(a, b applyoperatorv1.GenerationStatusApplyConfiguration) int { + if c := strings.Compare(ptr.Deref(a.Group, ""), ptr.Deref(b.Group, "")); c != 0 { + return c + } + if c := strings.Compare(ptr.Deref(a.Resource, ""), ptr.Deref(b.Resource, "")); c != 0 { + return c + } + if c := strings.Compare(ptr.Deref(a.Namespace, ""), ptr.Deref(b.Namespace, "")); c != 0 { + return c + } + if c := strings.Compare(ptr.Deref(a.Name, ""), ptr.Deref(b.Name, "")); c != 0 { + return c + } + + return 0 +} + +func CompareNodeStatusByNode(a, b applyoperatorv1.NodeStatusApplyConfiguration) int { + return strings.Compare(ptr.Deref(a.NodeName, ""), ptr.Deref(b.NodeName, "")) +} diff --git a/vendor/github.com/openshift/library-go/pkg/operator/v1helpers/interfaces.go b/vendor/github.com/openshift/library-go/pkg/operator/v1helpers/interfaces.go index 1dd9c641a..68201864b 100644 --- a/vendor/github.com/openshift/library-go/pkg/operator/v1helpers/interfaces.go +++ b/vendor/github.com/openshift/library-go/pkg/operator/v1helpers/interfaces.go @@ -3,7 +3,10 @@ package v1helpers import ( "context" + "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" + operatorv1 "github.com/openshift/api/operator/v1" + applyoperatorv1 "github.com/openshift/client-go/operator/applyconfigurations/operator/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/client-go/tools/cache" ) @@ -20,6 +23,9 @@ type OperatorClient interface { UpdateOperatorSpec(ctx context.Context, oldResourceVersion string, in *operatorv1.OperatorSpec) (out *operatorv1.OperatorSpec, newResourceVersion string, err error) // UpdateOperatorStatus updates the status of the operator, assuming the given resource version. UpdateOperatorStatus(ctx context.Context, oldResourceVersion string, in *operatorv1.OperatorStatus) (out *operatorv1.OperatorStatus, err error) + + ApplyOperatorSpec(ctx context.Context, fieldManager string, applyConfiguration *applyoperatorv1.OperatorSpecApplyConfiguration) (err error) + ApplyOperatorStatus(ctx context.Context, fieldManager string, applyConfiguration *applyoperatorv1.OperatorStatusApplyConfiguration) (err error) } type StaticPodOperatorClient interface { @@ -34,6 +40,9 @@ type StaticPodOperatorClient interface { UpdateStaticPodOperatorStatus(ctx context.Context, resourceVersion string, in *operatorv1.StaticPodOperatorStatus) (out *operatorv1.StaticPodOperatorStatus, err error) // UpdateStaticPodOperatorSpec updates the spec, assuming the given resource version. UpdateStaticPodOperatorSpec(ctx context.Context, resourceVersion string, in *operatorv1.StaticPodOperatorSpec) (out *operatorv1.StaticPodOperatorSpec, newResourceVersion string, err error) + + ApplyStaticPodOperatorSpec(ctx context.Context, fieldManager string, applyConfiguration *applyoperatorv1.StaticPodOperatorSpecApplyConfiguration) (err error) + ApplyStaticPodOperatorStatus(ctx context.Context, fieldManager string, applyConfiguration *applyoperatorv1.StaticPodOperatorStatusApplyConfiguration) (err error) } type OperatorClientWithFinalizers interface { @@ -43,3 +52,11 @@ type OperatorClientWithFinalizers interface { // RemoveFinalizer removes a finalizer from the operator CR, if it is there. No-op otherwise. RemoveFinalizer(ctx context.Context, finalizer string) error } + +type Foo interface { + ExtractOperatorSpec(fieldManager string) (*applyoperatorv1.OperatorSpecApplyConfiguration, error) + ExtractOperatorStatus(fieldManager string) (*applyoperatorv1.OperatorStatusApplyConfiguration, error) +} + +type OperatorSpecExtractor func(obj *unstructured.Unstructured, fieldManager string) (*applyoperatorv1.OperatorSpecApplyConfiguration, error) +type OperatorStatusExtractor func(obj *unstructured.Unstructured, fieldManager string) (*applyoperatorv1.OperatorStatusApplyConfiguration, error) diff --git a/vendor/github.com/openshift/library-go/pkg/operator/v1helpers/test_helpers.go b/vendor/github.com/openshift/library-go/pkg/operator/v1helpers/test_helpers.go index 7fa64719f..38cbba1bc 100644 --- a/vendor/github.com/openshift/library-go/pkg/operator/v1helpers/test_helpers.go +++ b/vendor/github.com/openshift/library-go/pkg/operator/v1helpers/test_helpers.go @@ -6,6 +6,7 @@ import ( "strconv" "time" + applyoperatorv1 "github.com/openshift/client-go/operator/applyconfigurations/operator/v1" corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -14,8 +15,10 @@ import ( "k8s.io/client-go/kubernetes" corev1listers "k8s.io/client-go/listers/core/v1" "k8s.io/client-go/tools/cache" + "k8s.io/utils/ptr" operatorv1 "github.com/openshift/api/operator/v1" + v1 "github.com/openshift/api/operator/v1" ) // NewFakeSharedIndexInformer returns a fake shared index informer, suitable to use in static pod controller unit tests. @@ -155,6 +158,22 @@ func (c *fakeStaticPodOperatorClient) UpdateStaticPodOperatorSpec(ctx context.Co return c.fakeStaticPodOperatorSpec, c.resourceVersion, nil } +func (c *fakeStaticPodOperatorClient) ApplyOperatorSpec(ctx context.Context, fieldManager string, applyConfiguration *applyoperatorv1.OperatorSpecApplyConfiguration) (err error) { + return nil +} + +func (c *fakeStaticPodOperatorClient) ApplyOperatorStatus(ctx context.Context, fieldManager string, applyConfiguration *applyoperatorv1.OperatorStatusApplyConfiguration) (err error) { + return nil +} + +func (c *fakeStaticPodOperatorClient) ApplyStaticPodOperatorSpec(ctx context.Context, fieldManager string, applyConfiguration *applyoperatorv1.StaticPodOperatorSpecApplyConfiguration) (err error) { + return nil +} + +func (c *fakeStaticPodOperatorClient) ApplyStaticPodOperatorStatus(ctx context.Context, fieldManager string, applyConfiguration *applyoperatorv1.StaticPodOperatorStatusApplyConfiguration) (err error) { + return nil +} + func (c *fakeStaticPodOperatorClient) GetOperatorState() (*operatorv1.OperatorSpec, *operatorv1.OperatorStatus, string, error) { return &c.fakeStaticPodOperatorSpec.OperatorSpec, &c.fakeStaticPodOperatorStatus.OperatorStatus, c.resourceVersion, nil } @@ -283,6 +302,15 @@ func (c *fakeOperatorClient) UpdateOperatorSpec(ctx context.Context, resourceVer return c.fakeOperatorSpec, c.resourceVersion, nil } +func (c *fakeOperatorClient) ApplyOperatorSpec(ctx context.Context, fieldManager string, applyConfiguration *applyoperatorv1.OperatorSpecApplyConfiguration) (err error) { + return nil +} + +func (c *fakeOperatorClient) ApplyOperatorStatus(ctx context.Context, fieldManager string, applyConfiguration *applyoperatorv1.OperatorStatusApplyConfiguration) (err error) { + c.fakeOperatorStatus = convertOperatorStatusApplyConfiguration(applyConfiguration) + return nil +} + func (c *fakeOperatorClient) EnsureFinalizer(ctx context.Context, finalizer string) error { if c.fakeObjectMeta == nil { c.fakeObjectMeta = &metav1.ObjectMeta{} @@ -311,3 +339,35 @@ func (c *fakeOperatorClient) RemoveFinalizer(ctx context.Context, finalizer stri func (c *fakeOperatorClient) SetObjectMeta(meta *metav1.ObjectMeta) { c.fakeObjectMeta = meta } + +func convertOperatorStatusApplyConfiguration(applyConfiguration *applyoperatorv1.OperatorStatusApplyConfiguration) *v1.OperatorStatus { + status := &v1.OperatorStatus{ + ObservedGeneration: ptr.Deref(applyConfiguration.ObservedGeneration, 0), + Version: ptr.Deref(applyConfiguration.Version, ""), + ReadyReplicas: ptr.Deref(applyConfiguration.ReadyReplicas, 0), + } + + for _, condition := range applyConfiguration.Conditions { + newCondition := operatorv1.OperatorCondition{ + Type: ptr.Deref(condition.Type, ""), + Status: ptr.Deref(condition.Status, ""), + Reason: ptr.Deref(condition.Reason, ""), + Message: ptr.Deref(condition.Message, ""), + } + status.Conditions = append(status.Conditions, newCondition) + } + + for _, generation := range applyConfiguration.Generations { + newGeneration := operatorv1.GenerationStatus{ + Group: ptr.Deref(generation.Group, ""), + Resource: ptr.Deref(generation.Resource, ""), + Namespace: ptr.Deref(generation.Namespace, ""), + Name: ptr.Deref(generation.Name, ""), + LastGeneration: ptr.Deref(generation.LastGeneration, 0), + Hash: ptr.Deref(generation.Hash, ""), + } + status.Generations = append(status.Generations, newGeneration) + } + + return status +} diff --git a/vendor/modules.txt b/vendor/modules.txt index 86ec6e5a0..97e4e0653 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -162,7 +162,7 @@ github.com/modern-go/reflect2 # github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 ## explicit github.com/munnerz/goautoneg -# github.com/openshift/api v0.0.0-20240918014254-07bccfd9266f +# github.com/openshift/api v0.0.0-20240926031850-46b94866c024 ## explicit; go 1.22.0 github.com/openshift/api github.com/openshift/api/annotations @@ -245,7 +245,7 @@ github.com/openshift/build-machinery-go/make/targets/golang github.com/openshift/build-machinery-go/make/targets/openshift github.com/openshift/build-machinery-go/make/targets/openshift/operator github.com/openshift/build-machinery-go/scripts -# github.com/openshift/client-go v0.0.0-20240528061634-b054aa794d87 +# github.com/openshift/client-go v0.0.0-20240925210910-aaed17e719c5 ## explicit; go 1.22.0 github.com/openshift/client-go/config/applyconfigurations/config/v1 github.com/openshift/client-go/config/applyconfigurations/config/v1alpha1 @@ -281,7 +281,7 @@ github.com/openshift/client-go/operator/informers/externalversions/operator/v1 github.com/openshift/client-go/operator/informers/externalversions/operator/v1alpha1 github.com/openshift/client-go/operator/listers/operator/v1 github.com/openshift/client-go/operator/listers/operator/v1alpha1 -# github.com/openshift/library-go v0.0.0-20240715191351-e0aa70d55678 +# github.com/openshift/library-go v0.0.0-20240925155829-3c41fd1dea0b ## explicit; go 1.22.0 github.com/openshift/library-go/pkg/authorization/hardcodedauthorizer github.com/openshift/library-go/pkg/certs @@ -307,6 +307,7 @@ github.com/openshift/library-go/pkg/operator/csi/csiconfigobservercontroller github.com/openshift/library-go/pkg/operator/csi/csidrivercontrollerservicecontroller github.com/openshift/library-go/pkg/operator/deploymentcontroller github.com/openshift/library-go/pkg/operator/events +github.com/openshift/library-go/pkg/operator/genericoperatorclient github.com/openshift/library-go/pkg/operator/loglevel github.com/openshift/library-go/pkg/operator/management github.com/openshift/library-go/pkg/operator/managementstatecontroller From e45fbfff6e383d9e17639f20ffee1766341e1175 Mon Sep 17 00:00:00 2001 From: Fabio Bertinatto Date: Thu, 26 Sep 2024 17:21:35 -0300 Subject: [PATCH 13/13] Fixes --- pkg/operator/csidriveroperator/crcontroller.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/pkg/operator/csidriveroperator/crcontroller.go b/pkg/operator/csidriveroperator/crcontroller.go index 385e872d8..42947578b 100644 --- a/pkg/operator/csidriveroperator/crcontroller.go +++ b/pkg/operator/csidriveroperator/crcontroller.go @@ -222,6 +222,11 @@ func (c *CSIDriverOperatorCRController) syncConditions(ctx context.Context, cond WithReason("WaitForOperator"). WithMessage(fmt.Sprintf("Waiting for %s operator to report status", c.name)) } + } else { + progressingCnd = progressingCnd. + WithReason(clusterCSIDriverProgressingCnd.Reason). + WithStatus(clusterCSIDriverProgressingCnd.Status). + WithMessage(clusterCSIDriverProgressingCnd.Message) } // Upgradeable condition @@ -243,6 +248,12 @@ func (c *CSIDriverOperatorCRController) syncConditions(ctx context.Context, cond clusterCSIDriverDegradedCnd := status.UnionCondition(operatorapi.OperatorStatusTypeDegraded, operatorapi.ConditionFalse, nil, conditions...) if clusterCSIDriverDegradedCnd.Status == operatorapi.ConditionUnknown { degradedCnd = degradedCnd.WithStatus(operatorapi.ConditionFalse) + } else { + degradedCnd = degradedCnd. + WithStatus(clusterCSIDriverDegradedCnd.Status). + WithReason(clusterCSIDriverDegradedCnd.Reason). + WithMessage(clusterCSIDriverDegradedCnd.Message) + } // Create a partial status with conditions and newGeneration