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

Test DaemonSetPatch with and without annotation conflicts #2630

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

rquitales
Copy link
Contributor

@rquitales rquitales commented Oct 24, 2023

This PR adds a test (TestPatchForceWithDaemonSet) in nodejs which tests out a DaemonSetPatch on a kube-proxy DaemonSet object with conflicting field managers. This PR also includes code to spin up a KinD cluster. The test runs against kind since we are interacting with kube-system objects and this allows isolation from other tests.

Steps the test does:

  1. Spin up KinD cluster for tests
  2. Use kubectl to fetch the latest kube-proxy manifest from the live cluster
  3. Update the .spec.template.spec.containers[0].image field and re-apply to cluster using kubectl client side apply to change field owners
  4. Run step 1 of the Pulumi program test, this attempts to update .spec.template.spec.containers[0].image and .spec.template.spec.containers[0].command WITHOUT the pulumi.com/patchForce=true annotation.
  5. Expect test failure
  6. Run step 2 of the Pulumi program test which updates .spec.template.spec.containers[0].image and .spec.template.spec.containers[0].command WITH the pulumi.com/patchForce=true annotation.
  7. Verify that the fields are successfully updated

This test confirms that without setting the patchForce annotation, the pulumi up step fails since there is a field conflict error. It is only with the patchForce annotation that pulumi up succeeds.

The field manager conflict error that occurs from step 2:

  kubernetes:apps/v1:DaemonSetPatch (kube-proxy-image):
    error: resource kube-system/kube-proxy was not successfully created by the Kubernetes API server : Server-Side Apply field conflict detected. see https://www.pulumi.com/registry/packages/kubernetes/how-to-guides/managing-resources-with-server-side-apply/#handle-field-conflicts-on-existing-resources for troubleshooting help
    : Apply failed with 2 conflicts: conflicts with "kubeadm" using apps/v1:
    - .spec.template.spec.containers[name="kube-proxy"].command
    conflicts with "kubectl-client-side-apply" using apps/v1:
    - .spec.template.spec.containers[name="kube-proxy"].image

Related: #2629

@github-actions
Copy link

Does the PR have any schema changes?

Looking good! No breaking changes found.
No new resources/functions.

@codecov-commenter
Copy link

codecov-commenter commented Oct 24, 2023

Codecov Report

Merging #2630 (7b03365) into master (f3498a9) will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##           master    #2630   +/-   ##
=======================================
  Coverage   18.34%   18.34%           
=======================================
  Files          47       47           
  Lines        9625     9625           
=======================================
  Hits         1766     1766           
  Misses       7760     7760           
  Partials       99       99           

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@pulumi-bot pulumi-bot added the needs-triage Needs attention from the triage team label Oct 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-triage Needs attention from the triage team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants