mirror of
https://github.com/rancher/types.git
synced 2025-04-28 02:30:07 +00:00
Merge pull request #1127 from mrajashree/updStrategy
Copy k8s updateStrategy into new type
This commit is contained in:
commit
0d1e1dcc8d
@ -2,7 +2,6 @@ package v3
|
||||
|
||||
import (
|
||||
"github.com/rancher/norman/types"
|
||||
appsv1 "k8s.io/api/apps/v1"
|
||||
v1 "k8s.io/api/core/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
apiserverv1alpha1 "k8s.io/apiserver/pkg/apis/apiserver/v1alpha1"
|
||||
@ -384,7 +383,7 @@ type NetworkConfig struct {
|
||||
// NodeSelector key pair
|
||||
NodeSelector map[string]string `yaml:"node_selector" json:"nodeSelector,omitempty"`
|
||||
// Network plugin daemonset upgrade strategy
|
||||
UpdateStrategy *appsv1.DaemonSetUpdateStrategy `yaml:"update_strategy" json:"updateStrategy,omitempty"`
|
||||
UpdateStrategy *DaemonSetUpdateStrategy `yaml:"update_strategy" json:"updateStrategy,omitempty"`
|
||||
}
|
||||
|
||||
type AuthWebhookConfig struct {
|
||||
@ -428,7 +427,7 @@ type IngressConfig struct {
|
||||
// Extra volume mounts
|
||||
ExtraVolumeMounts []ExtraVolumeMount `yaml:"extra_volume_mounts" json:"extraVolumeMounts,omitempty" norman:"type=array[json]"`
|
||||
// nginx daemonset upgrade strategy
|
||||
UpdateStrategy *appsv1.DaemonSetUpdateStrategy `yaml:"update_strategy" json:"updateStrategy,omitempty"`
|
||||
UpdateStrategy *DaemonSetUpdateStrategy `yaml:"update_strategy" json:"updateStrategy,omitempty"`
|
||||
}
|
||||
|
||||
type ExtraEnv struct {
|
||||
@ -816,7 +815,7 @@ type MonitoringConfig struct {
|
||||
// NodeSelector key pair
|
||||
NodeSelector map[string]string `yaml:"node_selector" json:"nodeSelector,omitempty"`
|
||||
// Update strategy
|
||||
UpdateStrategy *appsv1.DeploymentStrategy `yaml:"update_strategy" json:"updateStrategy,omitempty"`
|
||||
UpdateStrategy *DeploymentStrategy `yaml:"update_strategy" json:"updateStrategy,omitempty"`
|
||||
// Number of monitoring addon pods
|
||||
Replicas *int32 `yaml:"replicas" json:"replicas,omitempty" norman:"default=1"`
|
||||
}
|
||||
@ -846,7 +845,7 @@ type DNSConfig struct {
|
||||
// Nodelocal DNS
|
||||
Nodelocal *Nodelocal `yaml:"nodelocal" json:"nodelocal,omitempy"`
|
||||
// Update strategy
|
||||
UpdateStrategy *appsv1.DeploymentStrategy `yaml:"update_strategy" json:"updateStrategy,omitempty"`
|
||||
UpdateStrategy *DeploymentStrategy `yaml:"update_strategy" json:"updateStrategy,omitempty"`
|
||||
// Autoscaler fields to determine number of dns replicas
|
||||
LinearAutoscalerParams *LinearAutoscalerParams `yaml:"linear_autoscaler_params" json:"linearAutoscalerParams,omitempty"`
|
||||
}
|
||||
@ -855,7 +854,7 @@ type Nodelocal struct {
|
||||
// link-local IP for nodelocal DNS
|
||||
IPAddress string `yaml:"ip_address" json:"ipAddress,omitempy"`
|
||||
// Nodelocal DNS daemonset upgrade strategy
|
||||
UpdateStrategy *appsv1.DaemonSetUpdateStrategy `yaml:"update_strategy" json:"updateStrategy,omitempty"`
|
||||
UpdateStrategy *DaemonSetUpdateStrategy `yaml:"update_strategy" json:"updateStrategy,omitempty"`
|
||||
// NodeSelector key pair
|
||||
NodeSelector map[string]string `yaml:"node_selector" json:"nodeSelector,omitempty"`
|
||||
}
|
||||
|
@ -72,7 +72,9 @@ func rkeTypes(schemas *types.Schemas) *types.Schemas {
|
||||
MustImport(&Version, v3.ExtraEnv{}).
|
||||
MustImport(&Version, v3.ExtraVolume{}).
|
||||
MustImport(&Version, v3.ExtraVolumeMount{}).
|
||||
MustImport(&Version, v3.LinearAutoscalerParams{})
|
||||
MustImport(&Version, v3.LinearAutoscalerParams{}).
|
||||
MustImport(&Version, v3.DeploymentStrategy{}).
|
||||
MustImport(&Version, v3.DaemonSetUpdateStrategy{})
|
||||
}
|
||||
|
||||
func schemaTypes(schemas *types.Schemas) *types.Schemas {
|
||||
|
38
apis/management.cattle.io/v3/update_strategy_types.go
Normal file
38
apis/management.cattle.io/v3/update_strategy_types.go
Normal file
@ -0,0 +1,38 @@
|
||||
package v3
|
||||
|
||||
import (
|
||||
appsv1 "k8s.io/api/apps/v1"
|
||||
)
|
||||
|
||||
/* All fields in this file are copied over from apps/v1. Referencing k8s fields caused problems because of the "Type" field in
|
||||
DeploymentStrategy and DaemonSetUpdateStrategy*/
|
||||
|
||||
// DeploymentStrategy describes how to replace existing pods with new ones.
|
||||
type DeploymentStrategy struct {
|
||||
// Type of deployment. Can be "Recreate" or "RollingUpdate". Default is RollingUpdate.
|
||||
// +optional
|
||||
Strategy appsv1.DeploymentStrategyType `json:"strategy,omitempty" protobuf:"bytes,1,opt,name=type,casttype=DeploymentStrategyType"`
|
||||
|
||||
// Rolling update config params. Present only if DeploymentStrategyType =
|
||||
// RollingUpdate.
|
||||
//---
|
||||
// TODO: Update this to follow our convention for oneOf, whatever we decide it
|
||||
// to be.
|
||||
// +optional
|
||||
RollingUpdate *appsv1.RollingUpdateDeployment `json:"rollingUpdate,omitempty" protobuf:"bytes,2,opt,name=rollingUpdate"`
|
||||
}
|
||||
|
||||
// DaemonSetUpdateStrategy is a struct used to control the update strategy for a DaemonSet.
|
||||
type DaemonSetUpdateStrategy struct {
|
||||
// Type of daemon set update. Can be "RollingUpdate" or "OnDelete". Default is RollingUpdate.
|
||||
// +optional
|
||||
Strategy appsv1.DaemonSetUpdateStrategyType `json:"strategy,omitempty" protobuf:"bytes,1,opt,name=type"`
|
||||
|
||||
// Rolling update config params. Present only if type = "RollingUpdate".
|
||||
//---
|
||||
// TODO: Update this to follow our convention for oneOf, whatever we decide it
|
||||
// to be. Same as Deployment `strategy.rollingUpdate`.
|
||||
// See https://github.com/kubernetes/kubernetes/issues/35345
|
||||
// +optional
|
||||
RollingUpdate *appsv1.RollingUpdateDaemonSet `json:"rollingUpdate,omitempty" protobuf:"bytes,2,opt,name=rollingUpdate"`
|
||||
}
|
@ -2966,7 +2966,7 @@ func (in *DNSConfig) DeepCopyInto(out *DNSConfig) {
|
||||
}
|
||||
if in.UpdateStrategy != nil {
|
||||
in, out := &in.UpdateStrategy, &out.UpdateStrategy
|
||||
*out = new(appsv1.DeploymentStrategy)
|
||||
*out = new(DeploymentStrategy)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
if in.LinearAutoscalerParams != nil {
|
||||
@ -2987,6 +2987,48 @@ func (in *DNSConfig) DeepCopy() *DNSConfig {
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *DaemonSetUpdateStrategy) DeepCopyInto(out *DaemonSetUpdateStrategy) {
|
||||
*out = *in
|
||||
if in.RollingUpdate != nil {
|
||||
in, out := &in.RollingUpdate, &out.RollingUpdate
|
||||
*out = new(appsv1.RollingUpdateDaemonSet)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DaemonSetUpdateStrategy.
|
||||
func (in *DaemonSetUpdateStrategy) DeepCopy() *DaemonSetUpdateStrategy {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(DaemonSetUpdateStrategy)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *DeploymentStrategy) DeepCopyInto(out *DeploymentStrategy) {
|
||||
*out = *in
|
||||
if in.RollingUpdate != nil {
|
||||
in, out := &in.RollingUpdate, &out.RollingUpdate
|
||||
*out = new(appsv1.RollingUpdateDeployment)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DeploymentStrategy.
|
||||
func (in *DeploymentStrategy) DeepCopy() *DeploymentStrategy {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(DeploymentStrategy)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *DiskVsphereOpts) DeepCopyInto(out *DiskVsphereOpts) {
|
||||
*out = *in
|
||||
@ -4505,7 +4547,7 @@ func (in *IngressConfig) DeepCopyInto(out *IngressConfig) {
|
||||
}
|
||||
if in.UpdateStrategy != nil {
|
||||
in, out := &in.UpdateStrategy, &out.UpdateStrategy
|
||||
*out = new(appsv1.DaemonSetUpdateStrategy)
|
||||
*out = new(DaemonSetUpdateStrategy)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
return
|
||||
@ -5436,7 +5478,7 @@ func (in *MonitoringConfig) DeepCopyInto(out *MonitoringConfig) {
|
||||
}
|
||||
if in.UpdateStrategy != nil {
|
||||
in, out := &in.UpdateStrategy, &out.UpdateStrategy
|
||||
*out = new(appsv1.DeploymentStrategy)
|
||||
*out = new(DeploymentStrategy)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
if in.Replicas != nil {
|
||||
@ -5785,7 +5827,7 @@ func (in *NetworkConfig) DeepCopyInto(out *NetworkConfig) {
|
||||
}
|
||||
if in.UpdateStrategy != nil {
|
||||
in, out := &in.UpdateStrategy, &out.UpdateStrategy
|
||||
*out = new(appsv1.DaemonSetUpdateStrategy)
|
||||
*out = new(DaemonSetUpdateStrategy)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
return
|
||||
@ -6491,7 +6533,7 @@ func (in *Nodelocal) DeepCopyInto(out *Nodelocal) {
|
||||
*out = *in
|
||||
if in.UpdateStrategy != nil {
|
||||
in, out := &in.UpdateStrategy, &out.UpdateStrategy
|
||||
*out = new(appsv1.DaemonSetUpdateStrategy)
|
||||
*out = new(DaemonSetUpdateStrategy)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
if in.NodeSelector != nil {
|
||||
|
@ -3,10 +3,10 @@ package client
|
||||
const (
|
||||
DaemonSetUpdateStrategyType = "daemonSetUpdateStrategy"
|
||||
DaemonSetUpdateStrategyFieldRollingUpdate = "rollingUpdate"
|
||||
DaemonSetUpdateStrategyFieldType = "type"
|
||||
DaemonSetUpdateStrategyFieldStrategy = "strategy"
|
||||
)
|
||||
|
||||
type DaemonSetUpdateStrategy struct {
|
||||
RollingUpdate *RollingUpdateDaemonSet `json:"rollingUpdate,omitempty" yaml:"rollingUpdate,omitempty"`
|
||||
Type string `json:"type,omitempty" yaml:"type,omitempty"`
|
||||
Strategy string `json:"strategy,omitempty" yaml:"strategy,omitempty"`
|
||||
}
|
||||
|
@ -3,10 +3,10 @@ package client
|
||||
const (
|
||||
DeploymentStrategyType = "deploymentStrategy"
|
||||
DeploymentStrategyFieldRollingUpdate = "rollingUpdate"
|
||||
DeploymentStrategyFieldType = "type"
|
||||
DeploymentStrategyFieldStrategy = "strategy"
|
||||
)
|
||||
|
||||
type DeploymentStrategy struct {
|
||||
RollingUpdate *RollingUpdateDeployment `json:"rollingUpdate,omitempty" yaml:"rollingUpdate,omitempty"`
|
||||
Type string `json:"type,omitempty" yaml:"type,omitempty"`
|
||||
Strategy string `json:"strategy,omitempty" yaml:"strategy,omitempty"`
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user