diff --git a/Makefile b/Makefile index 99317cd94..45c02a62f 100644 --- a/Makefile +++ b/Makefile @@ -162,7 +162,7 @@ undeploy: ## Undeploy controller from the K8s cluster specified in ~/.kube/confi ##@ E2E e2e: ## Run operator e2e tests - kubectl kuttl test ./tests/k8s --config ./tests/kuttl-tests.yaml + kubectl kuttl test ./tests/k8s --config ./tests/kuttl-tests.yaml all: test install run e2e ## UnitTest, Run the operator locally and execute e2e tests. diff --git a/api/v1beta1/argocd_types.go b/api/v1beta1/argocd_types.go index ffafe3326..51cd5ebd7 100644 --- a/api/v1beta1/argocd_types.go +++ b/api/v1beta1/argocd_types.go @@ -128,6 +128,12 @@ type ArgoCDApplicationControllerSpec struct { // VolumeMounts adds volumeMounts to the Argo CD Controller container. VolumeMounts []corev1.VolumeMount `json:"volumeMounts,omitempty"` + + // Custom annotations to pods deployed by the operator + Annotations map[string]string `json:"annotations,omitempty"` + + // Custom labels to pods deployed by the operator + Labels map[string]string `json:"labels,omitempty"` } func (a *ArgoCDApplicationControllerSpec) IsEnabled() bool { @@ -195,6 +201,12 @@ type ArgoCDApplicationSet struct { // SCMProviders defines the list of allowed custom SCM provider API URLs SCMProviders []string `json:"scmProviders,omitempty"` + + // Custom annotations to pods deployed by the operator + Annotations map[string]string `json:"annotations,omitempty"` + + // Custom labels to pods deployed by the operator + Labels map[string]string `json:"labels,omitempty"` } func (a *ArgoCDApplicationSet) IsEnabled() bool { @@ -529,6 +541,12 @@ type ArgoCDRepoSpec struct { // Remote specifies the remote URL of the Repo Server container. (optional, by default, a local instance managed by the operator is used.) Remote *string `json:"remote,omitempty"` + + // Custom annotations to pods deployed by the operator + Annotations map[string]string `json:"annotations,omitempty"` + + // Custom labels to pods deployed by the operator + Labels map[string]string `json:"labels,omitempty"` } func (a *ArgoCDRepoSpec) IsEnabled() bool { @@ -638,6 +656,12 @@ type ArgoCDServerSpec struct { // VolumeMounts adds volumeMounts to the Argo CD Server container. VolumeMounts []corev1.VolumeMount `json:"volumeMounts,omitempty"` + + // Custom annotations to pods deployed by the operator + Annotations map[string]string `json:"annotations,omitempty"` + + // Custom labels to pods deployed by the operator + Labels map[string]string `json:"labels,omitempty"` } func (a *ArgoCDServerSpec) IsEnabled() bool { diff --git a/api/v1beta1/zz_generated.deepcopy.go b/api/v1beta1/zz_generated.deepcopy.go index bceb4e4bf..060014808 100644 --- a/api/v1beta1/zz_generated.deepcopy.go +++ b/api/v1beta1/zz_generated.deepcopy.go @@ -151,6 +151,20 @@ func (in *ArgoCDApplicationControllerSpec) DeepCopyInto(out *ArgoCDApplicationCo (*in)[i].DeepCopyInto(&(*out)[i]) } } + if in.Annotations != nil { + in, out := &in.Annotations, &out.Annotations + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + if in.Labels != nil { + in, out := &in.Labels, &out.Labels + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ArgoCDApplicationControllerSpec. @@ -199,6 +213,20 @@ func (in *ArgoCDApplicationSet) DeepCopyInto(out *ArgoCDApplicationSet) { *out = make([]string, len(*in)) copy(*out, *in) } + if in.Annotations != nil { + in, out := &in.Annotations, &out.Annotations + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + if in.Labels != nil { + in, out := &in.Labels, &out.Labels + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ArgoCDApplicationSet. @@ -667,6 +695,20 @@ func (in *ArgoCDRepoSpec) DeepCopyInto(out *ArgoCDRepoSpec) { *out = new(string) **out = **in } + if in.Annotations != nil { + in, out := &in.Annotations, &out.Annotations + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + if in.Labels != nil { + in, out := &in.Labels, &out.Labels + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ArgoCDRepoSpec. @@ -857,6 +899,20 @@ func (in *ArgoCDServerSpec) DeepCopyInto(out *ArgoCDServerSpec) { (*in)[i].DeepCopyInto(&(*out)[i]) } } + if in.Annotations != nil { + in, out := &in.Annotations, &out.Annotations + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + if in.Labels != nil { + in, out := &in.Labels, &out.Labels + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ArgoCDServerSpec. diff --git a/bundle/manifests/argocd-operator.clusterserviceversion.yaml b/bundle/manifests/argocd-operator.clusterserviceversion.yaml index b64d71c75..5b6a84ea0 100644 --- a/bundle/manifests/argocd-operator.clusterserviceversion.yaml +++ b/bundle/manifests/argocd-operator.clusterserviceversion.yaml @@ -247,7 +247,7 @@ metadata: capabilities: Deep Insights categories: Integration & Delivery certified: "false" - createdAt: "2024-09-27T05:27:12Z" + createdAt: "2024-09-16T21:29:22Z" description: Argo CD is a declarative, GitOps continuous delivery tool for Kubernetes. operators.operatorframework.io/builder: operator-sdk-v1.35.0 operators.operatorframework.io/project_layout: go.kubebuilder.io/v4 diff --git a/bundle/manifests/argoproj.io_argocds.yaml b/bundle/manifests/argoproj.io_argocds.yaml index f38aefbc6..0d4537a24 100644 --- a/bundle/manifests/argoproj.io_argocds.yaml +++ b/bundle/manifests/argoproj.io_argocds.yaml @@ -7269,6 +7269,11 @@ spec: description: ArgoCDApplicationSet defines whether the Argo CD ApplicationSet controller should be installed. properties: + annotations: + additionalProperties: + type: string + description: Custom annotations to pods deployed by the operator + type: object enabled: description: Enabled is the flag to enable the Application Set Controller during ArgoCD installation. (optional, default `true`) @@ -7400,6 +7405,11 @@ spec: image: description: Image is the Argo CD ApplicationSet image (optional) type: string + labels: + additionalProperties: + type: string + description: Custom labels to pods deployed by the operator + type: object logLevel: description: LogLevel describes the log level that should be used by the ApplicationSet controller. Defaults to ArgoCDDefaultLogLevel @@ -7677,6 +7687,11 @@ spec: description: Controller defines the Application Controller options for ArgoCD. properties: + annotations: + additionalProperties: + type: string + description: Custom annotations to pods deployed by the operator + type: object appSync: description: |- AppSync is used to control the sync frequency, by default the ArgoCD @@ -9133,6 +9148,11 @@ spec: - name type: object type: array + labels: + additionalProperties: + type: string + description: Custom labels to pods deployed by the operator + type: object logFormat: description: LogFormat refers to the log format used by the Application Controller component. Defaults to ArgoCDDefaultLogFormat if @@ -13202,6 +13222,11 @@ spec: repo: description: Repo defines the repo server options for Argo CD. properties: + annotations: + additionalProperties: + type: string + description: Custom annotations to pods deployed by the operator + type: object autotls: description: |- AutoTLS specifies the method to use for automatic TLS configuration for the repo server @@ -14662,6 +14687,11 @@ spec: - name type: object type: array + labels: + additionalProperties: + type: string + description: Custom labels to pods deployed by the operator + type: object logFormat: description: LogFormat describes the log format that should be used by the Repo Server. Defaults to ArgoCDDefaultLogFormat @@ -17821,6 +17851,11 @@ spec: server: description: Server defines the options for the ArgoCD Server component. properties: + annotations: + additionalProperties: + type: string + description: Custom annotations to pods deployed by the operator + type: object autoscale: description: Autoscale defines the autoscale options for the Argo CD Server component. @@ -19450,6 +19485,11 @@ spec: insecure: description: Insecure toggles the insecure flag. type: boolean + labels: + additionalProperties: + type: string + description: Custom labels to pods deployed by the operator + type: object logFormat: description: LogFormat refers to the log level to be used by the ArgoCD Server component. Defaults to ArgoCDDefaultLogFormat diff --git a/config/crd/bases/argoproj.io_argocds.yaml b/config/crd/bases/argoproj.io_argocds.yaml index 30486dd91..e00009b51 100644 --- a/config/crd/bases/argoproj.io_argocds.yaml +++ b/config/crd/bases/argoproj.io_argocds.yaml @@ -7258,6 +7258,11 @@ spec: description: ArgoCDApplicationSet defines whether the Argo CD ApplicationSet controller should be installed. properties: + annotations: + additionalProperties: + type: string + description: Custom annotations to pods deployed by the operator + type: object enabled: description: Enabled is the flag to enable the Application Set Controller during ArgoCD installation. (optional, default `true`) @@ -7389,6 +7394,11 @@ spec: image: description: Image is the Argo CD ApplicationSet image (optional) type: string + labels: + additionalProperties: + type: string + description: Custom labels to pods deployed by the operator + type: object logLevel: description: LogLevel describes the log level that should be used by the ApplicationSet controller. Defaults to ArgoCDDefaultLogLevel @@ -7666,6 +7676,11 @@ spec: description: Controller defines the Application Controller options for ArgoCD. properties: + annotations: + additionalProperties: + type: string + description: Custom annotations to pods deployed by the operator + type: object appSync: description: |- AppSync is used to control the sync frequency, by default the ArgoCD @@ -9122,6 +9137,11 @@ spec: - name type: object type: array + labels: + additionalProperties: + type: string + description: Custom labels to pods deployed by the operator + type: object logFormat: description: LogFormat refers to the log format used by the Application Controller component. Defaults to ArgoCDDefaultLogFormat if @@ -13191,6 +13211,11 @@ spec: repo: description: Repo defines the repo server options for Argo CD. properties: + annotations: + additionalProperties: + type: string + description: Custom annotations to pods deployed by the operator + type: object autotls: description: |- AutoTLS specifies the method to use for automatic TLS configuration for the repo server @@ -14651,6 +14676,11 @@ spec: - name type: object type: array + labels: + additionalProperties: + type: string + description: Custom labels to pods deployed by the operator + type: object logFormat: description: LogFormat describes the log format that should be used by the Repo Server. Defaults to ArgoCDDefaultLogFormat @@ -17810,6 +17840,11 @@ spec: server: description: Server defines the options for the ArgoCD Server component. properties: + annotations: + additionalProperties: + type: string + description: Custom annotations to pods deployed by the operator + type: object autoscale: description: Autoscale defines the autoscale options for the Argo CD Server component. @@ -19439,6 +19474,11 @@ spec: insecure: description: Insecure toggles the insecure flag. type: boolean + labels: + additionalProperties: + type: string + description: Custom labels to pods deployed by the operator + type: object logFormat: description: LogFormat refers to the log level to be used by the ArgoCD Server component. Defaults to ArgoCDDefaultLogFormat diff --git a/controllers/argocd/applicationset.go b/controllers/argocd/applicationset.go index d438fa77d..0187b1d82 100644 --- a/controllers/argocd/applicationset.go +++ b/controllers/argocd/applicationset.go @@ -246,6 +246,16 @@ func (r *ReconcileArgoCD) reconcileApplicationSetDeployment(cr *argoproj.ArgoCD, } } + if cr.Spec.ApplicationSet.Annotations != nil { + deploy.Spec.Template.Annotations = cr.Spec.ApplicationSet.Annotations + } + + if cr.Spec.ApplicationSet.Labels != nil { + for key, value := range cr.Spec.ApplicationSet.Labels { + deploy.Spec.Template.Labels[key] = value + } + } + podSpec.Containers = []corev1.Container{ r.applicationSetContainer(cr, addSCMGitlabVolumeMount), } @@ -263,7 +273,8 @@ func (r *ReconcileArgoCD) reconcileApplicationSetDeployment(cr *argoproj.ArgoCD, !reflect.DeepEqual(existing.Spec.Selector, deploy.Spec.Selector) || !reflect.DeepEqual(existing.Spec.Template.Spec.NodeSelector, deploy.Spec.Template.Spec.NodeSelector) || !reflect.DeepEqual(existing.Spec.Template.Spec.Tolerations, deploy.Spec.Template.Spec.Tolerations) || - !reflect.DeepEqual(existing.Spec.Template.Spec.Containers[0].SecurityContext, deploy.Spec.Template.Spec.Containers[0].SecurityContext) + !reflect.DeepEqual(existing.Spec.Template.Spec.Containers[0].SecurityContext, deploy.Spec.Template.Spec.Containers[0].SecurityContext) || + !reflect.DeepEqual(existing.Spec.Template.Annotations, deploy.Spec.Template.Annotations) // If the Deployment already exists, make sure the values we care about are up-to-date if deploymentsDifferent { @@ -276,6 +287,8 @@ func (r *ReconcileArgoCD) reconcileApplicationSetDeployment(cr *argoproj.ArgoCD, existing.Spec.Template.Spec.NodeSelector = deploy.Spec.Template.Spec.NodeSelector existing.Spec.Template.Spec.Tolerations = deploy.Spec.Template.Spec.Tolerations existing.Spec.Template.Spec.Containers[0].SecurityContext = deploy.Spec.Template.Spec.Containers[0].SecurityContext + existing.Spec.Template.Annotations = deploy.Spec.Template.Annotations + return r.Client.Update(context.TODO(), existing) } return nil // Deployment found with nothing to do, move along... diff --git a/controllers/argocd/deployment.go b/controllers/argocd/deployment.go index 116f1b928..605a9f591 100644 --- a/controllers/argocd/deployment.go +++ b/controllers/argocd/deployment.go @@ -1106,6 +1106,16 @@ func (r *ReconcileArgoCD) reconcileRepoDeployment(cr *argoproj.ArgoCD, useTLSFor deploy.Spec.Replicas = replicas } + if cr.Spec.Repo.Annotations != nil { + deploy.Spec.Template.Annotations = cr.Spec.Repo.Annotations + } + + if cr.Spec.Repo.Labels != nil { + for key, value := range cr.Spec.Repo.Labels { + deploy.Spec.Template.Labels[key] = value + } + } + existing := newDeploymentWithSuffix("repo-server", "repo-server", cr) if argoutil.IsObjectFound(r.Client, cr.Namespace, existing.Name, existing) { @@ -1181,6 +1191,20 @@ func (r *ReconcileArgoCD) reconcileRepoDeployment(cr *argoproj.ArgoCD, useTLSFor changed = true } + deploy.Spec.Template.Annotations = cr.Spec.Repo.Annotations + if !reflect.DeepEqual(deploy.Spec.Template.Annotations, existing.Spec.Template.Annotations) { + existing.Spec.Template.Annotations = deploy.Spec.Template.Annotations + changed = true + } + + for key, value := range cr.Spec.Repo.Labels { + deploy.Spec.Template.Labels[key] = value + } + if !reflect.DeepEqual(deploy.Spec.Template.Labels, existing.Spec.Template.Labels) { + existing.Spec.Template.Labels = deploy.Spec.Template.Labels + changed = true + } + if changed { return r.Client.Update(context.TODO(), existing) } @@ -1347,6 +1371,16 @@ func (r *ReconcileArgoCD) reconcileServerDeployment(cr *argoproj.ArgoCD, useTLSF deploy.Spec.Template.Spec.Containers = append(deploy.Spec.Template.Spec.Containers, cr.Spec.Server.SidecarContainers...) } + if cr.Spec.Server.Annotations != nil { + deploy.Spec.Template.Annotations = cr.Spec.Server.Annotations + } + + if cr.Spec.Server.Labels != nil { + for key, value := range cr.Spec.Server.Labels { + deploy.Spec.Template.Labels[key] = value + } + } + existing := newDeploymentWithSuffix("server", "server", cr) if argoutil.IsObjectFound(r.Client, cr.Namespace, existing.Name, existing) { if !cr.Spec.Server.IsEnabled() { @@ -1408,6 +1442,21 @@ func (r *ReconcileArgoCD) reconcileServerDeployment(cr *argoproj.ArgoCD, useTLSF changed = true } } + + deploy.Spec.Template.Annotations = cr.Spec.Server.Annotations + + for key, value := range cr.Spec.Server.Labels { + deploy.Spec.Template.Labels[key] = value + } + if !reflect.DeepEqual(deploy.Spec.Template.Annotations, existing.Spec.Template.Annotations) { + existing.Spec.Template.Annotations = deploy.Spec.Template.Annotations + changed = true + } + if !reflect.DeepEqual(deploy.Spec.Template.Labels, existing.Spec.Template.Labels) { + existing.Spec.Template.Labels = deploy.Spec.Template.Labels + changed = true + } + if changed { return r.Client.Update(context.TODO(), existing) } diff --git a/controllers/argocd/statefulset.go b/controllers/argocd/statefulset.go index 567c73e01..bbc91ee75 100644 --- a/controllers/argocd/statefulset.go +++ b/controllers/argocd/statefulset.go @@ -742,6 +742,16 @@ func (r *ReconcileArgoCD) reconcileApplicationControllerStatefulSet(cr *argoproj } } + if cr.Spec.Controller.Annotations != nil { + ss.Spec.Template.Annotations = cr.Spec.Controller.Annotations + } + + if cr.Spec.Controller.Labels != nil { + for key, value := range cr.Spec.Controller.Labels { + ss.Spec.Template.Labels[key] = value + } + } + existing := newStatefulSetWithSuffix("application-controller", "application-controller", cr) if argoutil.IsObjectFound(r.Client, cr.Namespace, existing.Name, existing) { if !cr.Spec.Controller.IsEnabled() { @@ -804,9 +814,23 @@ func (r *ReconcileArgoCD) reconcileApplicationControllerStatefulSet(cr *argoproj changed = true } + ss.Spec.Template.Annotations = cr.Spec.Controller.Annotations + if !reflect.DeepEqual(ss.Spec.Template.Annotations, existing.Spec.Template.Annotations) { + existing.Spec.Template.Annotations = ss.Spec.Template.Annotations + changed = true + } + + for key, value := range cr.Spec.Controller.Labels { + ss.Spec.Template.Labels[key] = value + } + if !reflect.DeepEqual(ss.Spec.Template.Labels, existing.Spec.Template.Labels) { + existing.Spec.Template.Labels = ss.Spec.Template.Labels + changed = true + } if changed { return r.Client.Update(context.TODO(), existing) } + return nil // StatefulSet found with nothing to do, move along... } diff --git a/deploy/olm-catalog/argocd-operator/0.13.0/argocd-operator.v0.13.0.clusterserviceversion.yaml b/deploy/olm-catalog/argocd-operator/0.13.0/argocd-operator.v0.13.0.clusterserviceversion.yaml index b64d71c75..5b6a84ea0 100644 --- a/deploy/olm-catalog/argocd-operator/0.13.0/argocd-operator.v0.13.0.clusterserviceversion.yaml +++ b/deploy/olm-catalog/argocd-operator/0.13.0/argocd-operator.v0.13.0.clusterserviceversion.yaml @@ -247,7 +247,7 @@ metadata: capabilities: Deep Insights categories: Integration & Delivery certified: "false" - createdAt: "2024-09-27T05:27:12Z" + createdAt: "2024-09-16T21:29:22Z" description: Argo CD is a declarative, GitOps continuous delivery tool for Kubernetes. operators.operatorframework.io/builder: operator-sdk-v1.35.0 operators.operatorframework.io/project_layout: go.kubebuilder.io/v4 diff --git a/deploy/olm-catalog/argocd-operator/0.13.0/argoproj.io_argocds.yaml b/deploy/olm-catalog/argocd-operator/0.13.0/argoproj.io_argocds.yaml index f38aefbc6..0d4537a24 100644 --- a/deploy/olm-catalog/argocd-operator/0.13.0/argoproj.io_argocds.yaml +++ b/deploy/olm-catalog/argocd-operator/0.13.0/argoproj.io_argocds.yaml @@ -7269,6 +7269,11 @@ spec: description: ArgoCDApplicationSet defines whether the Argo CD ApplicationSet controller should be installed. properties: + annotations: + additionalProperties: + type: string + description: Custom annotations to pods deployed by the operator + type: object enabled: description: Enabled is the flag to enable the Application Set Controller during ArgoCD installation. (optional, default `true`) @@ -7400,6 +7405,11 @@ spec: image: description: Image is the Argo CD ApplicationSet image (optional) type: string + labels: + additionalProperties: + type: string + description: Custom labels to pods deployed by the operator + type: object logLevel: description: LogLevel describes the log level that should be used by the ApplicationSet controller. Defaults to ArgoCDDefaultLogLevel @@ -7677,6 +7687,11 @@ spec: description: Controller defines the Application Controller options for ArgoCD. properties: + annotations: + additionalProperties: + type: string + description: Custom annotations to pods deployed by the operator + type: object appSync: description: |- AppSync is used to control the sync frequency, by default the ArgoCD @@ -9133,6 +9148,11 @@ spec: - name type: object type: array + labels: + additionalProperties: + type: string + description: Custom labels to pods deployed by the operator + type: object logFormat: description: LogFormat refers to the log format used by the Application Controller component. Defaults to ArgoCDDefaultLogFormat if @@ -13202,6 +13222,11 @@ spec: repo: description: Repo defines the repo server options for Argo CD. properties: + annotations: + additionalProperties: + type: string + description: Custom annotations to pods deployed by the operator + type: object autotls: description: |- AutoTLS specifies the method to use for automatic TLS configuration for the repo server @@ -14662,6 +14687,11 @@ spec: - name type: object type: array + labels: + additionalProperties: + type: string + description: Custom labels to pods deployed by the operator + type: object logFormat: description: LogFormat describes the log format that should be used by the Repo Server. Defaults to ArgoCDDefaultLogFormat @@ -17821,6 +17851,11 @@ spec: server: description: Server defines the options for the ArgoCD Server component. properties: + annotations: + additionalProperties: + type: string + description: Custom annotations to pods deployed by the operator + type: object autoscale: description: Autoscale defines the autoscale options for the Argo CD Server component. @@ -19450,6 +19485,11 @@ spec: insecure: description: Insecure toggles the insecure flag. type: boolean + labels: + additionalProperties: + type: string + description: Custom labels to pods deployed by the operator + type: object logFormat: description: LogFormat refers to the log level to be used by the ArgoCD Server component. Defaults to ArgoCDDefaultLogFormat diff --git a/docs/usage/custom_labels_annotations.md b/docs/usage/custom_labels_annotations.md new file mode 100644 index 000000000..a7d23a62c --- /dev/null +++ b/docs/usage/custom_labels_annotations.md @@ -0,0 +1,35 @@ +# Custom Annotations and Labels + +You can add labels and annotations to the pods of the server, repo, application set controller, and application controller. + +```[yaml] +spec: + server: + labels: + custom: label + custom2: server + annotations: + custom: annotation + custom2: server + repo: + labels: + custom: label + custom2: repo + annotations: + custom: annotation + custom2: repo + controller: + labels: + custom: label + custom2: controller + annotations: + custom: annotation + custom2: controller + applicationSet: + labels: + custom: label + custom2: applicationSet + annotations: + custom: annotation + custom2: applicationSet +``` \ No newline at end of file diff --git a/mkdocs.yml b/mkdocs.yml index cafe1d25f..e50d018a4 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -37,20 +37,20 @@ nav: - OpenShift: install/openshift.md - Operator Lifecycle Manager: install/olm.md - Manual Installation: install/manual.md - - Usage: + - Usage: - Basics: usage/basics.md - Config Management: usage/config_management_2.0.md - Custom Tooling: usage/customization.md - Deploy Resources to Different Namespaces: usage/deploy-to-different-namespaces.md - Export: usage/export.md - ExtraConfig: usage/extra-config.md - - High Availability: + - High Availability: - Redis: usage/ha/redis.md - Repo Server: usage/ha/repo-server.md - Ingress: usage/ingress.md - Insights: usage/insights.md - Dex: usage/dex.md - - Keycloak: + - Keycloak: - Kubernetes: usage/keycloak/kubernetes.md - OpenShift: usage/keycloak/openshift.md - Notifications: usage/notifications.md @@ -59,14 +59,15 @@ nav: - Custom Roles: usage/custom_roles.md - Apps in Any Namespace: usage/apps-in-any-namespace.md - Appsets in Any Namespace: usage/appsets-in-any-namespace.md + - Custom labels and annotations: usage/custom_labels_annotations.md - Reference: - ArgoCD: reference/argocd.md - ArgoCDExport: reference/argocdexport.md - API Docs: reference/api.html.md - NotificationsConfiguration: reference/notificationsconfiguration.md - - Contributing: + - Contributing: - Contributing: developer-guide/contributing.md - - Development: + - Development: - Setup: developer-guide/development.md - OLM Environment: developer-guide/olm-env.md - OpenAPI: developer-guide/openapi.md diff --git a/tests/k8s/1-043_validate_custom_labels_annotations/01-assert.yaml b/tests/k8s/1-043_validate_custom_labels_annotations/01-assert.yaml new file mode 100644 index 000000000..2d6d76f33 --- /dev/null +++ b/tests/k8s/1-043_validate_custom_labels_annotations/01-assert.yaml @@ -0,0 +1,59 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: argocd-sample-server +spec: + template: + metadata: + annotations: + custom: annotation + custom2: server + labels: + app.kubernetes.io/name: argocd-sample-server + custom: label + custom2: server +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: argocd-sample-repo-server +spec: + template: + metadata: + annotations: + custom: annotation + custom2: repo + labels: + app.kubernetes.io/name: argocd-sample-repo-server + custom: label + custom2: repo +--- +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: argocd-sample-application-controller +spec: + template: + metadata: + annotations: + custom: annotation + custom2: controller + labels: + app.kubernetes.io/name: argocd-sample-application-controller + custom: label + custom2: controller +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: argocd-sample-applicationset-controller +spec: + template: + metadata: + annotations: + custom: annotation + custom2: applicationSet + labels: + app.kubernetes.io/name: argocd-sample-applicationset-controller + custom: label + custom2: applicationSet \ No newline at end of file diff --git a/tests/k8s/1-043_validate_custom_labels_annotations/01-install.yaml b/tests/k8s/1-043_validate_custom_labels_annotations/01-install.yaml new file mode 100644 index 000000000..50739c217 --- /dev/null +++ b/tests/k8s/1-043_validate_custom_labels_annotations/01-install.yaml @@ -0,0 +1,33 @@ +apiVersion: argoproj.io/v1beta1 +kind: ArgoCD +metadata: + name: argocd-sample +spec: + server: + labels: + custom: label + custom2: server + annotations: + custom: annotation + custom2: server + repo: + labels: + custom: label + custom2: repo + annotations: + custom: annotation + custom2: repo + controller: + labels: + custom: label + custom2: controller + annotations: + custom: annotation + custom2: controller + applicationSet: + labels: + custom: label + custom2: applicationSet + annotations: + custom: annotation + custom2: applicationSet diff --git a/tests/k8s/1-043_validate_custom_labels_annotations/02-assert.yaml b/tests/k8s/1-043_validate_custom_labels_annotations/02-assert.yaml new file mode 100644 index 000000000..4501f2640 --- /dev/null +++ b/tests/k8s/1-043_validate_custom_labels_annotations/02-assert.yaml @@ -0,0 +1,44 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: argocd-sample-server +spec: + template: + metadata: + annotations: {} + labels: + app.kubernetes.io/name: argocd-sample-server +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: argocd-sample-repo-server +spec: + template: + metadata: + annotations: {} + labels: + app.kubernetes.io/name: argocd-sample-repo-server +--- +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: argocd-sample-application-controller +spec: + template: + metadata: + annotations: {} + labels: + app.kubernetes.io/name: argocd-sample-application-controller +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: argocd-sample-applicationset-controller +spec: + template: + metadata: + annotations: {} + labels: + app.kubernetes.io/name: argocd-sample-applicationset-controller + diff --git a/tests/k8s/1-043_validate_custom_labels_annotations/02-delete-labels-annotations.yaml b/tests/k8s/1-043_validate_custom_labels_annotations/02-delete-labels-annotations.yaml new file mode 100644 index 000000000..87730e7bc --- /dev/null +++ b/tests/k8s/1-043_validate_custom_labels_annotations/02-delete-labels-annotations.yaml @@ -0,0 +1,18 @@ +apiVersion: argoproj.io/v1beta1 +kind: ArgoCD +metadata: + name: argocd-sample +spec: + server: + labels: {} + annotations: {} + repo: + labels: {} + annotations: {} + controller: + labels: {} + annotations: {} + applicationSet: + labels: {} + annotations: {} +