mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-04 09:49:50 +00:00
Move old defaulters to public functions
Also make Deployment defaulting resilient to fuzzing
This commit is contained in:
parent
68a9983ec7
commit
0aa8da19a9
@ -71,7 +71,7 @@ func SetDefaults_Deployment(obj *Deployment) {
|
|||||||
if strategy.Type == "" {
|
if strategy.Type == "" {
|
||||||
strategy.Type = RollingUpdateDeploymentStrategyType
|
strategy.Type = RollingUpdateDeploymentStrategyType
|
||||||
}
|
}
|
||||||
if strategy.Type == RollingUpdateDeploymentStrategyType {
|
if strategy.Type == RollingUpdateDeploymentStrategyType || strategy.RollingUpdate != nil {
|
||||||
if strategy.RollingUpdate == nil {
|
if strategy.RollingUpdate == nil {
|
||||||
rollingUpdate := RollingUpdateDeployment{}
|
rollingUpdate := RollingUpdateDeployment{}
|
||||||
strategy.RollingUpdate = &rollingUpdate
|
strategy.RollingUpdate = &rollingUpdate
|
||||||
|
@ -22,15 +22,18 @@ import (
|
|||||||
|
|
||||||
func addDefaultingFuncs(scheme *runtime.Scheme) error {
|
func addDefaultingFuncs(scheme *runtime.Scheme) error {
|
||||||
return scheme.AddDefaultingFuncs(
|
return scheme.AddDefaultingFuncs(
|
||||||
func(obj *ClusterRoleBinding) {
|
SetDefaults_ClusterRoleBinding,
|
||||||
if len(obj.RoleRef.APIGroup) == 0 {
|
SetDefaults_RoleBinding,
|
||||||
obj.RoleRef.APIGroup = GroupName
|
|
||||||
}
|
|
||||||
},
|
|
||||||
func(obj *RoleBinding) {
|
|
||||||
if len(obj.RoleRef.APIGroup) == 0 {
|
|
||||||
obj.RoleRef.APIGroup = GroupName
|
|
||||||
}
|
|
||||||
},
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func SetDefaults_ClusterRoleBinding(obj *ClusterRoleBinding) {
|
||||||
|
if len(obj.RoleRef.APIGroup) == 0 {
|
||||||
|
obj.RoleRef.APIGroup = GroupName
|
||||||
|
}
|
||||||
|
}
|
||||||
|
func SetDefaults_RoleBinding(obj *RoleBinding) {
|
||||||
|
if len(obj.RoleRef.APIGroup) == 0 {
|
||||||
|
obj.RoleRef.APIGroup = GroupName
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user