gocli, net-res-inj: Support readiness probe #1822
/cc @orelmisan @frenzyfriday @oshoval
Files cluster-provision/k8s/1.3{4..7}/pre-pull-images need to be updated accordingly.
Done. Thanks.
/retest-required
Thanks
worth to compare the values to the other network repos probes, unless you did that already,
and to ask Ram / Quique to review as they found out some bugs while developing it
/retest-required
Thanks
> worth to compare the values to the other network repos probes, unless you did that already, and to ask Ram / Quique to review as they found out some bugs while developing it
I copied the values from https://github.com/k8snetworkplumbingwg/network-resources-injector/blob/603fe81f57fb9886388a0fd58901bf33380a34c2/deployments/server.yaml#L84.
@RamLavi, @qinqon do you have any insights?
/retest
Commit message has a dangling footnote:
Following [1] network-resourcs-injector now
[1] is missing.
nit: There is at least one typo.
Any reason for the commit tag over a digest? A digest is immutable, so the pre-pulled image stays exactly what CI validated, and it would match the other digest-pinned entries in pre-pull-images files.
image: ghcr.io/k8snetworkplumbingwg/network-resources-injector@sha256:e8cae03bb83ab65f134315a57bb076b25121cc4635342fad1a4714c811639b59
Thank you for the PR @nirdothan!
This is great!
note that CI uses imagePullPolicy: IfNotPresent
so even if the image behind the tag is changed it won't help, moreover a tag shouldn't be overridden
it is just nicer
> Thanks
> worth to compare the values to the other network repos probes, unless you did that already, and to ask Ram / Quique to review as they found out some bugs while developing it
> I copied the values from https://github.com/k8snetworkplumbingwg/network-resources-injector/blob/603fe81f57fb9886388a0fd58901bf33380a34c2/deployments/server.yaml#L84.
> @RamLavi, @qinqon do you have any insights?
The timings matching CNAO (readiness 5/10, liveness 15/20) seem fine.
The issue I have with this is in the endpoint, not the numbers. In the image this PR pins, /readyz is on the health server (:8444), always returns 200, and that server starts before TLS load / NAD cache / ListenAndServeTLS on :8443:
https://github.com/k8snetworkplumbingwg/network-resources-injector/blob/603fe81f57fb9886388a0fd58901bf33380a34c2/cmd/webhook/main.go#L102-L116
https://github.com/k8snetworkplumbingwg/network-resources-injector/blob/603fe81f57fb9886388a0fd58901bf33380a34c2/cmd/webhook/main.go#L162-L205
The Service still targets 8443, so /readyz can succeed while apiserver still gets connection-refused on /mutate. initialDelaySeconds: 5 may hide that race; it does not close it.
If kubevirtci needs a probe that actually means “webhook is listening”, a tcpSocket readiness probe on 8443 would match the admission port. Copying upstream /readyz as-is does not.
note that CI uses imagePullPolicy: IfNotPresent so even if the image behind the tag is changed it won't help, moreover a tag shouldn't be overridden it is just nicer
@oshoval this specific manifest uses imagePullPolicy: Always.
>If kubevirtci needs a probe that actually means “webhook is listening”, a tcpSocket readiness probe on 8443 would match the admission port. Copying upstream /readyz as-is does not.
@RamLavi this is pure gold. Thanks!
Addressed reviews from @RamLavi @oshoval and @orelmisan
Changes commit message since the solution has changed.
SHA?
Same bellow.
there is a script that bumps net-res-inj
worth to adapt it to do those changes as well please
not sure why you changed the pullPolicy
@orelmisan I used the hash but not that one ^, because I fell back to v1.9.0 since the new readyz endpoint is redundant and we don't need it per https://github.com/kubevirt/kubevirtci/pull/1822#issuecomment-5436369483.
@oshoval I misread your comment and changed the policy to IfNotPresent although that's not what you meant :) but I find it better anyway.
@orelmisan I used the hash but not that one ^, because I fell back to v1.9.0 since the new readyz endpoint is redundant and we don't need it per #1822 (comment).
> @oshoval I misread your comment and changed the policy to IfNotPresent although that's not what you meant :) but I find it better anyway.
If that is the case, I suggest retaining the released version tag.
Always doesnt pull if the image is there already and match the sha, so always is better
a tag that is changed behind the scene (wrong if happens), doesnt repull with IfnotPresent
i think the PR should do the minimal changes anyhow,
please also update the bump script, else it becomes outdated
Aligned now with tags per @oshoval's request (which I don't see anymore) but is consistent with the bump script.
there is a script that bumps net-res-inj worth to adapt it to do those changes as well please
Reverted the hashes back to tags so bump script should work.
not sure why you changed the pullPolicy
Reverted back to Always
Reverted the hashes back to tags so bump script should work.
can you test it please ?
any change that you did to the manifest must appear there, else it will lose on bump
@oshoval
Please LMK if you are asking for any other changes
> Reverted the hashes back to tags so bump script should work.
> can you test it please ? any change that you did to the manifest must appear there, else it will lose on bump
Having trouble ATM testing it due to ./cluster-provision/k8s/update-pre-pull-images.sh: line 36: rg: command not found and installation of rg is failing.
Would appreciate if you could test it otherwise will install it later (need a reboot).
> > Reverted the hashes back to tags so bump script should work.
>
>
> can you test it please ? any change that you did to the manifest must appear there, else it will lose on bump
> Having trouble ATM testing it due to ./cluster-provision/k8s/update-pre-pull-images.sh: line 36: rg: command not found and installation of rg is failing. Would appreciate if you could test it otherwise will install it later (need a reboot).
i mean to test the bumper script
the reason is not just the sha, it is all the other fields
* AFAIU Bump script does not need update since the image tag was eventually unchanged.
Please LMK if you are asking for any other changes
see please https://github.com/kubevirt/kubevirtci/pull/1822#issuecomment-5491770666
> > > Reverted the hashes back to tags so bump script should work.
> >
> >
> > can you test it please ? any change that you did to the manifest must appear there, else it will lose on bump
>
>
> Having trouble ATM testing it due to ./cluster-provision/k8s/update-pre-pull-images.sh: line 36: rg: command not found and installation of rg is failing. Would appreciate if you could test it otherwise will install it later (need a reboot).
> i mean to test the bumper script the reason is not just the sha, it is all the other fields
The error above is from the bumper script. It calls update-pre-pull-images.sh.
diff --git a/cluster-provision/gocli/opts/network_resources_injector/manifests/server.yaml b/cluster-provision/gocli/opts/network_resources_injector/manifests/server.yaml
index 32bdb194..ffdb74bc 100644
--- a/cluster-provision/gocli/opts/network_resources_injector/manifests/server.yaml
+++ b/cluster-provision/gocli/opts/network_resources_injector/manifests/server.yaml
@@ -29,7 +29,7 @@ spec:
labels:
app: network-resources-injector
spec:
- serviceAccountName: network-resources-injector-sa
+ serviceAccount: network-resources-injector-sa
containers:
- name: webhook-server
image: ghcr.io/k8snetworkplumbingwg/network-resources-injector:v1.9.0
@@ -42,6 +42,10 @@ spec:
- -tls-private-key-file=/etc/tls/tls.key
- -tls-cert-file=/etc/tls/tls.crt
- -health-check-port=8444
+ # Optional TLS hardening flags:
+ # - -tls-min-version=VersionTLS13
+ # - -tls-cipher-suites=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384
+ # - -tls-curve-preferences=29,23,24
- -logtostderr
- -v=2
- -insecure
@@ -70,23 +74,11 @@ spec:
memory: "200Mi"
cpu: "500m"
livenessProbe:
- failureThreshold: 3
httpGet:
path: /healthz
port: 8444
- scheme: HTTP
- initialDelaySeconds: 15
- periodSeconds: 20
- successThreshold: 1
- timeoutSeconds: 1
- readinessProbe:
- failureThreshold: 3
- tcpSocket:
- port: 8443
- initialDelaySeconds: 5
- periodSeconds: 10
- successThreshold: 1
- timeoutSeconds: 1
+ initialDelaySeconds: 10
+ periodSeconds: 5
initContainers:
- name: installer
image: ghcr.io/k8snetworkplumbingwg/network-resources-injector:v1.9.0
it is wrong, it strips the fields, since you need to add them to the script please
> diff --git a/cluster-provision/gocli/opts/network_resources_injector/manifests/server.yaml b/cluster-provision/gocli/opts/network_resources_injector/manifests/server.yaml > index 32bdb194..ffdb74bc 100644 > --- a/cluster-provision/gocli/opts/network_resources_injector/manifests/server.yaml > +++ b/cluster-provision/gocli/opts/network_resources_injector/manifests/server.yaml > @@ -29,7 +29,7 @@ spec: > labels: > app: network-resources-injector > spec: > - serviceAccountName: network-resources-injector-sa > + serviceAccount: network-resources-injector-sa > containers: > - name: webhook-server > image: ghcr.io/k8snetworkplumbingwg/network-resources-injector:v1.9.0 > @@ -42,6 +42,10 @@ spec: > - -tls-private-key-file=/etc/tls/tls.key > - -tls-cert-file=/etc/tls/tls.crt > - -health-check-port=8444 > + # Optional TLS hardening flags: > + # - -tls-min-version=VersionTLS13 > + # - -tls-cipher-suites=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 > + # - -tls-curve-preferences=29,23,24 > - -logtostderr > - -v=2 > - -insecure > @@ -70,23 +74,11 @@ spec: > memory: "200Mi" > cpu: "500m" > livenessProbe: > - failureThreshold: 3 > httpGet: > path: /healthz > port: 8444 > - scheme: HTTP > - initialDelaySeconds: 15 > - periodSeconds: 20 > - successThreshold: 1 > - timeoutSeconds: 1 > - readinessProbe: > - failureThreshold: 3 > - tcpSocket: > - port: 8443 > - initialDelaySeconds: 5 > - periodSeconds: 10 > - successThreshold: 1 > - timeoutSeconds: 1 > + initialDelaySeconds: 10 > + periodSeconds: 5 > initContainers: > - name: installer > image: ghcr.io/k8snetworkplumbingwg/network-resources-injector:v1.9.0 >
> it is wrong, it strips the fields, since you need to add them to the script please
This script relies too much on the correctness of the upstream manifest. I'll try to change the manifest upstream.
There has been no activity on this PR for 45 days.
To protect limited CI resources, it has been automatically labelled 'stale'.
This PR will automatically rot after an additional 14 days of inactivity, and will be closed shortly after that.
What you can do:
If the PR is waiting on you to respond to a question or feedback and/or update the PR, please do so.
You can mark the PR as fresh and remove the label with the following command: /remove-lifecycle stale
If this PR is safe to close now, please help the project by closing it with: /close
If you need attention on this PR from a reviewer, you can raise it on the agenda of the relevant SIG meeting or KubeVirt Community meeting, or ping the kubevirt-dev slack channel.
/lifecycle stale
/remove-lifecycle stale
Last change follows merge of https://github.com/k8snetworkplumbingwg/network-resources-injector/pull/243 utilizing enhanced readinessProbe.
Last push disables network-resources-injector in check-cluster-up.sh in single stack flow. Since multus is disabled, net-res-inj must be disabled too.
please keep Always, all over
there is no reason to change it, and not related to this PR
please drop, just comments
unless there is a reason to have it
worth to add please few words about the path that was taken on PR desc, wrt https://github.com/kubevirt/kubevirtci/pull/1822#issuecomment-5437368581
Removed. I actually left in in place for the bump script, because it will "bring it back" once it runs and I wanted the diffs to be thinner.
worth to add please few words about the path that was taken on PR desc, wrt #1822 (comment)
I added it because you requested, even-though I think that its an upstream project consideration and kubevirtci should just be concerned with deploying it.
@nirdothan: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:
Test name | Commit | Details | Required | Rerun command
--- | --- | --- | --- | ---
check-provision-k8s-1.34 | 3eff19e784c79396d38091de7ce1b7d151976802 | link | false | /test check-provision-k8s-1.34
<details>
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.
</details>
<!-- test report -->
> worth to add please few words about the path that was taken on PR desc, wrt #1822 (comment)
> I added it because you requested, even-though I think that its an upstream project consideration and kubevirtci should just be concerned with deploying it.
meant on PR desc please, not commit msg, it is more visable,
and not for the "review" flow, that it was "hacky" but for focusing on what was learned before it and is the gist of the how to do it correct, anyhow whatever you prefer, it is just good history for learning purpose
thanks, so we will need indeed the bump to skip it as well, or to return it,
sorry for the back and forth, anyhow can be done in the future when there is a tag
Approved these changes.
> > worth to add please few words about the path that was taken on PR desc, wrt #1822 (comment)
>
>
> I added it because you requested, even-though I think that its an upstream project consideration and kubevirtci should just be concerned with deploying it.
> meant on PR desc please, not commit msg, it is more visable, and not for the "review" flow, that it was "hacky" but for focusing on what was learned before it and is the gist of the how to do it correct, anyhow whatever you prefer, it is just good history for learning purpose
I honestly don't think that this solution is better than @RamLavi's proposed solution. However I can add a dew words in the description.
I honestly don't think that this solution is better than @RamLavi's proposed solution. However I can add a dew words in the description.
thought you did as Ram suggested at least in the direction of it, and the gist of it is what i meant worth to have in the PR desc
/approve
Thank you @nirdothan - would you mind creating a follow up issue so we don't forget to bump after release of network-resources-injector?
oshoval
nirdothan
<!-- Thanks for sending a pull request! Here are some tips for you:
1. Consider creating this PR as draft: https://github.com/kubevirt/kubevirt/blob/main/CONTRIBUTING.md#consider-opening-your-pull-request-as-draft
2. Follow the instructions for writing a release note from k8s: https://git.k8s.io/community/contributors/guide/release-notes.md
-->
What this PR does / why we need it:
Add readiness and liveness probes to deployment.
Bump image to the lastest image that includes [1], where readiness
probe was enhanced to actually test the mutating server status.
To date there is no tagged release that includes that functionality
therefore a commit tag is used as a temporary alternative
until network-reousrces-injector releases a 1.11 release.
Note: hack/bump-net-resources-injector.sh is not applicable
for this bump since it is not bumping to latest.
It is expected to work (and should be tested) in the next
bump to a tagged release.
Note: The discussion in [1] surfaced different opinions about how to implement a readiness probe for a TLS service endpoint: [2] suggested a TCP probe directly to the /mutate endpoint while the maintainers of the u/s project suggested a separate HTTP endpoint, but instead of dummy, have it fed with statuses from the real server.
The reader is welcome to asses both methods to determine which one is proffered.
The author of this PR is happy with both.
[1] https://github.com/k8snetworkplumbingwg/network-resources-injector/commit/33ab42f3854594227576ae1e2767f4aa4552b8ac
[2] https://github.com/kubevirt/kubevirtci/pull/1822#issuecomment-5436369483
Which issue(s) this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)format, will close the issue(s) when PR gets merged):Fixes #
Special notes for your reviewer:
Using untagged upstream image because a tagged release is not expected soon.
Checklist
This checklist is not enforcing, but it's a reminder of items that could be relevant to every PR.
Approvers are expected to review this list.
Release note:
<!-- Write your release note:
1. Enter your extended release note in the below block. If the PR requires additional action from users switching to the new release, include the string "action required".
2. If no release note is required, just write "NONE".
-->
``
release-note
``NONE