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: add API types for secrets sync controller #1364

Draft
wants to merge 47 commits into
base: feature/secrets-sync-controller
Choose a base branch
from

Conversation

mandreap
Copy link

@mandreap mandreap commented Oct 29, 2023

What type of PR is this?
/kind feature

What this PR does / why we need it:
Provides the API for the Secret Store Sync Controller.

At the end this feature will:

  • remove the secret sync controller from the Secret Store CSI driver
  • create a new secret store sync controller to synchronize secrets as kubernetes secrets
  • update the RBAC permissions for the Secret Store CSI controllers

Special notes for your reviewer:

  • This will be moved in a separate project. Added here for review during the next Sig Auth API review meeting.

TODOs:

  • squashed commits
  • includes documentation
  • adds unit tests

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Oct 29, 2023
@k8s-ci-robot k8s-ci-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Oct 29, 2023
@k8s-ci-robot
Copy link
Contributor

Hi @mandreap. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

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/test-infra repository.

@k8s-ci-robot k8s-ci-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Oct 29, 2023
@mandreap mandreap marked this pull request as draft October 29, 2023 17:01
@k8s-ci-robot k8s-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Oct 29, 2023
@mandreap mandreap changed the base branch from main to feature/secrets-sync-controller October 30, 2023 12:59
Copy link
Contributor

@enj enj left a comment

Choose a reason for hiding this comment

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

I think the controller's RBAC, admission policy, and CLI config are required to complete the picture on this API.

Comment on lines 6 to 7
secretProviderClassName: spc-multiple-secrets # [REQUIRED] name of the SecretProviderClass
serviceAccountName: <workload-identity-sa-name> # [REQUIRED] name of the service account
Copy link
Contributor

Choose a reason for hiding this comment

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

@aramase this does means you could try to use the same SPC across multiple SAs. That sounds like something that is possible today via the pod mount, but does anyone actually do that?

Copy link
Member

Choose a reason for hiding this comment

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

it is used when the same SPC needs to be mounted in 2 different pods that have different SA. I don't think it's done explicitly but because the pods already have a SA configured they would just use that as-is.

@aramase
Copy link
Member

aramase commented Nov 2, 2023

/retitle feat: add API for secrets sync

@k8s-ci-robot k8s-ci-robot changed the title Mandrea/secretstoresynccontroller feat: add API for secrets sync Nov 2, 2023
Comment on lines 6 to 7
secretProviderClassName: spc-multiple-secrets # [REQUIRED] name of the SecretProviderClass
serviceAccountName: <workload-identity-sa-name> # [REQUIRED] name of the service account
Copy link
Member

Choose a reason for hiding this comment

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

it is used when the same SPC needs to be mounted in 2 different pods that have different SA. I don't think it's done explicitly but because the pods already have a SA configured they would just use that as-is.

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: mandreap
Once this PR has been reviewed and has the lgtm label, please assign ritazh for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found 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

@aramase aramase changed the title feat: add API for secrets sync feat: add API types for secrets sync Nov 2, 2023
@mandreap mandreap changed the title feat: add API types for secrets sync feat: add API types for secrets sync controller Nov 27, 2023
@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 27, 2023
Copy link

@liggitt liggitt left a comment

Choose a reason for hiding this comment

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

@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 Jan 31, 2024
// +kubebuilder:validation:XValidation:message="Labels should have < 63 characters for both keys and values.",rule="(self.all(x, x.size() < 63 && self[x].size() < 63) == true)"
// +kubebuilder:validation:XValidation:message="Labels should not contain secrets-store.sync.x-k8s.io. This key is reserved for the controller.",rule="(self.all(x, x.contains('secrets-store.sync.x-k8s.io') == false))"
// +optional
Labels map[string]string `json:"labels,omitempty"`
Copy link

Choose a reason for hiding this comment

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

@jpbetz @cici37 we ran into a gap here where CEL validation of the key hits budget limits because there's no way to constrain the maxLength of the key in openapi, so the worst-case 1-3MB size is used for the key. This meant a normal regex to check qualified name got rejected as too expensive.

Copy link

Choose a reason for hiding this comment

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

Probably worth opening an issue for kubebuilder to be able to specify constraints on the value (like maxLength). CRDs can express this but it doesn't seem like kubebuilder can.

@k8s-triage-robot
Copy link

The Kubernetes project currently lacks enough contributors to adequately respond to all PRs.

This bot triages PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the PR is closed

You can:

  • Mark this PR as fresh with /remove-lifecycle stale
  • Close this PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label May 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. 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