cluster-template-examples
cluster-template-examples copied to clipboard
clustertemplate role binding namespace not found
hey guys i wanna to ask you is the template really valid ? because with that i cannot find my namespaces
namespace: c-m-{{ trunc 8 (sha256sum (printf "%s/%s" $root.Release.Namespace $root.Values.cluster.name)) }}
Hi!
Rancher 2.7 seems to have change to a random id since https://github.com/rancher/rancher/commit/cc9f7eed4264a9805c69efcbd9b7856a24dbc6b1
Make it much harder to do project and fix permissions for the created clusters.
+1 still a problem in rancher v2.7.3
+1
Still a problem on Rancher v2.7.5
Is there a workaround? How is the Rancher cattle-management cluster name generated? Simply truncating the sha256sum
of the release namespace concatted with /
+ cluster name is no longer valid.
clusterroletemplatebinding.yaml
1 {{ $root := . }}
2 {{- range $index, $member := .Values.clusterMembers }}
3 apiVersion: management.cattle.io/v3
4 clusterName: c-m-{{ trunc 8 (sha256sum (printf "%s/%s" $root.Release.Namespace $root.Values.cluster.name)) }}
5 kind: ClusterRoleTemplateBinding
6 metadata:
7 name: ctrb-{{ trunc 8 (sha256sum (printf "%s/%s" $root.Release.Namespace $member.principalName )) }}
8 namespace: c-m-{{ trunc 8 (sha256sum (printf "%s/%s" $root.Release.Namespace $root.Values.cluster.name)) }}
9 roleTemplateName: {{ $member.roleTemplateName }}
10 userPrincipalName: {{ $member.principalName }}
11 principalId: {{ $member.principalId }}
12 {{- end }}
Example deploying cluster template:
Valid Namespace: c-m-ppthnkp5
Output:
$ helm upgrade -i -n fleet-default --values ./charts/values.yaml $(CLUSTER) ./charts
Error: UPGRADE FAILED: failed to create resource: namespaces "c-m-b41e0870" not found