Skip to content

Commit

Permalink
feat(strm-1272): add installation type; enable/disable parts based on…
Browse files Browse the repository at this point in the history
… installation type
  • Loading branch information
trietsch authored Jun 16, 2022
2 parents 3c801bf + 51a359c commit f489626
Show file tree
Hide file tree
Showing 14 changed files with 823 additions and 31 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ wipe: check_clean
kubectl delete namespace ${namespace}

check_clean:
@echo "We're going to wipe these and uinstall helm"
@echo "We're going to wipe these and uninstall helm"
kubectl get pvc
kubectl get secrets
@echo -n "Are you sure? [y/N] " && read ans && [ $${ans:-N} = y ]
Expand Down
13 changes: 10 additions & 3 deletions helm/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@

{{- define "imagePullSecret" }}
{{ if eq .Values.license.installationType "SELF_HOSTED" }}
{{- $imagePullSecret := .Values.registry.imagePullSecret | required ".Values.registry.imagePullSecret is required, please refer to your installation credentials in the console." -}}

{{- printf "{\"auths\": {\"%s\": {\"username\": \"_json_key_base64\",\"password\": \"%s\",\"email\":\"%s\", \"auth\": \"%s\"}}}" .Values.registry.url $imagePullSecret ($imagePullSecret | b64dec | fromJson).client_email ((printf "_json_key_base64:%s" $imagePullSecret) | b64enc) | b64enc}}
{{ end }}
{{- end }}

{{- define "bootstrapServers" }}
{{- printf "%s.%s:%d" .Values.kafka.fullnameOverride .Values.namespace (.Values.kafka.service.ports.client | int) }}'
{{- end }}

{{ define "installationDetails" }}
{{ define "installationEnvironmentVariables" }}
- name: STRM_INSTALLATION_TYPE
value: {{.Values.license.installationType}}
- name: STRM_API_HOST
value: {{.Values.api.host}}
- name: STRM_API_PORT
Expand All @@ -28,8 +32,6 @@
value: STRM_AUTH_CLIENT_ID
- name: STRM_AUTH_CLIENT_SECRET_KUBERNETES_SECRET_KEY
value: STRM_AUTH_CLIENT_SECRET
- name: STRM_IMAGE_PULL_SECRET_NAME
value: "strmprivacy-docker-registry"
- name: STRM_AUTH_CLIENT_SECRET
valueFrom:
secretKeyRef:
Expand All @@ -45,4 +47,9 @@
optional: false
{{ end }}

{{ define "selfHostedEnvironmentVariables" }}
- name: STRM_IMAGE_PULL_SECRET_NAME
value: "strmprivacy-docker-registry"
{{ end }}


12 changes: 10 additions & 2 deletions helm/templates/batch-exporters-agent/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@
{{ $kafka := .Values.kafka}}
{{ $bootstrap := $config.kafkaBootstrapServers |
default (printf "%s-headless.%s.svc.cluster.local:%d" $kafka.fullnameOverride .Values.namespace ($kafka.service.ports.client | int)) }}
{{ $image := (printf "%s/%s/%s/%s:%s" .Values.registry.url .Values.registry.base.prefix .Values.registry.base.path $component.image.name $component.image.version) }}
{{ $image := eq .Values.license.installationType "SELF_HOSTED" | ternary
(printf "%s/%s/%s/%s:%s" .Values.registry.url .Values.registry.base.prefix .Values.registry.base.path $component.image.name $component.image.version)
(printf "%s/%s:%s" .Values.registry.awsMarketplaceUrl (regexReplaceAll ".+/(.+)$" $component.image.name "${1}") $component.image.version)
}}

apiVersion: apps/v1
kind: Deployment
Expand All @@ -25,16 +28,21 @@ spec:
spec:
automountServiceAccountToken: true
serviceAccountName: {{$name}}
{{ if eq .Values.license.installationType "SELF_HOSTED" }}
imagePullSecrets:
- name: strmprivacy-docker-registry
{{ end }}
containers:
- name: agent
env:
{{ include "installationDetails" . }}
{{ include "installationEnvironmentVariables" . }}
- name: APP_NAMESPACE
value: {{ .Values.namespace }}
- name: STRM_BOOTSTRAP_SERVERS
value: {{ $bootstrap }}
{{ if eq .Values.license.installationType "SELF_HOSTED" }}
{{ include "selfHostedEnvironmentVariables" .}}
{{ end }}
image: {{ $image }}

{{ end }}
12 changes: 10 additions & 2 deletions helm/templates/batch-job-agent/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@
{{- $name := $component.name }}
{{- $postgresHost := $config.postgres.host |
default (printf "%s.%s" $postgres.fullnameOverride .Values.namespace) -}}
{{ $image := (printf "%s/%s/%s/%s:%s" .Values.registry.url .Values.registry.base.prefix .Values.registry.base.path $component.image.name $component.image.version) }}
{{ $image := eq .Values.license.installationType "SELF_HOSTED" | ternary
(printf "%s/%s/%s/%s:%s" .Values.registry.url .Values.registry.base.prefix .Values.registry.base.path $component.image.name $component.image.version)
(printf "%s/%s:%s" .Values.registry.awsMarketplaceUrl (regexReplaceAll ".+/(.+)$" $component.image.name "${1}") $component.image.version)
}}


apiVersion: apps/v1
Expand All @@ -27,13 +30,18 @@ spec:
spec:
automountServiceAccountToken: true
serviceAccountName: {{$name}}
{{ if eq .Values.license.installationType "SELF_HOSTED" }}
imagePullSecrets:
- name: strmprivacy-docker-registry
{{ end }}
containers:
- name: agent
image: {{ $image }}
env:
{{ include "installationDetails" .}}
{{ include "installationEnvironmentVariables" .}}
{{ if eq .Values.license.installationType "SELF_HOSTED" }}
{{ include "selfHostedEnvironmentVariables" .}}
{{ end }}
- name: STRM_ENTITY_NAMESPACE
value: {{ .Values.namespace }}
- name: STRM_DATABASE_NAME
Expand Down
2 changes: 2 additions & 0 deletions helm/templates/common/image-pull-secret.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{ if eq .Values.license.installationType "SELF_HOSTED" }}
apiVersion: v1
kind: Secret
metadata:
Expand All @@ -8,3 +9,4 @@ metadata:
type: kubernetes.io/dockerconfigjson
data:
.dockerconfigjson: '{{ template "imagePullSecret" . }}'
{{ end }}
10 changes: 3 additions & 7 deletions helm/templates/common/installation-secret.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
{{- $installationId := .Values.license.installationId | required ".Values.license.installationId is required, please refer to your installation credentials in the console." -}}
{{- $installationClientId := .Values.license.installationClientId | required ".Values.license.installationClientId is required, please refer to your installation credentials in the console." -}}
{{- $installationClientSecret := .Values.license.installationClientSecret | required ".Values.license.installationClientSecret is required, please refer to your installation credentials in the console." -}}

apiVersion: v1
kind: Secret
metadata:
name: installation-credentials
namespace: {{.Values.namespace}}
type: Opaque
stringData:
STRM_INSTALLATION_ID: {{ $installationId }}
STRM_AUTH_CLIENT_ID: {{ $installationClientId }}
STRM_AUTH_CLIENT_SECRET: {{ $installationClientSecret }}
STRM_INSTALLATION_ID: {{ .Values.license.installationId }}
STRM_AUTH_CLIENT_ID: {{ .Values.license.installationClientId }}
STRM_AUTH_CLIENT_SECRET: {{ .Values.license.installationClientSecret }}
12 changes: 10 additions & 2 deletions helm/templates/confluent-schema-proxy/deployment.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
{{ $component := .Values.components.confluentSchemaProxy }}
{{ if $component.enabled }}
{{ $config := $component.configuration }}
{{ $image := (printf "%s/%s/%s/%s:%s" .Values.registry.url .Values.registry.base.prefix .Values.registry.base.path $component.image.name $component.image.version) }}
{{ $image := eq .Values.license.installationType "SELF_HOSTED" | ternary
(printf "%s/%s/%s/%s:%s" .Values.registry.url .Values.registry.base.prefix .Values.registry.base.path $component.image.name $component.image.version)
(printf "%s/%s:%s" .Values.registry.awsMarketplaceUrl (regexReplaceAll ".+/(.+)$" $component.image.name "${1}") $component.image.version)
}}

apiVersion: apps/v1
kind: Deployment
Expand All @@ -20,16 +23,21 @@ spec:
labels:
strmprivacy.io/app: confluent-schema-proxy
spec:
{{ if eq .Values.license.installationType "SELF_HOSTED" }}
imagePullSecrets:
- name: strmprivacy-docker-registry
{{ end }}
containers:
- name: confluent-schema-proxy
image: {{ $image }}
ports:
- containerPort: 8080
name: http
env:
{{ include "installationDetails" .}}
{{ include "installationEnvironmentVariables" .}}
{{ if eq .Values.license.installationType "SELF_HOSTED" }}
{{ include "selfHostedEnvironmentVariables" .}}
{{ end }}
{{ if .Values.enableLivenessChecks }}
livenessProbe:
httpGet:
Expand Down
12 changes: 10 additions & 2 deletions helm/templates/data-connector-agent/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@

{{ $name := $component.name }}
{{ $config := $component.configuration }}
{{ $image := (printf "%s/%s/%s/%s:%s" .Values.registry.url .Values.registry.base.prefix .Values.registry.base.path $component.image.name $component.image.version) }}
{{ $image := eq .Values.license.installationType "SELF_HOSTED" | ternary
(printf "%s/%s/%s/%s:%s" .Values.registry.url .Values.registry.base.prefix .Values.registry.base.path $component.image.name $component.image.version)
(printf "%s/%s:%s" .Values.registry.awsMarketplaceUrl (regexReplaceAll ".+/(.+)$" $component.image.name "${1}") $component.image.version)
}}

apiVersion: apps/v1
kind: Deployment
Expand All @@ -21,13 +24,18 @@ spec:
app: {{ $name }}
spec:
automountServiceAccountToken: true
{{ if eq .Values.license.installationType "SELF_HOSTED" }}
imagePullSecrets:
- name: strmprivacy-docker-registry
{{ end }}
containers:
- name: agent
image: {{ $image }}
env:
{{ include "installationDetails" . }}
{{ include "installationEnvironmentVariables" . }}
{{ if eq .Values.license.installationType "SELF_HOSTED" }}
{{ include "selfHostedEnvironmentVariables" .}}
{{ end }}
- name: APP_NAMESPACE
value: {{ .Values.namespace }}

Expand Down
12 changes: 10 additions & 2 deletions helm/templates/esr-proxy/deployment.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
{{ $component := .Values.components.esrProxy }}
{{ if $component.enabled }}
{{ $config := $component.configuration }}
{{ $image := (printf "%s/%s/%s/%s:%s" .Values.registry.url .Values.registry.base.prefix .Values.registry.base.path $component.image.name $component.image.version) }}
{{ $kafka := .Values.kafka}}
{{ $bootstrap := $config.kafkaBootstrapServers |
default (printf "%s.%s:%d" $kafka.fullnameOverride .Values.namespace ($kafka.service.ports.client | int)) }}
{{ $image := eq .Values.license.installationType "SELF_HOSTED" | ternary
(printf "%s/%s/%s/%s:%s" .Values.registry.url .Values.registry.base.prefix .Values.registry.base.path $component.image.name $component.image.version)
(printf "%s/%s:%s" .Values.registry.awsMarketplaceUrl (regexReplaceAll ".+/(.+)$" $component.image.name "${1}") $component.image.version)
}}

apiVersion: apps/v1
kind: Deployment
Expand All @@ -23,14 +26,19 @@ spec:
labels:
strmprivacy.io/app: esr-proxy
spec:
{{ if eq .Values.license.installationType "SELF_HOSTED" }}
imagePullSecrets:
- name: strmprivacy-docker-registry
{{ end }}
containers:
- name: esr-proxy
image: {{ $image }}
env:
- name: APP_BOOTSTRAP_SERVERS
value: {{ $bootstrap }}
{{ include "installationDetails" .}}
{{ include "installationEnvironmentVariables" .}}
{{ if eq .Values.license.installationType "SELF_HOSTED" }}
{{ include "selfHostedEnvironmentVariables" .}}
{{ end }}

{{ end }}
12 changes: 10 additions & 2 deletions helm/templates/event-gateway/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@
default (printf "%s.%s:%d" $kafka.fullnameOverride .Values.namespace ($kafka.service.ports.client | int)) }}
{{ $redis := $config.redisHost |
default (printf "%s-master.%s.svc.cluster.local" .Values.redis.fullnameOverride .Values.namespace) }}
{{ $image := (printf "%s/%s/%s/%s:%s" .Values.registry.url .Values.registry.base.prefix .Values.registry.base.path $component.image.name $component.image.version) }}
{{ $image := eq .Values.license.installationType "SELF_HOSTED" | ternary
(printf "%s/%s/%s/%s:%s" .Values.registry.url .Values.registry.base.prefix .Values.registry.base.path $component.image.name $component.image.version)
(printf "%s/%s:%s" .Values.registry.awsMarketplaceUrl (regexReplaceAll ".+/(.+)$" $component.image.name "${1}") $component.image.version)
}}

apiVersion: apps/v1
kind: Deployment
Expand Down Expand Up @@ -34,16 +37,18 @@ spec:
strmprivacy.io/app: event-gateway
topologyKey: kubernetes.io/hostname
weight: 100
{{ if eq .Values.license.installationType "SELF_HOSTED" }}
imagePullSecrets:
- name: strmprivacy-docker-registry
{{ end }}
containers:
- name: event-gateway
image: {{ $image }}
ports:
- containerPort: {{ $config.appPort }}
name: http
env:
{{ include "installationDetails" .}}
{{ include "installationEnvironmentVariables" .}}
- name: STRM_GATEWAY_PORT
value: "{{ $config.appPort }}"
- name: STRM_BOOTSTRAP_SERVERS
Expand All @@ -56,6 +61,9 @@ spec:
key: redis-password
# TODO verify if this name is correct with different Redis names
name: {{ .Values.redis.fullnameOverride }}
{{ if eq .Values.license.installationType "SELF_HOSTED" }}
{{ include "selfHostedEnvironmentVariables" .}}
{{ end }}
{{ if .Values.enableLivenessChecks }}
livenessProbe:
httpGet:
Expand Down
13 changes: 10 additions & 3 deletions helm/templates/streams-agent/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@
{{ $kafka := .Values.kafka}}
{{ $bootstrap := $config.kafkaBootstrapServers |
default (printf "%s-headless.%s.svc.cluster.local:%d" $kafka.fullnameOverride .Values.namespace ($kafka.service.ports.client | int)) }}
{{ $image := (printf "%s/%s/%s/%s:%s" .Values.registry.url .Values.registry.base.prefix .Values.registry.base.path $component.image.name $component.image.version) }}
{{ $redisSecretName := $config.redisSecret.name | default (printf "%s" .Values.redis.fullnameOverride) }}
{{ $redisSecretKey := $config.redisSecret.key | default "redis-password" }}

{{ $image := eq .Values.license.installationType "SELF_HOSTED" | ternary
(printf "%s/%s/%s/%s:%s" .Values.registry.url .Values.registry.base.prefix .Values.registry.base.path $component.image.name $component.image.version)
(printf "%s/%s:%s" .Values.registry.awsMarketplaceUrl (regexReplaceAll ".+/(.+)$" $component.image.name "${1}") $component.image.version)
}}

apiVersion: apps/v1
kind: Deployment
Expand All @@ -25,13 +27,18 @@ spec:
strmprivacy.io/app: streams-agent
spec:
automountServiceAccountToken: true
{{ if eq .Values.license.installationType "SELF_HOSTED" }}
imagePullSecrets:
- name: strmprivacy-docker-registry
{{ end }}
containers:
- name: streams-agent
image: {{$image}}
env:
{{ include "installationDetails" .}}
{{ include "installationEnvironmentVariables" .}}
{{ if eq .Values.license.installationType "SELF_HOSTED" }}
{{ include "selfHostedEnvironmentVariables" .}}
{{ end }}
- name: APP_DECRYPTER_NAMESPACE
value: {{ .Values.namespace }}
- name: STRM_BOOTSTRAP_SERVERS
Expand Down
12 changes: 10 additions & 2 deletions helm/templates/web-socket/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@
default (printf "%s.%s:%d" $kafka.fullnameOverride .Values.namespace ($kafka.service.ports.client | int)) }}
{{ $redis := $config.redisHost |
default (printf "%s.%s" .Values.redis.fullnameOverride .Values.namespace) }}
{{ $image := (printf "%s/%s/%s/%s:%s" .Values.registry.url .Values.registry.base.prefix .Values.registry.base.path $component.image.name $component.image.version) }}
{{ $image := eq .Values.license.installationType "SELF_HOSTED" | ternary
(printf "%s/%s/%s/%s:%s" .Values.registry.url .Values.registry.base.prefix .Values.registry.base.path $component.image.name $component.image.version)
(printf "%s/%s:%s" .Values.registry.awsMarketplaceUrl (regexReplaceAll ".+/(.+)$" $component.image.name "${1}") $component.image.version)
}}

apiVersion: apps/v1
kind: Deployment
Expand All @@ -26,13 +29,18 @@ spec:
labels:
strmprivacy.io/app: web-socket
spec:
{{ if eq .Values.license.installationType "SELF_HOSTED" }}
imagePullSecrets:
- name: strmprivacy-docker-registry
{{ end }}
containers:
- name: web-socket
image: {{ $image }}
env:
{{ include "installationDetails" .}}
{{ include "installationEnvironmentVariables" .}}
{{ if eq .Values.license.installationType "SELF_HOSTED" }}
{{ include "selfHostedEnvironmentVariables" .}}
{{ end }}
- name: STRM_EGRESSPORT
value: "{{ $config.appPort }}"
- name: STRM_BOOTSTRAP_SERVERS
Expand Down
Loading

0 comments on commit f489626

Please sign in to comment.