Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
5 changes: 5 additions & 0 deletions charts/cluster-proxy/templates/manager-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ spec:
{{- if .Values.featureGates }}
- --feature-gates=ClusterProfile={{ .Values.featureGates.clusterProfile | default false}}
{{- end}}
env:
- name: POD_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
securityContext:
allowPrivilegeEscalation: false
capabilities:
Expand Down
5 changes: 5 additions & 0 deletions charts/cluster-proxy/templates/user-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@ spec:
- --server-cert=/user-tls/tls.crt
- --service-proxy-ca-cert=/proxy-ca/ca.crt
- --agent-install-namespace=open-cluster-management-agent-addon
env:
- name: POD_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
securityContext:
allowPrivilegeEscalation: false
capabilities:
Expand Down
28 changes: 26 additions & 2 deletions cmd/addon-manager/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ import (
"open-cluster-management.io/cluster-proxy/pkg/proxyagent/agent"
"open-cluster-management.io/cluster-proxy/pkg/proxyserver/controllers"
"open-cluster-management.io/cluster-proxy/pkg/proxyserver/operator/authentication/selfsigned"
sdktls "open-cluster-management.io/sdk-go/pkg/tls"
//+kubebuilder:scaffold:imports
)

Expand Down Expand Up @@ -165,13 +166,38 @@ func main() {
os.Exit(1)
}

ctx, cancel := context.WithCancel(ctrl.SetupSignalHandler())
defer cancel()

podNamespace := os.Getenv("POD_NAMESPACE")
if len(podNamespace) == 0 {
klog.Fatalf("Pod namespace is empty, please set the ENV for POD_NAMESPACE")
}

// Using common code to watch for the TLS Profile configmap and restart.
// Note that technically this addon-manager does not serve any thing with tls directly and only
// updates the configuration in the proxyServer via the RegisterClusterManagementAddonReconciler.
// So we could alternatively add a watch there on the configmap and simply reconcile.
// This way keeps it simpler with common code, but does restart when the configmap changes
sdkTLSConfig, err := sdktls.StartTLSConfigMapWatcher(ctx, nativeClient, podNamespace, func() {
klog.Info("TLS ConfigMap changed, restarting")
os.Exit(0)
})
if err != nil {
setupLog.Error(err, "failed to start TLS ConfigMap watcher")
os.Exit(1)
}
klog.Infof("TLS config loaded: minVersion=%s, ciphersuites=%s", sdktls.VersionToString(sdkTLSConfig.MinVersion),
sdktls.CipherSuitesToString(sdkTLSConfig.CipherSuites))

if err := controllers.RegisterClusterManagementAddonReconciler(
mgr,
selfSigner,
nativeClient,
nativeInformer.Core().V1().Secrets(),
imagePullPolicy,
ownerRef,
sdkTLSConfig,
); err != nil {
setupLog.Error(err, "unable to create controller", "controller", "ClusterManagementAddonReconciler")
os.Exit(1)
Expand Down Expand Up @@ -220,8 +246,6 @@ func main() {
os.Exit(1)
}

ctx, cancel := context.WithCancel(ctrl.SetupSignalHandler())
defer cancel()
go nativeInformer.Start(ctx.Done())
go func() {
<-mgr.Elected()
Expand Down
46 changes: 23 additions & 23 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,29 @@ module open-cluster-management.io/cluster-proxy
go 1.25.0

require (
github.com/onsi/ginkgo/v2 v2.22.0
github.com/onsi/gomega v1.36.1
github.com/onsi/ginkgo/v2 v2.27.2
github.com/onsi/gomega v1.38.2
github.com/openshift/library-go v0.0.0-20250711143941-47604345e7ea
github.com/pkg/errors v0.9.1
github.com/stretchr/testify v1.11.1
google.golang.org/grpc v1.76.0
k8s.io/api v0.34.2
k8s.io/apimachinery v0.34.2
k8s.io/client-go v0.34.2
k8s.io/api v0.35.2
k8s.io/apimachinery v0.35.2
k8s.io/client-go v0.35.2
k8s.io/klog/v2 v2.130.1
k8s.io/utils v0.0.0-20250604170112-4c0f3b243397
k8s.io/utils v0.0.0-20251002143259-bc988d571ff4
open-cluster-management.io/addon-framework v1.2.0
open-cluster-management.io/api v1.2.0
open-cluster-management.io/sdk-go v1.2.0
open-cluster-management.io/api v1.2.1-0.20260305075857-4d5f387ec6be
open-cluster-management.io/sdk-go v1.2.1-0.20260331032456-0cc72e52e4f2
sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.31.2
sigs.k8s.io/controller-runtime v0.22.4
sigs.k8s.io/controller-runtime v0.23.1
)

require (
github.com/spf13/cobra v1.10.1
github.com/spf13/pflag v1.0.10
k8s.io/component-base v0.34.2
k8s.io/apiserver v0.35.0
k8s.io/component-base v0.35.2
sigs.k8s.io/apiserver-network-proxy v0.33.0
sigs.k8s.io/cluster-inventory-api v0.0.0-20251124125836-445319b6307a
)
Expand Down Expand Up @@ -52,11 +53,10 @@ require (
github.com/go-openapi/swag v0.23.1 // indirect
github.com/go-task/slim-sprig/v3 v3.0.0 // indirect
github.com/gobwas/glob v0.2.3 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/google/btree v1.1.3 // indirect
github.com/google/gnostic-models v0.7.0 // indirect
github.com/google/go-cmp v0.7.0 // indirect
github.com/google/pprof v0.0.0-20241029153458-d1b30febd7db // indirect
github.com/google/pprof v0.0.0-20250403155104-27863c87afa6 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/gorilla/websocket v1.5.4-0.20250319132907-e064f32e3674 // indirect
github.com/huandu/xstrings v1.5.0 // indirect
Expand All @@ -72,10 +72,10 @@ require (
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/prometheus/client_golang v1.22.0 // indirect
github.com/prometheus/client_model v0.6.1 // indirect
github.com/prometheus/common v0.63.0 // indirect
github.com/prometheus/procfs v0.15.1 // indirect
github.com/prometheus/client_golang v1.23.2 // indirect
github.com/prometheus/client_model v0.6.2 // indirect
github.com/prometheus/common v0.66.1 // indirect
github.com/prometheus/procfs v0.16.1 // indirect
github.com/santhosh-tekuri/jsonschema/v6 v6.0.2 // indirect
github.com/shopspring/decimal v1.4.0 // indirect
github.com/spf13/cast v1.7.0 // indirect
Expand All @@ -84,9 +84,10 @@ require (
go.opentelemetry.io/otel/trace v1.37.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
go.uber.org/zap v1.27.0 // indirect
go.yaml.in/yaml/v2 v2.4.2 // indirect
go.yaml.in/yaml/v2 v2.4.3 // indirect
go.yaml.in/yaml/v3 v3.0.4 // indirect
golang.org/x/crypto v0.46.0 // indirect
golang.org/x/mod v0.30.0 // indirect
golang.org/x/net v0.47.0 // indirect
golang.org/x/oauth2 v0.32.0 // indirect
golang.org/x/sync v0.19.0 // indirect
Expand All @@ -98,15 +99,14 @@ require (
gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20251029180050-ab9386a59fda // indirect
google.golang.org/protobuf v1.36.10 // indirect
gopkg.in/evanphx/json-patch.v4 v4.12.0 // indirect
gopkg.in/evanphx/json-patch.v4 v4.13.0 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
helm.sh/helm/v3 v3.19.4 // indirect
k8s.io/apiextensions-apiserver v0.34.2 // indirect
k8s.io/apiserver v0.34.2 // indirect
k8s.io/kube-openapi v0.0.0-20250710124328-f3f2b991d03b // indirect
sigs.k8s.io/json v0.0.0-20241014173422-cfa47c3a1cc8 // indirect
k8s.io/apiextensions-apiserver v0.35.0 // indirect
k8s.io/kube-openapi v0.0.0-20250910181357-589584f1c912 // indirect
sigs.k8s.io/json v0.0.0-20250730193827-2d320260d730 // indirect
sigs.k8s.io/randfill v1.0.0 // indirect
sigs.k8s.io/structured-merge-diff/v6 v6.3.0 // indirect
sigs.k8s.io/structured-merge-diff/v6 v6.3.2-0.20260122202528-d9cc6641c482 // indirect
sigs.k8s.io/yaml v1.6.0 // indirect
)
Loading