File tree Expand file tree Collapse file tree 10 files changed +42
-16
lines changed
Expand file tree Collapse file tree 10 files changed +42
-16
lines changed Original file line number Diff line number Diff line change @@ -32,6 +32,7 @@ dependencies:
3232- name : sealed-secrets
3333 repository : https://bitnami-labs.github.io/sealed-secrets/
3434 version : 2.17.2
35+ condition : sealed-secrets.enabled
3536- name : codefresh-tunnel-client
3637 repository : oci://quay.io/codefresh/charts
3738 version : 0.1.21
Original file line number Diff line number Diff line change 1111{{/* Workaround to NOT change label selectors from previous runtime release when event-reporter was part of cf-argocd-extras Subchart */}}
1212{{- $_ := set $context.Values "nameOverride" "cf-argocd-extras" }}
1313
14+ {{/* Remove nonResourceURLs when RBAC is namespaced */}}
15+ {{- $rules := $context.Values.rbac.rules }}
16+ {{- if $context.Values.rbac.namespaced }}
17+ {{- $rules = list }}
18+ {{- range $context.Values.rbac.rules }}
19+ {{- if not .nonResourceURLs }}
20+ {{- $rules = append $rules . }}
21+ {{- end }}
22+ {{- end }}
23+ {{- end }}
24+ {{- $_ := set $context.Values.rbac "rules" $rules }}
25+
1426{{- $templateName := printf "cf-common-%s.rbac" (index .Subcharts "cf-common").Chart.Version }}
1527{{- include $templateName $context }}
1628
Original file line number Diff line number Diff line change @@ -14,6 +14,9 @@ global:
1414
1515replicaCount: 1
1616
17+ # -- Restrict the gitops operator to a single namespace (by the namespace of Helm release)
18+ singleNamespace: false
19+
1720# -- Codefresh gitops operator crds
1821crds:
1922 # -- Whether or not to install CRDs
Original file line number Diff line number Diff line change 11
22{{- define "gitops-operator.resources.promotion-template-rbac" }}
33apiVersion : rbac.authorization.k8s.io/v1
4- kind : ClusterRole
4+ kind : {{ .Values.singleNamespace | ternary "Role" " ClusterRole" }}
55metadata :
66 labels :
77 {{- include "gitops-operator.selectorLabels" . | nindent 4 }}
@@ -45,14 +45,14 @@ rules:
4545
4646---
4747apiVersion : rbac.authorization.k8s.io/v1
48- kind : ClusterRoleBinding
48+ kind : {{ .Values.singleNamespace | ternary "RoleBinding" " ClusterRoleBinding" }}
4949metadata :
5050 labels :
5151 {{- include "gitops-operator.selectorLabels" . | nindent 4 }}
5252 name : promotion-template
5353roleRef :
5454 apiGroup : rbac.authorization.k8s.io
55- kind : ClusterRole
55+ kind : {{ .Values.singleNamespace | ternary "Role" " ClusterRole" }}
5656 name : promotion-template
5757subjects :
5858- kind : ServiceAccount
Original file line number Diff line number Diff line change 11
22{{- define "gitops-operator.resources.auth-proxy-rbac" }}
33apiVersion : rbac.authorization.k8s.io/v1
4- kind : ClusterRole
4+ kind : {{ .Values.singleNamespace | ternary "Role" " ClusterRole" }}
55metadata :
66 labels :
77 {{- include "gitops-operator.selectorLabels" . | nindent 4 }}
@@ -22,14 +22,14 @@ rules:
2222
2323---
2424apiVersion : rbac.authorization.k8s.io/v1
25- kind : ClusterRoleBinding
25+ kind : {{ .Values.singleNamespace | ternary "RoleBinding" " ClusterRoleBinding" }}
2626metadata :
2727 labels :
2828 {{- include "gitops-operator.selectorLabels" . | nindent 4 }}
2929 name : codefresh-gitops-operator-proxy
3030roleRef :
3131 apiGroup : rbac.authorization.k8s.io
32- kind : ClusterRole
32+ kind : {{ .Values.singleNamespace | ternary "Role" " ClusterRole" }}
3333 name : codefresh-gitops-operator-proxy
3434subjects :
3535- kind : ServiceAccount
Original file line number Diff line number Diff line change 11
22{{- define "gitops-operator.resources.rbac-operator" }}
33apiVersion : rbac.authorization.k8s.io/v1
4- kind : ClusterRole
4+ kind : {{ .Values.singleNamespace | ternary "Role" " ClusterRole" }}
55metadata :
66 labels :
77 {{- include "gitops-operator.selectorLabels" . | nindent 4 }}
2626 - patch
2727 - update
2828 - watch
29+ {{- if not .Values.singleNamespace }}
2930- apiGroups :
3031 - codefresh.io
3132 resources :
5253 - get
5354 - patch
5455 - update
56+ {{- end }}
5557- apiGroups :
5658 - " "
5759 resources :
@@ -72,29 +74,29 @@ rules:
7274
7375---
7476apiVersion : rbac.authorization.k8s.io/v1
75- kind : ClusterRoleBinding
77+ kind : {{ .Values.singleNamespace | ternary "RoleBinding" " ClusterRoleBinding" }}
7678metadata :
7779 labels :
7880 {{- include "gitops-operator.selectorLabels" . | nindent 4 }}
7981 name : codefresh-gitops-operator
8082roleRef :
8183 apiGroup : rbac.authorization.k8s.io
82- kind : ClusterRole
84+ kind : {{ .Values.singleNamespace | ternary "Role" " ClusterRole" }}
8385 name : codefresh-gitops-operator
8486subjects :
8587- kind : ServiceAccount
8688 name : {{ include "gitops-operator.serviceAccountName" . }}
8789 namespace : {{ .Release.Namespace }}
8890---
8991apiVersion : rbac.authorization.k8s.io/v1
90- kind : ClusterRoleBinding
92+ kind : {{ .Values.singleNamespace | ternary "RoleBinding" " ClusterRoleBinding" }}
9193metadata :
9294 labels :
9395 {{- include "gitops-operator.selectorLabels" . | nindent 4 }}
9496 name : codefresh-gitops-operator-workflows
9597roleRef :
9698 apiGroup : rbac.authorization.k8s.io
97- kind : ClusterRole
99+ kind : {{ .Values.singleNamespace | ternary "Role" " ClusterRole" }}
98100 name : argo-edit
99101subjects :
100102- kind : ServiceAccount
Original file line number Diff line number Diff line change 11
22{{- define "gitops-operator.resources.restricted-git-source-rbac" }}
3+ {{- if not .Values.singleNamespace }}
34apiVersion : rbac.authorization.k8s.io/v1
45kind : ClusterRole
56metadata :
@@ -80,4 +81,5 @@ subjects:
8081- kind : ServiceAccount
8182 name : {{ include "gitops-operator.serviceAccountName" . }}
8283 namespace : {{ .Release.Namespace }}
84+ {{- end }}
8385{{- end }}
Original file line number Diff line number Diff line change @@ -431,11 +431,14 @@ Output comma separated list of installed runtime components
431431*/} }
432432{ {- define " codefresh-gitops-runtime.component-list" } }
433433 { {- $argoEvents := dict " name" " argo-events" " version" (get .Subcharts " argo-events" ).Chart.AppVersion } }
434- { {- $sealedSecrets := dict " name" " sealed-secrets" " version" (get .Subcharts " sealed-secrets" ).Chart.AppVersion } }
435434 { {- $internalRouter := dict " name" " internal-router" " version" .Chart.AppVersion } }
436435 { {- $appProxy := dict " name" " app-proxy" " version" (index (get .Values " app-proxy" ) " image" " tag" ) } }
437436 { {- $sourcesServer := dict " name" " sources-server" " version" (get .Values " cf-argocd-extras" ).sourcesServer.container.image.tag } }
438- { {- $comptList := list $argoEvents $appProxy $sealedSecrets $internalRouter $sourcesServer } }
437+ { {- $comptList := list $argoEvents $appProxy $internalRouter $sourcesServer } }
438+ { {- if and (index .Values " sealed-secrets" " enabled" ) } }
439+ { {- $sealedSecrets := dict " name" " sealed-secrets" " version" (get .Subcharts " sealed-secrets" ).Chart.AppVersion } }
440+ { {- $comptList = append $comptList $sealedSecrets } }
441+ { {- end } }
439442{ {- if and (index .Values " argo-cd" " enabled" ) } }
440443 { {- $argoCD := dict " name" " argocd" " version" (get .Subcharts " argo-cd" ).Chart.AppVersion } }
441444 { {- $comptList = append $comptList $argoCD } }
Original file line number Diff line number Diff line change 44{{- $_ := set $appProxyContext "Values" (deepCopy (get .Values "app-proxy")) }}
55{{- $_ := set $appProxyContext.Values "global" (deepCopy (get .Values "global")) }}
66apiVersion : rbac.authorization.k8s.io/v1
7- kind : ClusterRoleBinding
7+ kind : {{ $appProxyContext.Values.singleNamespace | ternary "RoleBinding" " ClusterRoleBinding" }}
88metadata :
99 name : cap-app-proxy-argo-workflows
1010roleRef :
1111 apiGroup : rbac.authorization.k8s.io
12- kind : ClusterRole
12+ kind : {{ $appProxyContext.Values.singleNamespace | ternary "Role" " ClusterRole" }}
1313 name : {{ include "codefresh-gitops-runtime.argo-workflows.server.name" . }}
1414subjects :
1515 - kind : ServiceAccount
Original file line number Diff line number Diff line change @@ -713,6 +713,9 @@ gitops-operator:
713713 annotations : {}
714714 # -- Additional labels for gitops operator CRDs
715715 additionalLabels : {}
716+ # -- Restrict the gitops operator to a single namespace (by the namespace of Helm release)
717+ singleNamespace : false
718+ # -- GitOps operator configuration
716719 config :
717720 # -- Task polling interval
718721 taskPollingInterval : 10s
@@ -724,8 +727,8 @@ gitops-operator:
724727 maxConcurrentReleases : 100
725728 # -- An optional template for the promotion wrapper (empty default will use the embedded one)
726729 promotionWrapperTemplate : ' '
730+ # -- GitOps operator image
727731 image :
728- # -- defaults
729732 registry : quay.io
730733 repository : codefresh/codefresh-gitops-operator
731734 tag : v0.11.1
You can’t perform that action at this time.
0 commit comments