Skip to content

Commit c8746f9

Browse files
shirtabachiimikhail-klimkophilipkotliyakovATGardnercf-ci-bot-v2
authored
feat: multi-runtime installation (#939) (#946)
* feat: support single-namespaced runtime installation (#617) --------- * Support multi-runtime-installation --------- Co-authored-by: mikhail-klimko <[email protected]> Co-authored-by: Philip Kotliyakov <[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 0165f13 commit c8746f9

34 files changed

+436
-35
lines changed

.github/workflows/component-test.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ jobs:
6868
helm repo add mockserver https://www.mock-server.com
6969
7070
71+
7172
- name: Run KUTTL tests
7273
run: |
7374
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: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ dependencies:
3333
- name: sealed-secrets
3434
repository: https://bitnami-labs.github.io/sealed-secrets/
3535
version: 2.17.2
36+
condition: sealed-secrets.enabled
3637
- name: codefresh-tunnel-client
3738
repository: oci://quay.io/codefresh/charts
3839
version: 0.1.22

charts/gitops-runtime/README.md

Lines changed: 64 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,68 @@ See [Use OCI-based registries](https://helm.sh/docs/topics/registries/)
3131
## Codefresh official documentation:
3232
Prior to running the installation please see the official documentation at: https://codefresh.io/docs/docs/installation/gitops/hybrid-gitops-helm-installation/
3333

34+
## Multi Runtime Installation
35+
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.
36+
To achieve this, configure your Runtimes to run in namespaced mode by setting `global.runtime.singleNamespace=true`. See the values.yaml example below:
37+
```yaml
38+
global:
39+
runtime:
40+
singleNamespace: true
41+
sealed-secrets:
42+
enabled: false
43+
argo-cd:
44+
createClusterRoles: false
45+
crds:
46+
install: false
47+
configs:
48+
params:
49+
application.namespaces: ''
50+
argo-events:
51+
controller:
52+
rbac:
53+
namespaced: true
54+
argo-workflows:
55+
crds:
56+
install: false
57+
singleNamespace: true
58+
createAggregateRoles: false
59+
controller:
60+
clusterWorkflowTemplates:
61+
enabled: false
62+
server:
63+
clusterWorkflowTemplates:
64+
enabled: false
65+
argo-rollouts:
66+
enabled: false
67+
tunnel-client:
68+
enabled: false
69+
gitops-operator:
70+
crds:
71+
install: false
72+
```
73+
74+
Note that for the first runtime in the cluster, you have to configure it to install the CRDs, with setting these values:
75+
```yaml
76+
global:
77+
runtime:
78+
isConfigurationRuntime: true
79+
argo-cd:
80+
crds:
81+
install: true
82+
argo-workflows:
83+
crds:
84+
install: true
85+
argo-rollouts:
86+
installCRDs: true
87+
gitops-operator:
88+
crds:
89+
install: true
90+
```
91+
92+
> [!WARNING]
93+
> 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`.
94+
> If you already have a runtime installed in the cluster without this setting, multi runtime installation is not supported.
95+
3496
## Argo-workflows artifact and log storage
3597
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.
3698
If you want to utilize the Codefresh SaaS solution for log storage for all workflows in the runtime please set the following values:
@@ -555,6 +617,7 @@ global:
555617
| event-reporters.cluster-event-reporter | object | `{}` | |
556618
| event-reporters.runtime-event-reporter | object | `{}` | |
557619
| gitops-operator.affinity | object | `{}` | |
620+
| gitops-operator.config | object | `{"commitStatusPollingInterval":"10s","maxConcurrentReleases":100,"promotionWrapperTemplate":"","taskPollingInterval":"10s","workflowMonitorPollingInterval":"10s"}` | GitOps operator configuration |
558621
| gitops-operator.config.commitStatusPollingInterval | string | `"10s"` | Commit status polling interval |
559622
| 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) |
560623
| gitops-operator.config.maxReconcileRetries | int | `10` | Maximum number of reconcile retries on promotion-related resources before failing a promotion task |
@@ -638,7 +701,7 @@ global:
638701
| 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) |
639702
| global.runtime.isConfigurationRuntime | bool | `false` | is the runtime set as a "configuration runtime". |
640703
| global.runtime.name | string | `nil` | Runtime name. Must be unique per platform account. |
641-
| global.runtime.singleNamespace | bool | `false` | Defines if runtime is namespace scoped. Required for running multiple runtimes in the same cluster |
704+
| global.runtime.singleNamespace | bool | `false` | Runtime single namespace mode. When true, runtime operates in single namespace scope. |
642705
| global.tolerations | list | `[]` | Global tolerations for all components |
643706
| 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 |
644707
| 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
@@ -31,6 +31,69 @@ See [Use OCI-based registries](https://helm.sh/docs/topics/registries/)
3131
## Codefresh official documentation:
3232
Prior to running the installation please see the official documentation at: https://codefresh.io/docs/docs/installation/gitops/hybrid-gitops-helm-installation/
3333

34+
## Multi Runtime Installation
35+
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.
36+
To achieve this, configure your Runtimes to run in namespaced mode by setting `global.runtime.singleNamespace=true`. See the values.yaml example below:
37+
```yaml
38+
global:
39+
runtime:
40+
singleNamespace: true
41+
sealed-secrets:
42+
enabled: false
43+
argo-cd:
44+
createClusterRoles: false
45+
crds:
46+
install: false
47+
configs:
48+
params:
49+
application.namespaces: ''
50+
argo-events:
51+
controller:
52+
rbac:
53+
namespaced: true
54+
argo-workflows:
55+
crds:
56+
install: false
57+
singleNamespace: true
58+
createAggregateRoles: false
59+
controller:
60+
clusterWorkflowTemplates:
61+
enabled: false
62+
server:
63+
clusterWorkflowTemplates:
64+
enabled: false
65+
argo-rollouts:
66+
enabled: false
67+
tunnel-client:
68+
enabled: false
69+
gitops-operator:
70+
crds:
71+
install: false
72+
```
73+
74+
Note that for the first runtime in the cluster, you have to configure it to install the CRDs, with setting these values:
75+
```yaml
76+
global:
77+
runtime:
78+
isConfigurationRuntime: true
79+
argo-cd:
80+
crds:
81+
install: true
82+
argo-workflows:
83+
crds:
84+
install: true
85+
argo-rollouts:
86+
installCRDs: true
87+
gitops-operator:
88+
crds:
89+
install: true
90+
```
91+
92+
> [!WARNING]
93+
> 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`.
94+
> If you already have a runtime installed in the cluster without this setting, multi runtime installation is not supported.
95+
96+
3497
## Argo-workflows artifact and log storage
3598
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.
3699
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 }}
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 }}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{{- define "argo-cd.namespaced-rbac.serviceaccount" }}
2+
apiVersion: v1
3+
kind: ServiceAccount
4+
metadata:
5+
name: argocd-manager
6+
namespace: {{ .Release.Namespace }}
7+
labels:
8+
{{- include "codefresh-gitops-runtime.labels" . | nindent 4 }}
9+
codefresh.io/component: argocd-namespaced-rbac
10+
{{- end }}

0 commit comments

Comments
 (0)