diff --git a/api/osko/v1alpha1/alertmanagerconfig_types.go b/api/osko/v1alpha1/alertmanagerconfig_types.go index 8388568..46abbc1 100644 --- a/api/osko/v1alpha1/alertmanagerconfig_types.go +++ b/api/osko/v1alpha1/alertmanagerconfig_types.go @@ -7,7 +7,7 @@ import ( // AlertManagerConfigSpec defines the desired state of AlertManagerConfig type AlertManagerConfigSpec struct { - SecretRef v1.SecretReference `json:"secretRef,omitempty"` + ConfigSecretRef v1.SecretReference `json:"configSecretRef,omitempty"` } // AlertManagerConfigStatus defines the observed state of AlertManagerConfig diff --git a/api/osko/v1alpha1/zz_generated.deepcopy.go b/api/osko/v1alpha1/zz_generated.deepcopy.go index 2f6f279..be9c608 100644 --- a/api/osko/v1alpha1/zz_generated.deepcopy.go +++ b/api/osko/v1alpha1/zz_generated.deepcopy.go @@ -72,7 +72,7 @@ func (in *AlertManagerConfigList) DeepCopyObject() runtime.Object { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *AlertManagerConfigSpec) DeepCopyInto(out *AlertManagerConfigSpec) { *out = *in - out.SecretRef = in.SecretRef + out.ConfigSecretRef = in.ConfigSecretRef } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AlertManagerConfigSpec. diff --git a/config/crd/bases/osko.dev_alertmanagerconfigs.yaml b/config/crd/bases/osko.dev_alertmanagerconfigs.yaml index cc51ea7..22520f0 100644 --- a/config/crd/bases/osko.dev_alertmanagerconfigs.yaml +++ b/config/crd/bases/osko.dev_alertmanagerconfigs.yaml @@ -49,7 +49,7 @@ spec: spec: description: AlertManagerConfigSpec defines the desired state of AlertManagerConfig properties: - secretRef: + configSecretRef: description: |- SecretReference represents a Secret Reference. It has enough information to retrieve secret in any namespace diff --git a/internal/controller/osko/alertmanagerconfig_controller.go b/internal/controller/osko/alertmanagerconfig_controller.go index b00ab8a..2a66014 100644 --- a/internal/controller/osko/alertmanagerconfig_controller.go +++ b/internal/controller/osko/alertmanagerconfig_controller.go @@ -85,11 +85,11 @@ func (r *AlertManagerConfigReconciler) Reconcile(ctx context.Context, req ctrl.R return ctrl.Result{}, err } - if amc.Spec.SecretRef.Namespace == "" { - amc.Spec.SecretRef.Namespace = req.Namespace + if amc.Spec.ConfigSecretRef.Namespace == "" { + amc.Spec.ConfigSecretRef.Namespace = req.Namespace } - err = r.Get(ctx, client.ObjectKey{Namespace: amc.Spec.SecretRef.Namespace, Name: amc.Spec.SecretRef.Name}, secret) + err = r.Get(ctx, client.ObjectKey{Namespace: amc.Spec.ConfigSecretRef.Namespace, Name: amc.Spec.ConfigSecretRef.Name}, secret) if err != nil { if apierrors.IsNotFound(err) { if err = utils.UpdateStatus(ctx, amc, r.Client, "Ready", metav1.ConditionFalse, "Secret from secretRef not found"); err != nil { @@ -150,12 +150,12 @@ func (r *AlertManagerConfigReconciler) findObjectsForSecret() func(ctx context.C log.Error(err, errGetAMC) return []reconcile.Request{} } - if amc.Spec.SecretRef.Namespace == "" { - amc.Spec.SecretRef.Namespace = a.GetNamespace() + if amc.Spec.ConfigSecretRef.Namespace == "" { + amc.Spec.ConfigSecretRef.Namespace = a.GetNamespace() } secretNamespacedName := types.NamespacedName{ - Name: amc.Spec.SecretRef.Name, - Namespace: amc.Spec.SecretRef.Namespace, + Name: amc.Spec.ConfigSecretRef.Name, + Namespace: amc.Spec.ConfigSecretRef.Namespace, } return []reconcile.Request{{NamespacedName: secretNamespacedName}}