Skip to content

feat: multi runtime install #617

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

Draft
wants to merge 8 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions charts/gitops-runtime/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ dependencies:
- name: sealed-secrets
repository: https://bitnami-labs.github.io/sealed-secrets/
version: 2.17.2
condition: sealed-secrets.enabled
- name: codefresh-tunnel-client
repository: oci://quay.io/codefresh/charts
version: 0.1.21
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,18 @@
{{/* Workaround to NOT change label selectors from previous runtime release when event-reporter was part of cf-argocd-extras Subchart */}}
{{- $_ := set $context.Values "nameOverride" "cf-argocd-extras" }}

{{/* Remove nonResourceURLs when RBAC is namespaced */}}
{{- $rules := $context.Values.rbac.rules }}
{{- if $context.Values.rbac.namespaced }}
{{- $rules = list }}
{{- range $context.Values.rbac.rules }}
{{- if not .nonResourceURLs }}
{{- $rules = append $rules . }}
{{- end }}
{{- end }}
{{- end }}
{{- $_ := set $context.Values.rbac "rules" $rules }}

{{- $templateName := printf "cf-common-%s.rbac" (index .Subcharts "cf-common").Chart.Version }}
{{- include $templateName $context }}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ global:

replicaCount: 1

# -- Restrict the gitops operator to a single namespace (by the namespace of Helm release)
singleNamespace: false

# -- Codefresh gitops operator crds
crds:
# -- Whether or not to install CRDs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ kind: ClusterRole
metadata:
labels:
{{- include "gitops-operator.selectorLabels" . | nindent 4 }}
name: promotion-template
name: {{ .Values.singleNamespace | ternary (printf "promotion-template-%s" .Release.Namespace) "promotion-template" }}
rules:
- apiGroups:
- ""
Expand Down Expand Up @@ -49,11 +49,11 @@ kind: ClusterRoleBinding
metadata:
labels:
{{- include "gitops-operator.selectorLabels" . | nindent 4 }}
name: promotion-template
name: {{ .Values.singleNamespace | ternary (printf "promotion-template-%s" .Release.Namespace) "promotion-template" }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: promotion-template
name: {{ .Values.singleNamespace | ternary (printf "promotion-template-%s" .Release.Namespace) "promotion-template" }}
subjects:
- kind: ServiceAccount
name: {{ include "gitops-operator.promotionTemplate.serviceAccountName" . }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ kind: ClusterRole
metadata:
labels:
{{- include "gitops-operator.selectorLabels" . | nindent 4 }}
name: codefresh-gitops-operator-proxy
name: {{ .Values.singleNamespace | ternary (printf "codefresh-gitops-operator-proxy-%s" .Release.Namespace) "codefresh-gitops-operator-proxy" }}
rules:
- apiGroups:
- authentication.k8s.io
Expand All @@ -26,11 +26,11 @@ kind: ClusterRoleBinding
metadata:
labels:
{{- include "gitops-operator.selectorLabels" . | nindent 4 }}
name: codefresh-gitops-operator-proxy
name: {{ .Values.singleNamespace | ternary (printf "codefresh-gitops-operator-proxy-%s" .Release.Namespace) "codefresh-gitops-operator-proxy" }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: codefresh-gitops-operator-proxy
name: {{ .Values.singleNamespace | ternary (printf "codefresh-gitops-operator-proxy-%s" .Release.Namespace) "codefresh-gitops-operator-proxy" }}
subjects:
- kind: ServiceAccount
name: {{ include "gitops-operator.serviceAccountName" . }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ kind: ClusterRole
metadata:
labels:
{{- include "gitops-operator.selectorLabels" . | nindent 4 }}
name: codefresh-gitops-operator
name: {{ .Values.singleNamespace | ternary (printf "codefresh-gitops-operator-%s" .Release.Namespace) "codefresh-gitops-operator" }}
rules:
- apiGroups:
- ""
Expand All @@ -26,6 +26,7 @@ rules:
- patch
- update
- watch
{{- if not .Values.singleNamespace }}
- apiGroups:
- codefresh.io
resources:
Expand All @@ -52,6 +53,7 @@ rules:
- get
- patch
- update
{{- end }}
- apiGroups:
- ""
resources:
Expand All @@ -69,33 +71,153 @@ rules:
- get
- list
- watch
---
{{- if .Values.singleNamespace }}
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: argo-role
rules:
- apiGroups:
- coordination.k8s.io
resources:
- leases
verbs:
- create
- get
- update
- apiGroups:
- ""
resources:
- pods
- pods/exec
verbs:
- create
- get
- list
- watch
- update
- patch
- delete
- apiGroups:
- ""
resources:
- configmaps
verbs:
- get
- watch
- list
- apiGroups:
- ""
resources:
- persistentvolumeclaims
- persistentvolumeclaims/finalizers
verbs:
- create
- update
- delete
- get
- apiGroups:
- argoproj.io
resources:
- workflows
- workflows/finalizers
- workflowtasksets
- workflowtasksets/finalizers
- workflowartifactgctasks
verbs:
- get
- list
- watch
- update
- patch
- delete
- create
- apiGroups:
- argoproj.io
resources:
- workflowtemplates
- workflowtemplates/finalizers
verbs:
- get
- list
- watch
- apiGroups:
- argoproj.io
resources:
- workflowtaskresults
verbs:
- list
- watch
- deletecollection
- apiGroups:
- ""
resources:
- serviceaccounts
verbs:
- get
- list
- apiGroups:
- ""
resources:
- secrets
verbs:
- get
- apiGroups:
- argoproj.io
resources:
- cronworkflows
- cronworkflows/finalizers
verbs:
- get
- list
- watch
- update
- patch
- delete
- apiGroups:
- ""
resources:
- events
verbs:
- create
- patch
- apiGroups:
- policy
resources:
- poddisruptionbudgets
verbs:
- create
- get
- delete
{{- end }}

---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
labels:
{{- include "gitops-operator.selectorLabels" . | nindent 4 }}
name: codefresh-gitops-operator
name: {{ .Values.singleNamespace | ternary (printf "codefresh-gitops-operator-%s" .Release.Namespace) "codefresh-gitops-operator" }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: codefresh-gitops-operator
name: {{ .Values.singleNamespace | ternary (printf "codefresh-gitops-operator-%s" .Release.Namespace) "codefresh-gitops-operator" }}
subjects:
- kind: ServiceAccount
name: {{ include "gitops-operator.serviceAccountName" . }}
namespace: {{ .Release.Namespace }}
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
kind: {{ .Values.singleNamespace | ternary "RoleBinding" "ClusterRoleBinding" }}
metadata:
labels:
{{- include "gitops-operator.selectorLabels" . | nindent 4 }}
name: codefresh-gitops-operator-workflows
name: {{ .Values.singleNamespace | ternary (printf "codefresh-gitops-operator-workflows-%s" .Release.Namespace) "codefresh-gitops-operator-workflows" }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: argo-edit
kind: {{ .Values.singleNamespace | ternary "Role" "ClusterRole" }}
name: {{ .Values.singleNamespace | ternary "argo-role" "argo-edit" }}
subjects:
- kind: ServiceAccount
name: {{ include "gitops-operator.serviceAccountName" . }}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@

{{- define "gitops-operator.resources.restricted-git-source-rbac" }}
{{- if not .Values.singleNamespace }}
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
Expand Down Expand Up @@ -80,4 +81,5 @@ subjects:
- kind: ServiceAccount
name: {{ include "gitops-operator.serviceAccountName" . }}
namespace: {{ .Release.Namespace }}
{{- end }}
{{- end }}
7 changes: 5 additions & 2 deletions charts/gitops-runtime/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -431,11 +431,14 @@ Output comma separated list of installed runtime components
*/}}
{{- define "codefresh-gitops-runtime.component-list"}}
{{- $argoEvents := dict "name" "argo-events" "version" (get .Subcharts "argo-events").Chart.AppVersion }}
{{- $sealedSecrets := dict "name" "sealed-secrets" "version" (get .Subcharts "sealed-secrets").Chart.AppVersion }}
{{- $internalRouter := dict "name" "internal-router" "version" .Chart.AppVersion }}
{{- $appProxy := dict "name" "app-proxy" "version" (index (get .Values "app-proxy") "image" "tag") }}
{{- $sourcesServer := dict "name" "sources-server" "version" (get .Values "cf-argocd-extras").sourcesServer.container.image.tag }}
{{- $comptList := list $argoEvents $appProxy $sealedSecrets $internalRouter $sourcesServer }}
{{- $comptList := list $argoEvents $appProxy $internalRouter $sourcesServer }}
{{- if and (index .Values "sealed-secrets" "enabled") }}
{{- $sealedSecrets := dict "name" "sealed-secrets" "version" (get .Subcharts "sealed-secrets").Chart.AppVersion }}
{{- $comptList = append $comptList $sealedSecrets }}
{{- end }}
{{- if and (index .Values "argo-cd" "enabled") }}
{{- $argoCD := dict "name" "argocd" "version" (get .Subcharts "argo-cd").Chart.AppVersion }}
{{- $comptList = append $comptList $argoCD }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
{{- $_ := set $appProxyContext "Values" (deepCopy (get .Values "app-proxy")) }}
{{- $_ := set $appProxyContext.Values "global" (deepCopy (get .Values "global")) }}
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
kind: {{ $appProxyContext.Values.singleNamespace | ternary "RoleBinding" "ClusterRoleBinding" }}
metadata:
name: cap-app-proxy-argo-workflows
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
kind: {{ $appProxyContext.Values.singleNamespace | ternary "Role" "ClusterRole" }}
name: {{ include "codefresh-gitops-runtime.argo-workflows.server.name" . }}
subjects:
- kind: ServiceAccount
Expand Down
4 changes: 3 additions & 1 deletion charts/gitops-runtime/templates/gitops-operator/crds.yaml
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
{{- include "gitops-operator.crds" . }}
{{- if and (index .Values "gitops-operator" "enabled") }}
{{- include "gitops-operator.crds" . }}
{{- end }}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{- if and (index .Values "gitops-operator" "enabled") }}
{{- $context := deepCopy . }}

{{- $defaultVals := include "gitops-operator.default-values" . | fromYaml }}
Expand Down Expand Up @@ -44,3 +45,4 @@
{{- end }}

{{- include "gitops-operator.resources.deployment" $context }}
{{- end }}
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
{{- include "gitops-operator.resources.promotion-template" . }}
{{- if and (index .Values "gitops-operator" "enabled") }}
{{- include "gitops-operator.resources.promotion-template" . }}
{{- end }}
4 changes: 3 additions & 1 deletion charts/gitops-runtime/templates/gitops-operator/rbac.yaml
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
{{- include "gitops-operator.resources.rbac" . }}
{{- if and (index .Values "gitops-operator" "enabled") }}
{{- include "gitops-operator.resources.rbac" . }}
{{- end }}
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
{{- if and (index .Values "gitops-operator" "enabled") }}

{{- $context := deepCopy . }}

{{- $defaultVals := include "gitops-operator.default-values" . | fromYaml }}
Expand All @@ -7,3 +9,5 @@
{{- $_ := set $context.Values "global" (deepCopy (get .Values "global")) }}

{{- include "gitops-operator.resources.sa" $context }}

{{- end }}
7 changes: 6 additions & 1 deletion charts/gitops-runtime/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -519,6 +519,8 @@ tunnel-client:
#-----------------------------------------------------------------------------------------------------------------------
app-proxy:
replicaCount: 1
# -- Restrict the app-proxy to a single namespace (by the namespace of Helm release)
singleNamespace: false
# -- Image enrichment process configuration
image-enrichment:
# -- Enable or disable enrichment process. Please note that for enrichemnt, argo-workflows has to be enabled as well.
Expand Down Expand Up @@ -685,6 +687,9 @@ gitops-operator:
annotations: {}
# -- Additional labels for gitops operator CRDs
additionalLabels: {}
# -- Restrict the gitops operator to a single namespace (by the namespace of Helm release)
singleNamespace: false
# -- GitOps operator configuration
config:
# -- Task polling interval
taskPollingInterval: 10s
Expand All @@ -696,8 +701,8 @@ gitops-operator:
maxConcurrentReleases: 100
# -- An optional template for the promotion wrapper (empty default will use the embedded one)
promotionWrapperTemplate: ''
# -- GitOps operator image
image:
# -- defaults
registry: quay.io
repository: codefresh/codefresh-gitops-operator
tag: v0.8.11
Expand Down