Skip to content

Commit b531b91

Browse files
daniel-codefresholeksandr-codefreshyaroslav-codefreshmikhail-klimkoandrii-codefresh
authored
Release 0.1.37 (#292)
* CR-20911-app-proxy (#284) * bump app-proxy with security fixes * update app-proxy with security fix in autopilot * CR-20910 -- Fix gitops vulns (#285) Fix gitops vulns * feat: csdp-add-cluster chart templates update (#286) * appVersions (#288) * bump app-proxy (#289) Update kustomization.yaml * fix: argocd-manager sa token for openshift (#290) * Bump app-proxy (#291) Update kustomization.yaml * release 0.1.37 --------- Co-authored-by: Oleksandr Saulyak <oleksandr.saulyak@codefresh.io> Co-authored-by: Yaroslav Drachenko <yaroslav@codefresh.io> Co-authored-by: mikhail-klimko <mikhail.klimko@codefresh.io> Co-authored-by: Andrii Shaforostov <andrii@codefresh.io> Co-authored-by: Daniel Maizel <daniel.maizel@codefresh.io>
1 parent bcdef74 commit b531b91

File tree

19 files changed

+259
-102
lines changed

19 files changed

+259
-102
lines changed

Makefile

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
VERSION=$(shell cat VERSION)
22
KUST_VERSION_FILE="./csdp/base_components/bootstrap/kustomization.yaml"
33
RUNTIME_YAML_FILE="./csdp/hybrid/basic/runtime.yaml"
4+
YQ_BINARY := /usr/local/bin/yq
45

56
BUMP_CHECK_MSG="Error: git working tree is not clean, make sure that you ran 'make bump' locally and commit the changes!"
67

78
.PHONY: bump
8-
bump: /usr/local/bin/yq
9+
bump: $(YQ_BINARY)
910
@echo "bumping version ${VERSION}"
1011

1112
@echo "--> updating file: ${KUST_VERSION_FILE}"
@@ -22,8 +23,13 @@ check-bump: bump
2223
@git status --short && git diff --quiet || (echo "\n${BUMP_CHECK_MSG}" && exit 1)
2324

2425

25-
/usr/local/bin/yq:
26-
@echo "Downloading yq..."
27-
@curl -L https://github.com/mikefarah/yq/releases/latest/download/yq_$(shell go env GOOS)_$(shell go env GOARCH) -o /usr/local/bin/yq &&\
28-
chmod +x /usr/local/bin/yq
29-
@yq --version
26+
$(YQ_BINARY):
27+
@echo "Checking if yq is installed..."
28+
@if command -v yq > /dev/null ; then \
29+
echo "yq is already installed"; \
30+
else \
31+
@echo "Downloading yq..." \
32+
@curl -L https://github.com/mikefarah/yq/releases/latest/download/yq_$(shell go env GOOS)_$(shell go env GOARCH) -o $(YQ_BINARY) &&\
33+
chmod +x $(YQ_BINARY); \
34+
@yq --version; \
35+
fi

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.1.36
1+
0.1.37

add-cluster/add-cluster.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@
99
# CSDP_TOKEN_SECRET
1010
# SKIP_TLS_VALIDATION (cm - optional)
1111

12+
if $DEBUG; then
13+
set -eou xtrace
14+
fi
15+
1216
SECRET_NAME=""
1317

1418
function get_service_account_secret_name() {

add-cluster/helm/Chart.yaml

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,17 @@
11
apiVersion: v2
22
name: csdp-add-cluster
33
description: This helm chart adds a remote cluster to an existing Codefresh runtime
4-
54
type: application
6-
7-
version: 0.2.0
8-
9-
appVersion: 0.7.0
5+
version: 0.4.0
6+
appVersion: 0.8.0
7+
home: https://codefresh.io/
8+
icon: https://avatars1.githubusercontent.com/u/11412079?v=3
9+
sources:
10+
- https://github.com/codefresh-io/csdp-official/tree/main/add-cluster/helm
11+
maintainers:
12+
- name: codefresh
13+
url: https://codefresh-io.github.io/
14+
dependencies:
15+
- name: cf-common
16+
repository: oci://quay.io/codefresh/charts
17+
version: 0.16.0

add-cluster/helm/templates/_helpers.tpl

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,28 @@ app.kubernetes.io/managed-by: {{ .Release.Service }}
4545
Creates the ServiceAccount name (used for the *Role and *RoleBinding as well)
4646
Based on the "argocd-manager" unless explicitly set
4747
*/}}
48-
{{- define "csdp-add-cluster.serviceAccount" -}}
49-
{{- if .Values.serviceAccount }}
50-
{{- .Values.serviceAccount | trunc 63 | trimSuffix "-" }}
51-
{{- else }}
52-
{{- if contains "argocd-manager" .Release.Name }}
53-
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
54-
{{- else }}
55-
{{- printf "%s-%s" .Release.Name "argocd-manager" | trunc 63 | trimSuffix "-" }}
56-
{{- end }}
57-
{{- end }}
48+
{{- define "csdp-add-cluster.serviceAccountName" -}}
49+
{{- if .Values.serviceAccount.create }}
50+
{{- default (include "csdp-add-cluster.fullname" .) .Values.serviceAccount.name }}
51+
{{- else }}
52+
{{- default "default" .Values.serviceAccount.name }}
53+
{{- end }}
5854
{{- end }}
55+
56+
{{/*
57+
Environment variable value of Codefresh installation token
58+
*/}}
59+
{{- define "csdp-add-cluster.token-env-var-value" -}}
60+
{{- if .Values.codefresh.userToken.token }}
61+
valueFrom:
62+
secretKeyRef:
63+
name: {{ include "csdp-add-cluster.fullname" . }}-secret
64+
key: codefresh-api-token
65+
{{- else if .Values.codefresh.userToken.secretKeyRef }}
66+
valueFrom:
67+
secretKeyRef:
68+
{{- .Values.codefresh.userToken.secretKeyRef | toYaml | nindent 4 }}
69+
{{- else }}
70+
{{ fail ".Values.codefresh.userToken OR .Values.codefresh.userToken.secretKeyRef is required!" }}
71+
{{- end }}
72+
{{- end }}

add-cluster/helm/templates/clusterrole.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1+
{{- if .Values.rbac.create }}
12
apiVersion: rbac.authorization.k8s.io/v1
23
kind: ClusterRole
34
metadata:
4-
name: {{ include "csdp-add-cluster.serviceAccount" . }}-role
5+
name: {{ include "csdp-add-cluster.serviceAccountName" . }}-role
56
labels:
67
{{- include "csdp-add-cluster.labels" . | nindent 4 }}
78
rules:
@@ -15,3 +16,4 @@ rules:
1516
- '*'
1617
verbs:
1718
- '*'
19+
{{- end }}
Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
1+
{{- if .Values.rbac.create }}
12
apiVersion: rbac.authorization.k8s.io/v1
23
kind: ClusterRoleBinding
34
metadata:
4-
name: {{ include "csdp-add-cluster.serviceAccount" . }}-role-binding
5+
name: {{ include "csdp-add-cluster.serviceAccountName" . }}-role-binding
56
labels:
67
{{- include "csdp-add-cluster.labels" . | nindent 4 }}
78
roleRef:
89
apiGroup: rbac.authorization.k8s.io
910
kind: ClusterRole
10-
name: {{ include "csdp-add-cluster.serviceAccount" . }}-role
11+
name: {{ include "csdp-add-cluster.serviceAccountName" . }}-role
1112
subjects:
1213
- kind: ServiceAccount
13-
name: {{ include "csdp-add-cluster.serviceAccount" . }}
14+
name: {{ include "csdp-add-cluster.serviceAccountName" . }}
1415
namespace: {{ .Values.systemNamespace | default "kube-system" }}
16+
{{- end }}

add-cluster/helm/templates/configmap.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@ apiVersion: v1
22
kind: ConfigMap
33
metadata:
44
name: {{ include "csdp-add-cluster.fullname" . }}-cm
5-
namespace: kube-system
5+
namespace: {{ .Values.systemNamespace | default "kube-system" }}
66
labels:
77
{{- include "csdp-add-cluster.labels" . | nindent 4 }}
88
data:
9-
ingressUrl: {{ .Values.ingressUrl | quote }}
10-
contextName: {{ .Values.contextName | quote }}
11-
server: {{ .Values.server | quote }}
9+
ingressUrl: {{ required ".Values.ingressUrl is required!" .Values.ingressUrl | quote }}
10+
contextName: {{ required ".Values.contextName is required!" .Values.contextName | quote }}
11+
server: {{ required ".Values.server is required!" .Values.server | quote }}
1212
labels: {{ .Values.labels | quote }}
1313
annotations: {{ .Values.annotations | quote }}

add-cluster/helm/templates/job.yaml

Lines changed: 71 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
{{ $cfCommonTplSemver := printf "cf-common-%s" (index .Subcharts "cf-common").Chart.Version }}
12
apiVersion: batch/v1
23
kind: Job
34
metadata:
@@ -6,64 +7,87 @@ metadata:
67
labels:
78
{{- include "csdp-add-cluster.labels" . | nindent 4 }}
89
spec:
9-
ttlSecondsAfterFinished: 600 # stick around for 10m
10+
{{- with .Values.ttlSecondsAfterFinished }}
11+
ttlSecondsAfterFinished: {{ . }}
12+
{{- end }}
13+
{{- with .Values.backoffLimit }}
14+
backoffLimit: {{ .}}
15+
{{- end }}
1016
template:
1117
metadata:
1218
name: {{ include "csdp-add-cluster.fullname" . }}-pod
19+
labels:
20+
{{- include "csdp-add-cluster.labels" . | nindent 8 }}
1321
spec:
14-
serviceAccount: {{ include "csdp-add-cluster.serviceAccount" . }}
15-
restartPolicy: Never
22+
{{- include (printf "%s.image.pullSecrets" $cfCommonTplSemver ) . | nindent 8 }}
23+
serviceAccount: {{ include "csdp-add-cluster.serviceAccountName" . }}
24+
securityContext:
25+
{{- toYaml .Values.podSecurityContext | nindent 8 }}
1626
containers:
1727
- name: main
18-
image: "quay.io/codefresh/csdp-add-cluster:{{ .Chart.AppVersion }}"
19-
imagePullPolicy: Always
28+
image: {{ include (printf "%v.tplrender" $cfCommonTplSemver) (dict "Values" (include (printf "%s.image.name" $cfCommonTplSemver ) (dict "image" .Values.image "context" .)) "context" .) }}
29+
imagePullPolicy: {{ .Values.image.pullPolicy | default "Always" }}
2030
command:
2131
- bash
2232
args:
2333
- ./add-cluster.sh
2434
env:
25-
- name: SERVICE_ACCOUNT_NAME
26-
valueFrom:
27-
fieldRef:
28-
fieldPath: spec.serviceAccountName
29-
- name: INGRESS_URL
30-
valueFrom:
31-
configMapKeyRef:
32-
name: {{ include "csdp-add-cluster.fullname" . }}-cm
33-
key: ingressUrl
34-
- name: CSDP_TOKEN
35-
valueFrom:
36-
secretKeyRef:
37-
name: {{ include "csdp-add-cluster.fullname" . }}-secret
38-
key: csdpToken
39-
- name: CONTEXT_NAME
40-
valueFrom:
41-
configMapKeyRef:
42-
name: {{ include "csdp-add-cluster.fullname" . }}-cm
43-
key: contextName
44-
- name: SERVER
45-
valueFrom:
46-
configMapKeyRef:
47-
name: {{ include "csdp-add-cluster.fullname" . }}-cm
48-
key: server
49-
- name: CSDP_TOKEN_SECRET
50-
value: {{ include "csdp-add-cluster.fullname" . }}-secret
35+
- name: SERVICE_ACCOUNT_NAME
36+
valueFrom:
37+
fieldRef:
38+
fieldPath: spec.serviceAccountName
39+
- name: INGRESS_URL
40+
valueFrom:
41+
configMapKeyRef:
42+
name: {{ include "csdp-add-cluster.fullname" . }}-cm
43+
key: ingressUrl
44+
- name: CSDP_TOKEN
45+
{{- include "csdp-add-cluster.token-env-var-value" . | indent 12 }}
46+
- name: CONTEXT_NAME
47+
valueFrom:
48+
configMapKeyRef:
49+
name: {{ include "csdp-add-cluster.fullname" . }}-cm
50+
key: contextName
51+
- name: SERVER
52+
valueFrom:
53+
configMapKeyRef:
54+
name: {{ include "csdp-add-cluster.fullname" . }}-cm
55+
key: server
56+
- name: CSDP_TOKEN_SECRET
57+
value: {{ include "csdp-add-cluster.fullname" . }}-secret
58+
{{- include (printf "%s.env-vars" $cfCommonTplSemver) (dict "Values" .Values.env "context" .) | nindent 10 }}
5159
volumeMounts:
52-
- name: config-volume
53-
mountPath: /etc/config
60+
- name: config-volume
61+
mountPath: /etc/config
62+
{{- with .Values.extraVolumeMounts }}
63+
{{- toYaml . | nindent 10 }}
64+
{{- end }}
65+
{{- with .Values.resources }}
5466
resources:
55-
limits:
56-
memory: 512Mi
57-
cpu: '1'
58-
requests:
59-
memory: 256Mi
60-
cpu: '0.2'
67+
{{- toYaml . | nindent 12 }}
68+
{{- end }}
6169
volumes:
62-
- name: config-volume
63-
configMap:
64-
name: {{ include "csdp-add-cluster.fullname" . }}-cm
65-
items:
66-
- key: annotations
67-
path: annotations.yaml
68-
- key: labels
69-
path: labels.yaml
70+
- name: config-volume
71+
configMap:
72+
name: {{ include "csdp-add-cluster.fullname" . }}-cm
73+
items:
74+
- key: annotations
75+
path: annotations.yaml
76+
- key: labels
77+
path: labels.yaml
78+
{{- with .Values.extraVolumes }}
79+
{{- toYaml . | nindent 6 }}
80+
{{- end }}
81+
{{- with .Values.nodeSelector }}
82+
nodeSelector:
83+
{{- toYaml . | nindent 8 }}
84+
{{- end }}
85+
{{- with .Values.affinity }}
86+
affinity:
87+
{{- toYaml . | nindent 8 }}
88+
{{- end }}
89+
{{- with .Values.tolerations }}
90+
tolerations:
91+
{{- toYaml . | nindent 6 }}
92+
{{- end }}
93+
restartPolicy: OnFailure

add-cluster/helm/templates/secret.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
{{- if .Values.codefresh.userToken.token }}
12
apiVersion: v1
23
kind: Secret
34
metadata:
@@ -7,4 +8,5 @@ metadata:
78
{{- include "csdp-add-cluster.labels" . | nindent 4 }}
89
type: Opaque
910
data:
10-
csdpToken: {{ .Values.csdpToken | b64enc | quote }}
11+
codefresh-api-token: {{ .Values.codefresh.userToken.token | b64enc | quote }}
12+
{{- end }}

0 commit comments

Comments
 (0)