Skip to content

Commit

Permalink
Feat/v0.0.7 (#24)
Browse files Browse the repository at this point in the history
  • Loading branch information
dsun0720 authored Nov 17, 2023
1 parent e6020db commit f4b8874
Show file tree
Hide file tree
Showing 10 changed files with 226 additions and 26 deletions.
2 changes: 1 addition & 1 deletion charts/featbit/Chart.lock
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ dependencies:
repository: https://charts.bitnami.com/bitnami
version: 3.6.8
digest: sha256:5216820a0c78b79a1baed297e1c0c0d76ad528fa22ff41d4fd44d109da552ce7
generated: "2023-08-22T23:09:12.331683+02:00"
generated: "2023-11-15T16:05:25.343071+01:00"
4 changes: 2 additions & 2 deletions charts/featbit/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.0.6
version: 0.0.7

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "2.5.0"
appVersion: "2.5.2"

kubeVersion: ">=1.23-0"

Expand Down
84 changes: 81 additions & 3 deletions charts/featbit/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ Return whether Redis uses password authentication or not
{{- if .Values.kafka.enabled -}}
{{- printf "%s:%d" (include "featbit.kafka.fullname" .) (.Values.kafka.service.ports.client | int) }}
{{- else if .Values.isPro -}}
{{- required "You need to provide a producer broker list when using external kafka" (join "," .Values.externalKafka.brokers.producers) | printf "%s" -}}
{{- required "You need to provide a producer broker list when using external kafka" (join "," .Values.externalKafka.brokers.producer.hosts) | printf "%s" -}}
{{- end }}
{{- end }}

Expand All @@ -367,10 +367,66 @@ Return whether Redis uses password authentication or not
{{- if .Values.kafka.enabled -}}
{{- printf "%s:%d" (include "featbit.kafka.fullname" .) (.Values.kafka.service.ports.client | int) }}
{{- else if .Values.isPro -}}
{{- required "You need to provide a consumer broker list when using external kafka" (join "," .Values.externalKafka.brokers.consumers) | printf "%s" -}}
{{- required "You need to provide a consumer broker list when using external kafka" (join "," .Values.externalKafka.brokers.consumer.hosts) | printf "%s" -}}
{{- end }}
{{- end }}

{{- define "featbit.kafka.producer.auth.enabled" -}}
{{- if and (not .Values.kafka.enabled) (or .Values.externalKafka.brokers.producer.password .Values.externalKafka.brokers.producer.existingSecret) -}}
{{- true -}}
{{- end -}}
{{- end -}}

{{- define "featbit.kafka.producer.createSecret" -}}
{{- if and (not .Values.kafka.enabled) (not .Values.externalKafka.brokers.producer.existingSecret) .Values.externalKafka.brokers.producer.password }}
{{- true -}}
{{- end -}}
{{- end -}}

{{- define "featbit.kafka.producer.secretName" -}}
{{- if .Values.externalKafka.brokers.producer.existingSecret }}
{{- printf "%s" .Values.externalKafka.brokers.producer.existingSecret -}}
{{- else -}}
{{- printf "%s-external-producer" (include "featbit.kafka.fullname" .) -}}
{{- end -}}
{{- end -}}

{{- define "featbit.kafka.producer.secretPasswordKey" -}}
{{- if and (not .Values.kafka.enabled) .Values.externalKafka.brokers.producer.existingSecret -}}
{{- required "You need to provide existingSecretPasswordKey when an existingSecret is specified in external kafka producer" .Values.externalKafka.brokers.producer.existingSecretPasswordKey | printf "%s" -}}
{{- else -}}
{{- printf "kafka-external-producer-password" -}}
{{- end -}}
{{- end -}}

{{- define "featbit.kafka.consumer.auth.enabled" -}}
{{- if and (not .Values.kafka.enabled) (or .Values.externalKafka.brokers.consumer.password .Values.externalKafka.brokers.consumer.existingSecret) -}}
{{- true -}}
{{- end -}}
{{- end -}}

{{- define "featbit.kafka.consumer.createSecret" -}}
{{- if and (not .Values.kafka.enabled) (not .Values.externalKafka.brokers.consumer.existingSecret) .Values.externalKafka.brokers.consumer.password }}
{{- true -}}
{{- end -}}
{{- end -}}

{{- define "featbit.kafka.consumer.secretName" -}}
{{- if .Values.externalKafka.brokers.consumer.existingSecret }}
{{- printf "%s" .Values.externalKafka.brokers.consumer.existingSecret -}}
{{- else -}}
{{- printf "%s-external-consumer" (include "featbit.kafka.fullname" .) -}}
{{- end -}}
{{- end -}}

{{- define "featbit.kafka.consumer.secretPasswordKey" -}}
{{- if and (not .Values.kafka.enabled) .Values.externalKafka.brokers.consumer.existingSecret -}}
{{- required "You need to provide existingSecretPasswordKey when an existingSecret is specified in external kafka consumer" .Values.externalKafka.brokers.consumer.existingSecretPasswordKey | printf "%s" -}}
{{- else -}}
{{- printf "kafka-external-consumer-password" -}}
{{- end -}}
{{- end -}}

{*
------ CLICKHOUSE ------
*}
Expand All @@ -392,13 +448,35 @@ Return clickhouse fullname
Return the Redis host
*/}}
{{- define "featbit.clickhouse.host" -}}
{{- if .Values.clickhouse.enabled }}
{{- if .Values.clickhouse.enabled -}}
{{- printf "%s" (include "featbit.clickhouse.fullname" .) -}}
{{- else if .Values.isPro -}}
{{- required "You need to provide a host when using external Clickhouse" .Values.externalClickhouse.host | printf "%s" -}}
{{- end -}}
{{- end -}}

{{- define "featbit.clickhouse.altHosts" -}}
{{- if and (not .Values.clickhouse.enabled) .Values.isPro .Values.externalClickhouse.altHosts -}}
{{- print "%s" (join "," .Values.externalClickhouse.altHosts) -}}
{{- end -}}
{{- end -}}

{{- define "featbit.clickhouse.port" -}}
{{- if .Values.clickhouse.enabled -}}
{{- printf "%d" .Values.clickhouse.containerPorts.tcp -}}
{{- else if .Values.isPro -}}
{{- required "You need to provide a host port when using external Clickhouse" (.Values.externalClickhouse.tcpPort | int) | printf "%d" -}}
{{- end -}}
{{- end -}}

{{- define "featbit.clickhouse.httpPort" -}}
{{- if .Values.clickhouse.enabled -}}
{{- printf "%d" .Values.clickhouse.containerPorts.http -}}
{{- else if .Values.isPro -}}
{{- required "You need to provide a host http port when using external Clickhouse" (.Values.externalClickhouse.httpPort | int) | printf "%d" -}}
{{- end -}}
{{- end -}}

{{- define "featbit.clickhouse.user" -}}
{{- if .Values.clickhouse.enabled }}
{{- .Values.clickhouse.auth.username -}}
Expand Down
55 changes: 52 additions & 3 deletions charts/featbit/templates/_pro-env.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,39 @@
key: {{ include "featbit.clickhouse.secretPasswordKey" . }}
- name: CLICKHOUSE_DATABASE
value: {{ include "featbit.clickhouse.database" . }}
- name: CLICKHOUSE_PORT
value: {{ (include "featbit.clickhouse.port" .) | quote }}
- name: CLICKHOUSE_HTTP_PORT
value: {{ (include "featbit.clickhouse.httpPort" .) | quote }}
{{- if (not .Values.clickhouse.enabled) }}
- name: CLICKHOUSE_SECURE
value: {{ .Values.externalClickhouse.secure | quote }}
- name: CLICKHOUSE_VERIFY
value: {{ .Values.externalClickhouse.verify | quote }}
{{- if .Values.externalClickhouse.cluster }}
- name: CLICKHOUSE_CLUSTER
value: {{ .Values.externalClickhouse.cluster | quote }}
value: {{ .Values.externalClickhouse.cluster }}
{{- else }}
- name: CLICKHOUSE_REPLICATION
value: "false"
{{- end }}
{{- if (include "featbit.clickhouse.altHosts" .) }}
- name: CLICKHOUSE_ALT_HOST
value: {{ include "featbit.clickhouse.altHosts" . }}
{{- end }}
{{- end }}
{{- if (include "featbit.kafka.producer.auth.enabled" .) }}
- name: KAFKA_SECURITY_PROTOCOL
value: {{ .Values.externalKafka.brokers.producer.protocol }}
- name: KAFKA_SASL_MECHANISM
value: {{ .Values.externalKafka.brokers.producer.mechanism }}
- name: KAFKA_SASL_USER
value: {{ .Values.externalKafka.brokers.producer.user }}
- name: KAFKA_SASL_PASSWORD
valueFrom:
secretKeyRef:
name: {{ include "featbit.kafka.producer.secretName" . }}
key: {{ include "featbit.kafka.producer.secretPasswordKey" . }}
{{- end }}
{{- end }}
{{- end -}}
Expand All @@ -37,10 +58,38 @@
{{- if .Values.isPro }}
- name: IS_PRO
value: "true"
- name: Kafka__BootstrapServers
- name: Kafka__Producer__bootstrap.servers
value: {{ include "featbit.kafka.producer.brokers" . }}
- name: Kafka__ConsumerServers
- name: Kafka__Consumer__bootstrap.servers
value: {{ include "featbit.kafka.consumer.brokers" . }}

{{- if (include "featbit.kafka.producer.auth.enabled" .) }}
- name: Kafka__Producer__sasl.username
value: {{ .Values.externalKafka.brokers.producer.user }}
- name: Kafka__Producer__sasl.password
valueFrom:
secretKeyRef:
name: {{ include "featbit.kafka.producer.secretName" . }}
key: {{ include "featbit.kafka.producer.secretPasswordKey" . }}
- name: Kafka__Producer__sasl.mechanism
value: {{ .Values.externalKafka.brokers.producer.mechanism }}
- name: Kafka__Producer__security.protocol
value: {{ .Values.externalKafka.brokers.producer.protocol }}
{{- end }}

{{- if (include "featbit.kafka.consumer.auth.enabled" .) }}
- name: Kafka__Consumer__sasl.username
value: {{ .Values.externalKafka.brokers.consumer.user }}
- name: Kafka__Consumer__sasl.password
valueFrom:
secretKeyRef:
name: {{ include "featbit.kafka.consumer.secretName" . }}
key: {{ include "featbit.kafka.consumer.secretPasswordKey" . }}
- name: Kafka__Consumer__sasl.mechanism
value: {{ .Values.externalKafka.brokers.consumer.mechanism }}
- name: Kafka__Consumer__security.protocol
value: {{ .Values.externalKafka.brokers.consumer.protocol }}
{{- end }}
{{- end }}
{{- end -}}

Expand Down
11 changes: 9 additions & 2 deletions charts/featbit/templates/api-ingress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
{{- $fullName := (include "featbit.fullname" .) -}}
{{- $svcName := (include "api.svc.name" .) -}}
{{- $svcPort := 80 -}}
{{- if and .Values.global.ingressClassName (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }}
{{- if not (hasKey .Values.api.ingress.annotations "kubernetes.io/ingress.class") }}
{{- $_ := set .Values.api.ingress.annotations "kubernetes.io/ingress.class" .Values.global.ingressClassName }}
{{- end }}
{{- end }}
{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}}
apiVersion: networking.k8s.io/v1
{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}}
Expand All @@ -17,12 +22,14 @@ metadata:
{{- include "featbit-metadata-labels-common" . | nindent 4 }}
annotations:
{{- include "featbit-metadata-annotations-common" . | nindent 4 }}
kubernetes.io/ingress.class: {{ default "nginx" .Values.global.ingressClassName }}
{{- with .Values.api.ingress.annotations }}
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
{{- if and .Values.api.ingress.tls.enabled .Values.api.ingress.tls.secretName .Values.api.ingress.host}}
{{- if and .Values.global.ingressClassName (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }}
ingressClassName: {{ .Values.global.ingressClassName }}
{{- end }}
{{- if and .Values.api.ingress.tls.enabled .Values.api.ingress.tls.secretName .Values.api.ingress.host }}
tls:
- secretName: {{ .Values.api.ingress.tls.secretName }}
hosts:
Expand Down
4 changes: 2 additions & 2 deletions charts/featbit/templates/da-server-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,13 @@ spec:
periodSeconds: 5
timeoutSeconds: 2
httpGet:
path: /api
path: /health/liveness
port: http
readinessProbe:
periodSeconds: 10
timeoutSeconds: 5
httpGet:
path: /api
path: /health/readiness
port: http
resources:
{{- toYaml .Values.das.resources | nindent 12 }}
Expand Down
11 changes: 9 additions & 2 deletions charts/featbit/templates/eval-server-ingress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
{{- $fullName := (include "featbit.fullname" .) -}}
{{- $svcName := (include "els.svc.name" .) -}}
{{- $svcPort := 80 -}}
{{- if and .Values.global.ingressClassName (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }}
{{- if not (hasKey .Values.els.ingress.annotations "kubernetes.io/ingress.class") }}
{{- $_ := set .Values.els.ingress.annotations "kubernetes.io/ingress.class" .Values.global.ingressClassName }}
{{- end }}
{{- end }}
{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}}
apiVersion: networking.k8s.io/v1
{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}}
Expand All @@ -17,12 +22,14 @@ metadata:
{{- include "featbit-metadata-labels-common" . | nindent 4 }}
annotations:
{{- include "featbit-metadata-annotations-common" . | nindent 4 }}
kubernetes.io/ingress.class: {{ default "nginx" .Values.global.ingressClassName }}
{{- with .Values.els.ingress.annotations }}
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
{{- if and .Values.els.ingress.tls.enabled .Values.els.ingress.tls.secretName .Values.els.ingress.host}}
{{- if and .Values.global.ingressClassName (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }}
ingressClassName: {{ .Values.global.ingressClassName }}
{{- end }}
{{- if and .Values.els.ingress.tls.enabled .Values.els.ingress.tls.secretName .Values.els.ingress.host }}
tls:
- secretName: {{ .Values.els.ingress.tls.secretName }}
hosts:
Expand Down
31 changes: 31 additions & 0 deletions charts/featbit/templates/kafka-external-secret.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{{- if (include "featbit.kafka.producer.createSecret" .) }}
apiVersion: v1
kind: Secret
metadata:
namespace: {{ .Release.Namespace }}
name: {{ template "featbit.kafka.producer.secretName" . }}
labels:
{{- include "featbit-metadata-labels-common" . | nindent 4 }}
annotations:
{{- include "featbit-metadata-annotations-common" . | nindent 4 }}
type: Opaque
data:
{{ template "featbit.kafka.producer.secretPasswordKey" . }}: {{ .Values.externalKafka.brokers.producer.password | b64enc | quote }}
{{- end }}

---

{{- if (include "featbit.kafka.consumer.createSecret" .) }}
apiVersion: v1
kind: Secret
metadata:
namespace: {{ .Release.Namespace }}
name: {{ template "featbit.kafka.consumer.secretName" . }}
labels:
{{- include "featbit-metadata-labels-common" . | nindent 4 }}
annotations:
{{- include "featbit-metadata-annotations-common" . | nindent 4 }}
type: Opaque
data:
{{ template "featbit.kafka.consumer.secretPasswordKey" . }}: {{ .Values.externalKafka.brokers.consumer.password | b64enc | quote }}
{{- end }}
11 changes: 9 additions & 2 deletions charts/featbit/templates/ui-ingress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
{{- $fullName := (include "featbit.fullname" .) -}}
{{- $svcName := (include "ui.svc.name" .) -}}
{{- $svcPort := 80 -}}
{{- if and .Values.global.ingressClassName (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }}
{{- if not (hasKey .Values.ui.ingress.annotations "kubernetes.io/ingress.class") }}
{{- $_ := set .Values.ui.ingress.annotations "kubernetes.io/ingress.class" .Values.global.ingressClassName }}
{{- end }}
{{- end }}
{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}}
apiVersion: networking.k8s.io/v1
{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}}
Expand All @@ -17,12 +22,14 @@ metadata:
{{- include "featbit-metadata-labels-common" . | nindent 4 }}
annotations:
{{- include "featbit-metadata-annotations-common" . | nindent 4 }}
kubernetes.io/ingress.class: {{ default "nginx" .Values.global.ingressClassName }}
{{- with .Values.ui.ingress.annotations }}
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
{{- if and .Values.ui.ingress.tls.enabled .Values.ui.ingress.tls.secretName .Values.ui.ingress.host}}
{{- if and .Values.global.ingressClassName (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }}
ingressClassName: {{ .Values.global.ingressClassName }}
{{- end }}
{{- if and .Values.ui.ingress.tls.enabled .Values.ui.ingress.tls.secretName .Values.ui.ingress.host }}
tls:
- secretName: {{ .Values.ui.ingress.tls.secretName }}
hosts:
Expand Down
Loading

0 comments on commit f4b8874

Please sign in to comment.