Skip to content

Commit

Permalink
Define installStrategy in ClusterManagementAddOn (#198)
Browse files Browse the repository at this point in the history
Signed-off-by: Rokibul Hasan <mdrokibulhasan@appscode.com>
  • Loading branch information
RokibulHasan7 committed Jun 11, 2024
1 parent 3afda24 commit 44993c8
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 17 deletions.
10 changes: 2 additions & 8 deletions charts/cluster-proxy/templates/clustermanagementaddon.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,8 @@ spec:
name: cluster-proxy
- group: addon.open-cluster-management.io
resource: addondeploymentconfigs
{{- if .Values.installByPlacement.placementName }}
installStrategy:
type: Placements
placements:
- name: {{ .Values.installByPlacement.placementName }}
{{- if .Values.installByPlacement.placementNamespace }}
namespace: {{ .Values.installByPlacement.placementNamespace }}
{{- else }}
namespace: {{ .Release.Namespace }}
{{- end }}
{{- end }}
- name: {{ .Values.installByPlacement.placementName | default "cluster-proxy-placement" }}
namespace: {{ .Values.installByPlacement.placementNamespace | default .Release.Namespace }}
11 changes: 11 additions & 0 deletions charts/cluster-proxy/templates/clustersetbinding.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{{- if not .Values.installByPlacement.placementName }}

apiVersion: cluster.open-cluster-management.io/v1beta2
kind: ManagedClusterSetBinding
metadata:
name: global
namespace: {{ .Release.Namespace }}
spec:
clusterSet: global

{{- end }}
1 change: 0 additions & 1 deletion charts/cluster-proxy/templates/manager-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ spec:
args:
- --leader-elect=true
- --signer-secret-namespace={{ .Release.Namespace }}
- --agent-install-all=true
securityContext:
allowPrivilegeEscalation: false
capabilities:
Expand Down
10 changes: 10 additions & 0 deletions charts/cluster-proxy/templates/placement.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{{- if not .Values.installByPlacement.placementName }}
apiVersion: cluster.open-cluster-management.io/v1beta1
kind: Placement
metadata:
name: cluster-proxy-placement
namespace: {{ .Release.Namespace }}
spec:
clusterSets:
- global
{{- end }}
10 changes: 2 additions & 8 deletions cmd/addon-manager/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ var (
func init() {
utilruntime.Must(clientgoscheme.AddToScheme(scheme))

utilruntime.Must(addonv1alpha1.AddToScheme(scheme))
utilruntime.Must(addonv1alpha1.Install(scheme))
utilruntime.Must(proxyv1alpha1.AddToScheme(scheme))
utilruntime.Must(clusterv1beta2.AddToScheme(scheme))
utilruntime.Must(clusterv1beta2.Install(scheme))
//+kubebuilder:scaffold:scheme
}

Expand All @@ -68,7 +68,6 @@ func main() {
var enableLeaderElection bool
var probeAddr string
var signerSecretNamespace, signerSecretName string
var agentInstallAll bool
var enableKubeApiProxy bool

logger := textlogger.NewLogger(textlogger.NewConfig())
Expand All @@ -86,11 +85,6 @@ func main() {
flag.StringVar(&config.AgentImageName, "agent-image-name",
config.AgentImageName,
"The name of the addon agent's image")
// This is deprecated.
flag.BoolVar(
&agentInstallAll, "agent-install-all", false,
"Configure the install strategy of agent on managed clusters. "+
"Enabling this will automatically install agent on all managed cluster.")
flag.BoolVar(&enableKubeApiProxy, "enable-kube-api-proxy", true, "Enable proxy to agent kube-apiserver")
flag.StringVar(&config.DefaultAddonInstallNamespace, "agent-install-namespace", config.DefaultAddonInstallNamespace,
"The default namespace to install the addon agents.")
Expand Down

0 comments on commit 44993c8

Please sign in to comment.