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

Modularization: Operator CRDs registration #24068

Closed
pippolo84 opened this issue Feb 28, 2023 · 0 comments · Fixed by #24219
Closed

Modularization: Operator CRDs registration #24068

pippolo84 opened this issue Feb 28, 2023 · 0 comments · Fixed by #24219
Labels
area/modularization area/operator Impacts the cilium-operator component

Comments

@pippolo84
Copy link
Member

What

At startup, the operator registers all the CRDs with the k8s api server. It does that calling client.RegisterCRDs.

To allow cleaner separation of concerns, it is possible to develop a cell the invokes the CRDs registration.
This should be done just once after the operator has been elected leader. Since the Invoke calls are executed in order by the hive, this means that the CRDs registration invoke should be the first one to be added in WithLeaderLifecycle.

A further improvement may be to refactor what is currently done in the agent to wait for the registration of the CRDs.

Success Criteria

  • The CRDs registration is moved into an independent cell.Invoke
  • The CRDs registration should be the first operation to be invoked after the operator is elected leader.
  • If the operation is not carried out synchronously, we should verify that the log is not flooded with errors due to temporary missing CRDs.

Scope: operator/cmd/root.go

Related: #23425

@pippolo84 pippolo84 added area/operator Impacts the cilium-operator component area/modularization labels Feb 28, 2023
christarazi pushed a commit to knight42/cilium that referenced this issue Mar 30, 2023
Fixes: cilium#24068

1. Move CRD registration to a separate cell inside the client package,
   and add a `--skip-crd-creation` flag.
2. Remove the `SkipCRDOption` from the `operatorOption.OperatorConfig` struct,
   alongside any reference to it in `operator/cmd/fags.go`,
   `operator/option/config.go` and `pkg/option/config.go`
3. Update cmdref

Signed-off-by: Jian Zeng <anonymousknight96@gmail.com>
christarazi pushed a commit that referenced this issue Mar 31, 2023
Fixes: #24068

1. Move CRD registration to a separate cell inside the client package,
   and add a `--skip-crd-creation` flag.
2. Remove the `SkipCRDOption` from the `operatorOption.OperatorConfig` struct,
   alongside any reference to it in `operator/cmd/fags.go`,
   `operator/option/config.go` and `pkg/option/config.go`
3. Update cmdref

Signed-off-by: Jian Zeng <anonymousknight96@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/modularization area/operator Impacts the cilium-operator component
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant