Skip to content

Commit

Permalink
Merge pull request #70 from alercebroker/lightcurve-chart
Browse files Browse the repository at this point in the history
feat(lightcurve): add chart
  • Loading branch information
dirodriguezm authored Mar 24, 2023
2 parents 7d97313 + 96676dc commit 1017ffd
Show file tree
Hide file tree
Showing 10 changed files with 376 additions and 0 deletions.
23 changes: 23 additions & 0 deletions charts/lightcurve-step/.helmignore
Original file line number Diff line number Diff line change
@@ -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/
6 changes: 6 additions & 0 deletions charts/lightcurve-step/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
apiVersion: v2
appVersion: rc-123029d
description: Full lightcurve provider step
name: lightcurve-step
type: application
version: 0.1.0
68 changes: 68 additions & 0 deletions charts/lightcurve-step/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "lightcurve-step.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 "lightcurve-step.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 "lightcurve-step.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

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

{{/*
Selector labels
*/}}
{{- define "lightcurve-step.selectorLabels" -}}
app.kubernetes.io/name: {{ include "lightcurve-step.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{/*
Create the name of the service account to use
*/}}
{{- define "lightcurve-step.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "lightcurve-step.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}

{{- define "imagePullSecret" }}
{{- with .Values.imageCredentials }}
{{- printf "{\"auths\":{\"%s\":{\"username\":\"%s\",\"password\":\"%s\",\"email\":\"%s\",\"auth\":\"%s\"}}}" .registry .username .password .email (printf "%s:%s" .username .password | b64enc) | b64enc }}
{{- end }}
{{- end }}
14 changes: 14 additions & 0 deletions charts/lightcurve-step/templates/configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "lightcurve-step.fullname" . }}
namespace: {{ .Values.namespace }}
data:
consumer-topics: {{ .Values.configmap.consumerTopics }}
consume-messages: "{{ .Values.configmap.consumeMessages }}"
consumer-server: {{ .Values.configmap.consumerServer }}
producer-server: {{ .Values.configmap.producerServer }}
producer-topic: {{ .Values.configmap.producerTopic }}
metrics-server: {{ .Values.configmap.metricsServer }}
metrics-topic: {{ .Values.configmap.metricsTopic }}
use-prometheus: "{{ .Values.configmap.usePrometheus }}"
120 changes: 120 additions & 0 deletions charts/lightcurve-step/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "lightcurve-step.fullname" . }}
namespace: {{ .Values.namespace }}
labels:
{{- include "lightcurve-step.labels" . | nindent 4 }}
spec:
{{- if not .Values.autoscaling.enabled }}
replicas: {{ .Values.replicaCount }}
{{- end }}
selector:
matchLabels:
{{- include "lightcurve-step.selectorLabels" . | nindent 6 }}
template:
metadata:
{{- with .Values.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "lightcurve-step.selectorLabels" . | nindent 8 }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
containers:
- name: {{ .Chart.Name }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
ports:
- name: metrics
containerPort: 8000
protocol: TCP
resources:
{{- toYaml .Values.resources | nindent 12 }}
env:
- name: CONSUMER_TOPICS
valueFrom:
configMapKeyRef:
name: {{ include "lightcurve-step.fullname" . }}
key: consumer-topics
- name: CONSUMER_SERVER
valueFrom:
configMapKeyRef:
name: {{ include "lightcurve-step.fullname" . }}
key: consumer-server
- name: CONSUME_MESSAGES
valueFrom:
configMapKeyRef:
name: {{ include "lightcurve-step.fullname" . }}
key: consume-messages
- name: CONSUMER_GROUP_ID
value: {{ include "lightcurve-step.fullname" . }}
- name: PRODUCER_SERVER
valueFrom:
configMapKeyRef:
name: {{ include "lightcurve-step.fullname" . }}
key: producer-server
- name: PRODUCER_TOPIC
valueFrom:
configMapKeyRef:
name: {{ include "lightcurve-step.fullname" . }}
key: producer-topic
- name: METRICS_SERVER
valueFrom:
configMapKeyRef:
name: {{ include "lightcurve-step.fullname" . }}
key: metrics-server
- name: METRICS_TOPIC
valueFrom:
configMapKeyRef:
name: {{ include "lightcurve-step.fullname" . }}
key: metrics-topic
{{- if .Values.secrets.kafkaAuth.consumer.enabled }}
- name: CONSUMER_KAFKA_USERNAME
valueFrom:
secretKeyRef:
name: kafka-auth
key: username
- name: CONSUMER_KAFKA_PASSWORD
valueFrom:
secretKeyRef:
name: kafka-auth
key: password
{{- end }}
{{- if .Values.secrets.kafkaAuth.producer.enabled }}
- name: PRODUCER_KAFKA_USERNAME
valueFrom:
secretKeyRef:
name: kafka-auth
key: username
- name: PRODUCER_KAFKA_PASSWORD
valueFrom:
secretKeyRef:
name: kafka-auth
key: password
{{- end }}
{{- if .Values.secrets.kafkaAuth.metrics.enabled }}
- name: METRICS_KAFKA_USERNAME
valueFrom:
secretKeyRef:
name: kafka-auth
key: username
- name: METRICS_KAFKA_PASSWORD
valueFrom:
secretKeyRef:
name: kafka-auth
key: password
{{- end }}
- name: USE_PROMETHEUS
valueFrom:
configMapKeyRef:
name: {{ include "lightcurve-step.fullname" . }}
key: use-prometheus
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
28 changes: 28 additions & 0 deletions charts/lightcurve-step/templates/hpa.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{{- if .Values.autoscaling.enabled }}
apiVersion: autoscaling/v2beta1
kind: HorizontalPodAutoscaler
metadata:
name: {{ include "lightcurve-step.fullname" . }}
labels:
{{- include "lightcurve-step.labels" . | nindent 4 }}
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: {{ include "lightcurve-step.fullname" . }}
minReplicas: {{ .Values.autoscaling.minReplicas }}
maxReplicas: {{ .Values.autoscaling.maxReplicas }}
metrics:
{{- if .Values.autoscaling.targetCPUUtilizationPercentage }}
- type: Resource
resource:
name: cpu
targetAverageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }}
{{- end }}
{{- if .Values.autoscaling.targetMemoryUtilizationPercentage }}
- type: Resource
resource:
name: memory
targetAverageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }}
{{- end }}
{{- end }}
6 changes: 6 additions & 0 deletions charts/lightcurve-step/templates/namespace.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
apiVersion: v1
kind: Namespace
metadata:
name: {{ .Values.namespace }}
labels:
name: {{ .Values.namespace }}
22 changes: 22 additions & 0 deletions charts/lightcurve-step/templates/secret.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
apiVersion: v1
kind: Secret
metadata:
name: image-pull-access
namespace: {{ .Values.namespace }}
type: kubernetes.io/dockerconfigjson
data:
.dockerconfigjson: {{ template "imagePullSecret" . }}
---
apiVersion: v1
kind: Secret
metadata:
name: kafka-auth
namespace: {{ .Values.namespace }}
stringData:
consumer-username: "{{ .Values.secrets.kafkaAuth.consumer.username }}"
consumer-password: "{{ .Values.secrets.kafkaAuth.consumer.password }}"
producer-username: "{{ .Values.secrets.kafkaAuth.producer.username }}"
producer-password: "{{ .Values.secrets.kafkaAuth.producer.password }}"
metrics-username: "{{ .Values.secrets.kafkaAuth.metrics.username }}"
metrics-password: "{{ .Values.secrets.kafkaAuth.metrics.password }}"
15 changes: 15 additions & 0 deletions charts/lightcurve-step/templates/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "lightcurve-step.fullname" . }}
labels:
{{- include "lightcurve-step.labels" . | nindent 4 }}
spec:
type: {{ .Values.service.type }}
ports:
- port: {{ .Values.service.port }}
targetPort: http
protocol: TCP
name: http
selector:
{{- include "lightcurve-step.selectorLabels" . | nindent 4 }}
74 changes: 74 additions & 0 deletions charts/lightcurve-step/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# Default values for step_starter.
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.

replicaCount: 1

namespace: lightcurve-step

image:
repository: ghcr.io/alercebroker/lightcurve_step
pullPolicy: IfNotPresent
# Overrides the image tag whose default is the chart appVersion.
tag: ""

imagePullSecrets:
- name: "image-pull-access"
nameOverride: ""
fullnameOverride: ""

podAnnotations: {}

service:
type: ClusterIP
port: 8000

resources: {}

autoscaling:
enabled: false
minReplicas: 1
maxReplicas: 100
targetCPUUtilizationPercentage: 80
# targetMemoryUtilizationPercentage: 80

affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: eks.amazonaws.com/nodegroup
operator: In
## Override this value with the NodeGroup tag accordingly
values: []

configmap:
consumerTopics: ""
consumeMessages: ""
consumerServer: ""
producerServer: ""
producerTopic: ""
metricsServer: ""
metricsTopic: ""
usePrometheus: ""

secrets:
kafkaAuth:
consumer:
enabled: false
username: ""
password: ""
producer:
enabled: false
username: ""
password: ""
metrics:
enabled: false
username: ""
password: ""

imageCredentials:
registry: ""
username: ""
password: ""
email: ""

0 comments on commit 1017ffd

Please sign in to comment.