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

Creating TLSOptions in favor of PullOptions and PushOptions. #86

Merged
merged 1 commit into from Nov 24, 2022

Conversation

ybettan
Copy link
Contributor

@ybettan ybettan commented Sep 22, 2022

The build object, always push to the same registry that the
kernelMapping will pull from, therefore, there is not need to
duplicate the config.

In addition that, I have also renamed some of the fields for better
self-documented code.

Here is how this field is used in the module:

  • kernelMapping[].build.baseImageRegistryTLS is only meant for pulling the
    base image of the Dockerfile specified in the build.

  • kernelMapping[].registryTLS is meant for specifying the TLS options for
    pulling the image we want to deploy or for pushing it in case we are building
    it in-cluster (because they will always be the same).

  • moduleLoaderContainerSpec.registryTLS is just the global value of all
    kernelMapping[]'s entries.

Signed-off-by: Yoni Bettan yonibettan@gmail.com

@k8s-ci-robot k8s-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Sep 22, 2022
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ybettan

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 approved Indicates a PR has been approved by an approver from all required OWNERS files. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Sep 22, 2022
@ybettan ybettan force-pushed the cert-options branch 4 times, most recently from 2df4d5c to faf02aa Compare September 29, 2022 08:59
@qbarrand
Copy link
Contributor

If we change the CRD now, we probably need to implement a conversion webhook to avoid breaking clients.
https://book.kubebuilder.io/multiversion-tutorial/tutorial.html

@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Nov 23, 2022
@codecov-commenter
Copy link

codecov-commenter commented Nov 23, 2022

Codecov Report

Base: 71.86% // Head: 71.88% // Increases project coverage by +0.02% 🎉

Coverage data is based on head (4d8aba7) compared to base (351def7).
Patch coverage: 80.00% of modified lines in pull request are covered.

❗ Current head 4d8aba7 differs from pull request most recent head 02978ac. Consider uploading reports for the commit 02978ac to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #86      +/-   ##
==========================================
+ Coverage   71.86%   71.88%   +0.02%     
==========================================
  Files          25       25              
  Lines        2417     2419       +2     
==========================================
+ Hits         1737     1739       +2     
  Misses        597      597              
  Partials       83       83              
Impacted Files Coverage Δ
internal/module/helper.go 0.00% <0.00%> (ø)
internal/registry/registry.go 36.50% <80.00%> (ø)
controllers/module_reconciler.go 67.69% <100.00%> (ø)
internal/build/job/maker.go 92.98% <100.00%> (+0.08%) ⬆️
internal/build/job/manager.go 78.46% <100.00%> (ø)
internal/preflight/preflight.go 71.05% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@k8s-ci-robot k8s-ci-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Nov 23, 2022
@ybettan ybettan changed the title [WIP] Creating TLSOptions in favor of PullOptions and PushOptions. Creating TLSOptions in favor of PullOptions and PushOptions. Nov 23, 2022
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Nov 23, 2022
@ybettan
Copy link
Contributor Author

ybettan commented Nov 23, 2022

@qbarrand @yevgeny-shnaidman Are we OK to merge it without a conversion webhook at this point?

@ybettan ybettan force-pushed the cert-options branch 3 times, most recently from b11cfdd to f5d6f5d Compare November 23, 2022 14:41
@ybettan
Copy link
Contributor Author

ybettan commented Nov 23, 2022

@yevgeny-shnaidman @qbarrand PTAL

@qbarrand
Copy link
Contributor

Should we also define kernelMapping[].sign.baseImageRegistryTLS?

@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Nov 24, 2022
@ybettan
Copy link
Contributor Author

ybettan commented Nov 24, 2022

Should we also define kernelMapping[].sign.baseImageRegistryTLS?

I don't think we do. baseImageRegistryTLS is only for pulling a base image while building, for pulling a pre-built image or for pushing a just-built image we are using km.registryTLS anyway.

@chr15p Am I missing something here?

@ybettan
Copy link
Contributor Author

ybettan commented Nov 24, 2022

/hold
Wait for Github actions before merging.

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Nov 24, 2022
@ybettan
Copy link
Contributor Author

ybettan commented Nov 24, 2022

/unhold

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Nov 24, 2022
@chr15p
Copy link
Contributor

chr15p commented Nov 24, 2022

Should we also define kernelMapping[].sign.baseImageRegistryTLS?

I don't think we do. baseImageRegistryTLS is only for pulling a base image while building, for pulling a pre-built image or for pushing a just-built image we are using km.registryTLS anyway.

@chr15p Am I missing something here?

Signing pulls an image, signs its kmods, then pushes it back again. So it both pulls and pushes, and theoretically they could be to/from different registrys. We're currently using spec.ImageRepoSecret for the creds to do the pushing and pulling which it doesn't look like you're changing so I think we're ok.

We might want to add per sign pull/push secrets, it would probably be a good thing, but at the moment we dont do that.

@ybettan
Copy link
Contributor Author

ybettan commented Nov 24, 2022

We might want to add per sign pull/push secrets, it would probably be a good thing, but at the moment we dont do that.

This PR isn't about secret but rather about transport (TLS) options.

We can discuss adding secrets to the sign if needed but I don't think is has the same context as this PR does.

api/v1beta1/module_types.go Outdated Show resolved Hide resolved
api/v1beta1/module_types.go Outdated Show resolved Hide resolved
The `build` object, always push to the same registry that the
`kernelMapping` will pull from, therefore, there is not need to
duplicate the config.

In addition that, I have also renamed some of the fields for better
self-documented code.

Here is how this field is used in the module:

* `kernelMapping[].build.baseImageRegistryTLS` is only meant for pulling the
   base image of the Dockerfile specified in the build.

* `kernelMapping[].registryTLS` is meant for specifying the TLS options for
  pulling the image we want to deploy or for pushing it in case we are building
  it in-cluster (because they will always be the same).

* `moduleLoaderContainerSpec.registryTLS` is just the global value of all
  kernelMapping[]'s entries.

Signed-off-by: Yoni Bettan <yonibettan@gmail.com>
@qbarrand
Copy link
Contributor

baseImageRegistryTLS is only for pulling a base image while building

Signing does essentially the same as building, I don't see any reason why we shouldn't have the same TLS options.

@yevgeny-shnaidman
Copy link
Contributor

baseImageRegistryTLS is only for pulling a base image while building

Signing does essentially the same as building, I don't see any reason why we shouldn't have the same TLS options.

Signing is accessing the same registry as building. Do you see any scenario where we execute sign without build?

@ybettan
Copy link
Contributor Author

ybettan commented Nov 24, 2022

Signing does essentially the same as building, I don't see any reason why we shouldn't have the same TLS options.

Signing isn't pulling any "base image" as build does. It is only pulling existing images or pushing after signing, hence, using the km.registryTLS (same as build is doing when pushing).

build.baseImageRegistryTLS is only used to pull the base image withing a Dockerfile, we don't have such in signing.

@ybettan
Copy link
Contributor Author

ybettan commented Nov 24, 2022

As agree with @qbarrand TLS options doesn't exist for signing in this PR, therefore, they will be added separately in a different PR.

@qbarrand
Copy link
Contributor

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Nov 24, 2022
@k8s-ci-robot k8s-ci-robot merged commit 65421fe into kubernetes-sigs:main Nov 24, 2022
@chr15p
Copy link
Contributor

chr15p commented Nov 24, 2022

Signing is accessing the same registry as building. Do you see any scenario where we execute sign without build?

yes, if a vendor distributes a their own pre-built driver container and it needs to be signed to run on the users cluster.

and yes, sorry pull options not secrets, but signing still doesn't use them, and maybe it should, but that is a separate issue/PR

@ybettan ybettan deleted the cert-options branch November 24, 2022 14:17
qbarrand pushed a commit to qbarrand/kernel-module-management that referenced this pull request Jun 2, 2023
…ernetes-sigs#86)

Bumps [github.com/google/go-containerregistry](https://github.com/google/go-containerregistry) from 0.9.0 to 0.10.0.
- [Release notes](https://github.com/google/go-containerregistry/releases)
- [Changelog](https://github.com/google/go-containerregistry/blob/main/.goreleaser.yml)
- [Commits](google/go-containerregistry@v0.9.0...v0.10.0)

---
updated-dependencies:
- dependency-name: github.com/google/go-containerregistry
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
qbarrand pushed a commit to qbarrand/kernel-module-management that referenced this pull request Jun 2, 2023
Bumps [github.com/onsi/gomega](https://github.com/onsi/gomega) from 1.20.2 to 1.24.0.
- [Release notes](https://github.com/onsi/gomega/releases)
- [Changelog](https://github.com/onsi/gomega/blob/master/CHANGELOG.md)
- [Commits](onsi/gomega@v1.20.2...v1.24.0)

---
updated-dependencies:
- dependency-name: github.com/onsi/gomega
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
yevgeny-shnaidman pushed a commit to yevgeny-shnaidman/kernel-module-management-upstream that referenced this pull request Jul 31, 2023
…ernetes-sigs#86)

Bumps [github.com/google/go-containerregistry](https://github.com/google/go-containerregistry) from 0.9.0 to 0.10.0.
- [Release notes](https://github.com/google/go-containerregistry/releases)
- [Changelog](https://github.com/google/go-containerregistry/blob/main/.goreleaser.yml)
- [Commits](google/go-containerregistry@v0.9.0...v0.10.0)

---
updated-dependencies:
- dependency-name: github.com/google/go-containerregistry
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@‌github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@‌users.noreply.github.com>
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/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants