Skip to content

Commit c6b4690

Browse files
nmiraschRizwana777
andauthored
feat: Create argocd-cmd-params-cm configMap (#1756) (#1762)
(cherry picked from commit 6711c59) Signed-off-by: Rizwana777 <rizwananaaz177@gmail.com> Signed-off-by: nmirasch <neus.miras@gmail.com> Co-authored-by: Rizwana Naaz <rizwananaaz177@gmail.com>
1 parent e624ae0 commit c6b4690

File tree

9 files changed

+104
-14
lines changed

9 files changed

+104
-14
lines changed

api/v1beta1/argocd_types.go

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

943943
// AggregatedClusterRoles will allow users to have aggregated ClusterRoles for a cluster scoped instance.
944944
AggregatedClusterRoles bool `json:"aggregatedClusterRoles,omitempty"`
945+
946+
// CmdParams specifies command-line parameters for the Argo CD components.
947+
CmdParams map[string]string `json:"cmdParams,omitempty"`
945948
}
946949

947950
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: 11 additions & 7 deletions
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-03-06T14:19:20Z"
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
@@ -441,8 +441,10 @@ spec:
441441
- urn:alm:descriptor:com.tectonic.ui:fieldGroup:Prometheus
442442
- urn:alm:descriptor:com.tectonic.ui:fieldGroup:Server
443443
- urn:alm:descriptor:com.tectonic.ui:booleanSwitch
444-
- description: ConfigManagementPlugins is used to specify additional config
445-
management plugins.
444+
- description: 'Deprecated: ConfigManagementPlugins field is no longer supported.
445+
Argo CD now requires plugins to be defined as sidecar containers of repo
446+
server component. See ''.spec.repo.sidecarContainers''. ConfigManagementPlugins
447+
was previously used to specify additional config management plugins.'
446448
displayName: Config Management Plugins'
447449
path: configManagementPlugins
448450
x-descriptors:
@@ -1058,8 +1060,10 @@ spec:
10581060
- urn:alm:descriptor:com.tectonic.ui:fieldGroup:Prometheus
10591061
- urn:alm:descriptor:com.tectonic.ui:fieldGroup:Server
10601062
- urn:alm:descriptor:com.tectonic.ui:booleanSwitch
1061-
- description: ConfigManagementPlugins is used to specify additional config
1062-
management plugins.
1063+
- description: 'Deprecated: ConfigManagementPlugins field is no longer supported.
1064+
Argo CD now requires plugins to be defined as sidecar containers of repo
1065+
server component. See ''.spec.repo.sidecarContainers''. ConfigManagementPlugins
1066+
was previously used to specify additional config management plugins.'
10631067
displayName: Config Management Plugins'
10641068
path: configManagementPlugins
10651069
x-descriptors:
@@ -1189,8 +1193,8 @@ spec:
11891193
x-descriptors:
11901194
- urn:alm:descriptor:com.tectonic.ui:fieldGroup:Import
11911195
- urn:alm:descriptor:com.tectonic.ui:text
1192-
- description: InitialRepositories to configure Argo CD with upon creation of
1193-
the cluster.
1196+
- description: 'Deprecated: InitialRepositories to configure Argo CD with upon
1197+
creation of the cluster.'
11941198
displayName: Initial Repositories'
11951199
path: initialRepositories
11961200
x-descriptors:

bundle/manifests/argoproj.io_argocds.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9414,6 +9414,12 @@ spec:
94149414
required:
94159415
- content
94169416
type: object
9417+
cmdParams:
9418+
additionalProperties:
9419+
type: string
9420+
description: CmdParams specifies command-line parameters for the Argo
9421+
CD components.
9422+
type: object
94179423
configManagementPlugins:
94189424
description: ConfigManagementPlugins is used to specify additional
94199425
config management plugins.

common/defaults.go

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

301301
// NotificationsControllerMetricsPort is the port that is used to expose notifications controller metrics.
302302
NotificationsControllerMetricsPort = 9001
303+
304+
// ArgoCDCmdParamsConfigMapName is the upstream hard-coded ArgoCD command params ConfigMap name.
305+
ArgoCDCmdParamsConfigMapName = "argocd-cmd-params-cm"
303306
)
304307

305308
// 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
@@ -9403,6 +9403,12 @@ spec:
94039403
required:
94049404
- content
94059405
type: object
9406+
cmdParams:
9407+
additionalProperties:
9408+
type: string
9409+
description: CmdParams specifies command-line parameters for the Argo
9410+
CD components.
9411+
type: object
94069412
configManagementPlugins:
94079413
description: ConfigManagementPlugins is used to specify additional
94089414
config management plugins.

controllers/argocd/configmap.go

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

351+
if err := r.reconcileArgoCmdParamsConfigMap(cr); err != nil {
352+
return err
353+
}
354+
351355
return r.reconcileGPGKeysConfigMap(cr)
352356
}
353357

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

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

Lines changed: 11 additions & 7 deletions
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-03-06T14:19:20Z"
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
@@ -441,8 +441,10 @@ spec:
441441
- urn:alm:descriptor:com.tectonic.ui:fieldGroup:Prometheus
442442
- urn:alm:descriptor:com.tectonic.ui:fieldGroup:Server
443443
- urn:alm:descriptor:com.tectonic.ui:booleanSwitch
444-
- description: ConfigManagementPlugins is used to specify additional config
445-
management plugins.
444+
- description: 'Deprecated: ConfigManagementPlugins field is no longer supported.
445+
Argo CD now requires plugins to be defined as sidecar containers of repo
446+
server component. See ''.spec.repo.sidecarContainers''. ConfigManagementPlugins
447+
was previously used to specify additional config management plugins.'
446448
displayName: Config Management Plugins'
447449
path: configManagementPlugins
448450
x-descriptors:
@@ -1058,8 +1060,10 @@ spec:
10581060
- urn:alm:descriptor:com.tectonic.ui:fieldGroup:Prometheus
10591061
- urn:alm:descriptor:com.tectonic.ui:fieldGroup:Server
10601062
- urn:alm:descriptor:com.tectonic.ui:booleanSwitch
1061-
- description: ConfigManagementPlugins is used to specify additional config
1062-
management plugins.
1063+
- description: 'Deprecated: ConfigManagementPlugins field is no longer supported.
1064+
Argo CD now requires plugins to be defined as sidecar containers of repo
1065+
server component. See ''.spec.repo.sidecarContainers''. ConfigManagementPlugins
1066+
was previously used to specify additional config management plugins.'
10631067
displayName: Config Management Plugins'
10641068
path: configManagementPlugins
10651069
x-descriptors:
@@ -1189,8 +1193,8 @@ spec:
11891193
x-descriptors:
11901194
- urn:alm:descriptor:com.tectonic.ui:fieldGroup:Import
11911195
- urn:alm:descriptor:com.tectonic.ui:text
1192-
- description: InitialRepositories to configure Argo CD with upon creation of
1193-
the cluster.
1196+
- description: 'Deprecated: InitialRepositories to configure Argo CD with upon
1197+
creation of the cluster.'
11941198
displayName: Initial Repositories'
11951199
path: initialRepositories
11961200
x-descriptors:

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
@@ -9414,6 +9414,12 @@ spec:
94149414
required:
94159415
- content
94169416
type: object
9417+
cmdParams:
9418+
additionalProperties:
9419+
type: string
9420+
description: CmdParams specifies command-line parameters for the Argo
9421+
CD components.
9422+
type: object
94179423
configManagementPlugins:
94189424
description: ConfigManagementPlugins is used to specify additional
94199425
config management plugins.

0 commit comments

Comments
 (0)