diff --git a/charts/ace-ocm-addons/README.md b/charts/ace-ocm-addons/README.md
index 352018dc2..c874bf8c9 100644
--- a/charts/ace-ocm-addons/README.md
+++ b/charts/ace-ocm-addons/README.md
@@ -45,31 +45,34 @@ The command removes all the Kubernetes components associated with the chart and
The following table lists the configurable parameters of the `ace-ocm-addons` chart and their default values.
-| Parameter | Description | Default |
-|-------------------------------------------|-------------------------|--------------------------------------------|
-| nameOverride | | ""
|
-| fullnameOverride | | ""
|
-| offlineInstaller | | false
|
-| image.proxies.appscode | r.appscode.com | r.appscode.com
|
-| image.proxies.dockerHub | company/bin:tag | ""
|
-| image.proxies.dockerLibrary | alpine, nginx etc. | ""
|
-| image.proxies.ghcr | ghcr.io/company/bin:tag | ghcr.io
|
-| image.proxies.quay | quay.io/company/bin:tag | quay.io
|
-| image.proxies.kubernetes | registry.k8s.io/bin:tag | registry.k8s.io
|
-| registry.credentials | | {}
|
-| helm.repositories.appscode-charts-oci.url | | oci://ghcr.io/appscode-charts
|
-| helm.releases.kube-ui-server.enabled | | true
|
-| helm.releases.kube-ui-server.version | | "v2023.12.18"
|
-| helm.releases.license-proxyserver.enabled | | true
|
-| helm.releases.license-proxyserver.version | | "v2023.11.14"
|
-| helm.releases.opscenter-features.enabled | | true
|
-| helm.releases.opscenter-features.version | | "v2024.2.13"
|
+| Parameter | Description | Default |
+|-------------------------------------------|-------------------------|----------------------------------------------------|
+| nameOverride | | ""
|
+| fullnameOverride | | ""
|
+| kubeconfigSecretName | | ""
|
+| addonManagerNamespace | | open-cluster-management-addon
|
+| placement.create | | true
|
+| placement.name | | global
|
+| kubectl.image | | ghcr.io/appscode/kubectl-nonroot:1.25
|
+| offlineInstaller | | false
|
+| image.proxies.appscode | r.appscode.com | r.appscode.com
|
+| image.proxies.dockerHub | company/bin:tag | ""
|
+| image.proxies.dockerLibrary | alpine, nginx etc. | ""
|
+| image.proxies.ghcr | ghcr.io/company/bin:tag | ghcr.io
|
+| image.proxies.quay | quay.io/company/bin:tag | quay.io
|
+| image.proxies.kubernetes | registry.k8s.io/bin:tag | registry.k8s.io
|
+| registry.credentials | | {}
|
+| helm.repositories.appscode-charts-oci.url | | oci://ghcr.io/appscode-charts
|
+| helm.releases.kube-ui-server.enabled | | true
|
+| helm.releases.kube-ui-server.version | | "v2023.12.20"
|
+| helm.releases.opscenter-features.enabled | | true
|
+| helm.releases.opscenter-features.version | | "v2024.2.13"
|
Specify each parameter using the `--set key=value[,key=value]` argument to `helm upgrade -i`. For example:
```bash
-$ helm upgrade -i ace-ocm-addons appscode/ace-ocm-addons -n open-cluster-management --create-namespace --version=v2024.2.13 --set image.proxies.appscode=r.appscode.com
+$ helm upgrade -i ace-ocm-addons appscode/ace-ocm-addons -n open-cluster-management --create-namespace --version=v2024.2.13 --set addonManagerNamespace=open-cluster-management-addon
```
Alternatively, a YAML file that specifies the values for the parameters can be provided while
diff --git a/charts/ace-ocm-addons/templates/clustersetbinding.yaml b/charts/ace-ocm-addons/common/addon/clustersetbinding.yaml
similarity index 57%
rename from charts/ace-ocm-addons/templates/clustersetbinding.yaml
rename to charts/ace-ocm-addons/common/addon/clustersetbinding.yaml
index 23c6f7799..c1cac2b43 100644
--- a/charts/ace-ocm-addons/templates/clustersetbinding.yaml
+++ b/charts/ace-ocm-addons/common/addon/clustersetbinding.yaml
@@ -1,7 +1,11 @@
+{{- if .Values.placement.create }}
+
apiVersion: cluster.open-cluster-management.io/v1beta2
kind: ManagedClusterSetBinding
metadata:
name: global
- namespace: global-kubeops
+ namespace: {{ include "ace-ocm-addons.namespace" . }}
spec:
clusterSet: global
+
+{{- end }}
diff --git a/charts/ace-ocm-addons/templates/manifestrelicaset.yaml b/charts/ace-ocm-addons/common/addon/manifestrelicaset.yaml
similarity index 98%
rename from charts/ace-ocm-addons/templates/manifestrelicaset.yaml
rename to charts/ace-ocm-addons/common/addon/manifestrelicaset.yaml
index c55e28279..ee0d473fc 100644
--- a/charts/ace-ocm-addons/templates/manifestrelicaset.yaml
+++ b/charts/ace-ocm-addons/common/addon/manifestrelicaset.yaml
@@ -1,11 +1,11 @@
apiVersion: work.open-cluster-management.io/v1alpha1
kind: ManifestWorkReplicaSet
metadata:
- name: opscenter-core-addons
- namespace: global-kubeops
+ name: ace-addons
+ namespace: {{ include "ace-ocm-addons.namespace" $ }}
spec:
placementRefs:
- - name: global
+ - name: {{ .Values.placement.name }}
manifestWorkTemplate:
# deleteOption:
# propagationPolicy: SelectivelyOrphan
diff --git a/charts/ace-ocm-addons/common/addon/placement.yaml b/charts/ace-ocm-addons/common/addon/placement.yaml
new file mode 100644
index 000000000..4474834fa
--- /dev/null
+++ b/charts/ace-ocm-addons/common/addon/placement.yaml
@@ -0,0 +1,12 @@
+{{- if .Values.placement.create }}
+
+apiVersion: cluster.open-cluster-management.io/v1beta1
+kind: Placement
+metadata:
+ name: {{ .Values.placement.name }}
+ namespace: {{ include "ace-ocm-addons.namespace" . }}
+spec:
+ clusterSets:
+ - global
+
+{{- end }}
diff --git a/charts/ace-ocm-addons/templates/_helpers.tpl b/charts/ace-ocm-addons/templates/_helpers.tpl
index b1ace4087..16a4415b7 100644
--- a/charts/ace-ocm-addons/templates/_helpers.tpl
+++ b/charts/ace-ocm-addons/templates/_helpers.tpl
@@ -51,14 +51,10 @@ app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}
{{/*
-Create the name of the service account to use
+Addon manager namespace
*/}}
-{{- define "ace-ocm-addons.serviceAccountName" -}}
-{{- if .Values.serviceAccount.create }}
-{{- default (include "ace-ocm-addons.fullname" .) .Values.serviceAccount.name }}
-{{- else }}
-{{- default "default" .Values.serviceAccount.name }}
-{{- end }}
+{{- define "ace-ocm-addons.namespace" -}}
+{{ ternary .Release.Namespace (required "A valid .Values.addonManagerNamespace is required!" .Values.addonManagerNamespace) (empty .Values.kubeconfigSecretName) }}
{{- end }}
{{/*
diff --git a/charts/ace-ocm-addons/templates/k8s/addon.yaml b/charts/ace-ocm-addons/templates/k8s/addon.yaml
new file mode 100644
index 000000000..ccd2d776f
--- /dev/null
+++ b/charts/ace-ocm-addons/templates/k8s/addon.yaml
@@ -0,0 +1,12 @@
+{{- if not .Values.kubeconfigSecretName }}
+
+{{- $restpl := $.Files.Get "common/addon/clustersetbinding.yaml" }}
+{{ tpl $restpl $ }}
+---
+{{- $restpl := $.Files.Get "common/addon/placement.yaml" }}
+{{ tpl $restpl $ }}
+---
+{{- $restpl := $.Files.Get "common/addon/manifestrelicaset.yaml" }}
+{{ tpl $restpl $ }}
+
+{{- end }}
diff --git a/charts/ace-ocm-addons/templates/namespace.yaml b/charts/ace-ocm-addons/templates/namespace.yaml
deleted file mode 100644
index a477d6167..000000000
--- a/charts/ace-ocm-addons/templates/namespace.yaml
+++ /dev/null
@@ -1,4 +0,0 @@
-apiVersion: v1
-kind: Namespace
-metadata:
- name: global-kubeops
diff --git a/charts/ace-ocm-addons/templates/ocm-mc/addon.yaml b/charts/ace-ocm-addons/templates/ocm-mc/addon.yaml
new file mode 100644
index 000000000..c43e89189
--- /dev/null
+++ b/charts/ace-ocm-addons/templates/ocm-mc/addon.yaml
@@ -0,0 +1,49 @@
+{{- if .Values.kubeconfigSecretName }}
+
+apiVersion: batch/v1
+kind: Job
+metadata:
+ name: ace-configure-addon
+ namespace: {{ .Release.Namespace }}
+ annotations:
+ "helm.sh/hook-weight": "2"
+ "helm.sh/hook": post-install,post-upgrade,post-rollback
+ "helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded,hook-failed
+spec:
+ ttlSecondsAfterFinished: 0
+ backoffLimit: 3
+ template:
+ spec:
+ automountServiceAccountToken: false
+ containers:
+ - name: kubectl
+ image: {{ .Values.kubectl.image }}
+ workingDir: /var/run/secrets/ocm
+ command:
+ - sh
+ - -c
+ - |
+ sleep 2; \
+ kubectl --kubeconfig=auth/kubeconfig create ns {{ include "ace-ocm-addons.namespace" $ }} || true; \
+ kubectl --kubeconfig=auth/kubeconfig apply -f - <