From 1a47b4db393756ebd5f9bf0d34257bb9d21832c0 Mon Sep 17 00:00:00 2001 From: Tamal Saha Date: Sun, 12 Nov 2023 22:05:42 -0800 Subject: [PATCH] Fix agentNamespace in spoke Signed-off-by: Tamal Saha --- apis/installer/v1alpha1/cluster_manager_spoke_types.go | 3 +++ charts/cluster-manager-spoke/README.md | 1 + .../templates/bootstrap_hub_kubeconfig.yaml | 2 +- .../templates/hosted/external_managed_kubeconfig.yaml | 2 +- charts/cluster-manager-spoke/templates/namespace.yaml | 9 +++++++++ .../cluster-manager-spoke/values.openapiv3_schema.yaml | 3 +++ charts/cluster-manager-spoke/values.yaml | 2 ++ s.yaml | 8 -------- 8 files changed, 20 insertions(+), 10 deletions(-) delete mode 100644 s.yaml diff --git a/apis/installer/v1alpha1/cluster_manager_spoke_types.go b/apis/installer/v1alpha1/cluster_manager_spoke_types.go index 550608cc..ee0f380a 100644 --- a/apis/installer/v1alpha1/cluster_manager_spoke_types.go +++ b/apis/installer/v1alpha1/cluster_manager_spoke_types.go @@ -46,6 +46,9 @@ type ClusterManagerSpokeSpec struct { // ClusterName: the name of the joined cluster on the hub ClusterName string `json:"clusterName"` + // AgentNamespace: the namespace to deploy the agent + AgentNamespace string `json:"agentNamespace"` + // SpokeHub: Hub information // +optional Hub SpokeHub `json:"hub"` diff --git a/charts/cluster-manager-spoke/README.md b/charts/cluster-manager-spoke/README.md index 04680861..1d18beb8 100644 --- a/charts/cluster-manager-spoke/README.md +++ b/charts/cluster-manager-spoke/README.md @@ -48,6 +48,7 @@ The following table lists the configurable parameters of the `cluster-manager-sp | Parameter | Description | Default | |----------------------------------------|-------------|----------------------------------------------| | clusterName | | "" | +| agentNamespace | | "" | | hub.apiServer | | "" | | hub.kubeConfig | | "" | | klusterlet.name | | klusterlet | diff --git a/charts/cluster-manager-spoke/templates/bootstrap_hub_kubeconfig.yaml b/charts/cluster-manager-spoke/templates/bootstrap_hub_kubeconfig.yaml index 4f3a4c89..fb60e0ee 100644 --- a/charts/cluster-manager-spoke/templates/bootstrap_hub_kubeconfig.yaml +++ b/charts/cluster-manager-spoke/templates/bootstrap_hub_kubeconfig.yaml @@ -3,7 +3,7 @@ apiVersion: v1 kind: Secret metadata: name: bootstrap-hub-kubeconfig - namespace: {{ .Release.Namespace }} + namespace: {{ required "A valid .agentNamespace entry required!" .Values.agentNamespace }} type: Opaque data: kubeconfig: {{ required "A valid .hub.kubeConfig entry required!" .Values.hub.kubeConfig }} diff --git a/charts/cluster-manager-spoke/templates/hosted/external_managed_kubeconfig.yaml b/charts/cluster-manager-spoke/templates/hosted/external_managed_kubeconfig.yaml index 29eec323..4283aa9c 100644 --- a/charts/cluster-manager-spoke/templates/hosted/external_managed_kubeconfig.yaml +++ b/charts/cluster-manager-spoke/templates/hosted/external_managed_kubeconfig.yaml @@ -5,7 +5,7 @@ apiVersion: v1 kind: Secret metadata: name: external-managed-kubeconfig - namespace: {{ .Release.Namespace }} + namespace: {{ required "A valid .agentNamespace entry required!" .Values.agentNamespace }} type: Opaque data: kubeconfig: {{ .Values.managedKubeconfig }} diff --git a/charts/cluster-manager-spoke/templates/namespace.yaml b/charts/cluster-manager-spoke/templates/namespace.yaml index 0f525cfe..740a4fec 100644 --- a/charts/cluster-manager-spoke/templates/namespace.yaml +++ b/charts/cluster-manager-spoke/templates/namespace.yaml @@ -5,3 +5,12 @@ metadata: annotations: workload.openshift.io/allowed: "management" name: open-cluster-management + +--- + +apiVersion: v1 +kind: Namespace +metadata: + annotations: + workload.openshift.io/allowed: "management" + name: {{ required "A valid .agentNamespace entry required!" .Values.agentNamespace }} diff --git a/charts/cluster-manager-spoke/values.openapiv3_schema.yaml b/charts/cluster-manager-spoke/values.openapiv3_schema.yaml index 7f9b1aa7..75a66c65 100644 --- a/charts/cluster-manager-spoke/values.openapiv3_schema.yaml +++ b/charts/cluster-manager-spoke/values.openapiv3_schema.yaml @@ -1,4 +1,6 @@ properties: + agentNamespace: + type: string bundleVersion: properties: operatorImageVersion: @@ -65,5 +67,6 @@ properties: type: object type: array required: +- agentNamespace - clusterName type: object diff --git a/charts/cluster-manager-spoke/values.yaml b/charts/cluster-manager-spoke/values.yaml index 9e3c6a73..0847bef1 100644 --- a/charts/cluster-manager-spoke/values.yaml +++ b/charts/cluster-manager-spoke/values.yaml @@ -1,5 +1,7 @@ clusterName: "" +agentNamespace: "" + hub: apiServer: "" kubeConfig: "" diff --git a/s.yaml b/s.yaml deleted file mode 100644 index 08e56d86..00000000 --- a/s.yaml +++ /dev/null @@ -1,8 +0,0 @@ -apiVersion: v1 -kind: Secret -metadata: - name: default-token2 - annotations: - kubernetes.io/service-account.name: default -type: kubernetes.io/service-account-token -