Skip to content

Commit 0af88d3

Browse files
mikhail-klimkophilipkotliyakovshirtabachiiATGardnercf-ci-bot-v2
authored
feat: support single-namespaced runtime installation (#617)
--------- Co-authored-by: Philip Kotliyakov <[email protected]> Co-authored-by: shirtabachii <[email protected]> Co-authored-by: Noam Gal <[email protected]> Co-authored-by: cf-ci-bot-v2 <[email protected]> Co-authored-by: ilia-medvedev-codefresh <[email protected]>
1 parent ab4e6c7 commit 0af88d3

35 files changed

+460
-37
lines changed

.github/workflows/component-test.yaml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,16 @@ on:
55
push:
66
branches:
77
- main
8+
- 'stable/*'
9+
- 'monthly/*'
810
paths-ignore:
911
- "*.md"
1012
- charts/**
1113
pull_request:
1214
branches:
1315
- main
16+
- 'stable/*'
17+
- 'monthly/*'
1418
paths-ignore:
1519
- "*.md"
1620
- charts/**
@@ -68,7 +72,7 @@ jobs:
6872
helm repo add gitea-charts https://dl.gitea.com/charts/
6973
helm repo add mockserver https://www.mock-server.com
7074
71-
75+
7276
- name: Run KUTTL tests
7377
run: |
74-
cd tests/component-tests && ./../../bin/kuttl test --parallel 1 --start-kind=false --namespace e2e-test --config startup.yaml
78+
cd tests/component-tests && ./../../bin/kuttl test --parallel 1 --start-kind=false --namespace e2e-test --config startup.yaml

charts/gitops-runtime/Chart.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ apiVersion: v2
22
appVersion: 0.1.75
33
description: A Helm chart for Codefresh gitops runtime
44
name: gitops-runtime
5-
version: '0.23.3'
5+
version: '0.24.0'
66
home: https://github.com/codefresh-io/gitops-runtime-helm
77
icon: https://avatars1.githubusercontent.com/u/11412079?v=3
88
keywords:
@@ -37,6 +37,7 @@ dependencies:
3737
- name: sealed-secrets
3838
repository: https://bitnami-labs.github.io/sealed-secrets/
3939
version: 2.17.2
40+
condition: sealed-secrets.enabled
4041
- name: codefresh-tunnel-client
4142
repository: oci://quay.io/codefresh/charts
4243
version: 0.1.21

charts/gitops-runtime/README.md

Lines changed: 66 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,68 @@ See [Use OCI-based registries](https://helm.sh/docs/topics/registries/)
1515
## Codefresh official documentation:
1616
Prior to running the installation please see the official documentation at: https://codefresh.io/docs/docs/installation/gitops/hybrid-gitops-helm-installation/
1717

18+
## Multi Runtime Installation
19+
You can install multiple Codefresh GitOps Runtimes in the same cluster, as long as each Runtime is deployed in its own namespace and manages only the applications in that namespace.
20+
To achieve this, configure your Runtimes to run in namespaced mode by setting `global.runtime.singleNamespace=true`. See the values.yaml example below:
21+
```yaml
22+
global:
23+
runtime:
24+
singleNamespace: true
25+
sealed-secrets:
26+
enabled: false
27+
argo-cd:
28+
createClusterRoles: false
29+
crds:
30+
install: false
31+
configs:
32+
params:
33+
application.namespaces: ''
34+
argo-events:
35+
controller:
36+
rbac:
37+
namespaced: true
38+
argo-workflows:
39+
crds:
40+
install: false
41+
singleNamespace: true
42+
createAggregateRoles: false
43+
controller:
44+
clusterWorkflowTemplates:
45+
enabled: false
46+
server:
47+
clusterWorkflowTemplates:
48+
enabled: false
49+
argo-rollouts:
50+
enabled: false
51+
tunnel-client:
52+
enabled: false
53+
gitops-operator:
54+
crds:
55+
install: false
56+
```
57+
58+
Note that for the first runtime in the cluster, you have to configure it to install the CRDs, with setting these values:
59+
```yaml
60+
global:
61+
runtime:
62+
isConfigurationRuntime: true
63+
argo-cd:
64+
crds:
65+
install: true
66+
argo-workflows:
67+
crds:
68+
install: true
69+
argo-rollouts:
70+
installCRDs: true
71+
gitops-operator:
72+
crds:
73+
install: true
74+
```
75+
76+
> [!WARNING]
77+
> If you want more than one runtime in your cluster, make sure that all of the runtimes in your cluster are configured with `global.runtime.singleNamespace=true`.
78+
> If you already have a runtime installed in the cluster without this setting, multi runtime installation is not supported.
79+
1880
## Argo-workflows artifact and log storage
1981
Codefresh provides a SaaS object storage based solution for Argo workflows logs storage. The chart deploys a configmap named `codefresh-workflows-log-store` with the repository configuration.
2082
If you want to utilize the Codefresh SaaS solution for log storage for all workflows in the runtime please set the following values:
@@ -415,6 +477,7 @@ gitops-operator:
415477
| event-reporters.workflow.sensor.tolerations | list | `[]` | |
416478
| event-reporters.workflow.serviceAccount.create | bool | `true` | |
417479
| gitops-operator.affinity | object | `{}` | |
480+
| gitops-operator.config | object | `{"commitStatusPollingInterval":"10s","maxConcurrentReleases":100,"promotionWrapperTemplate":"","taskPollingInterval":"10s","workflowMonitorPollingInterval":"10s"}` | GitOps operator configuration |
418481
| gitops-operator.config.commitStatusPollingInterval | string | `"10s"` | Commit status polling interval |
419482
| gitops-operator.config.maxConcurrentReleases | int | `100` | Maximum number of concurrent releases being processed by the operator (this will not affect the number of releases being processed by the gitops runtime) |
420483
| gitops-operator.config.promotionWrapperTemplate | string | `""` | An optional template for the promotion wrapper (empty default will use the embedded one) |
@@ -427,9 +490,7 @@ gitops-operator:
427490
| gitops-operator.crds.keep | bool | `false` | Keep CRDs if gitops runtime release is uninstalled |
428491
| gitops-operator.enabled | bool | `true` | |
429492
| gitops-operator.fullnameOverride | string | `""` | |
430-
| gitops-operator.image.registry | string | `"quay.io"` | defaults |
431-
| gitops-operator.image.repository | string | `"codefresh/codefresh-gitops-operator"` | |
432-
| gitops-operator.image.tag | string | `"v0.10.2"` | |
493+
| gitops-operator.image | object | `{"registry":"quay.io","repository":"codefresh/codefresh-gitops-operator","tag":"v0.10.2"}` | GitOps operator image |
433494
| gitops-operator.imagePullSecrets | list | `[]` | |
434495
| gitops-operator.nameOverride | string | `""` | |
435496
| gitops-operator.nodeSelector | object | `{}` | |
@@ -482,7 +543,7 @@ gitops-operator:
482543
| global.httpsProxy | string | `""` | global HTTPS_PROXY for all components |
483544
| global.noProxy | string | `""` | global NO_PROXY for all components |
484545
| global.nodeSelector | object | `{}` | Global nodeSelector for all components |
485-
| global.runtime | object | `{"cluster":"https://kubernetes.default.svc","codefreshHosted":false,"eventBus":{"annotations":{},"jetstream":{"affinity":{},"containerTemplate":{"resources":{"limits":{"cpu":"500m","ephemeral-storage":"2Gi","memory":"4Gi"},"requests":{"cpu":"200m","ephemeral-storage":"2Gi","memory":"1Gi"}}},"maxPayload":"4MB","metadata":{"labels":{"app.kubernetes.io/name":"codefresh-eventbus"}},"nodeSelector":{},"replicas":3,"tolerations":[],"version":"latest"},"name":"","nats":{"native":{"affinity":{},"auth":"token","containerTemplate":{"resources":{"limits":{"cpu":"500m","ephemeral-storage":"2Gi","memory":"4Gi"},"requests":{"cpu":"200m","ephemeral-storage":"2Gi","memory":"1Gi"}}},"maxPayload":"4MB","metadata":{"labels":{"app.kubernetes.io/name":"codefresh-eventbus"}},"nodeSelector":{},"replicas":3,"tolerations":[]}},"pdb":{"enabled":true,"minAvailable":2},"type":"nats"},"gitCredentials":{"password":{"secretKeyRef":{},"value":null},"username":"username"},"ingress":{"annotations":{},"className":"nginx","enabled":false,"hosts":[],"labels":{},"protocol":"https","skipValidation":false,"tls":[]},"ingressUrl":"","isConfigurationRuntime":false,"name":null}` | Runtime level settings |
546+
| global.runtime | object | `{"cluster":"https://kubernetes.default.svc","codefreshHosted":false,"eventBus":{"annotations":{},"jetstream":{"affinity":{},"containerTemplate":{"resources":{"limits":{"cpu":"500m","ephemeral-storage":"2Gi","memory":"4Gi"},"requests":{"cpu":"200m","ephemeral-storage":"2Gi","memory":"1Gi"}}},"maxPayload":"4MB","metadata":{"labels":{"app.kubernetes.io/name":"codefresh-eventbus"}},"nodeSelector":{},"replicas":3,"tolerations":[],"version":"latest"},"name":"","nats":{"native":{"affinity":{},"auth":"token","containerTemplate":{"resources":{"limits":{"cpu":"500m","ephemeral-storage":"2Gi","memory":"4Gi"},"requests":{"cpu":"200m","ephemeral-storage":"2Gi","memory":"1Gi"}}},"maxPayload":"4MB","metadata":{"labels":{"app.kubernetes.io/name":"codefresh-eventbus"}},"nodeSelector":{},"replicas":3,"tolerations":[]}},"pdb":{"enabled":true,"minAvailable":2},"type":"nats"},"gitCredentials":{"password":{"secretKeyRef":{},"value":null},"username":"username"},"ingress":{"annotations":{},"className":"nginx","enabled":false,"hosts":[],"labels":{},"protocol":"https","skipValidation":false,"tls":[]},"ingressUrl":"","isConfigurationRuntime":false,"name":null,"singleNamespace":false}` | Runtime level settings |
486547
| global.runtime.cluster | string | `"https://kubernetes.default.svc"` | Runtime cluster. Should not be changed. |
487548
| global.runtime.codefreshHosted | bool | `false` | Defines whether this is a Codefresh hosted runtime. Should not be changed. |
488549
| global.runtime.eventBus | object | `{"annotations":{},"jetstream":{"affinity":{},"containerTemplate":{"resources":{"limits":{"cpu":"500m","ephemeral-storage":"2Gi","memory":"4Gi"},"requests":{"cpu":"200m","ephemeral-storage":"2Gi","memory":"1Gi"}}},"maxPayload":"4MB","metadata":{"labels":{"app.kubernetes.io/name":"codefresh-eventbus"}},"nodeSelector":{},"replicas":3,"tolerations":[],"version":"latest"},"name":"","nats":{"native":{"affinity":{},"auth":"token","containerTemplate":{"resources":{"limits":{"cpu":"500m","ephemeral-storage":"2Gi","memory":"4Gi"},"requests":{"cpu":"200m","ephemeral-storage":"2Gi","memory":"1Gi"}}},"maxPayload":"4MB","metadata":{"labels":{"app.kubernetes.io/name":"codefresh-eventbus"}},"nodeSelector":{},"replicas":3,"tolerations":[]}},"pdb":{"enabled":true,"minAvailable":2},"type":"nats"}` | Runtime eventbus |
@@ -503,6 +564,7 @@ gitops-operator:
503564
| global.runtime.ingressUrl | string | `""` | Explicit url for runtime ingress. Provide this value only if you don't want the chart to create and ingress (global.runtime.ingress.enabled=false) and tunnel-client is not used (tunnel-client.enabled=false) |
504565
| global.runtime.isConfigurationRuntime | bool | `false` | is the runtime set as a "configuration runtime". |
505566
| global.runtime.name | string | `nil` | Runtime name. Must be unique per platform account. |
567+
| global.runtime.singleNamespace | bool | `false` | Runtime single namespace mode. When true, runtime operates in single namespace scope. |
506568
| global.tolerations | list | `[]` | Global tolerations for all components |
507569
| installer | object | `{"affinity":{},"argoCdVersionCheck":{"argoServerLabels":{"app.kubernetes.io/component":"server","app.kubernetes.io/part-of":"argocd"}},"image":{"pullPolicy":"IfNotPresent","repository":"quay.io/codefresh/gitops-runtime-installer","tag":""},"nodeSelector":{},"skipUsageValidation":false,"skipValidation":false,"tolerations":[]}` | Runtime installer used for running hooks and checks on the release |
508570
| installer.skipUsageValidation | bool | `false` | if set to true, pre-install hook will *not* run |

charts/gitops-runtime/README.md.gotmpl

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,69 @@ See [Use OCI-based registries](https://helm.sh/docs/topics/registries/)
1515
## Codefresh official documentation:
1616
Prior to running the installation please see the official documentation at: https://codefresh.io/docs/docs/installation/gitops/hybrid-gitops-helm-installation/
1717

18+
## Multi Runtime Installation
19+
You can install multiple Codefresh GitOps Runtimes in the same cluster, as long as each Runtime is deployed in its own namespace and manages only the applications in that namespace.
20+
To achieve this, configure your Runtimes to run in namespaced mode by setting `global.runtime.singleNamespace=true`. See the values.yaml example below:
21+
```yaml
22+
global:
23+
runtime:
24+
singleNamespace: true
25+
sealed-secrets:
26+
enabled: false
27+
argo-cd:
28+
createClusterRoles: false
29+
crds:
30+
install: false
31+
configs:
32+
params:
33+
application.namespaces: ''
34+
argo-events:
35+
controller:
36+
rbac:
37+
namespaced: true
38+
argo-workflows:
39+
crds:
40+
install: false
41+
singleNamespace: true
42+
createAggregateRoles: false
43+
controller:
44+
clusterWorkflowTemplates:
45+
enabled: false
46+
server:
47+
clusterWorkflowTemplates:
48+
enabled: false
49+
argo-rollouts:
50+
enabled: false
51+
tunnel-client:
52+
enabled: false
53+
gitops-operator:
54+
crds:
55+
install: false
56+
```
57+
58+
Note that for the first runtime in the cluster, you have to configure it to install the CRDs, with setting these values:
59+
```yaml
60+
global:
61+
runtime:
62+
isConfigurationRuntime: true
63+
argo-cd:
64+
crds:
65+
install: true
66+
argo-workflows:
67+
crds:
68+
install: true
69+
argo-rollouts:
70+
installCRDs: true
71+
gitops-operator:
72+
crds:
73+
install: true
74+
```
75+
76+
> [!WARNING]
77+
> If you want more than one runtime in your cluster, make sure that all of the runtimes in your cluster are configured with `global.runtime.singleNamespace=true`.
78+
> If you already have a runtime installed in the cluster without this setting, multi runtime installation is not supported.
79+
80+
1881
## Argo-workflows artifact and log storage
1982
Codefresh provides a SaaS object storage based solution for Argo workflows logs storage. The chart deploys a configmap named `codefresh-workflows-log-store` with the repository configuration.
2083
If you want to utilize the Codefresh SaaS solution for log storage for all workflows in the runtime please set the following values:

charts/gitops-runtime/templates/_components/cap-app-proxy/_all_resources.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,5 @@
1010
{{ include "cap-app-proxy.resources.service" . }}
1111
---
1212
{{ include "cap-app-proxy.resources.sa" .}}
13-
{{- end }}
13+
---
14+
{{- end }}

charts/gitops-runtime/templates/_components/cap-app-proxy/_config.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,14 @@ argoCdUsername: {{ .Values.config.argoCdUsername }}
44
argoWorkflowsInsecure: {{ .Values.config.argoWorkflowsInsecure | quote }}
55
argoWorkflowsUrl: {{ default "" .Values.config.argoWorkflowsUrl }}
66
cors: {{ .Values.global.codefresh.url }}
7-
{{- with .Values.config.clusterChunkSize }}
7+
{{- with .Values.config.clusterChunkSize }}
88
clusterChunkSize: {{ . | quote }}
99
{{- end }}
1010
env: {{ .Values.config.env | quote}}
1111
isConfigurationRuntime: {{ .Values.global.runtime.isConfigurationRuntime | quote }}
1212
isExternalArgoCD: {{ .Values.global.runtime.isExternalArgoCD | quote }}
1313
runtimeName: {{ required "global.runtime.name is required" .Values.global.runtime.name | quote}}
14+
isNamespacedRuntime: {{ .Values.global.runtime.singleNamespace | quote }}
1415
skipGitPermissionValidation: {{ .Values.config.skipGitPermissionValidation | quote }}
1516
logLevel: {{ .Values.config.logLevel | quote }}
1617
{{- $enrichmentValues := get .Values "image-enrichment" }}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{{- define "argo-cd.namespaced-rbac.all" }}
2+
{{- if (index .Values "global" "runtime").singleNamespace }}
3+
{{- include "argo-cd.namespaced-rbac.serviceaccount" . }}
4+
---
5+
{{- include "argo-cd.namespaced-rbac.secret" . }}
6+
---
7+
{{- include "argo-cd.namespaced-rbac.role" . }}
8+
---
9+
{{- include "argo-cd.namespaced-rbac.rolebinding" . }}
10+
{{- end }}
11+
{{- end }}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{{- define "argo-cd.namespaced-rbac.role" }}
2+
apiVersion: rbac.authorization.k8s.io/v1
3+
kind: Role
4+
metadata:
5+
name: argocd-namespaced-role
6+
namespace: {{ .Release.Namespace }}
7+
labels:
8+
{{- include "codefresh-gitops-runtime.labels" . | nindent 4 }}
9+
codefresh.io/component: argocd-namespaced-rbac
10+
rules:
11+
- apiGroups:
12+
- '*'
13+
resources:
14+
- '*'
15+
verbs:
16+
- '*'
17+
{{- end }}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{{- define "argo-cd.namespaced-rbac.rolebinding" }}
2+
apiVersion: rbac.authorization.k8s.io/v1
3+
kind: RoleBinding
4+
metadata:
5+
name: argocd-namespaced-rolebinding
6+
namespace: {{ .Release.Namespace }}
7+
labels:
8+
{{- include "codefresh-gitops-runtime.labels" . | nindent 4 }}
9+
codefresh.io/component: argocd-namespaced-rbac
10+
roleRef:
11+
apiGroup: rbac.authorization.k8s.io
12+
kind: Role
13+
name: argocd-namespaced-role
14+
subjects:
15+
- kind: ServiceAccount
16+
name: argocd-manager
17+
namespace: {{ .Release.Namespace }}
18+
{{- end }}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{{- define "argo-cd.namespaced-rbac.secret" }}
2+
apiVersion: v1
3+
kind: Secret
4+
metadata:
5+
name: argocd-manager-long-lived-token
6+
annotations:
7+
kubernetes.io/service-account.name: argocd-manager
8+
type: kubernetes.io/service-account-token
9+
{{- end }}

0 commit comments

Comments
 (0)