Skip to content

Commit ce2cf30

Browse files
In Cluste runtime (#237)
1 parent 755312a commit ce2cf30

26 files changed

+847
-0
lines changed

charts/cf-runtime/.helmignore

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Patterns to ignore when building packages.
2+
# This supports shell glob matching, relative path matching, and
3+
# negation (prefixed with !). Only one pattern per line.
4+
.DS_Store
5+
# Common VCS dirs
6+
.git/
7+
.gitignore
8+
.bzr/
9+
.bzrignore
10+
.hg/
11+
.hgignore
12+
.svn/
13+
# Common backup files
14+
*.swp
15+
*.bak
16+
*.tmp
17+
*.orig
18+
*~
19+
# Various IDEs
20+
.project
21+
.idea/
22+
*.tmproj
23+
.vscode/

charts/cf-runtime/Chart.yaml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
apiVersion: v2
2+
name: cf-runtime
3+
description: A Helm chart for Kubernetes
4+
5+
# A chart can be either an 'application' or a 'library' chart.
6+
#
7+
# Application charts are a collection of templates that can be packaged into versioned archives
8+
# to be deployed.
9+
#
10+
# Library charts provide useful utilities or functions for the chart developer. They're included as
11+
# a dependency of application charts to inject those utilities and functions into the rendering
12+
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
13+
type: application
14+
15+
# This is the chart version. This version number should be incremented each time you make changes
16+
# to the chart and its templates, including the app version.
17+
# Versions are expected to follow Semantic Versioning (https://semver.org/)
18+
version: 0.1.0
19+
20+
# This is the version number of the application being deployed. This version number should be
21+
# incremented each time you make changes to the application. Versions are not expected to
22+
# follow Semantic Versioning. They should reflect the version the application is using.
23+
# It is recommended to use it with quotes.
24+
appVersion: "1.16.0"
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
{{/*
2+
Expand the name of the chart.
3+
*/}}
4+
{{- define "cf-runtime.name" -}}
5+
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
6+
{{- end }}
7+
8+
{{/*
9+
Create a default fully qualified app name.
10+
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
11+
If release name contains chart name it will be used as a full name.
12+
*/}}
13+
{{- define "cf-runtime.fullname" -}}
14+
{{- if .Values.fullnameOverride }}
15+
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
16+
{{- else }}
17+
{{- $name := default .Chart.Name .Values.nameOverride }}
18+
{{- if contains $name .Release.Name }}
19+
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
20+
{{- else }}
21+
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
22+
{{- end }}
23+
{{- end }}
24+
{{- end }}
25+
26+
{{/*
27+
Create chart name and version as used by the chart label.
28+
*/}}
29+
{{- define "cf-runtime.chart" -}}
30+
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
31+
{{- end }}
32+
33+
{{/*
34+
Common labels
35+
*/}}
36+
{{- define "cf-runtime.labels" -}}
37+
helm.sh/chart: {{ include "cf-runtime.chart" . }}
38+
{{ include "cf-runtime.selectorLabels" . }}
39+
{{- if .Chart.AppVersion }}
40+
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
41+
{{- end }}
42+
app.kubernetes.io/managed-by: {{ .Release.Service }}
43+
{{- end }}
44+
45+
{{/*
46+
Selector labels
47+
*/}}
48+
{{- define "cf-runtime.selectorLabels" -}}
49+
app.kubernetes.io/name: {{ include "cf-runtime.name" . }}
50+
app.kubernetes.io/instance: {{ .Release.Name }}
51+
{{- end }}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{{/*
2+
Expand the name of the chart.
3+
*/}}
4+
{{- define "cf-re.name" -}}
5+
{{- printf "%s-%s" (include "cf-runtime.name" .) "re" | trunc 63 | trimSuffix "-" }}
6+
{{- end }}
7+
8+
{{/*
9+
Create a default fully qualified app name.
10+
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
11+
If release name contains chart name it will be used as a full name.
12+
*/}}
13+
{{- define "cf-re.fullname" -}}
14+
{{- printf "%s-%s" (include "cf-runtime.fullname" .) "re" | trunc 63 | trimSuffix "-" }}
15+
{{- end }}
16+
17+
{{/*
18+
Common labels
19+
*/}}
20+
{{- define "cf-re.labels" -}}
21+
{{ include "cf-runtime.labels" . }}
22+
codefresh.io/application: runtime
23+
{{- end }}
24+
25+
{{/*
26+
Selector labels
27+
*/}}
28+
{{- define "cf-re.selectorLabels" -}}
29+
{{ include "cf-runtime.selectorLabels" . }}
30+
codefresh.io/application: runtime
31+
{{- end }}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
apiVersion: v1
2+
type: Opaque
3+
kind: Secret
4+
metadata:
5+
{{/* has to be a constant */}}
6+
name: codefresh-certs-server
7+
labels: {{- include "cf-re.labels" . | nindent 4 }}
8+
data:
9+
server-cert.pem: {{ .Values.global.keys.serverCert | b64enc }}
10+
server-key.pem: {{ .Values.global.keys.key | b64enc }}
11+
ca.pem: {{ .Values.global.keys.ca | b64enc }}
12+
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
apiVersion: v1
2+
kind: ConfigMap
3+
metadata:
4+
{{/* has to be a constant */}}
5+
name: codefresh-dind-config
6+
data:
7+
daemon.json: |
8+
{
9+
"hosts": [ "unix:///var/run/docker.sock",
10+
"tcp://0.0.0.0:1300"],
11+
"storage-driver": "overlay2",
12+
"tlsverify": true,
13+
"tls": true,
14+
"tlscacert": "/etc/ssl/cf-client/ca.pem",
15+
"tlscert": "/etc/ssl/cf/server-cert.pem",
16+
"tlskey": "/etc/ssl/cf/server-key.pem",
17+
"insecure-registries" : ["192.168.99.100:5000"],
18+
"metrics-addr" : "0.0.0.0:9323",
19+
"experimental" : true
20+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
labels:
5+
app: dind
6+
{{/* has to be a constant */}}
7+
name: dind
8+
spec:
9+
ports:
10+
- name: "dind-port"
11+
port: 1300
12+
protocol: TCP
13+
14+
# This is a headless service, Kubernetes won't assign a VIP for it.
15+
# *.dind.default.svc.cluster.local
16+
clusterIP: None
17+
selector:
18+
app: dind
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
apiVersion: v1
2+
kind: ServiceAccount
3+
metadata:
4+
{{/* has to be a constant */}}
5+
name: codefresh-engine
6+
labels: {{- include "cf-re.labels" . | nindent 4 }}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
{{/*
2+
Expand the name of the chart.
3+
*/}}
4+
{{- define "cf-venona.name" -}}
5+
{{- printf "%s-%s" (include "cf-runtime.name" .) "venona" | trunc 63 | trimSuffix "-" }}
6+
{{- end }}
7+
8+
{{/*
9+
Create a default fully qualified app name.
10+
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
11+
If release name contains chart name it will be used as a full name.
12+
*/}}
13+
{{- define "cf-venona.fullname" -}}
14+
{{- printf "%s-%s" (include "cf-runtime.fullname" .) "venona" | trunc 63 | trimSuffix "-" }}
15+
{{- end }}
16+
17+
{{/*
18+
Common labels
19+
*/}}
20+
{{- define "cf-venona.labels" -}}
21+
{{ include "cf-runtime.labels" . }}
22+
codefresh.io/application: venona
23+
{{- end }}
24+
25+
{{/*
26+
Selector labels
27+
*/}}
28+
{{- define "cf-venona.selectorLabels" -}}
29+
{{ include "cf-runtime.selectorLabels" . }}
30+
codefresh.io/application: venona
31+
{{- end }}
32+
33+
{{- define "cf-venona.docker-image" -}}
34+
{{- .Values.venona.image }}
35+
{{- end }}
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: {{ include "cf-venona.fullname" . }}
5+
labels: {{- include "cf-venona.labels" . | nindent 4 }}
6+
spec:
7+
selector:
8+
matchLabels: {{- include "cf-venona.selectorLabels" . | nindent 6 }}
9+
replicas: 1
10+
revisionHistoryLimit: 5
11+
strategy:
12+
rollingUpdate:
13+
maxSurge: 50%
14+
maxUnavailable: 50%
15+
type: RollingUpdate
16+
template:
17+
metadata:
18+
labels: {{- include "cf-venona.labels" . | nindent 8 }}
19+
spec:
20+
serviceAccountName: {{ include "cf-venona.fullname" . }}
21+
{{/* {{ if ne .Values.nodeSelector "" }}*/}}
22+
{{/* nodeSelector:*/}}
23+
{{/* {{ .Values.NodeSelector | nodeSelectorParamToYaml | indent 8 | unescape }}*/}}
24+
{{/* {{ end }}*/}}
25+
{{/* tolerations:*/}}
26+
{{/* {{ toYaml .Values.Tolerations | indent 8 | unescape }}*/}}
27+
containers:
28+
- name: venona
29+
env:
30+
{{/* {{- if .Values.EnvVars }}*/}}
31+
{{/* {{- range $key, $value := .Values.EnvVars }}*/}}
32+
{{/* - name: {{ $key }}*/}}
33+
{{/* value: "{{ $value}}"*/}}
34+
{{/* {{- end}}*/}}
35+
{{/* {{- end}}*/}}
36+
{{/* {{- if .Values.AdditionalEnvVars }}*/}}
37+
{{/* {{- range $key, $value := .Values.AdditionalEnvVars }}*/}}
38+
{{/* - name: {{ $key }}*/}}
39+
{{/* value: "{{ $value}}"*/}}
40+
{{/* {{- end}}*/}}
41+
{{/* {{- end}}*/}}
42+
- name: SELF_DEPLOYMENT_NAME
43+
valueFrom:
44+
fieldRef:
45+
fieldPath: metadata.name
46+
- name: CODEFRESH_TOKEN
47+
valueFrom:
48+
secretKeyRef:
49+
name: {{ include "cf-venona.fullname" . }}
50+
key: codefresh.token
51+
- name: CODEFRESH_IN_CLUSTER_RUNTIME
52+
value: {{ .Values.global.runtimeName }}
53+
- name: CODEFRESH_HOST
54+
value: {{ .Values.global.codefreshHost }}
55+
- name: AGENT_MODE
56+
value: InCluster
57+
- name: "AGENT_ID" {{/* agent name */}}
58+
value: {{ .Values.global.agentName }}
59+
{{- if ne .Values.dockerRegistry "" }}
60+
- name: DOCKER_REGISTRY
61+
value: {{ .Values.dockerRegistry }}
62+
{{- end }}
63+
{{- if .Values.newRelicLicense }}
64+
- name: NEWRELIC_LICENSE_KEY
65+
value: {{ .Values.newRelicLicense }}
66+
{{- end }}
67+
image: {{ include "cf-venona.docker-image" . }}
68+
ports:
69+
- containerPort: 8080
70+
protocol: TCP
71+
readinessProbe:
72+
httpGet:
73+
path: /health
74+
port: 8080
75+
periodSeconds: 5
76+
timeoutSeconds: 5
77+
successThreshold: 1
78+
failureThreshold: 5
79+
{{/* volumeMounts:*/}}
80+
{{/* - name: runnerconf*/}}
81+
{{/* mountPath: "/etc/secrets"*/}}
82+
{{/* readOnly: true*/}}
83+
imagePullPolicy: Always
84+
{{/* resources: {{ toYaml .Values.Runner.resources | nindent 10 /* todo capital change }}*/}}
85+
securityContext:
86+
runAsUser: 10001
87+
runAsGroup: 10001
88+
fsGroup: 10001
89+
restartPolicy: Always

0 commit comments

Comments
 (0)