Ocf150 modify helms and cicd to include celery

Proposers

  • Andres Anaya (Telefonica Innovación Digital)

Description

Creation of two Helm charts for integration into the OpenCAPIF (OCF) platform: Celery Beat and Celery Worker. These charts represent essential core services designed to handle periodic tasks and background job processing within the OCF architecture. The new charts are intended to be added to the existing OpenCAPIF Helm chart deployment structure, enhancing its functionality and service orchestration.

Demo or definition of done

  • Helm charts for Celery Beat and Celery Worker are successfully created and versioned.
  • Integration of these charts into the existing OpenCAPIF Helm chart repository.
  • Charts are configurable via values files for different deployment environments.
  • Successful deployment and operation verified in a test Kubernetes cluster.
  • Logging and error handling mechanisms are validated for both services.

References

  1. Reference name
  2. Author1, Author2, Author3, et. al., “My demo using feature,” in Conference-Name Demo Track, 20XX.

Acknowledgements

This work is funded by the European Commission through the project with Grant Agreement number . example HORIZON-JU-SNS-2022 FLEX-SCALE project with Grant

Edited by Andres Anaya Amariels

Merge request reports

Loading
+8 −0
Changes for helm/capif/charts/celery-beat/templates/NOTES.txt: 8 added lines, 0 removed lines.
Original line number Diff line number Diff line
1. Get the application URL by running these commands:
{{- if .Values.ingress.enabled }}
{{- range $host := .Values.ingress.hosts }}
  {{- range .paths }}
  http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ .path }}
  {{- end }}
{{- end }}
{{- end }}
+62 −0
Changes for helm/capif/charts/celery-beat/templates/_helpers.tpl: 62 added lines, 0 removed lines.
Original line number Diff line number Diff line
{{/*
Expand the name of the chart.
*/}}
{{- define "celery-beat.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 "celery-beat.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 "celery-beat.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

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

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

{{/*
Create the name of the service account to use
*/}}
{{- define "celery-beat.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "celery-beat.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}
+14 −0
Changes for helm/capif/charts/celery-beat/templates/configmap.yaml: 14 added lines, 0 removed lines.
Original line number Diff line number Diff line
apiVersion: v1
kind: ConfigMap
metadata:
  name: celery-beat-configmap
data:
  config.yaml: |
    mongo: {
      'user': '{{ .Values.env.mongoInitdbRootUsername }}',
      'password': '{{ .Values.env.mongoInitdbRootPassword }}',
      'db': 'capif',
      'notifications_col': 'notifications',
      'host': 'mongo',
      'port': "27017"
    }
+72 −0
Changes for helm/capif/charts/celery-beat/templates/deployment.yaml: 72 added lines, 0 removed lines.
Original line number Diff line number Diff line
apiVersion: apps/v1
kind: Deployment
metadata:
  name: {{ include "celery-beat.fullname" . }}
  labels:
    {{- include "celery-beat.labels" . | nindent 4 }}
spec:
  {{- if not .Values.autoscaling.enabled }}
  replicas: {{ .Values.replicaCount }}
  {{- end }}
  selector:
    matchLabels:
      {{- include "celery-beat.selectorLabels" . | nindent 6 }}
  template:
    metadata:
      annotations:
        date: "{{  now | unixEpoch }}"
        checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }}
      labels:
        {{- include "celery-beat.labels" . | nindent 8 }}
        {{- with .Values.podLabels }}
        {{- toYaml . | nindent 8 }}
        {{- end }}
    spec:
      {{- with .Values.imagePullSecrets }}
      imagePullSecrets:
        {{- toYaml . | nindent 8 }}
      {{- end }}
      serviceAccountName: {{ include "celery-beat.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:
            - name: CELERY_MODE
              value: {{ quote .Values.env.celeryMode }}
            - name: REDIS_HOST
              value: {{ quote .Values.env.redisHost }}
            - name: REDIS_PORT
              value: {{ quote .Values.env.redisPort }}
            - name: LOG_LEVEL
              value: {{ quote .Values.env.logLevel }}
          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 }}
+32 −0
Changes for helm/capif/charts/celery-beat/templates/hpa.yaml: 32 added lines, 0 removed lines.
Original line number Diff line number Diff line
{{- if .Values.autoscaling.enabled }}
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
  name: {{ include "celery-beat.fullname" . }}
  labels:
    {{- include "celery-beat.labels" . | nindent 4 }}
spec:
  scaleTargetRef:
    apiVersion: apps/v1
    kind: Deployment
    name: {{ include "celery-beat.fullname" . }}
  minReplicas: {{ .Values.autoscaling.minReplicas }}
  maxReplicas: {{ .Values.autoscaling.maxReplicas }}
  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 }}
Loading
Loading