本文整理匯總了Golang中k8s/io/kubernetes/pkg/runtime.Scheme.AddDefaultingFuncs方法的典型用法代碼示例。如果您正苦於以下問題:Golang Scheme.AddDefaultingFuncs方法的具體用法?Golang Scheme.AddDefaultingFuncs怎麽用?Golang Scheme.AddDefaultingFuncs使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類k8s/io/kubernetes/pkg/runtime.Scheme
的用法示例。
在下文中一共展示了Scheme.AddDefaultingFuncs方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: addConversionFuncs
func addConversionFuncs(scheme *runtime.Scheme) {
err := scheme.AddDefaultingFuncs(
func(obj *RouteSpec) {
obj.To.Kind = "Service"
},
func(obj *TLSConfig) {
if len(obj.Termination) == 0 && len(obj.DestinationCACertificate) == 0 {
obj.Termination = TLSTerminationEdge
}
switch obj.Termination {
case TLSTerminationType("Reencrypt"):
obj.Termination = TLSTerminationReencrypt
case TLSTerminationType("Edge"):
obj.Termination = TLSTerminationEdge
case TLSTerminationType("Passthrough"):
obj.Termination = TLSTerminationPassthrough
}
},
)
if err != nil {
panic(err)
}
err = scheme.AddConversionFuncs()
if err != nil {
panic(err)
}
if err := scheme.AddFieldLabelConversionFunc("v1", "Route",
oapi.GetFieldLabelConversionFunc(routeapi.RouteToSelectableFields(&routeapi.Route{}), nil),
); err != nil {
panic(err)
}
}
示例2: addDefaultingFuncs
func addDefaultingFuncs(scheme *runtime.Scheme) error {
RegisterDefaults(scheme)
return scheme.AddDefaultingFuncs(
SetDefaults_MasterConfiguration,
SetDefaults_NodeConfiguration,
)
}
示例3: addDefaultingFuncs
func addDefaultingFuncs(scheme *runtime.Scheme) {
scheme.AddDefaultingFuncs(
v1.SetDefaults_Secret,
v1.SetDefaults_ServiceSpec,
v1.SetDefaults_NamespaceStatus,
)
}
示例4: addDefaultingFuncs
func addDefaultingFuncs(scheme *runtime.Scheme) {
scheme.AddDefaultingFuncs(
SetDefaults_KubeProxyConfiguration,
SetDefaults_KubeSchedulerConfiguration,
SetDefaults_LeaderElectionConfiguration,
)
}
示例5: addDefaultingFuncs
func addDefaultingFuncs(scheme *runtime.Scheme) error {
return scheme.AddDefaultingFuncs(
SetDefaults_PodExecOptions,
SetDefaults_PodAttachOptions,
SetDefaults_ReplicationController,
SetDefaults_Volume,
SetDefaults_ContainerPort,
SetDefaults_Container,
SetDefaults_ServiceSpec,
SetDefaults_Pod,
SetDefaults_PodSpec,
SetDefaults_Probe,
SetDefaults_SecretVolumeSource,
SetDefaults_ConfigMapVolumeSource,
SetDefaults_DownwardAPIVolumeSource,
SetDefaults_DeprecatedDownwardAPIVolumeSource,
SetDefaults_Secret,
SetDefaults_PersistentVolume,
SetDefaults_PersistentVolumeClaim,
SetDefaults_ISCSIVolumeSource,
SetDefaults_Endpoints,
SetDefaults_HTTPGetAction,
SetDefaults_NamespaceStatus,
SetDefaults_Node,
SetDefaults_NodeStatus,
SetDefaults_ObjectFieldSelector,
SetDefaults_LimitRangeItem,
SetDefaults_ConfigMap,
SetDefaults_RBDVolumeSource,
SetDefaults_SCC,
)
}
示例6: addDefaultingFuncs
func addDefaultingFuncs(scheme *runtime.Scheme) {
scheme.AddDefaultingFuncs(
func(obj *Job) {
labels := obj.Spec.Template.Labels
// TODO: support templates defined elsewhere when we support them in the API
if labels != nil {
if obj.Spec.Selector == nil {
obj.Spec.Selector = &LabelSelector{
MatchLabels: labels,
}
}
if len(obj.Labels) == 0 {
obj.Labels = labels
}
}
// For a non-parallel job, you can leave both `.spec.completions` and
// `.spec.parallelism` unset. When both are unset, both are defaulted to 1.
if obj.Spec.Completions == nil && obj.Spec.Parallelism == nil {
obj.Spec.Completions = new(int32)
*obj.Spec.Completions = 1
obj.Spec.Parallelism = new(int32)
*obj.Spec.Parallelism = 1
}
if obj.Spec.Parallelism == nil {
obj.Spec.Parallelism = new(int32)
*obj.Spec.Parallelism = 1
}
},
)
}
示例7: addDefaultingFuncs
func addDefaultingFuncs(scheme *runtime.Scheme) error {
RegisterDefaults(scheme)
return scheme.AddDefaultingFuncs(
SetDefaults_Job,
SetDefaults_ScheduledJob,
)
}
示例8: addDefaultingFuncs
func addDefaultingFuncs(scheme *runtime.Scheme) error {
RegisterDefaults(scheme)
return scheme.AddDefaultingFuncs(
SetDefaults_ClusterRoleBinding,
SetDefaults_RoleBinding,
)
}
示例9: addDefaultingFuncs
func addDefaultingFuncs(scheme *runtime.Scheme) {
err := scheme.AddDefaultingFuncs(
SetDefaults_ImageImportSpec,
)
if err != nil {
panic(err)
}
}
示例10: addDefaultingFuncs
func addDefaultingFuncs(scheme *runtime.Scheme) error {
return scheme.AddDefaultingFuncs(
SetDefaults_RouteSpec,
SetDefaults_RouteTargetReference,
SetDefaults_TLSConfig,
SetDefaults_RouteIngress,
)
}
示例11: addDefaultingFuncs
func addDefaultingFuncs(scheme *runtime.Scheme) {
err := scheme.AddDefaultingFuncs(
SetDefaults_PolicyRule,
)
if err != nil {
panic(err)
}
}
示例12: addDefaultingFuncs
func addDefaultingFuncs(scheme *runtime.Scheme) {
err := scheme.AddDefaultingFuncs(
SetDefaults_ImagePolicyConfig,
)
if err != nil {
panic(err)
}
}
示例13: addDefaultingFuncs
func addDefaultingFuncs(scheme *kruntime.Scheme) error {
return scheme.AddDefaultingFuncs(
SetDefaults_KubeProxyConfiguration,
SetDefaults_KubeSchedulerConfiguration,
SetDefaults_LeaderElectionConfiguration,
SetDefaults_KubeletConfiguration,
)
}
示例14: addDefaultingFuncs
func addDefaultingFuncs(scheme *runtime.Scheme) error {
v1.RegisterDefaults(scheme)
return scheme.AddDefaultingFuncs(
v1.SetDefaults_Secret,
v1.SetDefaults_ServiceSpec,
v1.SetDefaults_NamespaceStatus,
)
}
示例15: addDefaultingFuncs
func addDefaultingFuncs(scheme *runtime.Scheme) {
err := scheme.AddDefaultingFuncs(
SetDefaults_PodNodeConstraintsConfig,
)
if err != nil {
panic(err)
}
}