Skip to content

Conversation

krzysied
Copy link
Contributor

@krzysied krzysied commented Feb 4, 2020

The test creates additional webhook that injects sidecar to hamster pods.
Injected sidecars should be in pod container spec, but should not be listed in VpaObservedContainers label. Injected sidecars should not cause eviction.

ref #2726

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Feb 4, 2020
@krzysied
Copy link
Contributor Author

krzysied commented Feb 4, 2020

/assign @bskiba

Copy link
Member

@bskiba bskiba left a comment

Choose a reason for hiding this comment

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

I've added some comments to the copied code that you can ignore since they are mostly copied.
Does this actually work with the run-e2e-tests.sh script? I remeber there were issues when I tried extracting the common libs from the v1 and v1beta2 dirs.

)

const (
// TODO(krzysied): Update the image url when agnhost:2.10
Copy link
Member

Choose a reason for hiding this comment

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

This comment does not parse in my head

Copy link
Member

Choose a reason for hiding this comment

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

Also it is still relevant? I see 2.10 below.

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 guess something must have interrupted me and I finished the comment with different thought in my head 🤣
I updated the comment and moved it to the test case.


utils.DeployWebhookAndService(f, agnhostImage, context, servicePort, containerPort, sidecarParam)

// Webhook must be placed after vpa webhook. Webhooks are registered alphabetically.
Copy link
Member

Choose a reason for hiding this comment

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

Is this really true that Webhooks are registered alphabetically?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

That is horrible, thanks for pointing this out to me.


// SetupServerCert setups up the server cert. For example, user apiservers and admission webhooks
// can use the cert to prove their identify to the kube-apiserver
func SetupServerCert(namespaceName, serviceName string) *certContext {
Copy link
Member

Choose a reason for hiding this comment

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

Since we only use it for Webhook, maybe name is SetupWebhookCert?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.
I removed serviceName parameter if we only use it for the specific webhook.


ginkgo.By("Adding recommendation for " + sidecarName)

vpa, err := getVpaClientSet(f).AutoscalingV1().VerticalPodAutoscalers(f.Namespace.Name).
Copy link
Member

Choose a reason for hiding this comment

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

Why not set recommendation up in the first place?

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 though it will be less code with creat + patch. It turned out to be not the greatest idea...
I moved the sidecar recommendation to the hamster vpa setup.

@bskiba
Copy link
Member

bskiba commented Feb 6, 2020

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Feb 6, 2020
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: bskiba

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Feb 6, 2020
@k8s-ci-robot k8s-ci-robot merged commit 1d2f183 into kubernetes:master Feb 6, 2020
@krzysied krzysied deleted the vpa_webhook_test branch February 6, 2020 12:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants