1
0
mirror of https://github.com/rancher/types.git synced 2025-07-19 15:56:26 +00:00

Merge pull request #1069 from mrajashree/nodeUpgradeStrategy

Add cluster upgrade strategy to rke
This commit is contained in:
Rajashree Mandaogane 2020-01-28 08:02:49 -08:00 committed by GitHub
commit 56c60bfefb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 79 additions and 28 deletions

View File

@ -302,17 +302,17 @@ type PublicEndpoint struct {
type NodeDrainInput struct {
// Drain node even if there are pods not managed by a ReplicationController, Job, or DaemonSet
// Drain will not proceed without Force set to true if there are such pods
Force bool `json:"force,omitempty"`
Force bool `yaml:"force" json:"force,omitempty"`
// If there are DaemonSet-managed pods, drain will not proceed without IgnoreDaemonSets set to true
// (even when set to true, kubectl won't delete pods - so setting default to true)
IgnoreDaemonSets bool `json:"ignoreDaemonSets,omitempty" norman:"default=true"`
IgnoreDaemonSets bool `yaml:"ignore_daemonsets" json:"ignoreDaemonSets,omitempty" norman:"default=true"`
// Continue even if there are pods using emptyDir
DeleteLocalData bool `json:"deleteLocalData,omitempty"`
DeleteLocalData bool `yaml:"delete_local_data" json:"deleteLocalData,omitempty"`
//Period of time in seconds given to each pod to terminate gracefully.
// If negative, the default value specified in the pod will be used
GracePeriod int `json:"gracePeriod,omitempty" norman:"default=-1"`
GracePeriod int `yaml:"grace_period" json:"gracePeriod,omitempty" norman:"default=-1"`
// Time to wait (in seconds) before giving up for one try
Timeout int `json:"timeout" norman:"min=1,max=10800,default=60"`
Timeout int `yaml:"timeout" json:"timeout" norman:"min=1,max=10800,default=60"`
}
type CloudCredential struct {

View File

@ -58,6 +58,15 @@ type RancherKubernetesEngineConfig struct {
RotateCertificates *RotateCertificates `yaml:"rotate_certificates,omitempty" json:"rotateCertificates,omitempty"`
// DNS Config
DNS *DNSConfig `yaml:"dns" json:"dns,omitempty"`
// Upgrade Strategy for the cluster
UpgradeStrategy *NodeUpgradeStrategy `yaml:"upgrade_strategy,omitempty" json:"upgradeStrategy,omitempty"`
}
type NodeUpgradeStrategy struct {
// MaxUnavailable input can be a number of nodes or a percentage of nodes (example, max_unavailable: 2 OR max_unavailable: 20%)
MaxUnavailable string `yaml:"max_unavailable" json:"maxUnavailable,omitempty" norman:"min=1,default=10%"`
Drain bool `yaml:"drain" json:"drain,omitempty"`
DrainInput *NodeDrainInput `yaml:"node_drain_input" json:"nodeDrainInput,omitempty"`
}
type BastionHost struct {

View File

@ -6302,6 +6302,27 @@ func (in *NodeTemplateStatus) DeepCopy() *NodeTemplateStatus {
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *NodeUpgradeStrategy) DeepCopyInto(out *NodeUpgradeStrategy) {
*out = *in
if in.DrainInput != nil {
in, out := &in.DrainInput, &out.DrainInput
*out = new(NodeDrainInput)
**out = **in
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeUpgradeStrategy.
func (in *NodeUpgradeStrategy) DeepCopy() *NodeUpgradeStrategy {
if in == nil {
return nil
}
out := new(NodeUpgradeStrategy)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *Nodelocal) DeepCopyInto(out *Nodelocal) {
*out = *in
@ -8480,6 +8501,11 @@ func (in *RancherKubernetesEngineConfig) DeepCopyInto(out *RancherKubernetesEngi
*out = new(DNSConfig)
(*in).DeepCopyInto(*out)
}
if in.UpgradeStrategy != nil {
in, out := &in.UpgradeStrategy, &out.UpgradeStrategy
*out = new(NodeUpgradeStrategy)
(*in).DeepCopyInto(*out)
}
return
}

View File

@ -0,0 +1,14 @@
package client
const (
NodeUpgradeStrategyType = "nodeUpgradeStrategy"
NodeUpgradeStrategyFieldDrain = "drain"
NodeUpgradeStrategyFieldDrainInput = "nodeDrainInput"
NodeUpgradeStrategyFieldMaxUnavailable = "maxUnavailable"
)
type NodeUpgradeStrategy struct {
Drain bool `json:"drain,omitempty" yaml:"drain,omitempty"`
DrainInput *NodeDrainInput `json:"nodeDrainInput,omitempty" yaml:"nodeDrainInput,omitempty"`
MaxUnavailable string `json:"maxUnavailable,omitempty" yaml:"maxUnavailable,omitempty"`
}

View File

@ -24,31 +24,33 @@ const (
RancherKubernetesEngineConfigFieldSSHCertPath = "sshCertPath"
RancherKubernetesEngineConfigFieldSSHKeyPath = "sshKeyPath"
RancherKubernetesEngineConfigFieldServices = "services"
RancherKubernetesEngineConfigFieldUpgradeStrategy = "upgradeStrategy"
RancherKubernetesEngineConfigFieldVersion = "kubernetesVersion"
)
type RancherKubernetesEngineConfig struct {
AddonJobTimeout int64 `json:"addonJobTimeout,omitempty" yaml:"addonJobTimeout,omitempty"`
Addons string `json:"addons,omitempty" yaml:"addons,omitempty"`
AddonsInclude []string `json:"addonsInclude,omitempty" yaml:"addonsInclude,omitempty"`
Authentication *AuthnConfig `json:"authentication,omitempty" yaml:"authentication,omitempty"`
Authorization *AuthzConfig `json:"authorization,omitempty" yaml:"authorization,omitempty"`
BastionHost *BastionHost `json:"bastionHost,omitempty" yaml:"bastionHost,omitempty"`
CloudProvider *CloudProvider `json:"cloudProvider,omitempty" yaml:"cloudProvider,omitempty"`
ClusterName string `json:"clusterName,omitempty" yaml:"clusterName,omitempty"`
DNS *DNSConfig `json:"dns,omitempty" yaml:"dns,omitempty"`
IgnoreDockerVersion bool `json:"ignoreDockerVersion,omitempty" yaml:"ignoreDockerVersion,omitempty"`
Ingress *IngressConfig `json:"ingress,omitempty" yaml:"ingress,omitempty"`
Monitoring *MonitoringConfig `json:"monitoring,omitempty" yaml:"monitoring,omitempty"`
Network *NetworkConfig `json:"network,omitempty" yaml:"network,omitempty"`
Nodes []RKEConfigNode `json:"nodes,omitempty" yaml:"nodes,omitempty"`
PrefixPath string `json:"prefixPath,omitempty" yaml:"prefixPath,omitempty"`
PrivateRegistries []PrivateRegistry `json:"privateRegistries,omitempty" yaml:"privateRegistries,omitempty"`
Restore *RestoreConfig `json:"restore,omitempty" yaml:"restore,omitempty"`
RotateCertificates *RotateCertificates `json:"rotateCertificates,omitempty" yaml:"rotateCertificates,omitempty"`
SSHAgentAuth bool `json:"sshAgentAuth,omitempty" yaml:"sshAgentAuth,omitempty"`
SSHCertPath string `json:"sshCertPath,omitempty" yaml:"sshCertPath,omitempty"`
SSHKeyPath string `json:"sshKeyPath,omitempty" yaml:"sshKeyPath,omitempty"`
Services *RKEConfigServices `json:"services,omitempty" yaml:"services,omitempty"`
Version string `json:"kubernetesVersion,omitempty" yaml:"kubernetesVersion,omitempty"`
AddonJobTimeout int64 `json:"addonJobTimeout,omitempty" yaml:"addonJobTimeout,omitempty"`
Addons string `json:"addons,omitempty" yaml:"addons,omitempty"`
AddonsInclude []string `json:"addonsInclude,omitempty" yaml:"addonsInclude,omitempty"`
Authentication *AuthnConfig `json:"authentication,omitempty" yaml:"authentication,omitempty"`
Authorization *AuthzConfig `json:"authorization,omitempty" yaml:"authorization,omitempty"`
BastionHost *BastionHost `json:"bastionHost,omitempty" yaml:"bastionHost,omitempty"`
CloudProvider *CloudProvider `json:"cloudProvider,omitempty" yaml:"cloudProvider,omitempty"`
ClusterName string `json:"clusterName,omitempty" yaml:"clusterName,omitempty"`
DNS *DNSConfig `json:"dns,omitempty" yaml:"dns,omitempty"`
IgnoreDockerVersion bool `json:"ignoreDockerVersion,omitempty" yaml:"ignoreDockerVersion,omitempty"`
Ingress *IngressConfig `json:"ingress,omitempty" yaml:"ingress,omitempty"`
Monitoring *MonitoringConfig `json:"monitoring,omitempty" yaml:"monitoring,omitempty"`
Network *NetworkConfig `json:"network,omitempty" yaml:"network,omitempty"`
Nodes []RKEConfigNode `json:"nodes,omitempty" yaml:"nodes,omitempty"`
PrefixPath string `json:"prefixPath,omitempty" yaml:"prefixPath,omitempty"`
PrivateRegistries []PrivateRegistry `json:"privateRegistries,omitempty" yaml:"privateRegistries,omitempty"`
Restore *RestoreConfig `json:"restore,omitempty" yaml:"restore,omitempty"`
RotateCertificates *RotateCertificates `json:"rotateCertificates,omitempty" yaml:"rotateCertificates,omitempty"`
SSHAgentAuth bool `json:"sshAgentAuth,omitempty" yaml:"sshAgentAuth,omitempty"`
SSHCertPath string `json:"sshCertPath,omitempty" yaml:"sshCertPath,omitempty"`
SSHKeyPath string `json:"sshKeyPath,omitempty" yaml:"sshKeyPath,omitempty"`
Services *RKEConfigServices `json:"services,omitempty" yaml:"services,omitempty"`
UpgradeStrategy *NodeUpgradeStrategy `json:"upgradeStrategy,omitempty" yaml:"upgradeStrategy,omitempty"`
Version string `json:"kubernetesVersion,omitempty" yaml:"kubernetesVersion,omitempty"`
}