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(helm): helm chart improvements #4220

Closed
wants to merge 14 commits into from

Conversation

michaelgoodrx
Copy link

@michaelgoodrx michaelgoodrx commented Apr 27, 2022

Summary

When using the Kuma helm chart at GoodRx, we had to make some tweaks to improve availability and integrate with our deployment and monitoring systems. These changes should all be backwards compatible and useful for the community at large. I realize we didn't discuss any of this with the maintainers beforehand. If you choose not to accept, we will maintain these changes in our own fork.

Full changelog

  • allow setting topology spread constraints
  • allow defining pod disruption budgets
  • allow defining autoscaling on ingress and egress
  • make service creation optional (because we make them ourselves using terraform)
  • allow adding optional extra labels (to assist our monitoring system)
  • allow creating kds tls secrets in helm, and any other k8s secrets (so we don't have to add an extra step to our pipeline)
  • allow specifying the resource requirements for ingress
  • allow setting pod lifecycle and termination grace period (necessary to avoid outages when using AWS)
  • standardize labels for all cp, egress, and ingress resources; some of them will get additional labels as a result. The selector labels are unaffected.

Issues resolved

Documentation

Testing

  • Unit tests
  • E2E tests
  • Manual testing on Universal
  • Manual testing on Kubernetes

I've tested these changes manually but I doubt I have tested every possible configuration.

Backwards compatibility

It should be backwards compatible, but others should verify, because this is very difficult to test. :)

@michaelgoodrx michaelgoodrx requested a review from a team as a code owner April 27, 2022 01:12
@lahabana lahabana changed the title Goodrx helm chart fixes feat(helm): helm chart improvements Apr 27, 2022
Copy link
Contributor

@lahabana lahabana left a comment

Choose a reason for hiding this comment

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

Thanks for the contrib!
I'm not opposed to any of these changes.
They make sense and provide more flexibility to the chart. I have a few comments which are mostly aesthetic.

deployments/charts/kuma/templates/cp-deployment.yaml Outdated Show resolved Hide resolved
deployments/charts/kuma/templates/cp-deployment.yaml Outdated Show resolved Hide resolved
deployments/charts/kuma/templates/egress-deployment.yaml Outdated Show resolved Hide resolved
deployments/charts/kuma/templates/ingress-service.yaml Outdated Show resolved Hide resolved
deployments/charts/kuma/values.yaml Outdated Show resolved Hide resolved
deployments/charts/kuma/values.yaml Outdated Show resolved Hide resolved
@michaelgoodrx
Copy link
Author

Thank you @lahabana for the fast review! I will make updates or respond to feedback ASAP. Might take a few days.

@michaelgoodrx michaelgoodrx force-pushed the goodrx-helm-chart-fixes branch from cbc19f1 to ae34250 Compare May 3, 2022 19:44
This includes a change to how affinty is defined so it is more flexible
and can be removed entirely if desired.

Signed-off-by: Michael Younkin <michael@goodrx.com>
Signed-off-by: Michael Younkin <michael@goodrx.com>
Signed-off-by: Michael Younkin <michael@goodrx.com>
Signed-off-by: Michael Younkin <michael@goodrx.com>
Signed-off-by: Michael Younkin <michael@goodrx.com>
Signed-off-by: Michael Younkin <michael@goodrx.com>
@michaelgoodrx michaelgoodrx force-pushed the goodrx-helm-chart-fixes branch from a33f77b to be71098 Compare May 3, 2022 23:29
@michaelgoodrx
Copy link
Author

Added sign-off to all commits

@michaelgoodrx michaelgoodrx force-pushed the goodrx-helm-chart-fixes branch 4 times, most recently from 3af00b1 to 7e992dc Compare May 4, 2022 00:10
@michaelgoodrx
Copy link
Author

Rendered updated documentation

@michaelgoodrx michaelgoodrx requested a review from lahabana May 4, 2022 00:15
@codecov-commenter
Copy link

Codecov Report

Merging #4220 (7e992dc) into master (6225a80) will decrease coverage by 0.03%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##           master    #4220      +/-   ##
==========================================
- Coverage   55.65%   55.62%   -0.04%     
==========================================
  Files         933      933              
  Lines       56251    56251              
==========================================
- Hits        31305    31288      -17     
- Misses      22460    22479      +19     
+ Partials     2486     2484       -2     
Impacted Files Coverage Δ
pkg/insights/components.go 58.33% <0.00%> (-25.01%) ⬇️
pkg/events/eventbus.go 85.18% <0.00%> (-7.41%) ⬇️
pkg/plugins/runtime/gateway/route/sorter.go 66.66% <0.00%> (-5.13%) ⬇️
pkg/defaults/components.go 82.14% <0.00%> (-3.58%) ⬇️
pkg/insights/resyncer.go 71.60% <0.00%> (-2.47%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6225a80...7e992dc. Read the comment docs.

@michaelgoodrx michaelgoodrx force-pushed the goodrx-helm-chart-fixes branch from 7e992dc to 33ed0db Compare May 4, 2022 00:40
@michaelgoodrx
Copy link
Author

Tested again in our dev environment. Everything appears functional.

@lahabana
Copy link
Contributor

lahabana commented May 4, 2022

/golden_files /format

Signed-off-by: Michael Younkin <michael@goodrx.com>
Signed-off-by: Michael Younkin <michael@goodrx.com>
Signed-off-by: Michael Younkin <michael@goodrx.com>
Signed-off-by: Michael Younkin <michael@goodrx.com>
Signed-off-by: Michael Younkin <michael@goodrx.com>
Signed-off-by: Michael Younkin <michael@goodrx.com>
This was tricky, because we had to get rid of the enabled flag in order
to maintain backwards compatibility. Because in the past, we only turned
on the kds cert checking code if a name was set, but now we want to also
turn it on if no name is set but create is true.

Signed-off-by: Michael Younkin <michael@goodrx.com>
Signed-off-by: Michael Younkin <michael@goodrx.com>
@michaelgoodrx michaelgoodrx force-pushed the goodrx-helm-chart-fixes branch from 33ed0db to 50a1709 Compare May 4, 2022 21:28
Copy link
Contributor

@jakubdyszkiewicz jakubdyszkiewicz left a comment

Choose a reason for hiding this comment

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

Those are great changes, thank you for taking the time to improve the chart!

| controlPlane.tls.kdsGlobalServer.create | bool | `false` | Whether or not to create the TLS secret in helm. |
| controlPlane.tls.kdsGlobalServer.cert | string | `""` | The TLS certificate to offer. |
| controlPlane.tls.kdsGlobalServer.key | string | `""` | The TLS key to use. |
| controlPlane.tls.kdsZoneClient.secretName | string | `""` | Name of the K8s TLS Secret resource. If you set this and don't set create=true, you have to create the secret manually. |
Copy link
Contributor

Choose a reason for hiding this comment

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

It's not a standard K8S TLS Secret (type: kubernetes.io/tls with cert+key). It's a secret that contains ca.crt with CA cert to validate.

I'd like to keep a comment with an explanation of what is this cert. How about something like this

Name of the K8s Secret resource that contains ca.crt which was used to sign the certificate of KDS Global Server. If you set this and don't set create=true, you have to create the secret manually.

| controlPlane.tls.kdsGlobalServer.key | string | `""` | The TLS key to use. |
| controlPlane.tls.kdsZoneClient.secretName | string | `""` | Name of the K8s TLS Secret resource. If you set this and don't set create=true, you have to create the secret manually. |
| controlPlane.tls.kdsZoneClient.create | bool | `false` | Whether or not to create the TLS secret in helm. |
| controlPlane.tls.kdsZoneClient.cert | string | `""` | The TLS certificate to expect. |
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we be a bit more explicit and name it controlPlane.tls.kdsZoneClient.caCert ? With a comment

CA bundle that was used to sign the certificate of KDS Global Server

@@ -38,23 +43,32 @@ A Helm chart for the Kuma Control Plane
| controlPlane.ingress.annotations | object | `{}` | Map of ingress annotations. |
| controlPlane.ingress.path | string | `"/"` | Ingress path. |
| controlPlane.ingress.pathType | string | `"ImplementationSpecific"` | Each path in an Ingress is required to have a corresponding path type. (ImplementationSpecific/Exact/Prefix) |
| controlPlane.globalZoneSyncService | object | `{"annotations":{},"loadBalancerIP":null,"port":5685,"type":"LoadBalancer"}` | URL of Global Kuma CP |
| controlPlane.globalZoneSyncService | object | `{"annotations":{},"enabled":true,"loadBalancerIP":null,"port":5685,"type":"LoadBalancer"}` | URL of Global Kuma CP |
Copy link
Contributor

Choose a reason for hiding this comment

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

optional: not caused by this PR, but it's a bit awkward that we have this documented as a potential option to modify, but really all available options are listed below. I'd delete # -- URL of Global Kuma CP comment in values.yaml

| controlPlane.image.pullPolicy | string | `"IfNotPresent"` | Kuma CP ImagePullPolicy |
| controlPlane.image.repository | string | `"kuma-cp"` | Kuma CP image repository |
| controlPlane.image.tag | string | `nil` | Kuma CP Image tag. When not specified, the value is copied from global.tag |
| controlPlane.additionalK8sSecrets | list | `[]` | list of additional secret resources to create; for each specify the name and stringData name is rendered as a template using (tpl $) |
Copy link
Contributor

Choose a reason for hiding this comment

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

So those secrets are not mounted to the CP?
Do they need to have CP labels (I'm thinking about moving it to root)?

Can you describe a practical example of this?

I'm wondering if there is a better pattern to solve this with HELM. Have you considered creating a simple chart that has a dependency on Kuma and includes your additional resources?

@lahabana
Copy link
Contributor

@michaelgoodrx the release freeze is in 1 week so please update this soon to make sure we get it in :)

@bartsmykla
Copy link
Contributor

Hi @michaelgoodrx, as today is a deadline for code freeze before the release, and we want this change in it, I decided to step in and address all @jakubdyszkiewicz's review remarks and fix failing tests. I removed the change related to additional secrets, as we were not sure if it's the best solution for this problem, but we are as always open for discussion if it's a crucial for you (give us more context and maybe we'll have some suggestions, or maybe we'll just decide it's the best solution so it'll be possible to add it in the future release). I hope you don't mind.

@bartsmykla bartsmykla closed this May 24, 2022
@michaelgoodrx
Copy link
Author

Hey @bartsmykla thanks, I really appreciate that you were able to merge it in my absence. I was on vacation and then caught COVID, it took a long time to recover.

RE the additional secrets, we are using them to create a secret for the kong mesh license key. I think some people might want it if they want to use a custom certificate for mutual TLS, or any other features you add in the future.

I think, once you do the release, we might be able to manage the kong mesh license key using the kong mesh chart as a subchart instead, if you don't want it in the kuma helm chart.

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

Successfully merging this pull request may close these issues.

5 participants