From 7cd39e279a2164c8076bf87cde7c8329af5f512f Mon Sep 17 00:00:00 2001 From: Zhiwei Yin Date: Thu, 19 Sep 2024 00:13:26 +0800 Subject: [PATCH] fix the cluster name is digital Signed-off-by: Zhiwei Yin --- addon/manifests/permission/rolebinding.yaml | 2 +- cmd/manager/exec/manager.go | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/addon/manifests/permission/rolebinding.yaml b/addon/manifests/permission/rolebinding.yaml index 9c3f9b9f..e3868dfd 100644 --- a/addon/manifests/permission/rolebinding.yaml +++ b/addon/manifests/permission/rolebinding.yaml @@ -2,7 +2,7 @@ apiVersion: rbac.authorization.k8s.io/v1 kind: RoleBinding metadata: name: open-cluster-management:addons:application-manager - namespace: {{ .ClusterName }} + namespace: "{{ .ClusterName }}" roleRef: apiGroup: rbac.authorization.k8s.io kind: ClusterRole diff --git a/cmd/manager/exec/manager.go b/cmd/manager/exec/manager.go index ac4369fe..144853f7 100644 --- a/cmd/manager/exec/manager.go +++ b/cmd/manager/exec/manager.go @@ -18,6 +18,7 @@ import ( "context" "crypto/tls" "fmt" + "math" "net/http" "os" "strings" @@ -245,6 +246,11 @@ func RunManager() { os.Exit(1) } + // Validate the LeaseDurationSeconds value to ensure it fits within int32 limits + if Options.LeaseDurationSeconds > math.MaxInt32 || Options.LeaseDurationSeconds < math.MinInt32 { + klog.Fatalf("lease-duration exceeds int32 range: %d", Options.LeaseDurationSeconds) + } + leaseReconciler := leasectrl.LeaseReconciler{ HubKubeClient: hubKubeClient, HubConfigFilePathName: Options.HubConfigFilePathName,