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

feat: validator: Load TLS configuration from ConfigMap #1119

Merged
merged 10 commits into from
Nov 25, 2024

Conversation

akrejcir
Copy link
Collaborator

@akrejcir akrejcir commented Nov 1, 2024

What this PR does / why we need it:
This PR moves the TLS configuration of template-validator to a ConfigMap. It is mounded as a file in the pod, and validator is able to update its configuration without restarting the pod.

Which issue(s) this PR fixes:
Jira: https://issues.redhat.com/browse/CNV-28716

Release note:

None

@kubevirt-bot kubevirt-bot added the release-note-none Denotes a PR that doesn't merit a release note. label Nov 1, 2024
@kubevirt-bot kubevirt-bot requested a review from 0xFelix November 1, 2024 10:27
@kubevirt-bot kubevirt-bot added the dco-signoff: yes Indicates the PR's author has DCO signed all their commits. label Nov 1, 2024
@kubevirt-bot kubevirt-bot requested a review from jcanocan November 1, 2024 10:27
@akrejcir
Copy link
Collaborator Author

akrejcir commented Nov 1, 2024

/cc @codingben @jcanocan @ksimon1

@akrejcir akrejcir force-pushed the validator-tls-config-map branch from 874c9bc to 520ceb4 Compare November 1, 2024 12:40
@codingben
Copy link
Member

@akrejcir Is it simialr to the implementation as in kubevirt/vm-console-proxy, e.g. filewatch.go? Maybe you can reuse this existing file to from kubevirt/vm-console-proxy to avoid code duplication?

@akrejcir
Copy link
Collaborator Author

akrejcir commented Nov 4, 2024

It is exactly the same package. I've mentioned it in the commit message: 3b2e200

Do you mean that SSP should import vm-console-proxy? I would rather avoid it, because it will cause unnecessary indirect dependencies.

internal/template-validator/tlsinfo/tlsinfo.go Outdated Show resolved Hide resolved
internal/template-validator/tlsinfo/tlsinfo.go Outdated Show resolved Hide resolved
internal/template-validator/validator/app.go Outdated Show resolved Hide resolved
internal/template-validator/tlsinfo/tlsinfo.go Outdated Show resolved Hide resolved
internal/template-validator/tlsinfo/tlsinfo.go Outdated Show resolved Hide resolved
internal/template-validator/tlsinfo/tlsinfo.go Outdated Show resolved Hide resolved
@akrejcir akrejcir force-pushed the validator-tls-config-map branch from 520ceb4 to 6ef7c2f Compare November 5, 2024 11:39
@akrejcir akrejcir force-pushed the validator-tls-config-map branch from 6ef7c2f to d1bdb12 Compare November 7, 2024 10:37
@akrejcir akrejcir force-pushed the validator-tls-config-map branch from d1bdb12 to d5336fd Compare November 18, 2024 16:03
These methods are not used from outside the package.

Signed-off-by: Andrej Krejcir <akrejcir@redhat.com>
Do not create or use the struct when using HTTP.

Signed-off-by: Andrej Krejcir <akrejcir@redhat.com>
This package was copied directly from vm-console-proxy:
https://github.com/kubevirt/vm-console-proxy/tree/main/pkg/filewatch

In a future commit, it will replace file watch logic in
internal/template-validator/tlsinfo.

We do this to simplify watching multiple directories with
TRS certificate and TLS configuration.

Signed-off-by: Andrej Krejcir <akrejcir@redhat.com>
Runs all callbacks before processing watch events. This means
that callbacks will have a change to notice the files after
the watch was started, but no events happened yet.

Signed-off-by: Andrej Krejcir <akrejcir@redhat.com>
Using the filewatch package in template validator
will make it easier to watch multiple directories
in a future commit.

Signed-off-by: Andrej Krejcir <akrejcir@redhat.com>
The GetClientConfig() will be used in future commit to set
TLS options.

Signed-off-by: Andrej Krejcir <akrejcir@redhat.com>
The TLS configuration is read from a ConfigMap
that is mounted as a file. This allows updating
the configuration without restarting the pod.

Signed-off-by: Andrej Krejcir <akrejcir@redhat.com>
Signed-off-by: Andrej Krejcir <akrejcir@redhat.com>
This will make it easier to modify the tests in future commit.

Signed-off-by: Andrej Krejcir <akrejcir@redhat.com>
Check TLS policy of template validator pod.

Signed-off-by: Andrej Krejcir <akrejcir@redhat.com>
@akrejcir akrejcir force-pushed the validator-tls-config-map branch from d5336fd to a369026 Compare November 19, 2024 11:25
@akrejcir
Copy link
Collaborator Author

/retest

1 similar comment
@akrejcir
Copy link
Collaborator Author

/retest

@jcanocan
Copy link
Contributor

Nothing to comment from my site. The PR looks great. Nice job!
/lgtm

@kubevirt-bot kubevirt-bot added the lgtm Indicates that a PR is ready to be merged. label Nov 21, 2024
Copy link
Member

@codingben codingben left a comment

Choose a reason for hiding this comment

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

/lgtm

Copy link
Member

@0xFelix 0xFelix left a comment

Choose a reason for hiding this comment

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

/approve

/hold

Putting hold to give chance to address Ben's comment.

@kubevirt-bot kubevirt-bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Nov 25, 2024
@kubevirt-bot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: 0xFelix

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

@kubevirt-bot kubevirt-bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Nov 25, 2024
@codingben
Copy link
Member

/unhold

@kubevirt-bot kubevirt-bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Nov 25, 2024
@kubevirt-bot kubevirt-bot merged commit 574b9e8 into kubevirt:main Nov 25, 2024
12 checks passed
@akrejcir akrejcir deleted the validator-tls-config-map branch November 25, 2024 15:20
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. dco-signoff: yes Indicates the PR's author has DCO signed all their commits. lgtm Indicates that a PR is ready to be merged. release-note-none Denotes a PR that doesn't merit a release note. size/XL
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants