Skip to content

Commit 67aad78

Browse files
authored
Merge pull request #36 from SAP/controller
Controller
2 parents e9cc651 + 43a2362 commit 67aad78

File tree

99 files changed

+4294
-2809
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

99 files changed

+4294
-2809
lines changed

.gitignore

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,12 @@ infrabox/test/github-review/results.xml
3737
src/pyinfrabox/.coverage
3838
src/pyinfrabox/coverage.xml
3939
src/pyinfrabox/results.xml
40-
src/controller/pkg/client
41-
src/controller/controller
42-
src/controller/vendor
4340
src/services/gcp/vendor
4441
src/services/gcp/gcp
4542
src/services/gcp/tmp/_output/
4643
src/services/namespace/vendor
4744
src/services/namespace/namespace
4845
src/services/namespace/tmp/_output/
46+
src/controller/vendor
47+
src/controller/namespace
48+
src/controller/tmp/_output/

deploy/infrabox-function/Chart.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
name: infrabox-function
2+
version: 1
Lines changed: 293 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,293 @@
1+
{{ define "env_database" }}
2+
-
3+
name: INFRABOX_DATABASE_USER
4+
valueFrom:
5+
secretKeyRef:
6+
name: infrabox-postgres
7+
key: username
8+
-
9+
name: INFRABOX_DATABASE_PASSWORD
10+
valueFrom:
11+
secretKeyRef:
12+
name: infrabox-postgres
13+
key: password
14+
-
15+
name: INFRABOX_DATABASE_HOST
16+
value: {{ default "localhost" .Values.storage.postgres.host | quote }}
17+
-
18+
name: INFRABOX_DATABASE_DB
19+
value: {{ default "infrabox" .Values.storage.postgres.db | quote }}
20+
-
21+
name: INFRABOX_DATABASE_PORT
22+
value: {{ default 5432 .Values.storage.postgres.port | quote }}
23+
-
24+
name: INFRABOX_STORAGE_CLOUDSQL_ENABLED
25+
value: {{ .Values.storage.cloudsql.enabled | quote }}
26+
{{ if .Values.storage.cloudsql.enabled }}
27+
-
28+
name: INFRABOX_STORAGE_CLOUDSQL_INSTANCE_CONNECTION_NAME
29+
value: {{ .Values.storage.cloudsql.instance_connection_name }}
30+
{{ end }}
31+
{{ end }}
32+
33+
{{ define "volumes_rsa" }}
34+
-
35+
name: rsa-key
36+
secret:
37+
secretName: infrabox-rsa
38+
{{ end }}
39+
40+
{{ define "mounts_rsa_private" }}
41+
-
42+
name: rsa-key
43+
mountPath: "/var/run/secrets/infrabox.net/rsa/id_rsa"
44+
subPath: id_rsa
45+
readOnly: true
46+
{{ end }}
47+
48+
{{ define "mounts_rsa_public" }}
49+
-
50+
name: rsa-key
51+
mountPath: "/var/run/secrets/infrabox.net/rsa/id_rsa.pub"
52+
subPath: id_rsa.pub
53+
readOnly: true
54+
{{ end }}
55+
56+
{{ define "volumes_database" }}
57+
{{ if .Values.storage.cloudsql.enabled }}
58+
-
59+
name: cloudsql-instance-credentials
60+
secret:
61+
secretName: infrabox-cloudsql-instance-credentials
62+
-
63+
name: cloudsql
64+
emptyDir:
65+
{{ end }}
66+
{{ end }}
67+
68+
{{ define "env_gcs" }}
69+
-
70+
name: INFRABOX_STORAGE_GCS_ENABLED
71+
value: {{ .Values.storage.gcs.enabled | quote }}
72+
{{ if .Values.storage.gcs.enabled }}
73+
-
74+
name: INFRABOX_STORAGE_GCS_BUCKET
75+
value: {{ .Values.storage.gcs.bucket }}
76+
-
77+
name: GOOGLE_APPLICATION_CREDENTIALS
78+
value: /etc/infrabox/gcs/gcs_service_account.json
79+
{{ end }}
80+
{{ end }}
81+
82+
{{ define "env_s3" }}
83+
-
84+
name: INFRABOX_STORAGE_S3_ENABLED
85+
value: {{ .Values.storage.s3.enabled | quote }}
86+
{{ if .Values.storage.s3.enabled }}
87+
-
88+
name: INFRABOX_STORAGE_S3_ENDPOINT
89+
value: {{ .Values.storage.s3.endpoint }}
90+
-
91+
name: INFRABOX_STORAGE_S3_PORT
92+
value: {{ .Values.storage.s3.port | quote }}
93+
-
94+
name: INFRABOX_STORAGE_S3_REGION
95+
value: {{ .Values.storage.s3.region | quote }}
96+
-
97+
name: INFRABOX_STORAGE_S3_SECURE
98+
value: {{ .Values.storage.s3.secure | quote }}
99+
-
100+
name: INFRABOX_STORAGE_S3_BUCKET
101+
value: {{ default "infrabox" .Values.storage.s3.bucket | quote }}
102+
-
103+
name: INFRABOX_STORAGE_S3_ACCESS_KEY
104+
valueFrom:
105+
secretKeyRef:
106+
name: infrabox-s3-credentials
107+
key: accessKey
108+
-
109+
name: INFRABOX_STORAGE_S3_SECRET_KEY
110+
valueFrom:
111+
secretKeyRef:
112+
name: infrabox-s3-credentials
113+
key: secretKey
114+
{{ end }}
115+
{{ end }}
116+
117+
{{ define "env_azure" }}
118+
-
119+
name: INFRABOX_STORAGE_AZURE_ENABLED
120+
value: {{ .Values.storage.azure.enabled | quote }}
121+
{{ if .Values.storage.azure.enabled }}
122+
-
123+
name: INFRABOX_STORAGE_AZURE_ACCOUNT_NAME
124+
valueFrom:
125+
secretKeyRef:
126+
name: infrabox-azure-credentials
127+
key: account-name
128+
-
129+
name: INFRABOX_STORAGE_AZURE_ACCOUNT_KEY
130+
valueFrom:
131+
secretKeyRef:
132+
name: infrabox-azure-credentials
133+
key: account-key
134+
{{ end }}
135+
{{ end }}
136+
137+
{{ define "env_github" }}
138+
-
139+
name: INFRABOX_GITHUB_ENABLED
140+
value: {{ .Values.github.enabled | quote }}
141+
{{ if .Values.github.enabled }}
142+
-
143+
name: INFRABOX_GITHUB_LOGIN_ENABLED
144+
value: {{ .Values.github.login.enabled | quote }}
145+
-
146+
name: INFRABOX_GITHUB_API_URL
147+
value: {{ default "https://api.github.com" .Values.github.api_url }}
148+
-
149+
name: INFRABOX_GITHUB_LOGIN_URL
150+
value: {{ default "https://github.com/login" .Values.github.login.url }}
151+
-
152+
name: INFRABOX_GITHUB_LOGIN_ALLOWED_ORGANIZATIONS
153+
value: {{ default "" .Values.github.login.allowed_organizations | quote }}
154+
{{ end }}
155+
{{ end }}
156+
157+
{{ define "env_gerrit" }}
158+
-
159+
name: INFRABOX_GERRIT_ENABLED
160+
value: {{ .Values.gerrit.enabled | quote }}
161+
{{ if .Values.gerrit.enabled }}
162+
-
163+
name: INFRABOX_GERRIT_HOSTNAME
164+
value: {{ required "gerrit.hostname is required" .Values.gerrit.hostname }}
165+
-
166+
name: INFRABOX_GERRIT_KEY_FILENAME
167+
value: /root/.ssh/id_rsa
168+
-
169+
name: INFRABOX_GERRIT_USERNAME
170+
value: {{ required "gerrit.username is required" .Values.gerrit.username }}
171+
-
172+
name: INFRABOX_GERRIT_PORT
173+
value: {{ default "29418" .Values.gerrit.port | quote }}
174+
{{ end }}
175+
{{ end }}
176+
177+
{{ define "env_ldap" }}
178+
-
179+
name: INFRABOX_ACCOUNT_LDAP_ENABLED
180+
value: {{ .Values.account.ldap.enabled | quote }}
181+
{{ if .Values.account.ldap.enabled }}
182+
-
183+
name: INFRABOX_ACCOUNT_LDAP_URL
184+
value: {{ required "account.ldap.url is required" .Values.account.ldap.url }}
185+
-
186+
name: INFRABOX_ACCOUNT_LDAP_BASE
187+
value: {{ required "account.ldap.base is required" .Values.account.ldap.base }}
188+
-
189+
name: INFRABOX_ACCOUNT_LDAP_DN
190+
valueFrom:
191+
secretKeyRef:
192+
name: infrabox-ldap
193+
key: dn
194+
-
195+
name: INFRABOX_ACCOUNT_LDAP_PASSWORD
196+
valueFrom:
197+
secretKeyRef:
198+
name: infrabox-ldap
199+
key: password
200+
{{ end }}
201+
{{ end }}
202+
203+
204+
{{ define "env_github_secrets" }}
205+
{{ if .Values.github.enabled }}
206+
-
207+
name: INFRABOX_GITHUB_CLIENT_ID
208+
valueFrom:
209+
secretKeyRef:
210+
name: infrabox-github
211+
key: client_id
212+
-
213+
name: INFRABOX_GITHUB_CLIENT_SECRET
214+
valueFrom:
215+
secretKeyRef:
216+
name: infrabox-github
217+
key: client_secret
218+
-
219+
name: INFRABOX_GITHUB_WEBHOOK_SECRET
220+
valueFrom:
221+
secretKeyRef:
222+
name: infrabox-github
223+
key: webhook_secret
224+
{{ end }}
225+
{{ end }}
226+
227+
{{ define "env_general" }}
228+
-
229+
name: INFRABOX_GENERAL_LOG_STACKDRIVER
230+
value: {{ default "false" .Values.general.log.stackdriver | quote }}
231+
-
232+
name: INFRABOX_GENERAL_DONT_CHECK_CERTIFICATES
233+
value: {{ default "false" .Values.general.dont_check_certificates | quote }}
234+
-
235+
name: INFRABOX_GENERAL_WORKER_NAMESPACE
236+
value: {{ default "infrabox-worker" .Values.general.worker_namespace }}
237+
-
238+
name: INFRABOX_ROOT_URL
239+
value: {{ .Values.root_url }}
240+
-
241+
name: INFRABOX_GENERAL_REPORT_ISSUE_URL
242+
value: {{ .Values.general.report_issue_url }}
243+
-
244+
name: INFRABOX_GENERAL_DOCKER_REGISTRY
245+
value: {{ .Values.general.docker_registry }}
246+
{{ end }}
247+
248+
{{ define "env_docker_registry" }}
249+
-
250+
name: INFRABOX_DOCKER_REGISTRY_ADMIN_USERNAME
251+
value: "admin"
252+
-
253+
name: INFRABOX_DOCKER_REGISTRY_ADMIN_PASSWORD
254+
valueFrom:
255+
secretKeyRef:
256+
name: infrabox-admin
257+
key: password
258+
{{ end }}
259+
260+
{{ define "containers_database" }}
261+
{{ if .Values.storage.cloudsql.enabled }}
262+
-
263+
image: gcr.io/cloudsql-docker/gce-proxy:1.09
264+
name: cloudsql-proxy
265+
command: ["/cloud_sql_proxy", "--dir=/cloudsql",
266+
"-instances={{ .Values.storage.cloudsql.instance_connection_name }}=tcp:5432",
267+
"-credential_file=/secrets/cloudsql/credentials.json"]
268+
volumeMounts:
269+
- name: cloudsql-instance-credentials
270+
mountPath: /secrets/cloudsql
271+
readOnly: true
272+
- name: cloudsql
273+
mountPath: /cloudsql
274+
{{ end }}
275+
{{ end }}
276+
277+
{{ define "env_job" }}
278+
-
279+
name: INFRABOX_JOB_MAX_OUTPUT_SIZE
280+
value: {{ default "104857600" .Values.job.max_output_size | quote }}
281+
-
282+
name: INFRABOX_JOB_SECURITY_CONTEXT_CAPABILITIES_ENABLED
283+
value: {{ default "false" .Values.job.security_context.capabilities.enabled | quote }}
284+
{{ end }}
285+
286+
{{ define "env_kubernetes" }}
287+
-
288+
name: INFRABOX_KUBERNETES_MASTER_HOST
289+
value: {{ default "kubernetes.default.svc.cluster.local" .Values.general.kubernetes_master_host }}
290+
-
291+
name: INFRABOX_KUBERNETES_MASTER_PORT
292+
value: {{ default 443 .Values.general.kubernetes_master_port | quote }}
293+
{{ end }}
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
apiVersion: core.infrabox.net/v1alpha1
2+
kind: IBFunction
3+
metadata:
4+
name: infrabox-default-function
5+
spec:
6+
image: {{ required "general.docker_registry is required" .Values.general.docker_registry }}/{{ default "job" .Values.job.image }}:{{ required "job.tag is required" .Values.job.tag }}
7+
securityContext:
8+
privileged: true
9+
resources:
10+
limits:
11+
cpu: 1000m
12+
requests:
13+
cpu: 1000m
14+
memory: 1Gi
15+
env:
16+
{{ include "env_general" . | indent 4 }}
17+
{{ include "env_job" . | indent 4 }}
18+
{{ include "env_gerrit" . | indent 4 }}
19+
-
20+
name: INFRABOX_LOCAL_CACHE_ENABLED
21+
value: {{ .Values.local_cache.enabled | quote }}
22+
-
23+
name: INFRABOX_SERVICE
24+
value: infrabox-default-function
25+
-
26+
name: INFRABOX_VERSION
27+
value: "unknown"
28+
volumeMounts:
29+
-
30+
mountPath: /etc/docker/daemon.json
31+
name: dockerd-config
32+
subPath: daemon.json
33+
-
34+
name: data-dir
35+
mountPath: "/data"
36+
{{ if .Values.local_cache.enabled }}
37+
-
38+
mountPath: /local-cache
39+
name: local-cache
40+
{{ end }}
41+
{{ if .Values.gerrit.enabled }}
42+
-
43+
mountPath: /tmp/gerrit
44+
name: gerrit-ssh
45+
{{ end }}
46+
volumes:
47+
-
48+
name: data-dir
49+
emptyDir: {}
50+
-
51+
name: dockerd-config
52+
configMap:
53+
name: infrabox-dockerd-config
54+
{{ if .Values.local_cache.enabled }}
55+
-
56+
name: local-cache
57+
hostPath:
58+
Path: {{ default "/tmp/infrabox/local_cache" .Values.local_cache.host_path }}
59+
{{ end }}
60+
{{ if .Values.gerrit.enabled }}
61+
-
62+
name: gerrit-ssh
63+
secret:
64+
secretName: infrabox-gerrit-ssh
65+
{{ end }}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
apiVersion: core.infrabox.net/v1alpha1
2+
kind: IBPipeline
3+
metadata:
4+
name: infrabox-default-pipeline
5+
spec:
6+
steps:
7+
- functionName: infrabox-default-function
8+
name: run

0 commit comments

Comments
 (0)