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

Add option for additional chart labels in values #3676

Merged
merged 10 commits into from
Oct 2, 2024

Conversation

mittal-ishaan
Copy link
Collaborator

@mittal-ishaan mittal-ishaan commented Sep 19, 2024

What does this PR change?

Allow users to add additional chart labels through values.yaml

Does this PR rely on any other PRs?

How does this PR impact users? (This is the kind of thing that goes in release notes!)

Users will now be able to add additional chart labels through values

Links to Issues or tickets this PR addresses or fixes

https://kubecost.atlassian.net/browse/ENG-2368

What risks are associated with merging this PR? What is required to fully test this PR?

low risk as this will be empty object by default and will be only adding chart labels when defined by user.

How was this PR tested?

rendered the helm chart template locally with and without additional chart labels
Ran the command

helm template cost-analyzer . > template.yaml

template.yaml had the following result for one of the manifest

# Source: cost-analyzer/templates/aggregator-cloud-cost-service.yaml
kind: Service
apiVersion: v1
metadata:
  name: cost-analyzer-cloud-cost
  namespace: default
  labels:

    helm.sh/chart: cost-analyzer-2.3.3
    app.kubernetes.io/managed-by: Helm
    LabelKey: LabelValue
    app.kubernetes.io/name: cost-analyzer
    app.kubernetes.io/instance: cost-analyzer
    app: cost-analyzer
spec:
  selector:

    app.kubernetes.io/name: cost-analyzer
    app.kubernetes.io/instance: cost-analyzer
    app: cost-analyzer
  type: "ClusterIP"
  ports:
    - name: tcp-api
      port: 9005
      targetPort: 9005

Have you made an update to documentation? If so, please provide the corresponding PR.

NA

@mittal-ishaan mittal-ishaan marked this pull request as draft September 19, 2024 19:29
@mittal-ishaan mittal-ishaan marked this pull request as ready for review September 20, 2024 12:37
@thomasvn
Copy link
Member

@mittal-ishaan Could you provide example output of how you templated the Helm chart successfully here? Additionally, could you link the associated Jira for this work?

@chipzoller
Copy link
Collaborator

Looks like a minor improvement here is to do some new line stripping under labels{} and selector{}.

@mittal-ishaan
Copy link
Collaborator Author

added a - before include to remove any white spaces present before it.

@thomasvn
Copy link
Member

thomasvn commented Oct 2, 2024

This looks good to me! I've also tested by doing the following.

chartLabels:
  thomasnTest: "helloworld"
helm template cost-analyzer --debug -f values-chartLabels.yaml | grep -C 3 thomasnTest

  labels:
    helm.sh/chart: cost-analyzer-2.3.3
    app.kubernetes.io/managed-by: Helm
    thomasnTest: helloworld
    app.kubernetes.io/name: cost-analyzer
    app.kubernetes.io/instance: release-name
    app: cost-analyzer
--
  labels:
    helm.sh/chart: cost-analyzer-2.3.3
    app.kubernetes.io/managed-by: Helm
    thomasnTest: helloworld
    app: aggregator
spec:
  selector:
--
  labels:
    helm.sh/chart: cost-analyzer-2.3.3
    app.kubernetes.io/managed-by: Helm
    thomasnTest: helloworld
    app.kubernetes.io/name: forecasting
    app.kubernetes.io/instance: release-name
    app: forecasting
--
  labels:
    helm.sh/chart: cost-analyzer-2.3.3
    app.kubernetes.io/managed-by: Helm
    thomasnTest: helloworld
    app.kubernetes.io/name: forecasting
    app.kubernetes.io/instance: release-name
    app: forecasting

@thomasvn thomasvn merged commit 1a0f9f5 into develop Oct 2, 2024
19 checks passed
@thomasvn thomasvn deleted the add_additional_chart_labels_values branch October 2, 2024 18:31
@thomasvn thomasvn added the v2.5 label Oct 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants