Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature_store: helm_chart: support k8s secret for mysql password #401

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions feature_store/helm_chart/1.1.2/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
apiVersion: v2
name: feature-store-api-chart
description: A Helm chart for feature-store data plane api

# 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: 1.1.2

# 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.
appVersion: 1.1.1
62 changes: 62 additions & 0 deletions feature_store/helm_chart/1.1.2/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "feature-store-dp-api.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 "feature-store-dp-api.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 "feature-store-dp-api.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Common labels
*/}}
{{- define "feature-store-dp-api.labels" -}}
helm.sh/chart: {{ include "feature-store-dp-api.chart" . }}
{{ include "feature-store-dp-api.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}

{{/*
Selector labels
*/}}
{{- define "feature-store-dp-api.selectorLabels" -}}
app.kubernetes.io/name: {{ include "feature-store-dp-api.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{/*
Create the name of the service account to use
*/}}
{{- define "feature-store-dp-api.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "feature-store-dp-api.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}
12 changes: 12 additions & 0 deletions feature_store/helm_chart/1.1.2/templates/configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: "feature-store-dp-api-configmap"
labels:
{{- include "feature-store-dp-api.labels" . | nindent 4 }}
data:
MYSQL_USER: "{{.Values.db.mysql.username}}"
MYSQL_DB_URL: "{{.Values.db.mysql.jdbcURL}}"
MYSQL_AUTH_TYPE: "{{.Values.db.mysql.authType}}"
MYSQL_VAULT_OCID: "{{.Values.db.mysql.vault.vaultOcid}}"
MYSQL_VAULT_SECRET_NAME: "{{.Values.db.mysql.vault.secretName}}"
97 changes: 97 additions & 0 deletions feature_store/helm_chart/1.1.2/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: "feature-store-dp-api"
labels:
{{- include "feature-store-dp-api.labels" . | nindent 4 }}
spec:
{{- if not .Values.autoscaling.enabled }}
replicas: {{ .Values.replicaCount }}
{{- end }}
{{- with .Values.deploymentStrategy }}
strategy:
{{- toYaml . | nindent 4 }}
{{- end }}
selector:
matchLabels:
{{- include "feature-store-dp-api.selectorLabels" . | nindent 6 }}
template:
metadata:
labels:
{{- include "feature-store-dp-api.selectorLabels" . | nindent 8 }}
annotations:
checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "feature-store-dp-api.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
containers:
- name: "{{ .Values.applicationEnv.containerName }}"
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{trimAll "/" .Values.oci_meta.repo }}/{{trimAll "/" .Values.oci_meta.images.api.image}}:{{ .Values.oci_meta.images.api.tag }}"
imagePullPolicy: IfNotPresent
envFrom:
- configMapRef:
name: "feature-store-dp-api-configmap"
{{- if (.Values.K8sSecret).enabled }}
- secretRef:
name: "{{ .Values.K8sSecret.name }}"
optional: true # to handle pods coming up if/while secret is unavailable
{{- end }}
ports:
- name: http
containerPort: 21000
protocol: TCP
livenessProbe:
httpGet:
path: /health
port: 21000
httpHeaders:
- name: Host
value: 127.0.0.1
initialDelaySeconds: {{ .Values.livenessProbe.initialDelaySeconds }}
failureThreshold: {{ .Values.livenessProbe.failureThreshold }}
periodSeconds: {{ .Values.livenessProbe.periodSeconds }}
timeoutSeconds: {{ .Values.livenessProbe.timeoutSeconds }}
readinessProbe:
httpGet:
path: /health
port: 21000
httpHeaders:
- name: Host
value: 127.0.0.1
initialDelaySeconds: {{ .Values.readinessProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.readinessProbe.periodSeconds }}
timeoutSeconds: {{ .Values.readinessProbe.timeoutSeconds }}
failureThreshold: {{ .Values.readinessProbe.failureThreshold }}
volumeMounts:
{{- toYaml .Values.volumeMounts | nindent 12 }}
resources:
{{- toYaml .Values.resources | nindent 12 }}
# To trick marketplace into thinking that authoriser is being used. This will only return true in validation
# phase by marketplace
{{- if eq "idogsu2ylimg/feature-store" .Values.oci_meta.images.authoriser.image }}
- name: "feature-store-authoriser"
image: "{{ .Values.oci_meta.repo }}/{{ .Values.oci_meta.images.authoriser.image}}:{{ .Values.oci_meta.images.authoriser.tag }}"
{{- 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 }}
volumes:
{{- toYaml .Values.volumes | nindent 12 }}

53 changes: 53 additions & 0 deletions feature_store/helm_chart/1.1.2/templates/hpa.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
{{- if .Values.autoscaling.enabled }}
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: "feature-store-dp-api"
labels:
{{- include "feature-store-dp-api.labels" . | nindent 4 }}
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: {{ include "feature-store-dp-api.fullname" . }}
minReplicas: {{ .Values.autoscaling.minReplicas }}
maxReplicas: {{ .Values.autoscaling.maxReplicas }}
behavior:
scaleDown:
selectPolicy: Min
stabilizationWindowSeconds: {{ .Values.autoscaling.scaleDown.stabilizationWindowSeconds }}
policies:
- periodSeconds: {{ .Values.autoscaling.scaleDown.periodSeconds }}
type: Percent
value: {{ .Values.autoscaling.scaleDown.percentage }}
- periodSeconds: {{ .Values.autoscaling.scaleDown.periodSeconds }}
type: Pods
value: {{ .Values.autoscaling.scaleDown.podCount }}
scaleUp:
stabilizationWindowSeconds: {{ .Values.autoscaling.scaleUp.stabilizationWindowSeconds }}
policies:
- type: Percent
value: {{ .Values.autoscaling.scaleUp.percentage }}
periodSeconds: {{ .Values.autoscaling.scaleUp.periodSeconds }}
- type: Pods
value: {{ .Values.autoscaling.scaleUp.podCount }}
periodSeconds: {{ .Values.autoscaling.scaleUp.periodSeconds }}
selectPolicy: Max
metrics:
{{- if .Values.autoscaling.targetCPUUtilizationPercentage }}
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage}}
{{- end }}
{{- if .Values.autoscaling.targetMemoryUtilizationPercentage }}
- type: Resource
resource:
name: memory
target:
type: Utilization
averageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage}}
{{- end }}
{{- end }}
24 changes: 24 additions & 0 deletions feature_store/helm_chart/1.1.2/templates/rbac.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: feature-store-dp-deployment
labels: {{- include "feature-store-dp-api.labels" . | nindent 4 }}
rules:
- apiGroups: ["" , "apps", "autoscaling", "keda.sh", "metrics.k8s.io"]
resources: ["deployments", "replicasets", "pods", "namespaces", "services", "horizontalpodautoscalers" ,"configmaps", "scaledobjects"]
verbs: ["*"]
---
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: {{ include "feature-store-dp-api.fullname" . }}
labels: {{- include "feature-store-dp-api.labels" . | nindent 4 }}
subjects:
- kind: ServiceAccount
name: {{ include "feature-store-dp-api.serviceAccountName" . }}
namespace: {{ .Values.serviceAccount.namespace }}
apiGroup: ""
roleRef:
kind: ClusterRole
name: feature-store-dp-deployment
apiGroup: ""
21 changes: 21 additions & 0 deletions feature_store/helm_chart/1.1.2/templates/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
apiVersion: v1
kind: Service
metadata:
name: "feature-store-dp-api"
labels:
{{- include "feature-store-dp-api.labels" . | nindent 4 }}
{{- if eq .Values.service.type "LoadBalancer" }}
annotations:
oci.oraclecloud.com/load-balancer-type: "nlb"
oci-network-load-balancer.oraclecloud.com/internal: "true"
{{- end }}

spec:
type: {{ .Values.service.type }}
ports:
- port: {{ .Values.service.port }}
targetPort: 21000
protocol: TCP
name: https
selector:
{{- include "feature-store-dp-api.selectorLabels" . | nindent 4 }}
12 changes: 12 additions & 0 deletions feature_store/helm_chart/1.1.2/templates/serviceaccount.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{{- if .Values.serviceAccount.create -}}
apiVersion: v1
kind: ServiceAccount
metadata:
name: "feature-store-dp-api"
labels:
{{- include "feature-store-dp-api.labels" . | nindent 4 }}
{{- with .Values.serviceAccount.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}
Loading