Skip to content
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: support singleNamespace option #266

Draft
wants to merge 12 commits into
base: release/0.14
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
13 changes: 7 additions & 6 deletions charts/gitops-runtime/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
apiVersion: v2
appVersion: 0.1.62
appVersion: 0.1.64
description: A Helm chart for Codefresh gitops runtime
name: gitops-runtime
version: 0.0.0
Expand All @@ -16,7 +16,7 @@ annotations:
dependencies:
- name: argo-cd
repository: https://codefresh-io.github.io/argo-helm
version: 7.4.7-5-cap-2.12.3-2024.10.28-20100fc54
version: 7.4.7-6-cap-2.12.3-2024.11.14-d7a4c4e7e
- name: argo-events
repository: https://codefresh-io.github.io/argo-helm
version: 2.4.7-1-cap-CR-24607
Expand All @@ -31,18 +31,19 @@ dependencies:
- name: sealed-secrets
repository: https://bitnami-labs.github.io/sealed-secrets/
version: 2.16.1
condition: sealed-secrets.enabled
- name: codefresh-tunnel-client
repository: oci://quay.io/codefresh/charts
version: 0.1.17
version: 0.1.18
alias: tunnel-client
condition: tunnel-client.enabled
- name: codefresh-gitops-operator
repository: oci://quay.io/codefresh/charts
version: 0.3.6
repository: oci://quay.io/codefresh/charts/dev
version: 0.0.0-feat-cr-24670-namespaced-install
alias: gitops-operator
condition: gitops-operator.enabled
- name: garage
repository: https://codefresh-io.github.io/garage
alias: garage-workflows-artifact-storage
version: 0.5.0-cf.1
version: 0.5.0-cf.2
condition: garage-workflows-artifact-storage.enabled
24 changes: 18 additions & 6 deletions charts/gitops-runtime/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -135,15 +135,24 @@ Determine argocd server service port. Must be called with chart root context
Determine argocd server url. Must be called with chart root context
*/}}
{{- define "codefresh-gitops-runtime.argocd.server.url" -}}
{{- $argoCDValues := (get .Values "argo-cd") }}
{{- $protocol := "https" }}
{{- $serverName := include "codefresh-gitops-runtime.argocd.server.servicename" . }}
{{- $port := include "codefresh-gitops-runtime.argocd.server.serviceport" . }}
{{- $path := (get $argoCDValues.configs.params "server.rootpath") }}
{{- if (eq $port "80") }}
{{- $protocol = "http" }}
{{- end }}
{{- printf "%s://%s:%s%s" $protocol $serverName $port $path }}
{{- $url := include "codefresh-gitops-runtime.argocd.server.no-protocol-url" . }}
{{- printf "%s://%s" $protocol $url }}
{{- end}}

{{/*
Determine argocd server url witout the protocol. Must be called with chart root context
*/}}
{{- define "codefresh-gitops-runtime.argocd.server.no-protocol-url" -}}
{{- $argoCDValues := (get .Values "argo-cd") }}
{{- $serverName := include "codefresh-gitops-runtime.argocd.server.servicename" . }}
{{- $port := include "codefresh-gitops-runtime.argocd.server.serviceport" . }}
{{- $path := (get $argoCDValues.configs.params "server.rootpath") }}
{{- printf "%s:%s%s" $serverName $port $path }}
{{- end}}

{{/*
Expand Down Expand Up @@ -233,10 +242,13 @@ Output comma separated list of installed runtime components
{{- define "codefresh-gitops-runtime.component-list"}}
{{- $argoCD := dict "name" "argocd" "version" (get .Subcharts "argo-cd").Chart.AppVersion }}
{{- $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") }}
{{- $comptList := list $argoCD $argoEvents $appProxy $sealedSecrets $internalRouter}}
{{- $comptList := list $argoCD $argoEvents $appProxy $internalRouter}}
{{- if index (get .Values "sealed-secrets") "enabled" }}
{{- $sealedSecrets := dict "name" "sealed-secrets" "version" (get .Subcharts "sealed-secrets").Chart.AppVersion }}
{{- $comptList = append $comptList $sealedSecrets }}
{{- end }}
{{- if index (get .Values "argo-rollouts") "enabled" }}
{{- $rolloutReporter := dict "name" "rollout-reporter" "version" .Chart.AppVersion }}
{{- $argoRollouts := dict "name" "argo-rollouts" "version" (get .Subcharts "argo-rollouts").Chart.AppVersion }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,18 @@
{{- $_ := set $appProxyContext "Values" (get .Values "app-proxy") }}
{{- $_ := set $appProxyContext.Values "global" (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
{{- if $appProxyContext.Values.singleNamespace }}
namespace: {{ .Release.Namespace }}
{{- end }}
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
name: {{ include "cap-app-proxy.serviceAccountName" $appProxyContext }}
namespace: {{ .Release.Namespace }}
{{- end }}
{{- end }}
4 changes: 2 additions & 2 deletions charts/gitops-runtime/templates/gitops-operator.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{- if index (get .Values "gitops-operator") "libraryMode" }}
{{- if and (index (get .Values "gitops-operator") "libraryMode") (index (get .Values "gitops-operator") "enabled") }}
{{- $gitopsOperatorContext := (index .Subcharts "gitops-operator")}}
{{- $argoCDImageDict := index .Subcharts "argo-cd" "Values" "global" "image" }}
{{- if not $argoCDImageDict.tag }}
Expand All @@ -18,7 +18,7 @@

{{/* Set argo-cd-server service and port */}}
{{ if not (index .Values "gitops-operator").env.ARGO_CD_URL }}
{{- $_ := set $gitopsOperatorContext.Values.env "ARGO_CD_URL" (include "codefresh-gitops-runtime.argocd.server.url" . ) }}
{{- $_ := set $gitopsOperatorContext.Values.env "ARGO_CD_URL" (include "codefresh-gitops-runtime.argocd.server.no-protocol-url" . ) }}
{{- end }}

{{/* Set workflows url */}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ tests:
path: spec.template.spec.containers[1].env
content:
name: ARGO_CD_URL
value: http://myargocd-server:80/some-path
value: myargocd-server:80/some-path

- it: contains all resources for notifications controller
template: gitops-operator.yaml
Expand Down Expand Up @@ -371,11 +371,11 @@ tests:
argo-cd.configs.params:
server.rootpath: /some-path
argo-cd.fullnameOverride: myargocd
gitops-operator.env.ARGO_CD_URL: http://some-other-url
gitops-operator.env.ARGO_CD_URL: some-other-url:123
asserts:
- contains:
path: spec.template.spec.containers[1].env
content:
name: ARGO_CD_URL
value: http://some-other-url
value: some-other-url:123

18 changes: 12 additions & 6 deletions charts/gitops-runtime/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ installer:
# Sealed secrets
# -----------------------------------------------------------------------------------------------------------------------
sealed-secrets:
enabled: true
fullnameOverride: sealed-secrets-controller
keyrenewperiod: "720h"
image:
Expand Down Expand Up @@ -383,6 +384,7 @@ tunnel-client:
#-----------------------------------------------------------------------------------------------------------------------
app-proxy:
replicaCount: 1
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 @@ -428,15 +430,15 @@ app-proxy:
tag: 1.1.11-main
image:
repository: quay.io/codefresh/cap-app-proxy
tag: 1.3142.0
tag: 1.3146.0
pullPolicy: IfNotPresent
# -- Extra volume mounts for main container
extraVolumeMounts: []

initContainer:
image:
repository: quay.io/codefresh/cap-app-proxy-init
tag: 1.3142.0
tag: 1.3146.0
pullPolicy: IfNotPresent
command:
- ./init.sh
Expand Down Expand Up @@ -562,11 +564,12 @@ gitops-operator:
# -- Additional labels for gitops operator CRDs
additionalLabels: {}

singleNamespace: false
env: {}
image: {}
# -- defaults
# repository: quay.io/codefresh/codefresh-gitops-operator
# tag: 'v{{ .Chart.AppVersion }}'
image:
# -- defaults
# repository: quay.io/codefresh/codefresh-gitops-operator
tag: feat-cr-24670-namespaced-install-cdc9a73

serviceAccount:
create: true
Expand Down Expand Up @@ -649,3 +652,6 @@ garage-workflows-artifact-storage:
size: 100Mi
# -- Resources for garage pods. For smaller deployments at least 100m CPU and 1024Mi memory is reccommended. For larger deployments double this size.
resources: {}
# -- Helm tests
tests:
enabled: false
4 changes: 2 additions & 2 deletions installer-image/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
FROM debian:bullseye-slim

ARG CF_CLI_VERSION=v0.1.60
ARG KUBECTL_VERSION=v1.27.2
ARG CF_CLI_VERSION=v0.1.68
ARG KUBECTL_VERSION=v1.28.12
ARG TARGETARCH

RUN apt-get update && apt-get install curl -y
Expand Down
2 changes: 1 addition & 1 deletion scripts/get-all-images.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ helm template release-name $CHARTDIR -f $VALUESFILE \
| awk -F ': ' '{print $2}' | awk NF \
| tr -d '"' | tr -d ',' | cut -f1 -d"@" \
| sort -u \
> $OUTPUTFILE
> $OUTPUTFILE