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

Reading sub-chart configmap yaml to rolling the deployment of parent chart pod #13002

Open
Subbad12 opened this issue May 3, 2024 · 1 comment

Comments

@Subbad12
Copy link

Subbad12 commented May 3, 2024

Output of helm version: Version:"v3.10.1"

Output of kubectl version:Client Version: v1.27.4
Kustomize Version: v5.0.1
Server Version: v1.27.11-gke.1062000

Cloud Provider/Platform (AKS, GKE, Minikube etc.): GKE

We have a sub-chart that is included as a dependency in the parent chart.

We want to roll out the deployment of a pod within the parent chart whenever there's any modification in either the parent chart's config map or the sub-chart's config map. For parent chart config map alterations, we've implemented a process that involves reading the configmap YAML file and computing its checksum, as outlined in the Helm documentation.

Could you please assist me how we can achieve the same for reading a sub-chart's config map YAML file and calculating its checksum?

Parent Chart.yaml
apiVersion: v2
appVersion: 1.0.0
dependencies:

  • name: sub-chart
    version: 1.0.0
    repository: alias:alias-repo
    description: A Helm chart for Kubernetes
    name: parent-chart
    type: application
    version: 1.0.0

Parent Template to calculate checksum
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ .Values.pod1.deploymentName }}
spec:
replicas: {{ int .Values.pod1.replicaCount }}
selector:
matchLabels:
name: {{ .Values.pod1.appName }}
template:
metadata:
annotations:
checksum/config: {{ include (print $.Template.BasePath "/parent-chart-configmap.yaml") . | sha256sum }}

Sub-chart has a configmap with some of the properties.

@gjenkins8
Copy link
Contributor

likely the lookup function would work here (but I would use this function with caution, it can makes your chart behavior awkwardly non-deterministic; calculating a hash of a config map seems reasonable through)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants