* 🐛 Apply TLS profile to spoke agent serving endpoints
The spoke agent binaries (klusterlet-agent, registration-agent, work-agent)
receive --tls-min-version and --tls-cipher-suites flags from the klusterlet
operator via deployment template rendering, but do not wire them to their own
library-go GenericAPIServer serving endpoint on port 8443.
Add ApplyTLSToCommand to all three spoke agent command constructors
(NewKlusterletAgentCmd, NewRegistrationAgent, NewWorkAgent) so the TLS flags
are consumed by the PersistentPreRunE hook and applied to the serving config.
This matches the pattern already used by all hub component commands
(registration-controller, placement, work, addon-manager, grpc-server).
Signed-off-by: Tesshu Flower <tflower@redhat.com>
* 🐛 Apply TLS profile to operator serving endpoints via ConfigMap
The cluster-manager operator (hub) and klusterlet operator (spoke) serve a
health/metrics endpoint on port 8443 via library-go's GenericAPIServer. Unlike
the hub controllers and spoke agents they manage, these operator binaries do not
receive --tls-min-version and --tls-cipher-suites flags from their deployment
manifests -- no external component injects those flags into the operator pods.
Instead, the operators have direct access to the ocm-tls-profile ConfigMap in
their namespace at startup:
- The cluster-manager operator reads it in RunClusterManagerOperator via
StartTLSConfigMapWatcher and calls os.Exit(0) on changes to restart.
- The klusterlet operator has a tls-profile-sync sidecar that writes the
ConfigMap from the local OCP APIServer TLS profile and triggers pod restarts.
Add ApplyTLSFromConfigMapToCommand to both operator commands. This installs a
PersistentPreRunE hook that reads the ocm-tls-profile ConfigMap once (using an
in-cluster kube client) before library-go's StartController creates the server,
writes a minimal GenericOperatorConfig YAML to /tmp, and sets --config to point
at it. This ensures the server's TLS config is set correctly from the first
request, using the same restart-on-change mechanism already in place.
The ConfigMap is optional: if not found (upstream deployments without the ACM
sidecar) or if the in-cluster config is unavailable (local dev), the hook is a
no-op and library-go defaults apply.
Also add ApplyTLSToCommand call-site comments to the three spoke agent commands
explaining the difference: agents receive TLS flags from their deployment
manifests (injected by the klusterlet operator), while the operator itself reads
the ConfigMap directly.
Signed-off-by: Tesshu Flower <tflower@redhat.com>
---------
Signed-off-by: Tesshu Flower <tflower@redhat.com>
* Add a disable-default-addon-namespace flag
if the flag is set, default addon ns will not be created
by the operator.
Signed-off-by: Jian Qiu <jqiu@redhat.com>
* Update with comments
Signed-off-by: Jian Qiu <jqiu@redhat.com>
---------
Signed-off-by: Jian Qiu <jqiu@redhat.com>
* 🌱 add a verify rule for golang files import order
This PR uses the [gci tool](https://github.com/daixiang0/gci) to make all go files' import section with a specific order, it will organize import with group with order:
1. standard library modules
2. 3rd party modules
3. modules in OCM org, like the `open-cluster-management.io/api`
4. current project `open-cluster-management.io/ocm` modules
developers can use the `make fmt-imports` to format the import automatically and the `make verify-fmt-imports` to check for any violation.
Signed-off-by: zhujian <jiazhu@redhat.com>
* 🌱 format the go files import
Signed-off-by: zhujian <jiazhu@redhat.com>
---------
Signed-off-by: zhujian <jiazhu@redhat.com>