Skip to content

Commit 6d30d53

Browse files
0.2.13 alpha - fix csv generation for private registry utility and add pdb for eventbus (#57)
1 parent 7018ee2 commit 6d30d53

File tree

7 files changed

+55
-26
lines changed

7 files changed

+55
-26
lines changed

charts/gitops-runtime/Chart.yaml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ apiVersion: v2
22
appVersion: 0.1.30
33
description: A Helm chart for Codefresh gitops runtime
44
name: gitops-runtime
5-
version: 0.2.12-alpha
5+
version: 0.2.13-alpha
66
home: https://github.com/codefresh-io/gitops-runtime-helm
77
icon: https://avatars1.githubusercontent.com/u/11412079?v=3
88
keywords:
@@ -15,8 +15,10 @@ annotations:
1515
artifacthub.io/alternativeName: "codefresh-gitops-runtime"
1616
artifacthub.io/prerelease: "true"
1717
artifacthub.io/changes: |
18-
- kind: changed
19-
description: re-enabled pre-install hook by default, after validation code was fixed.
18+
- kind: fixed
19+
description: csv generation for private registry utility
20+
- kind: added
21+
description: pdb for eventbus
2022
dependencies:
2123
- name: argo-cd
2224
repository: https://codefresh-io.github.io/argo-helm

charts/gitops-runtime/README.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
## Codefresh gitops runtime
2-
![Version: 0.2.12-alpha](https://img.shields.io/badge/Version-0.2.12--alpha-informational?style=flat-square) ![AppVersion: 0.1.30](https://img.shields.io/badge/AppVersion-0.1.30-informational?style=flat-square)
2+
![Version: 0.2.13-alpha](https://img.shields.io/badge/Version-0.2.13--alpha-informational?style=flat-square) ![AppVersion: 0.1.30](https://img.shields.io/badge/AppVersion-0.1.30-informational?style=flat-square)
33

44
## Codefresh official documentation:
55
Prior to running the installation please see the official documentation at: https://codefresh.io/docs/docs/installation/gitops/hybrid-gitops-helm-installation/
@@ -15,7 +15,7 @@ We have created a helper utility to resolve this issue:
1515
The utility is packaged in a container image. Below are instructions on executing the utility using Docker:
1616

1717
```
18-
docker run -v <output_dir>:/output quay.io/codefresh/gitops-runtime-private-registry-utils:0.2.12-alpha <local_registry>
18+
docker run -v <output_dir>:/output quay.io/codefresh/gitops-runtime-private-registry-utils:0.2.13-alpha <local_registry>
1919
```
2020
`output_dir` - is a local directory where the utility will output files. <br>
2121
`local_registry` - is your local registry where you want to mirror the images to
@@ -142,10 +142,11 @@ The utility will output 4 files into the folder:
142142
| global.codefresh.userToken | object | `{"secretKeyRef":{},"token":""}` | User token. Used for runtime registration against the patform. One of token (for plain text value) or secretKeyRef must be provided. |
143143
| global.codefresh.userToken.secretKeyRef | object | `{}` | User token that references an existing secret containing the token. |
144144
| global.codefresh.userToken.token | string | `""` | User token in plain text. The chart creates and manages the secret for this token. |
145-
| global.runtime | object | `{"cluster":"https://kubernetes.default.svc","eventBus":{"nats":{"native":{"auth":"token","containerTemplate":{"resources":{"limits":{"cpu":"500m","ephemeral-storage":"2Gi","memory":"4Gi"},"requests":{"cpu":"200m","ephemeral-storage":"2Gi","memory":"1Gi"}}},"maxPayload":"4MB","replicas":3}}},"eventBusName":"codefresh-eventbus","gitCredentials":{"password":{"secretKeyRef":{},"value":null},"username":"username"},"ingress":{"annotations":{},"className":"nginx","enabled":false,"hosts":[],"protocol":"https","tls":[]},"ingressUrl":"","name":null}` | Runtime level settings |
145+
| global.runtime | object | `{"cluster":"https://kubernetes.default.svc","eventBus":{"name":"codefresh-eventbus","nats":{"native":{"auth":"token","containerTemplate":{"resources":{"limits":{"cpu":"500m","ephemeral-storage":"2Gi","memory":"4Gi"},"requests":{"cpu":"200m","ephemeral-storage":"2Gi","memory":"1Gi"}}},"maxPayload":"4MB","replicas":3}},"pdb":{"enabled":true,"minAvailable":2}},"gitCredentials":{"password":{"secretKeyRef":{},"value":null},"username":"username"},"ingress":{"annotations":{},"className":"nginx","enabled":false,"hosts":[],"protocol":"https","tls":[]},"ingressUrl":"","name":null}` | Runtime level settings |
146146
| global.runtime.cluster | string | `"https://kubernetes.default.svc"` | Runtime cluster. Should not be changed. |
147-
| global.runtime.eventBus | object | `{"nats":{"native":{"auth":"token","containerTemplate":{"resources":{"limits":{"cpu":"500m","ephemeral-storage":"2Gi","memory":"4Gi"},"requests":{"cpu":"200m","ephemeral-storage":"2Gi","memory":"1Gi"}}},"maxPayload":"4MB","replicas":3}}}` | EventBus spec |
148-
| global.runtime.eventBusName | string | `"codefresh-eventbus"` | Eventbus name |
147+
| global.runtime.eventBus.name | string | `"codefresh-eventbus"` | Eventbus name |
148+
| global.runtime.eventBus.pdb | object | `{"enabled":true,"minAvailable":2}` | Pod disruption budget for the eventbus |
149+
| global.runtime.eventBus.pdb.minAvailable | int | `2` | Minimum number of available eventbus pods. For eventbus to stay functional the majority of its replicas should always be available. |
149150
| global.runtime.gitCredentials | object | `{"password":{"secretKeyRef":{},"value":null},"username":"username"}` | Git credentials runtime. Runtime is not fully functional without those credentials. If not provided through the installation, they must be provided through the Codefresh UI. |
150151
| global.runtime.gitCredentials.password | object | `{"secretKeyRef":{},"value":null}` | Password. If using GitHub token, please provide it here. |
151152
| global.runtime.gitCredentials.password.secretKeyRef | object | `{}` | secretKeyReference for Git credentials password. Provide name and key fields. |

charts/gitops-runtime/templates/argo-events/eventbus.yaml

Lines changed: 0 additions & 13 deletions
This file was deleted.
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{{- $eventBusName := default "codefresh-eventbus" .Values.global.runtime.eventBus.name }}
2+
{{- $eventBusSpec := .Values.global.runtime.eventBus }}
3+
{{/* Remove name from eventbus spec */}}
4+
{{- if hasKey $eventBusSpec "name" }}
5+
{{- $eventBusSpec = unset $eventBusSpec "name" }}
6+
{{- end }}
7+
{{/* Remove pdb from eventbus spec */}}
8+
{{- if hasKey $eventBusSpec "pdb" }}
9+
{{- $eventBusSpec = unset $eventBusSpec "pdb" }}
10+
{{- end }}
11+
apiVersion: argoproj.io/v1alpha1
12+
kind: EventBus
13+
metadata:
14+
name: {{ $eventBusName }}
15+
annotations:
16+
argocd.argoproj.io/sync-wave: "2"
17+
labels:
18+
app.kubernetes.io/part-of: argo-events
19+
codefresh.io/internal: "true"
20+
spec:
21+
{{- $eventBusSpec | toYaml | nindent 2}}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{{- $eventBusName := default "codefresh-eventbus" .Values.global.runtime.eventBus.name }}
2+
{{- if .Values.global.runtime.eventBus.pdb.enabled }}
3+
apiVersion: policy/v1
4+
kind: PodDisruptionBudget
5+
metadata:
6+
name: {{ $eventBusName }}
7+
spec:
8+
minAvailable: 2
9+
selector:
10+
matchLabels:
11+
eventbus-name: {{ $eventBusName }}
12+
{{- end }}

charts/gitops-runtime/values.yaml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,15 @@ global:
7575
# -- secretKeyReference for Git credentials password. Provide name and key fields.
7676
secretKeyRef: {}
7777

78-
# -- Eventbus name
79-
eventBusName: 'codefresh-eventbus'
80-
# -- EventBus spec
78+
# -- Runtime eventbus
8179
eventBus:
80+
# -- Eventbus name
81+
name: 'codefresh-eventbus'
82+
# -- Pod disruption budget for the eventbus
83+
pdb:
84+
enabled: true
85+
# -- Minimum number of available eventbus pods. For eventbus to stay functional the majority of its replicas should always be available.
86+
minAvailable: 2
8287
nats:
8388
native:
8489
replicas: 3

scripts/private-registry-utils/private-registry-utils.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ def replace_registry_in_image(image_string, new_registry):
2424
parts[0] = new_registry
2525
return '/'.join(parts)
2626
else:
27-
return new_registry + '/' + image_string
27+
newimage = new_registry + '/' + image_string
28+
return newimage
2829

2930
# Try to identify whether a string is a docker image
3031
def is_docker_image(image_string):
@@ -86,7 +87,7 @@ def recurse_get_source_target(currValue,new_registry,lstSourceTarget):
8687
recurse_get_source_target(item,new_registry,lstSourceTarget)
8788
elif type(currValue) is str:
8889
if is_docker_image(currValue):
89-
lstSourceTarget.append({"source_image": currValue, "target_image": replace_registry_in_image(sourceImage,new_registry)})
90+
lstSourceTarget.append({"source_image": currValue, "target_image": replace_registry_in_image(currValue,new_registry)})
9091

9192
def generate_file_from_field(list_of_dicts, field_name, output_file):
9293
with open(output_file, 'w+') as file:

0 commit comments

Comments
 (0)