check nil for LocalSecrets config (#962)
Some checks failed
Scorecard supply-chain security / Scorecard analysis (push) Failing after 2m36s
Post / images (amd64) (push) Failing after 3m35s
Post / coverage (push) Failing after 8m16s
Post / images (arm64) (push) Failing after 3m1s
Post / image manifest (push) Has been skipped
Post / trigger clusteradm e2e (push) Has been skipped

Signed-off-by: zhujian <jiazhu@redhat.com>
This commit is contained in:
Jian Zhu
2025-04-22 16:57:23 +08:00
committed by GitHub
parent 5170b59fa1
commit 73b6e2d514
13 changed files with 135 additions and 7 deletions

View File

@@ -59,7 +59,7 @@ metadata:
categories: Integration & Delivery,OpenShift Optional
certified: "false"
containerImage: quay.io/open-cluster-management/registration-operator:latest
createdAt: "2025-04-16T09:20:17Z"
createdAt: "2025-04-22T08:06:53Z"
description: Manages the installation and upgrade of the ClusterManager.
operators.operatorframework.io/builder: operator-sdk-v1.32.0
operators.operatorframework.io/project_layout: go.kubebuilder.io/v3

View File

@@ -251,6 +251,24 @@ spec:
ClusterAnnotations is annotations with the reserve prefix "agent.open-cluster-management.io" set on
ManagedCluster when creating only, other actors can update it afterwards.
type: object
clusterClaimConfiguration:
description: |-
ClusterClaimConfiguration represents the configuration of ClusterClaim
Effective only when the `ClusterClaim` feature gate is enabled.
properties:
maxCustomClusterClaims:
default: 20
description: Maximum number of custom ClusterClaims allowed.
format: int32
type: integer
reservedClusterClaimSuffixes:
description: Custom suffixes for reserved ClusterClaims.
items:
type: string
type: array
required:
- maxCustomClusterClaims
type: object
featureGates:
description: "FeatureGates represents the list of feature gates
for registration\nIf it is set empty, default feature gates

View File

@@ -251,6 +251,24 @@ spec:
ClusterAnnotations is annotations with the reserve prefix "agent.open-cluster-management.io" set on
ManagedCluster when creating only, other actors can update it afterwards.
type: object
clusterClaimConfiguration:
description: |-
ClusterClaimConfiguration represents the configuration of ClusterClaim
Effective only when the `ClusterClaim` feature gate is enabled.
properties:
maxCustomClusterClaims:
default: 20
description: Maximum number of custom ClusterClaims allowed.
format: int32
type: integer
reservedClusterClaimSuffixes:
description: Custom suffixes for reserved ClusterClaims.
items:
type: string
type: array
required:
- maxCustomClusterClaims
type: object
featureGates:
description: "FeatureGates represents the list of feature gates
for registration\nIf it is set empty, default feature gates

View File

@@ -31,7 +31,7 @@ metadata:
categories: Integration & Delivery,OpenShift Optional
certified: "false"
containerImage: quay.io/open-cluster-management/registration-operator:latest
createdAt: "2025-04-16T09:20:17Z"
createdAt: "2025-04-22T08:06:53Z"
description: Manages the installation and upgrade of the Klusterlet.
operators.operatorframework.io/builder: operator-sdk-v1.32.0
operators.operatorframework.io/project_layout: go.kubebuilder.io/v3

View File

@@ -251,6 +251,24 @@ spec:
ClusterAnnotations is annotations with the reserve prefix "agent.open-cluster-management.io" set on
ManagedCluster when creating only, other actors can update it afterwards.
type: object
clusterClaimConfiguration:
description: |-
ClusterClaimConfiguration represents the configuration of ClusterClaim
Effective only when the `ClusterClaim` feature gate is enabled.
properties:
maxCustomClusterClaims:
default: 20
description: Maximum number of custom ClusterClaims allowed.
format: int32
type: integer
reservedClusterClaimSuffixes:
description: Custom suffixes for reserved ClusterClaims.
items:
type: string
type: array
required:
- maxCustomClusterClaims
type: object
featureGates:
description: "FeatureGates represents the list of feature gates
for registration\nIf it is set empty, default feature gates

2
go.mod
View File

@@ -36,7 +36,7 @@ require (
k8s.io/kube-aggregator v0.32.1
k8s.io/utils v0.0.0-20241104100929-3ea5e8cea738
open-cluster-management.io/addon-framework v0.12.1-0.20250407131028-9d436ffc2da7
open-cluster-management.io/api v0.16.2-0.20250416130057-11622a5f2170
open-cluster-management.io/api v0.16.2-0.20250422072120-cadf714c3055
open-cluster-management.io/sdk-go v0.16.1-0.20250411154302-3a424961ead4
sigs.k8s.io/cluster-inventory-api v0.0.0-20240730014211-ef0154379848
sigs.k8s.io/controller-runtime v0.20.2

4
go.sum
View File

@@ -487,8 +487,8 @@ k8s.io/utils v0.0.0-20241104100929-3ea5e8cea738 h1:M3sRQVHv7vB20Xc2ybTt7ODCeFj6J
k8s.io/utils v0.0.0-20241104100929-3ea5e8cea738/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0=
open-cluster-management.io/addon-framework v0.12.1-0.20250407131028-9d436ffc2da7 h1:oLu9ag44Msf56Hb19b/b+UTNq0J2l9rhlBQ1gh7izCU=
open-cluster-management.io/addon-framework v0.12.1-0.20250407131028-9d436ffc2da7/go.mod h1:7AEw1Sq9UEWpQGTU8zV1XPNkFRBYPbyBh8tfhISV++s=
open-cluster-management.io/api v0.16.2-0.20250416130057-11622a5f2170 h1:SFtPxSCIPwDEv4iXNb4CiwjkT1gLdk6bPJGeFaKv6Ho=
open-cluster-management.io/api v0.16.2-0.20250416130057-11622a5f2170/go.mod h1:/OeqXycNBZQoe3WG6ghuWsMgsKGuMZrK8ZpsU6gWL0Y=
open-cluster-management.io/api v0.16.2-0.20250422072120-cadf714c3055 h1:D2vT3nnMS/To3ptz8LLg1zfJm/pL8XIaO1g7Qbyc/5o=
open-cluster-management.io/api v0.16.2-0.20250422072120-cadf714c3055/go.mod h1:/OeqXycNBZQoe3WG6ghuWsMgsKGuMZrK8ZpsU6gWL0Y=
open-cluster-management.io/sdk-go v0.16.1-0.20250411154302-3a424961ead4 h1:PT6kDaKjDi0EaQyNzIWzYAYeK4QpBHbm+/7VPrpJEkY=
open-cluster-management.io/sdk-go v0.16.1-0.20250411154302-3a424961ead4/go.mod h1:FtOYjn5dL8e9S1gzNb8cBNsFzHJ1F3cpmCo+qrltido=
sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.31.0 h1:CPT0ExVicCzcpeN4baWEV2ko2Z/AsiZgEdwgcfwLgMo=

View File

@@ -214,7 +214,8 @@ func (config *klusterletConfig) populateBootstrap(klusterlet *operatorapiv1.Klus
if config.MultipleHubs {
var bootstapKubeconfigSecrets []string
if klusterlet.Spec.RegistrationConfiguration.BootstrapKubeConfigs.Type == operatorapiv1.LocalSecrets {
if klusterlet.Spec.RegistrationConfiguration.BootstrapKubeConfigs.Type == operatorapiv1.LocalSecrets &&
klusterlet.Spec.RegistrationConfiguration.BootstrapKubeConfigs.LocalSecrets != nil {
for _, secret := range klusterlet.Spec.RegistrationConfiguration.BootstrapKubeConfigs.LocalSecrets.KubeConfigSecrets {
bootstapKubeconfigSecrets = append(bootstapKubeconfigSecrets, secret.Name)
}

2
vendor/modules.txt vendored
View File

@@ -1714,7 +1714,7 @@ open-cluster-management.io/addon-framework/pkg/agent
open-cluster-management.io/addon-framework/pkg/assets
open-cluster-management.io/addon-framework/pkg/index
open-cluster-management.io/addon-framework/pkg/utils
# open-cluster-management.io/api v0.16.2-0.20250416130057-11622a5f2170
# open-cluster-management.io/api v0.16.2-0.20250422072120-cadf714c3055
## explicit; go 1.23.6
open-cluster-management.io/api/addon/v1alpha1
open-cluster-management.io/api/client/addon/clientset/versioned

View File

@@ -251,6 +251,24 @@ spec:
ClusterAnnotations is annotations with the reserve prefix "agent.open-cluster-management.io" set on
ManagedCluster when creating only, other actors can update it afterwards.
type: object
clusterClaimConfiguration:
description: |-
ClusterClaimConfiguration represents the configuration of ClusterClaim
Effective only when the `ClusterClaim` feature gate is enabled.
properties:
maxCustomClusterClaims:
default: 20
description: Maximum number of custom ClusterClaims allowed.
format: int32
type: integer
reservedClusterClaimSuffixes:
description: Custom suffixes for reserved ClusterClaims.
items:
type: string
type: array
required:
- maxCustomClusterClaims
type: object
featureGates:
description: "FeatureGates represents the list of feature gates
for registration\nIf it is set empty, default feature gates

View File

@@ -176,6 +176,24 @@ type RegistrationConfiguration struct {
// This provides driver details required to register with hub
// +optional
RegistrationDriver RegistrationDriver `json:"registrationDriver,omitempty"`
// ClusterClaimConfiguration represents the configuration of ClusterClaim
// Effective only when the `ClusterClaim` feature gate is enabled.
// +optional
ClusterClaimConfiguration *ClusterClaimConfiguration `json:"clusterClaimConfiguration,omitempty"`
}
// ClusterClaimConfiguration represents the configuration of ClusterClaim
type ClusterClaimConfiguration struct {
// Maximum number of custom ClusterClaims allowed.
// +kubebuilder:validation:Required
// +kubebuilder:default:=20
// +required
MaxCustomClusterClaims int32 `json:"maxCustomClusterClaims"`
// Custom suffixes for reserved ClusterClaims.
// +optional
ReservedClusterClaimSuffixes []string `json:"reservedClusterClaimSuffixes,omitempty"`
}
type RegistrationDriver struct {

View File

@@ -116,6 +116,27 @@ func (in *CSRConfig) DeepCopy() *CSRConfig {
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ClusterClaimConfiguration) DeepCopyInto(out *ClusterClaimConfiguration) {
*out = *in
if in.ReservedClusterClaimSuffixes != nil {
in, out := &in.ReservedClusterClaimSuffixes, &out.ReservedClusterClaimSuffixes
*out = make([]string, len(*in))
copy(*out, *in)
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterClaimConfiguration.
func (in *ClusterClaimConfiguration) DeepCopy() *ClusterClaimConfiguration {
if in == nil {
return nil
}
out := new(ClusterClaimConfiguration)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ClusterManager) DeepCopyInto(out *ClusterManager) {
*out = *in
@@ -574,6 +595,11 @@ func (in *RegistrationConfiguration) DeepCopyInto(out *RegistrationConfiguration
}
in.BootstrapKubeConfigs.DeepCopyInto(&out.BootstrapKubeConfigs)
in.RegistrationDriver.DeepCopyInto(&out.RegistrationDriver)
if in.ClusterClaimConfiguration != nil {
in, out := &in.ClusterClaimConfiguration, &out.ClusterClaimConfiguration
*out = new(ClusterClaimConfiguration)
(*in).DeepCopyInto(*out)
}
return
}

View File

@@ -210,6 +210,16 @@ func (BootstrapKubeConfigs) SwaggerDoc() map[string]string {
return map_BootstrapKubeConfigs
}
var map_ClusterClaimConfiguration = map[string]string{
"": "ClusterClaimConfiguration represents the configuration of ClusterClaim",
"maxCustomClusterClaims": "Maximum number of custom ClusterClaims allowed.",
"reservedClusterClaimSuffixes": "Custom suffixes for reserved ClusterClaims.",
}
func (ClusterClaimConfiguration) SwaggerDoc() map[string]string {
return map_ClusterClaimConfiguration
}
var map_HubApiServerHostAlias = map[string]string{
"": "HubApiServerHostAlias holds the mapping between IP and hostname that will be injected as an entry in the pod's hosts file.",
"ip": "IP address of the host file entry.",
@@ -307,6 +317,7 @@ var map_RegistrationConfiguration = map[string]string{
"kubeAPIBurst": "KubeAPIBurst indicates the maximum burst of the throttle while talking with apiserver of hub cluster from the spoke cluster. If it is set empty, use the default value: 100",
"bootstrapKubeConfigs": "BootstrapKubeConfigs defines the ordered list of bootstrap kubeconfigs. The order decides which bootstrap kubeconfig to use first when rebootstrap.\n\nWhen the agent loses the connection to the current hub over HubConnectionTimeoutSeconds, or the managedcluster CR is set `hubAcceptsClient=false` on the hub, the controller marks the related bootstrap kubeconfig as \"failed\".\n\nA failed bootstrapkubeconfig won't be used for the duration specified by SkipFailedBootstrapKubeConfigSeconds. But if the user updates the content of a failed bootstrapkubeconfig, the \"failed\" mark will be cleared.",
"registrationDriver": "This provides driver details required to register with hub",
"clusterClaimConfiguration": "ClusterClaimConfiguration represents the configuration of ClusterClaim Effective only when the `ClusterClaim` feature gate is enabled.",
}
func (RegistrationConfiguration) SwaggerDoc() map[string]string {