-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: use hive clusterdeployment for creating spoke clusters #472
Changes from all commits
f2215f7
f9bf1f7
5b4e903
a073b8c
c6ffd0e
6cd4e85
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
{{- range .Values.clusterGroup.managedClusterGroups }} | ||
{{- $group := . }} | ||
|
||
{{- range $group.clusterDeployments}} | ||
{{ $cluster := . }} | ||
|
||
{{- if (eq $cluster.name nil) }} | ||
{{- fail (printf "managedClusterGroup clusterDeployment cluster name is empty: %s" $cluster) }} | ||
{{- end }} | ||
{{- if (eq $group.name nil) }} | ||
{{- fail (printf "managedClusterGroup clusterDeployment group name is empty: %s" $cluster) }} | ||
{{- end }} | ||
|
||
{{- $deploymentName := print $cluster.name "-" $group.name }} | ||
|
||
{{- $cloud := "None" }} | ||
{{- $region := "None" }} | ||
|
||
{{- if $cluster.platform.aws }} | ||
{{- $cloud = "aws" }} | ||
{{- $region = $cluster.platform.aws.region }} | ||
{{- else if $cluster.platform.azure }} | ||
{{- $cloud = "azure" }} | ||
{{- $region = $cluster.platform.azure.region }} | ||
{{- end }} | ||
|
||
--- | ||
apiVersion: v1 | ||
kind: Namespace | ||
metadata: | ||
name: {{ $deploymentName }} | ||
|
||
--- | ||
apiVersion: hive.openshift.io/v1 | ||
kind: ClusterDeployment | ||
metadata: | ||
name: {{ $deploymentName }} | ||
namespace: {{ $deploymentName }} | ||
labels: | ||
vendor: OpenShift | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should add the following here:
because if you do a deployment from scratch (i.e. one where ACM gets installed at the same time), the ACM app might be stuck because the multiclusterhub (which provides these CRDs) has not been installed yet and Argo will be stuck with:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. good to know - thanks! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Resolved in a073b8c. |
||
annotations: | ||
argocd.argoproj.io/sync-options: SkipDryRunOnMissingResource=true | ||
spec: | ||
baseDomain: {{ $cluster.baseDomain }} | ||
clusterName: {{ $deploymentName }} | ||
installAttemptsLimit: 1 | ||
platform: | ||
{{ $cloud }}: | ||
credentialsSecretRef: | ||
name: {{ $deploymentName }}-creds | ||
region: {{ $region }} | ||
provisioning: | ||
installConfigSecretRef: | ||
name: {{ $deploymentName }}-install-config | ||
sshPrivateKeySecretRef: | ||
name: {{ $deploymentName }}-ssh-private-key | ||
imageSetRef: | ||
name: img{{ $cluster.openshiftVersion }}-multi-appsub | ||
pullSecretRef: | ||
name: {{ $deploymentName }}-pull-secret | ||
|
||
--- | ||
apiVersion: cluster.open-cluster-management.io/v1 | ||
kind: ManagedCluster | ||
metadata: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as above with ClusterDeployment. We should probably add the annotation:
otherwise during an install from scratch we get:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Resolved in a073b8c. |
||
labels: | ||
cluster.open-cluster-management.io/clusterset: {{ $group.name }} | ||
{{- if (not $group.acmlabels) }} | ||
clusterGroup: {{ $group.name }} | ||
{{- else if eq (len $group.acmlabels) 0 }} | ||
clusterGroup: {{ $group.name }} | ||
{{- else }} | ||
{{- range $group.acmlabels }} | ||
{{ .name }}: {{ .value }} | ||
{{- end }} | ||
{{- end }} | ||
name: {{ $deploymentName }} | ||
annotations: | ||
argocd.argoproj.io/sync-options: SkipDryRunOnMissingResource=true | ||
spec: | ||
hubAcceptsClient: true | ||
{{- end }}{{- /* range $group.clusterDeployments */}} | ||
{{- end }}{{- /* range .Values.clusterGroup.managedClusterGroups */}} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{{- range .Values.clusterGroup.managedClusterGroups }} | ||
{{- if or .clusterPools .clusterDeployments }}{{- /* We only create ManagedClusterSets if there are clusterPools or clusterDeployments defined */}} | ||
--- | ||
apiVersion: cluster.open-cluster-management.io/v1beta2 | ||
kind: ManagedClusterSet | ||
metadata: | ||
annotations: | ||
cluster.open-cluster-management.io/submariner-broker-ns: {{ .name }}-broker | ||
argocd.argoproj.io/sync-options: SkipDryRunOnMissingResource=true | ||
name: {{ .name }} | ||
|
||
{{- end }}{{- /* if .clusterPools) */}} | ||
{{- end }}{{- /* range .Values.clusterGroup.managedClusterGroups */}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One thing that we could add here (because I am an idiot an I got bitten by it) is the following:
Reason was that I did not add the name attribute under the group and when running
make preview-acm
I saw a bunch of<nil>
in the object names and it surprised me a bit ;)We can also do it on top later, just writing it here so I don't forget
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ohh good catch! we'll add it here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Resolved in a073b8c.
Should we do the same for clusterpool.yaml?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah let's do later it in another PR maybe
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#524