/
defaults.go
47 lines (39 loc) · 1.24 KB
/
defaults.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
// SPDX-FileCopyrightText: 2024 SAP SE or an SAP affiliate company and Gardener contributors
//
// SPDX-License-Identifier: Apache-2.0
package v1alpha1
import (
v1beta1constants "github.com/gardener/gardener/pkg/apis/core/v1beta1/constants"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/utils/ptr"
)
func addDefaultingFuncs(scheme *runtime.Scheme) error {
return RegisterDefaults(scheme)
}
// SetDefaults_ControlPlaneConfig sets
// .storage to empty object.
func SetDefaults_ControlPlaneConfig(obj *ControlPlaneConfig) {
if obj.Storage == nil {
obj.Storage = &Storage{}
}
}
// SetDefaults_Storage sets
// managedDefaultClass to true.
func SetDefaults_Storage(obj *Storage) {
defaultManagedDefaultClass := true
if obj.ManagedDefaultClass == nil {
obj.ManagedDefaultClass = &defaultManagedDefaultClass
}
}
// SetDefaults_RegionAMIMapping set the architecture of machine ami image.
func SetDefaults_RegionAMIMapping(obj *RegionAMIMapping) {
if obj.Architecture == nil {
obj.Architecture = ptr.To(v1beta1constants.ArchitectureAMD64)
}
}
// SetDefaults_MachineImage set the architecture of machine image.
func SetDefaults_MachineImage(obj *MachineImage) {
if obj.Architecture == nil {
obj.Architecture = ptr.To(v1beta1constants.ArchitectureAMD64)
}
}