Skip to content

Commit 6711c59

Browse files
authored
feat: Create argocd-cmd-params-cm configMap (argoproj-labs#1756)
Signed-off-by: Rizwana777 <rizwananaaz177@gmail.com>
1 parent 4591280 commit 6711c59

File tree

9 files changed

+84
-2
lines changed

9 files changed

+84
-2
lines changed

api/v1beta1/argocd_types.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -954,6 +954,9 @@ type ArgoCDSpec struct {
954954

955955
// AggregatedClusterRoles will allow users to have aggregated ClusterRoles for a cluster scoped instance.
956956
AggregatedClusterRoles bool `json:"aggregatedClusterRoles,omitempty"`
957+
958+
// CmdParams specifies command-line parameters for the Argo CD components.
959+
CmdParams map[string]string `json:"cmdParams,omitempty"`
957960
}
958961

959962
const (

api/v1beta1/zz_generated.deepcopy.go

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bundle/manifests/argocd-operator.clusterserviceversion.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ metadata:
247247
capabilities: Deep Insights
248248
categories: Integration & Delivery
249249
certified: "false"
250-
createdAt: "2025-05-14T11:29:42Z"
250+
createdAt: "2025-06-18T07:38:13Z"
251251
description: Argo CD is a declarative, GitOps continuous delivery tool for Kubernetes.
252252
operators.operatorframework.io/builder: operator-sdk-v1.35.0
253253
operators.operatorframework.io/project_layout: go.kubebuilder.io/v4

bundle/manifests/argoproj.io_argocds.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9651,6 +9651,12 @@ spec:
96519651
required:
96529652
- content
96539653
type: object
9654+
cmdParams:
9655+
additionalProperties:
9656+
type: string
9657+
description: CmdParams specifies command-line parameters for the Argo
9658+
CD components.
9659+
type: object
96549660
configManagementPlugins:
96559661
description: 'Deprecated: ConfigManagementPlugins field is no longer
96569662
supported. Argo CD now requires plugins to be defined as sidecar

common/defaults.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,9 @@ vs-ssh.visualstudio.com ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC7Hr1oTWqNqOlzGJOf
297297

298298
// NotificationsControllerMetricsPort is the port that is used to expose notifications controller metrics.
299299
NotificationsControllerMetricsPort = 9001
300+
301+
// ArgoCDCmdParamsConfigMapName is the upstream hard-coded ArgoCD command params ConfigMap name.
302+
ArgoCDCmdParamsConfigMapName = "argocd-cmd-params-cm"
300303
)
301304

302305
// DefaultLabels returns the default set of labels for controllers.

config/crd/bases/argoproj.io_argocds.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9640,6 +9640,12 @@ spec:
96409640
required:
96419641
- content
96429642
type: object
9643+
cmdParams:
9644+
additionalProperties:
9645+
type: string
9646+
description: CmdParams specifies command-line parameters for the Argo
9647+
CD components.
9648+
type: object
96439649
configManagementPlugins:
96449650
description: 'Deprecated: ConfigManagementPlugins field is no longer
96459651
supported. Argo CD now requires plugins to be defined as sidecar

controllers/argocd/configmap.go

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,10 @@ func (r *ReconcileArgoCD) reconcileConfigMaps(cr *argoproj.ArgoCD, useTLSForRedi
321321
return err
322322
}
323323

324+
if err := r.reconcileArgoCmdParamsConfigMap(cr); err != nil {
325+
return err
326+
}
327+
324328
return r.reconcileGPGKeysConfigMap(cr)
325329
}
326330

@@ -789,3 +793,50 @@ func (r *ReconcileArgoCD) reconcileGPGKeysConfigMap(cr *argoproj.ArgoCD) error {
789793
argoutil.LogResourceCreation(log, cm)
790794
return r.Client.Create(context.TODO(), cm)
791795
}
796+
797+
// reconcileArgoCmdParamsConfigMap will ensure that the ConfigMap containing command line parameters for ArgoCD is present.
798+
func (r *ReconcileArgoCD) reconcileArgoCmdParamsConfigMap(cr *argoproj.ArgoCD) error {
799+
cm := newConfigMapWithName(common.ArgoCDCmdParamsConfigMapName, cr)
800+
cm.Data = make(map[string]string)
801+
802+
// Only set data if spec.cmdParams is defined
803+
if len(cr.Spec.CmdParams) > 0 {
804+
for k, v := range cr.Spec.CmdParams {
805+
cm.Data[k] = v
806+
}
807+
}
808+
809+
if err := controllerutil.SetControllerReference(cr, cm, r.Scheme); err != nil {
810+
return err
811+
}
812+
existingCM := &corev1.ConfigMap{}
813+
if argoutil.IsObjectFound(r.Client, cr.Namespace, cm.Name, existingCM) {
814+
changed := false
815+
816+
// Compare only if data is being managed
817+
if len(cm.Data) > 0 && !reflect.DeepEqual(cm.Data, existingCM.Data) {
818+
existingCM.Data = cm.Data
819+
changed = true
820+
}
821+
// Check OwnerReferences
822+
var refChanged bool
823+
var err error
824+
if refChanged, err = modifyOwnerReferenceIfNeeded(cr, existingCM, r.Scheme); err != nil {
825+
return err
826+
}
827+
if refChanged {
828+
changed = true
829+
}
830+
if changed {
831+
explanation := "updating data"
832+
if refChanged {
833+
explanation += ", owner reference"
834+
}
835+
argoutil.LogResourceUpdate(log, existingCM, explanation)
836+
return r.Update(context.TODO(), existingCM)
837+
}
838+
return nil // Do nothing as there is no change in the configmap.
839+
}
840+
argoutil.LogResourceCreation(log, cm)
841+
return r.Create(context.TODO(), cm)
842+
}

deploy/olm-catalog/argocd-operator/0.14.0/argocd-operator.v0.14.0.clusterserviceversion.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ metadata:
247247
capabilities: Deep Insights
248248
categories: Integration & Delivery
249249
certified: "false"
250-
createdAt: "2025-05-14T11:29:42Z"
250+
createdAt: "2025-06-18T07:38:13Z"
251251
description: Argo CD is a declarative, GitOps continuous delivery tool for Kubernetes.
252252
operators.operatorframework.io/builder: operator-sdk-v1.35.0
253253
operators.operatorframework.io/project_layout: go.kubebuilder.io/v4

deploy/olm-catalog/argocd-operator/0.14.0/argoproj.io_argocds.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9651,6 +9651,12 @@ spec:
96519651
required:
96529652
- content
96539653
type: object
9654+
cmdParams:
9655+
additionalProperties:
9656+
type: string
9657+
description: CmdParams specifies command-line parameters for the Argo
9658+
CD components.
9659+
type: object
96549660
configManagementPlugins:
96559661
description: 'Deprecated: ConfigManagementPlugins field is no longer
96569662
supported. Argo CD now requires plugins to be defined as sidecar

0 commit comments

Comments
 (0)