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

feat(chart)!: manage CRDs as part of release #1671

Merged
merged 3 commits into from
Mar 22, 2024

Conversation

hiddeco
Copy link
Contributor

@hiddeco hiddeco commented Mar 22, 2024

This introduces a new change to the chart which allows the Custom Resource Definitions to be managed as part of the release, effectively allowing upgrades. Which is not possible with Helm's built-in Custom Resource Definition management.

The behavior can be opted-out of by setting crds.create to false, causing them to be excluded from the Helm release manifests which effectively causes a fallback to Helm's default behavior.

With this change, existing installations will have to adopt the Custom Resource Definitions by configuring the following annotations and label on the resources:

RELEASE=<Helm release name>
NAMESPACE=<Helm release namespace>

for name in $(kubectl get crds -o name | grep kargo.akuity.io); do
   echo "Adopting $name"
   kubectl annotate $name meta.helm.sh/release-name=$RELEASE
   kubectl annotate $name meta.helm.sh/release-namespace=$NAMESPACE
   kubectl label $name app.kubernetes.io/managed-by=Helm
done

hiddeco added 2 commits March 22, 2024 11:11
Signed-off-by: Hidde Beydals <hidde@hhh.computer>
Signed-off-by: Hidde Beydals <hidde@hhh.computer>
Copy link

netlify bot commented Mar 22, 2024

Deploy Preview for docs-kargo-akuity-io ready!

Name Link
🔨 Latest commit 329611d
🔍 Latest deploy log https://app.netlify.com/sites/docs-kargo-akuity-io/deploys/65fd666f895f7e000800b243
😎 Deploy Preview https://deploy-preview-1671.kargo.akuity.io
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

codecov bot commented Mar 22, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 43.81%. Comparing base (93cb70a) to head (56e3025).

❗ Current head 56e3025 differs from pull request most recent head 329611d. Consider uploading reports for the commit 329611d to get more accurate results

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1671   +/-   ##
=======================================
  Coverage   43.81%   43.81%           
=======================================
  Files         202      202           
  Lines       12935    12935           
=======================================
  Hits         5667     5667           
  Misses       7026     7026           
  Partials      242      242           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
Comment on lines +1 to +11
{{- if .Values.crds.install -}}
{{- range $path, $bytes := .Files.Glob "crds/*.yaml" }}
{{- $manifest := $.Files.Get $path | fromYaml }}
{{- if $.Values.crds.keep }}
{{- $newAnnotations := dict "helm.sh/resource-policy" "keep" | merge $manifest.metadata.annotations }}
{{- $_ := set $manifest.metadata "annotations" $newAnnotations }}
{{- end }}
{{- $manifest | toYaml }}
{{- print "\n---\n" }}
{{- end }}
{{- end }}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is super slick.

@krancour
Copy link
Member

This LGTM and my only thought for a possible improvement is probably better left for a follow-up... we could make your little adoption script available in the project's hack/ dir.

@krancour krancour self-requested a review March 22, 2024 13:56
@hiddeco hiddeco changed the title feat(chart): manage CRDs as part of release feat(chart)!: manage CRDs as part of release Mar 22, 2024
@hiddeco hiddeco added this pull request to the merge queue Mar 22, 2024
Merged via the queue into akuity:main with commit a8ee287 Mar 22, 2024
15 checks passed
@hiddeco hiddeco deleted the chart-move-crds branch March 22, 2024 15:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants