Skip to content

Conversation

@hessjcg
Copy link
Collaborator

@hessjcg hessjcg commented Sep 30, 2022

Adds the mutating webhook that will update workloads as they are created or modified.

  • controllers/workload_controller.go implements an admission webhook that modifies workloads as they are created.
  • test/helpers/testcases.go holds implementations of test cases that are reused between the integration tests and the e2e tests.
  • test/helpers/resources.go has helpers that create resource definitions.

config/**/*.yaml changes are all boilerplate or generated changes to enable the webhook controller.

Copy link
Collaborator Author

@hessjcg hessjcg left a comment

Choose a reason for hiding this comment

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

Updated based on @enocom review.

@hessjcg hessjcg requested a review from enocom October 3, 2022 15:38
@enocom enocom requested a review from a team October 3, 2022 15:41
// WorkloadAdmissionWebhook implementation of a controller-runtime webhook for all
// supported workload types: Deployment, DaemonSet, StatefulSet, Pod, CronJob, Job
type WorkloadAdmissionWebhook struct {
Client client.Client
Copy link
Member

Choose a reason for hiding this comment

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

Should this be a pointer?

Copy link
Collaborator Author

@hessjcg hessjcg Oct 3, 2022

Choose a reason for hiding this comment

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

client.Client is an interface.

This is one of the weird things about Go is that interfaces could be implemented by pointers or values. Nobody uses a naming convention to indicate what is an interface and what is concrete type. The only syntax that indicates that something is concrete is accessing fields directly.

@hessjcg hessjcg merged commit c01c5c6 into main Oct 3, 2022
@hessjcg hessjcg deleted the smaller-chunks branch October 10, 2022 22:23
This was referenced Dec 7, 2022
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.

3 participants