Skip to content

Commit

Permalink
Add KThreesConfig defaults
Browse files Browse the repository at this point in the history
Signed-off-by: Andrea Mazzotti <[email protected]>
  • Loading branch information
anmazzotti committed May 23, 2024
1 parent 07376f4 commit 06b366b
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions bootstrap/api/v1beta2/kthreesconfig_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"context"

"k8s.io/apimachinery/pkg/runtime"
"k8s.io/utils/ptr"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/webhook/admission"
)
Expand Down Expand Up @@ -56,5 +57,12 @@ func (c *KThreesConfig) ValidateDelete(_ context.Context, _ runtime.Object) (adm

// Default will set default values for the KThreesConfig.
func (c *KThreesConfig) Default(_ context.Context, _ runtime.Object) error {
if c.Spec.ServerConfig.DisableCloudController == nil {
c.Spec.ServerConfig.DisableCloudController = ptr.To(true)
}

if c.Spec.ServerConfig.CloudProviderName == nil {
c.Spec.ServerConfig.CloudProviderName = ptr.To("external")
}
return nil
}

0 comments on commit 06b366b

Please sign in to comment.