Skip to content

Commit

Permalink
Minor fixes (gardener#8878)
Browse files Browse the repository at this point in the history
* Do not default KubeControllerManager struct for workerless

* Fix spelling in doc string
  • Loading branch information
shafeeqes authored Nov 29, 2023
1 parent ba208a4 commit ccb71cb
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 20 deletions.
8 changes: 4 additions & 4 deletions docs/api-reference/settings.md
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ KubeAPIServerOpenIDConnect
</td>
<td>
<p>Server contains the kube-apiserver&rsquo;s OpenID Connect configuration.
This configuration is not overwritting any existing OpenID Connect
This configuration is not overwriting any existing OpenID Connect
configuration already set on the Shoot object.</p>
</td>
</tr>
Expand All @@ -200,7 +200,7 @@ OpenIDConnectClientAuthentication
<em>(Optional)</em>
<p>Client contains the configuration used for client OIDC authentication
of Shoot clusters.
This configuration is not overwritting any existing OpenID Connect
This configuration is not overwriting any existing OpenID Connect
client authentication already set on the Shoot object.</p>
</td>
</tr>
Expand Down Expand Up @@ -497,7 +497,7 @@ KubeAPIServerOpenIDConnect
</td>
<td>
<p>Server contains the kube-apiserver&rsquo;s OpenID Connect configuration.
This configuration is not overwritting any existing OpenID Connect
This configuration is not overwriting any existing OpenID Connect
configuration already set on the Shoot object.</p>
</td>
</tr>
Expand All @@ -514,7 +514,7 @@ OpenIDConnectClientAuthentication
<em>(Optional)</em>
<p>Client contains the configuration used for client OIDC authentication
of Shoot clusters.
This configuration is not overwritting any existing OpenID Connect
This configuration is not overwriting any existing OpenID Connect
client authentication already set on the Shoot object.</p>
</td>
</tr>
Expand Down
7 changes: 4 additions & 3 deletions pkg/apis/core/v1beta1/defaults_shoot.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,6 @@ func SetDefaults_Shoot(obj *Shoot) {
if obj.Spec.Kubernetes.KubeAPIServer == nil {
obj.Spec.Kubernetes.KubeAPIServer = &KubeAPIServerConfig{}
}
if obj.Spec.Kubernetes.KubeControllerManager == nil {
obj.Spec.Kubernetes.KubeControllerManager = &KubeControllerManagerConfig{}
}

if obj.Spec.Purpose == nil {
p := ShootPurposeEvaluation
Expand Down Expand Up @@ -97,6 +94,10 @@ func SetDefaults_Shoot(obj *Shoot) {
obj.Spec.Kubernetes.KubeAPIServer.DefaultUnreachableTolerationSeconds = pointer.Int64(300)
}

if obj.Spec.Kubernetes.KubeControllerManager == nil {
obj.Spec.Kubernetes.KubeControllerManager = &KubeControllerManagerConfig{}
}

if obj.Spec.Kubernetes.KubeControllerManager.NodeCIDRMaskSize == nil {
obj.Spec.Kubernetes.KubeControllerManager.NodeCIDRMaskSize = calculateDefaultNodeCIDRMaskSize(&obj.Spec)
}
Expand Down
8 changes: 5 additions & 3 deletions pkg/apis/core/v1beta1/defaults_shoot_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -376,15 +376,17 @@ var _ = Describe("Shoot defaulting", func() {
})

Describe("KubeControllerManager settings defaulting", func() {
Describe("NodeCIDRMaskSize", func() {
It("should not default nodeCIDRMaskSize field for workerless Shoot", func() {
Describe("KubeControllerManager", func() {
It("should not default KubeControllerManager field for workerless Shoot", func() {
obj.Spec.Provider.Workers = nil

SetObjectDefaults_Shoot(obj)

Expect(obj.Spec.Kubernetes.KubeControllerManager.NodeCIDRMaskSize).To(BeNil())
Expect(obj.Spec.Kubernetes.KubeControllerManager).To(BeNil())
})
})

Describe("NodeCIDRMaskSize", func() {
Context("IPv4", func() {
It("should make nodeCIDRMaskSize big enough for 2*maxPods", func() {
obj.Spec.Provider.Workers = []Worker{{}}
Expand Down
4 changes: 2 additions & 2 deletions pkg/apis/settings/types_shared.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ import (
type OpenIDConnectPresetSpec struct {

// Server contains the kube-apiserver's OpenID Connect configuration.
// This configuration is not overwritting any existing OpenID Connect
// This configuration is not overwriting any existing OpenID Connect
// configuration already set on the Shoot object.
Server KubeAPIServerOpenIDConnect

// Client contains the configuration used for client OIDC authentication
// of Shoot clusters.
// This configuration is not overwritting any existing OpenID Connect
// This configuration is not overwriting any existing OpenID Connect
// client authentication already set on the Shoot object.
Client *OpenIDConnectClientAuthentication

Expand Down
4 changes: 2 additions & 2 deletions pkg/apis/settings/v1alpha1/generated.proto

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions pkg/apis/settings/v1alpha1/types_shared.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@ const (
type OpenIDConnectPresetSpec struct {

// Server contains the kube-apiserver's OpenID Connect configuration.
// This configuration is not overwritting any existing OpenID Connect
// This configuration is not overwriting any existing OpenID Connect
// configuration already set on the Shoot object.
Server KubeAPIServerOpenIDConnect `json:"server" protobuf:"bytes,1,opt,name=server"`

// Client contains the configuration used for client OIDC authentication
// of Shoot clusters.
// This configuration is not overwritting any existing OpenID Connect
// This configuration is not overwriting any existing OpenID Connect
// client authentication already set on the Shoot object.
// +optional
Client *OpenIDConnectClientAuthentication `json:"client,omitempty" protobuf:"bytes,2,opt,name=client"`
Expand Down
8 changes: 4 additions & 4 deletions pkg/openapi/openapi_generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit ccb71cb

Please sign in to comment.