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

[v2] E2E test groundwork #665

Merged
merged 2 commits into from
Sep 18, 2024
Merged

[v2] E2E test groundwork #665

merged 2 commits into from
Sep 18, 2024

Conversation

blampe
Copy link
Contributor

@blampe blampe commented Sep 16, 2024

This adds the groundwork for e2e testing the v2 branch. Try it with make test-e2e.

  • The Kubebuilder scaffolding was expecting some kustomize files on top of operator/config, so I regenerated CRDs into operator/config/bases and dropped a Deployment into operator/config/manager. We'll eventually need to consolidate this with the root config/crd.
  • I happened to have a more recent version of protoc-gen-go-grpc which changed the generated code slightly. I checked in a .mise.toml mostly just to write down which versions of each tool I was using while working on this. Totally optional but you can read docs here if you'd like a direnv-style tooling setup.
  • I removed the agent's Dockerfile, so we now have one image with manager and agent binaries.
  • I added a make target to build the rootless repo. I think we'll still want to get this working with the root repo.
  • I had to cut some corners with the image's version tag and how that gets plumbed to the agent. I'm currently generating a random hex tag and baking that into the binary to guarantee the operator spawns agents using the same image.
  • I copy-pasted some of the scaffolded RBAC stuff to get leader election working. The operator doesn't do any cleanup so it should be safe to relinquish the lease on shutdown.
  • Simplified the scaffolded e2e test -- we don't need prometheus or cert-manager (yet -- if we do we can add them later).

I haven't enabled an assertion for the random-yaml stack because I wasn't able to see it reliably reconcile. I was seeing GitHub rate limit errors as well as errors from the operator when updating status on the stack.

@blampe blampe added the impact/no-changelog-required This issue doesn't require a CHANGELOG update label Sep 16, 2024
Comment on lines +10 to +13
apiVersion: apps/v1
kind: Deployment
metadata:
name: controller-manager
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Kubebuilder scaffolding.

Copy link

codecov bot commented Sep 16, 2024

Codecov Report

Attention: Patch coverage is 16.00000% with 21 lines in your changes missing coverage. Please review.

Please upload report for BASE (v2@e850d02). Learn more about missing BASE report.

Files with missing lines Patch % Lines
agent/pkg/proto/agent_grpc.pb.go 0.00% 19 Missing ⚠️
operator/cmd/main.go 0.00% 2 Missing ⚠️
Additional details and impacted files
@@          Coverage Diff          @@
##             v2     #665   +/-   ##
=====================================
  Coverage      ?   19.06%           
=====================================
  Files         ?       25           
  Lines         ?     3745           
  Branches      ?        0           
=====================================
  Hits          ?      714           
  Misses        ?     2925           
  Partials      ?      106           

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

Comment on lines +38 to +43
// Generate a random tag to ensure pods get re-created when re-running the
// test locally.
bytes := make([]byte, 12)
_, _ = rand.Read(bytes) //nolint:staticcheck // Don't need crypto here.
tag := hex.EncodeToString(bytes)
projectimage := "pulumi/pulumi-kubernetes-operator-v2:" + tag
Copy link
Contributor

Choose a reason for hiding this comment

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

How do you suppose this is handled ordinarily? It is perhaps assumed that the build version would vary?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Using a latest tag with an IfNotPresent pull policy is sufficient for CI. I was having trouble running things multiple times locally because a new latest tag wouldn't cause things to re-deploy but I can probably simplify this with some more robust teardown logic.

Comment on lines +341 to +342
// TODO: get from configuration
workspaceAgentImage := "pulumi/pulumi-kubernetes-operator-v2:" + version.Version
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe this should be read from an environment variable.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll try to hook this up to the downward API.

@blampe blampe merged commit 7fd37bb into v2 Sep 18, 2024
6 checks passed
@blampe blampe deleted the blampe/v2-e2e branch September 18, 2024 19:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
impact/no-changelog-required This issue doesn't require a CHANGELOG update
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants