diff --git a/api/v1/types.go b/api/v1/types.go index e32e921e7..679d0070e 100644 --- a/api/v1/types.go +++ b/api/v1/types.go @@ -42,6 +42,9 @@ type ObservabilityComponentType string // ClientType - the type of the client type ClientType string +// AccType - the type of the client +type AccType string + const ( // Replication - placeholder for replication constant Replication ModuleType = "replication" diff --git a/controllers/acc_controller.go b/controllers/acc_controller.go index db49fbdbf..4415ee41f 100644 --- a/controllers/acc_controller.go +++ b/controllers/acc_controller.go @@ -84,12 +84,18 @@ const ( // AccFinalizerName - the name of the finalizer AccFinalizerName = "finalizer.dell.com" + + // AccVersion + AccVersion = "v1.0.0" ) var ( accdMutex sync.RWMutex accConfigVersionKey = fmt.Sprintf("%s/%s", AccMetadataPrefix, "ApexConnectivityClientConfigVersion") + // AccVersionKey + AccVersionKey = fmt.Sprintf("%s/%s", AccMetadataPrefix, "AccVersion") + // AccStopWatch - watcher stop handle AccStopWatch = make(chan struct{}) ) @@ -204,7 +210,6 @@ func (r *ApexConnectivityClientReconciler) Reconcile(ctx context.Context, req ct syncErr := r.SyncACC(ctx, *acc, *op) if syncErr == nil && !requeue.Requeue { log.Infof("ACC --> SyncACC nil") - //if err = DeployApexConnectivityClient(ctx, false, *op, *acc, crc); err != nil { if err = utils.UpdateAccStatus(ctx, acc, r, newStatus); err != nil { log.Error(err, "Failed to update CR status") return utils.LogBannerAndReturn(reconcile.Result{Requeue: true}, err) @@ -400,12 +405,15 @@ func applyAccConfigVersionAnnotations(ctx context.Context, instance *csmv1.ApexC log := logger.GetLogger(ctx) // If client has not been initialized yet, we first annotate the client with the config version annotation - annotations := instance.GetAnnotations() isUpdated := false if annotations == nil { annotations = make(map[string]string) } + + annotations[AccVersionKey] = AccVersion + instance.SetAnnotations(annotations) + if _, ok := annotations[accConfigVersionKey]; !ok { annotations[accConfigVersionKey] = instance.Spec.Client.ConfigVersion isUpdated = true @@ -508,8 +516,7 @@ func (r *ApexConnectivityClientReconciler) SyncACC(ctx context.Context, cr csmv1 } apexName := "ApexConnectivityClient" - - // sync statefulset + // sync StatefulSet if err = statefulset.SyncStatefulSet(ctx, controller.StatefulSet, cluster.ClusterK8sClient, apexName); err != nil { return err } diff --git a/operatorconfig/clientconfig/apexconnectivityclient/v1.0.0/statefulset.yaml b/operatorconfig/clientconfig/apexconnectivityclient/v1.0.0/statefulset.yaml index 632dfc45e..8531d9492 100644 --- a/operatorconfig/clientconfig/apexconnectivityclient/v1.0.0/statefulset.yaml +++ b/operatorconfig/clientconfig/apexconnectivityclient/v1.0.0/statefulset.yaml @@ -35,10 +35,10 @@ rules: verbs: ["get", "list", "watch"] - apiGroups: [""] resources: ["persistentvolumeclaims"] - verbs: ["list", "watch"] + verbs: ["list", "watch" "update"] - apiGroups: [""] resources: ["persistentvolumes"] - verbs: ["list", "watch"] + verbs: ["list", "watch" "create" "update" "delete"] - apiGroups: ["storage.k8s.io"] resources: ["storageclasses"] verbs: ["list", "watch", "create", "delete"] @@ -47,7 +47,7 @@ rules: verbs: ["list", "watch"] - apiGroups: ["apps"] resources: ["statefulsets"] - verbs: ["list", "watch"] + verbs: ["list", "watch" "update" "patch"] - apiGroups: ["apps"] resources: ["daemonsets"] verbs: ["list", "watch"] diff --git a/pkg/drivers/commonconfig.go b/pkg/drivers/commonconfig.go index b5e0c2cdc..a15cbbd50 100644 --- a/pkg/drivers/commonconfig.go +++ b/pkg/drivers/commonconfig.go @@ -31,9 +31,6 @@ import ( ) const ( - // AccManifest - deployment resources for Apex Connectivity Client - AccManifest string = "statefulset.yaml" - // AccNamespace - deployment namespace AccNamespace string = "" @@ -560,7 +557,6 @@ func GetCSIDriver(ctx context.Context, cr csmv1.ContainerStorageModule, operator // ModifyApexConnectivityClientCR - update the custom resource func ModifyApexConnectivityClientCR(yamlString string, cr csmv1.ApexConnectivityClient) string { - fmt.Println("ACC --> Inside ModifyApexConnectivityClientCR") namespace := "" aggregatorURL := AggregatorURLDefault connectivityClientImage := ""