-
Notifications
You must be signed in to change notification settings - Fork 2.7k
feat(registry): new CRD option #5372
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
base: master
Are you sure you want to change the base?
Conversation
Skipping CI for Draft Pull Request. |
Any chance we keep all API versions in folders Example https://github.com/gofogo/k8s-sigs-external-dns-fork/pull/15/files. This PR is in my repo still, it is working, but I have too many PR currently open ;-) And API GW https://github.com/kubernetes-sigs/gateway-api/tree/main/apis. The convention is for Custom Resources to keep them under structure |
I was thinking of doing something like that. That make sense to me 👍 . |
11bd380
to
f260e1c
Compare
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: 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 |
@@ -101,3 +101,100 @@ spec: | |||
storage: true | |||
subresources: | |||
status: {} | |||
--- |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The CRDs for the Helm chart should be in separate files and be formatted as described in #5479. The following command would be my suggestion to handle multiple CRDs being generated.
${CONTROLLER_GEN} object crd:crdVersions=v1 paths="./apis/..." output:crd:stdout | yamlfmt - | yq eval '.metadata.annotations |= with_entries(select(.key | test("kubernetes\.io")))' --split-exp '"./charts/external-dns/crds/" + .metadata.name + ".yaml"'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be fixed with a rebase.
PR needs rebase. 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. |
It probably makes sense to slice this PR into smaller parts. There's no major issue if code is added but not immediately functional. For instance, we could safely introduce code from apid/v1alpha1 without yet generating any YAML files. This approach might significantly speed up the implementation of this extremely cool feature! |
case "aws-sd": | ||
reg, err = registry.NewAWSSDRegistry(p, cfg.TXTOwnerID) | ||
case "crd": | ||
reg, err = registry.NewCRDRegistry(p, cfg.KubeConfig, cfg.APIServerURL, cfg.CRDSourceAPIVersion, cfg.Namespace, cfg.TXTOwnerID, cfg.RequestTimeout, cfg.TXTCacheInterval) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could we have something like
registry.NewCRDRegistry(p, WithKubeConfig(), WithApiServerUrl(), With...)
Easier to support and extend, alternative registry.NewCRDRegistry(p, cfg)
, and manage requried fields within the registry. Not a great, as there is coupling but still
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Something like
type RegistryOptions struct {
Provider provider.Provider
KubeConfig string
APIServerURL string
CRDSourceAPIVersion string
Namespace string
TXTOwnerID string
RequestTimeout time.Duration
TXTCacheInterval time.Duration
// Add new fields here as needed
}
func NewRegistry(opts RegistryOptions) (Registry, error) {
// use opts.Provider, opts.KubeConfig, etc.
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
opton example
type RegistryOption func(*Registry)
func WithKubeConfig(cfg string) RegistryOption { ... }
func NewRegistry(provider provider.Provider, opts ...RegistryOption) (Registry, error) {
reg := &Registry{Provider: provider}
for _, opt := range opts {
opt(reg)
}
// ...
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I could add this in another PR, so you just rebase or implement as part of this change and I make changes in other registries
Description
This is a follow up of #4598, updated with
DNSRecord
name and rebased on current master code.This PR is not yet ready, it needs:
The use of an other Kubeconfig will be for an other PR. Same for chart integration, with required new RBAC.
Fixes #4575
Checklist