Skip to content

Commit

Permalink
Merge pull request #16 from lalithkota/1.1
Browse files Browse the repository at this point in the history
Removed producer and worker subcharts and simplified helm chart
  • Loading branch information
venky-ganapathy authored Jan 28, 2025
2 parents 36ee705 + 7ddaa47 commit c1582c3
Show file tree
Hide file tree
Showing 29 changed files with 422 additions and 1,195 deletions.
7 changes: 2 additions & 5 deletions .github/workflows/publish-trigger.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:
- '**'
branches:
- 1.*
- 2.*
- develop
- main
workflow_dispatch:
Expand Down Expand Up @@ -72,11 +73,7 @@ jobs:
echo "chartpath: $chartpath"
chartname=$(basename "$chartpath")
if [ -f charts/${chartname}/Chart.yaml ]; then
echo "Chartname: $chartname"
echo "Chartname: $chartname"
helm dep up charts/$chartpath
echo "Chartname: $chartname"
helm dep up charts/$chartpath
helm package charts/$chartpath
is_rancher_chart=$(grep "$RANCHER_CHART_FILTER" charts/${chartpath%*/}/Chart.yaml || true)
if [ -n "$is_rancher_chart" ]; then
Expand Down Expand Up @@ -133,6 +130,6 @@ jobs:
author_name: openg2pbot
author_email: bot@openg2p.org
default_author: user_info
message: 'added registry bg tasks helm charts for publish openg2p/openg2p-social-registry-bg-tasks-deployment@${{ github.sha }}'
message: 'added registry bg tasks helm charts for publish openg2p/openg2p-registry-bg-tasks-deployment@${{ github.sha }}'
add: './*.tgz ./index.yaml rancher/index.yaml'
if: env.SKIP != 'TRUE'
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
# openg2p-registry-bg-tasks-deployment
# OpenG2P Registry Background Tasks Deployment

Deployment scripts - Helm Charts for deployment of openg2p-registry-bg-tasks

Refer to [OpenG2P Docs](https://docs.openg2p.org).
2 changes: 1 addition & 1 deletion charts/openg2p-registry-bg-tasks/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Chart.lock
*.tgz
*.tgz
22 changes: 4 additions & 18 deletions charts/openg2p-registry-bg-tasks/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,31 +1,17 @@
apiVersion: v2
name: openg2p-registry-bg-tasks
description: A Helm chart for OpenG2P Registry BG Tasks
description: A Helm chart for OpenG2P Registry Background Tasks
type: application
version: 1.1.0
appVersion: ""
version: 1.1.0-develop
dependencies:
- name: common
repository: oci://registry-1.docker.io/bitnamicharts
version: 2.x.x
condition: common.enabled
- name: redis
repository: oci://registry-1.docker.io/bitnamicharts
version: 20.x.x
condition: redis.enabled
- name: openg2p-registry-celery-beat-producers
version: 1.1.0
condition: openg2p-registry-celery-beat-producers.enabled
- name: openg2p-registry-celery-workers
version: 1.1.0
condition: openg2p-registry-celery-workers.enabled
keywords:
- openg2p-registry
- openg2p-registry-bg-tasks
maintainers:
- email: info@openg2p.org
name: OpenG2P
icon: https://openg2p.github.io/openg2p-helm/openg2p-logo.png
annotations:
catalog.cattle.io/display-name: "OpenG2P-Registry-BG-Tasks"
openg2p.org/add-to-rancher: ""

catalog.cattle.io/display-name: "OpenG2P Registry Background Tasks"
4 changes: 2 additions & 2 deletions charts/openg2p-registry-bg-tasks/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# OpenG2P Registry BG Tasks Helm Chart
# OpenG2P Registry Background Tasks Helm Chart

Helm Chart of OpenG2P Registry BG Tasks
Helm Chart of OpenG2P Registry Background Tasks

This file was deleted.

This file was deleted.

29 changes: 8 additions & 21 deletions charts/openg2p-registry-bg-tasks/questions.yaml
Original file line number Diff line number Diff line change
@@ -1,33 +1,20 @@
questions:
- variable: global.RBGTasksHostname
description: Hostname under which all Registry BG Task services will be accessed
type: string
label: G2P Registry BG Tasks Hostname

- variable: openg2p-registry-bg-celery-beat-producers.enabled
description: Install Registry BG Celery Beat Producers
- variable: producer.enabled
type: boolean
label: Registry BG Celery Beat Producers
label: Install Registry BG Tasks Producer?

- variable: openg2p-registry-bg-celery-workers.enabled
description: Install Registry BG Celery Workers
- variable: worker.enabled
type: boolean
label: Registry BG Celery Workers
label: Install Registry BG Tasks Worker?

- variable: global.keycloakBaseUrl
description: KeyCloak Base URL
type: string
label: KeyCloak Client Base Url
group: KeyCloak Settings
label: Keycloak Base Url

- variable: openg2p-registry-bg-tasks-celery-workers.envVars.REGISTRY_CELERY_WORKERS_AUTH_CLIENT_ID
description: KeyCloak Client ID
- variable: worker.envVars.REGISTRY_CELERY_WORKERS_AUTH_CLIENT_ID
type: string
label: KeyCloak Client ID
group: KeyCloak Settings
label: Keycloak Client ID

- variable: openg2p-registry-bg-tasks-celery-workers.envVars.REGISTRY_CELERY_WORKERS_AUTH_CLIENT_SECRET
description: KeyCloak Client Secret for Registry Celery Worker
- variable: worker.envVars.REGISTRY_CELERY_WORKERS_AUTH_CLIENT_SECRET
type: string
label: KeyCloak Client Secret
group: KeyCloak Settings
104 changes: 22 additions & 82 deletions charts/openg2p-registry-bg-tasks/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -1,94 +1,34 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "g2p-registry-bg.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "g2p-registry-bg.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Return podAnnotations
*/}}
{{- define "g2p-registry-bg.podAnnotations" -}}
{{- if .Values.podAnnotations }}
{{ include "common.tplvalues.render" (dict "value" .Values.podAnnotations "context" $) }}
{{- end }}
{{- if and .Values.metrics.enabled .Values.metrics.podAnnotations }}
{{ include "common.tplvalues.render" (dict "value" .Values.metrics.podAnnotations "context" $) }}
{{- end }}
{{- define "registry-bg-tasks.serviceAccountName" -}}
{{ default (include "common.names.fullname" .) .Values.serviceAccount.name }}
{{- end -}}

{{/*
Create the name of the service account to use
*/}}
{{- define "g2p-registry-bg.serviceAccountName" -}}
{{ default (printf "%s" (include "common.names.fullname" .)) .Values.serviceAccount.name }}
{{- define "registry-bg-tasks.imagePullSecrets" -}}
{{- include "common.images.pullSecrets" (dict "images" (list .Values.producer.image .Values.worker.image) "global" .Values.global) -}}
{{- 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 "g2p-registry-bg.fullname" -}}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Common labels
Render Env values section
*/}}
{{- define "g2p-registry-bg.labels" -}}
helm.sh/chart: {{ include "g2p-registry-bg.chart" . }}
{{ include "g2p-registry-bg.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- define "registry-bg-tasks.baseEnvVars" -}}
{{- $context := .context -}}
{{- range $k, $v := .envVars }}
- name: {{ $k }}
{{- if or (kindIs "int64" $v) (kindIs "float64" $v) (kindIs "bool" $v) }}
value: {{ $v | quote }}
{{- else if kindIs "string" $v }}
value: {{ include "common.tplvalues.render" ( dict "value" $v "context" $context ) | squote }}
{{- else }}
valueFrom: {{- include "common.tplvalues.render" ( dict "value" $v "context" $context ) | nindent 4}}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}

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

{{/*
Return the proper Docker Image Registry Secret Names
*/}}
{{- define "g2p-registry-bg.imagePullSecrets" -}}
{{- include "common.images.pullSecrets" (dict "images" (list .Values.image .Values.volumePermissions.image) "global" .Values.global) -}}
{{- end -}}

{{/*
Return the proper image name
*/}}
{{- define "g2p-registry-bg.image" -}}
{{ include "common.images.image" (dict "imageRoot" .Values.image "global" .Values.global) }}
{{- define "registry-bg-tasks.producer.envVars" -}}
{{- $envVars := merge (deepCopy .Values.commonEnvVars) (deepCopy .Values.commonEnvVarsFrom) (deepCopy .Values.producer.envVars) (deepCopy .Values.producer.envVarsFrom) -}}
{{- include "registry-bg-tasks.baseEnvVars" (dict "envVars" $envVars "context" $) }}
{{- end -}}

{{/*
Unified template to render environment variables with type checks and possible valueFrom rendering.
*/}}
{{- define "g2p-registry-bg.envVars" -}}
{{- $context := . -}} # We directly use the root context since 'context' was previously just the root passed as 'context'.
{{- $envVars := merge (deepCopy .Values.envVars) (deepCopy .Values.envVarsFrom) dict -}} # Merging all environment variable definitions into a single map.
{{- range $k, $v := $envVars }}
- name: {{ $k }}
{{- if or (kindIs "int64" $v) (kindIs "float64" $v) (kindIs "bool" $v) }}
value: {{ $v | quote }}
{{- else if kindIs "string" $v }}
value: {{ include "common.tplvalues.render" (dict "value" $v "context" $context) | squote }}
{{- else }}
valueFrom:
{{- include "common.tplvalues.render" (dict "value" $v "context" $context) | nindent 4 }}
{{- end }}
{{- end }}
{{- end }}
{{- define "registry-bg-tasks.worker.envVars" -}}
{{- $envVars := merge (deepCopy .Values.commonEnvVars) (deepCopy .Values.commonEnvVarsFrom) (deepCopy .Values.worker.envVars) (deepCopy .Values.worker.envVarsFrom) -}}
{{- include "registry-bg-tasks.baseEnvVars" (dict "envVars" $envVars "context" $) }}
{{- end -}}
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
{{- if .Values.producer.enabled }}
apiVersion: {{ include "common.capabilities.deployment.apiVersion" . }}
kind: Deployment
metadata:
name: {{ include "common.names.fullname" . }}-producer
labels: {{- include "common.labels.standard" (dict "customLabels" .Values.commonLabels "context" $) | nindent 4 }}
{{- if .Values.commonAnnotations }}
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
spec:
replicas: {{ .Values.producer.replicaCount }}
{{- if .Values.producer.updateStrategy }}
strategy: {{- toYaml .Values.producer.updateStrategy | nindent 4 }}
{{- end }}
selector:
matchLabels: {{- include "common.labels.matchLabels" (dict "customLabels" .Values.producer.podLabels "context" $) | nindent 6 }}
template:
metadata:
{{- if .Values.producer.podAnnotations }}
annotations: {{- include "common.tplvalues.render" (dict "value" .Values.producer.podAnnotations "context" $) | nindent 8 }}
{{- end }}
labels: {{- include "common.labels.standard" (dict "customLabels" .Values.producer.podLabels "context" $) | nindent 8 }}
spec:
serviceAccountName: {{ include "registry-bg-tasks.serviceAccountName" . }}
{{- include "registry-bg-tasks.imagePullSecrets" . | nindent 6 }}
hostAliases: {{- include "common.tplvalues.render" (dict "value" .Values.producer.hostAliases "context" $) | nindent 8 }}
{{- if .Values.producer.affinity }}
affinity: {{- include "common.tplvalues.render" ( dict "value" .Values.producer.affinity "context" $) | nindent 8 }}
{{- else }}
affinity:
podAffinity: {{- include "common.affinities.pods" (dict "type" .Values.producer.podAffinityPreset "context" $) | nindent 10 }}
podAntiAffinity: {{- include "common.affinities.pods" (dict "type" .Values.producer.podAntiAffinityPreset "context" $) | nindent 10 }}
nodeAffinity: {{- include "common.affinities.nodes" (dict "type" .Values.producer.nodeAffinityPreset.type "key" .Values.producer.nodeAffinityPreset.key "values" .Values.producer.nodeAffinityPreset.values) | nindent 10 }}
{{- end }}
nodeSelector: {{- include "common.tplvalues.render" ( dict "value" .Values.producer.nodeSelector "context" $) | nindent 8 }}
tolerations: {{- include "common.tplvalues.render" (dict "value" .Values.producer.tolerations "context" .) | nindent 8 }}
priorityClassName: {{ .Values.producer.priorityClassName | quote }}
{{- if .Values.producer.podSecurityContext.enabled }}
securityContext: {{- omit .Values.producer.podSecurityContext "enabled" | toYaml | nindent 8 }}
{{- end }}
initContainers:
{{- if .Values.producer.postgresCheckerInit.enabled }}
- name: postgres-checker
image: {{ .Values.producer.postgresCheckerInit.image }}
command:
{{- toYaml .Values.producer.postgresCheckerInit.command | nindent 12 }}
env: {{- include "registry-bg-tasks.producer.envVars" . | nindent 12 }}
{{- end }}
{{- if .Values.producer.initContainers }}
{{- include "common.tplvalues.render" (dict "value" .Values.producer.initContainers "context" $) | nindent 8 }}
{{- end }}
containers:
- name: registry-bg-tasks-producer
image: {{ include "common.images.image" (dict "imageRoot" .Values.producer.image "global" .Values.producer.global) }}
imagePullPolicy: {{ .Values.producer.image.pullPolicy }}
env: {{- include "registry-bg-tasks.producer.envVars" . | nindent 12 }}
{{- if .Values.producer.resources }}
resources: {{- toYaml .Values.producer.resources | nindent 12 }}
{{- end }}
{{- if .Values.producer.lifecycleHooks }}
lifecycle: {{- include "common.tplvalues.render" (dict "value" .Values.producer.lifecycleHooks "context" $) | nindent 12 }}
{{- end }}
{{- if .Values.producer.containerSecurityContext.enabled }}
securityContext: {{- omit .Values.producer.containerSecurityContext "enabled" | toYaml | nindent 12 }}
{{- end }}
{{- if .Values.producer.startupProbe.enabled }}
startupProbe: {{- include "common.tplvalues.render" (dict "value" (omit .Values.producer.startupProbe "enabled") "context" $) | nindent 12 }}
{{- end }}
{{- if .Values.producer.livenessProbe.enabled }}
livenessProbe: {{- include "common.tplvalues.render" (dict "value" (omit .Values.producer.livenessProbe "enabled") "context" $) | nindent 12 }}
{{- end }}
{{- if .Values.producer.readinessProbe.enabled }}
readinessProbe: {{- include "common.tplvalues.render" (dict "value" (omit .Values.producer.readinessProbe "enabled") "context" $) | nindent 12 }}
{{- end }}
{{- if .Values.producer.sidecars }}
{{- include "common.tplvalues.render" ( dict "value" .Values.producer.sidecars "context" $) | nindent 8 }}
{{- end }}
{{- end }}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ template "g2p-registry-bg.serviceAccountName" . }}
name: {{ include "registry-bg-tasks.serviceAccountName" . }}
labels: {{- include "common.labels.standard" (dict "customLabels" .Values.commonLabels "context" $) | nindent 4 }}
{{- if .Values.commonAnnotations }}
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
Expand Down
Loading

0 comments on commit c1582c3

Please sign in to comment.