Skip to content

Commit

Permalink
[greenhouse-ccloud] switch teamrolebinding to clusterSelector (#7047)
Browse files Browse the repository at this point in the history
* [greenhouse-ccloud] switch teamrolebinding to clusterSelector

* Update system/greenhouse-ccloud/templates/team-rolebindings.yaml

Co-authored-by: IvoGoman <[email protected]>

---------

Co-authored-by: IvoGoman <[email protected]>
  • Loading branch information
auhlig and IvoGoman authored Sep 16, 2024
1 parent 672c0e8 commit 3b2291a
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 12 deletions.
2 changes: 1 addition & 1 deletion system/greenhouse-ccloud/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ apiVersion: v2
name: ccloud
description: A Helm chart for the CCloud organization in Greenhouse.
type: application
version: 1.4.4
version: 1.4.5
9 changes: 5 additions & 4 deletions system/greenhouse-ccloud/ci/test-values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@ teams:
teamRoleBindings:
- teamRef: team1
teamRoleRef: role1
clusterNames:
- cluster1
- cluster2
clusterSelector:
matchLabels:
cluster-type: compute
environment: production

oidc:
issuer: https://top.secret
Expand Down Expand Up @@ -52,7 +53,7 @@ kubeconfigGenerator:
clientSecret: "TopSecret!"
swift:
username: "technical-user"
domainName: "my-domain"
domain: "my-domain"
projectID: "1234-project-id"
container: "container-one"
region: "testing"
Expand Down
9 changes: 4 additions & 5 deletions system/greenhouse-ccloud/templates/team-rolebindings.yaml
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
{{ $chartName := .Chart.Name }}
{{ range $roleBinding := .Values.teamRoleBindings }}
{{- if and $roleBinding.teamRef $roleBinding.teamRoleRef $roleBinding.clusterNames }}
{{- range $clusterName := $roleBinding.clusterNames }}
{{- if and $roleBinding.teamRef $roleBinding.teamRoleRef $roleBinding.clusterSelector }}
---
apiVersion: greenhouse.sap/v1alpha1
kind: TeamRoleBinding
metadata:
name: {{ printf "%s-%s-%s" $roleBinding.teamRef $roleBinding.teamRoleRef $clusterName | trunc 63 | trimSuffix "-" }}
name: {{ printf "%s-%s" $roleBinding.teamRef $roleBinding.teamRoleRef | trunc 63 | trimSuffix "-" }}
namespace: {{ $chartName }}
spec:
teamRef: {{ $roleBinding.teamRef }}
teamRoleRef: {{ $roleBinding.teamRoleRef }}
clusterName: {{ $clusterName }}
clusterSelector:
{{- $roleBinding.clusterSelector | toYaml | nindent 4 }}
{{- end }}
{{- else }}
{{- printf "Error: Missing teamRef, teamRoleRef, or clusterName in teamRoleBinding: %#v" $roleBinding | fail }}
{{- end }}
{{- end }}
6 changes: 4 additions & 2 deletions system/greenhouse-ccloud/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@ teams: {}
teamRoleBindings: []
# - teamRef: team1
# teamRoleRef: role1
# clusterNames:
# - cluster1
# clusterSelector
# matchLabels:
# cluster-type: compute
# environment: production

oidc:
issuer:
Expand Down

0 comments on commit 3b2291a

Please sign in to comment.