diff --git a/charts/configcat-proxy/.helmignore b/charts/configcat-proxy/.helmignore new file mode 100644 index 0000000..0e8a0eb --- /dev/null +++ b/charts/configcat-proxy/.helmignore @@ -0,0 +1,23 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*.orig +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ diff --git a/charts/configcat-proxy/Chart.yaml b/charts/configcat-proxy/Chart.yaml new file mode 100644 index 0000000..d513b26 --- /dev/null +++ b/charts/configcat-proxy/Chart.yaml @@ -0,0 +1,24 @@ +apiVersion: v2 +name: configcat-proxy +description: A Helm chart for the ConfigCat proxy. + +# A chart can be either an 'application' or a 'library' chart. +# +# Application charts are a collection of templates that can be packaged into versioned archives +# to be deployed. +# +# Library charts provide useful utilities or functions for the chart developer. They're included as +# a dependency of application charts to inject those utilities and functions into the rendering +# pipeline. Library charts do not define any templates and therefore cannot be deployed. +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.1.0 + +# 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: "1.0.1" diff --git a/charts/configcat-proxy/templates/_helpers.tpl b/charts/configcat-proxy/templates/_helpers.tpl new file mode 100644 index 0000000..dcafcd3 --- /dev/null +++ b/charts/configcat-proxy/templates/_helpers.tpl @@ -0,0 +1,62 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "configcat-proxy.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Create a default fully qualified app name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +If release name contains chart name it will be used as a full name. +*/}} +{{- define "configcat-proxy.fullname" -}} +{{- if .Values.fullnameOverride }} +{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- $name := default .Chart.Name .Values.nameOverride }} +{{- if contains $name .Release.Name }} +{{- .Release.Name | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }} +{{- end }} +{{- end }} +{{- end }} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "configcat-proxy.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "configcat-proxy.labels" -}} +helm.sh/chart: {{ include "configcat-proxy.chart" . }} +{{ include "configcat-proxy.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "configcat-proxy.selectorLabels" -}} +app.kubernetes.io/name: {{ include "configcat-proxy.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "configcat-proxy.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "configcat-proxy.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} diff --git a/charts/configcat-proxy/templates/configmap.yaml b/charts/configcat-proxy/templates/configmap.yaml new file mode 100644 index 0000000..275b636 --- /dev/null +++ b/charts/configcat-proxy/templates/configmap.yaml @@ -0,0 +1,10 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ .Release.Name }}-configmap + labels: + {{- include "configcat-proxy.labels" . | nindent 4 }} +data: + {{- range $key, $value := .Values.config }} + {{ $key }}: '{{ $value }}' + {{- end }} diff --git a/charts/configcat-proxy/templates/deployment.yaml b/charts/configcat-proxy/templates/deployment.yaml new file mode 100644 index 0000000..7ed2936 --- /dev/null +++ b/charts/configcat-proxy/templates/deployment.yaml @@ -0,0 +1,78 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "configcat-proxy.fullname" . }} + labels: + {{- include "configcat-proxy.labels" . | nindent 4 }} +spec: + {{- if not .Values.autoscaling.enabled }} + replicas: {{ .Values.replicaCount }} + {{- end }} + selector: + matchLabels: + {{- include "configcat-proxy.selectorLabels" . | nindent 6 }} + template: + metadata: + {{- with .Values.podAnnotations }} + annotations: + {{- toYaml . | nindent 8 }} + {{- end }} + labels: + {{- include "configcat-proxy.labels" . | nindent 8 }} + {{- with .Values.podLabels }} + {{- toYaml . | nindent 8 }} + {{- end }} + spec: + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + serviceAccountName: {{ include "configcat-proxy.serviceAccountName" . }} + securityContext: + {{- toYaml .Values.podSecurityContext | nindent 8 }} + containers: + - name: {{ .Chart.Name }} + securityContext: + {{- toYaml .Values.securityContext | nindent 12 }} + image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + env: + {{- range $key, $value := .Values.config }} + - name: {{ $key }} + valueFrom: + configMapKeyRef: + name: {{ $.Release.Name }}-configmap + key: {{ $key }} + {{- end }} + ports: + {{- range .Values.ports }} + - name: {{ .name }} + containerPort: {{ .port }} + protocol: {{ .protocol }} + {{- end }} + livenessProbe: + {{- toYaml .Values.livenessProbe | nindent 12 }} + readinessProbe: + {{- toYaml .Values.readinessProbe | nindent 12 }} + resources: + {{- toYaml .Values.resources | nindent 12 }} + {{- with .Values.volumeMounts }} + volumeMounts: + {{- toYaml . | nindent 12 }} + {{- end }} + {{- with .Values.volumes }} + volumes: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} diff --git a/charts/configcat-proxy/templates/service.yaml b/charts/configcat-proxy/templates/service.yaml new file mode 100644 index 0000000..e89a47b --- /dev/null +++ b/charts/configcat-proxy/templates/service.yaml @@ -0,0 +1,16 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ include "configcat-proxy.fullname" . }} + labels: + {{- include "configcat-proxy.labels" . | nindent 4 }} +spec: + selector: + {{- include "configcat-proxy.selectorLabels" . | nindent 4 }} + type: {{ .Values.service.type }} + ports: + {{- range .Values.service.ports }} + - name: {{ .name }} + port: {{ .port }} + protocol: {{ .protocol }} + {{- end }} diff --git a/charts/configcat-proxy/values.yaml b/charts/configcat-proxy/values.yaml new file mode 100644 index 0000000..0e46814 --- /dev/null +++ b/charts/configcat-proxy/values.yaml @@ -0,0 +1,93 @@ +# Default values for configcat-proxy. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +# This will set the replicaset count more information can be found here: https://kubernetes.io/docs/concepts/workloads/controllers/replicaset/ +replicaCount: 2 + +# This sets the container image more information can be found here: https://kubernetes.io/docs/concepts/containers/images/ +image: + repository: configcat/proxy + + # This sets the pull policy for images. + pullPolicy: IfNotPresent + +config: + # SDK keys + CONFIGCAT_SDKS: '' + + # CDN proxy + CONFIGCAT_HTTP_CDN_PROXY_ENABLED: true + CONFIGCAT_HTTP_CDN_PROXY_CORS_ENABLED: true + CONFIGCAT_HTTP_CDN_PROXY_CORS_ALLOWED_ORIGINS_REGEX_PATTERNS: '["https:\\/\\/[\\w-]+\\.onuptick\\.com"]' + CONFIGCAT_HTTP_CDN_PROXY_CORS_ALLOWED_ORIGINS_REGEX_IF_NO_MATCH: https://onuptick.com + + # API + CONFIGCAT_HTTP_API_ENABLED: true + CONFIGCAT_HTTP_API_CORS_ENABLED: true + CONFIGCAT_HTTP_API_CORS_ALLOWED_ORIGINS_REGEX_PATTERNS: '["https:\\/\\/[\\w-]+\\.onuptick\\.com"]' + CONFIGCAT_HTTP_API_CORS_ALLOWED_ORIGINS_REGEX_IF_NO_MATCH: https://onuptick.com + + # Disable unused services + CONFIGCAT_HTTP_WEBHOOK_ENABLED: false + CONFIGCAT_HTTP_SSE_ENABLED: false + + # Diagnostics + CONFIGCAT_DIAG_ENABLED: true + CONFIGCAT_DIAG_STATUS_ENABLED: true + CONFIGCAT_DIAG_METRICS_ENABLED: true + + # Miscellaneous + CONFIGCAT_TEST_DATA_GOVERNANCE: global + CONFIGCAT_TEST_LOG_LEVEL: warn + +ports: + - name: http + port: 8050 + protocol: TCP + - name: diagnostic + port: 8051 + protocol: TCP + +serviceAccount: + create: false + +podAnnotations: {} +podLabels: {} +podSecurityContext: {} +securityContext: {} + +service: + type: ClusterIP + ports: + - name: http + port: 8050 + protocol: TCP + - name: diagnostic + port: 8051 + protocol: TCP + +ingress: + enabled: false + +resources: {} + +livenessProbe: + httpGet: + path: /status + port: diagnostic +readinessProbe: + httpGet: + path: /status + port: diagnostic + +autoscaling: + enabled: false + # minReplicas: 1 + # maxReplicas: 100 + # targetCPUUtilizationPercentage: 80 + # targetMemoryUtilizationPercentage: 80 + +nodeSelector: {} +tolerations: [] +affinity: {}