mirror of
https://github.com/rancher/rke.git
synced 2025-08-17 14:27:01 +00:00
Add tolerations option to addons
This commit is contained in:
parent
b3b1f32602
commit
4e31add8fe
@ -24,6 +24,7 @@ import (
|
|||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
"gopkg.in/yaml.v2"
|
"gopkg.in/yaml.v2"
|
||||||
appsv1 "k8s.io/api/apps/v1"
|
appsv1 "k8s.io/api/apps/v1"
|
||||||
|
v1 "k8s.io/api/core/v1"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@ -66,6 +67,7 @@ type ingressOptions struct {
|
|||||||
HTTPSPort int
|
HTTPSPort int
|
||||||
NetworkMode string
|
NetworkMode string
|
||||||
UpdateStrategy *appsv1.DaemonSetUpdateStrategy
|
UpdateStrategy *appsv1.DaemonSetUpdateStrategy
|
||||||
|
Tolerations []v1.Toleration
|
||||||
}
|
}
|
||||||
|
|
||||||
type MetricsServerOptions struct {
|
type MetricsServerOptions struct {
|
||||||
@ -76,6 +78,7 @@ type MetricsServerOptions struct {
|
|||||||
Version string
|
Version string
|
||||||
UpdateStrategy *appsv1.DeploymentStrategy
|
UpdateStrategy *appsv1.DeploymentStrategy
|
||||||
Replicas *int32
|
Replicas *int32
|
||||||
|
Tolerations []v1.Toleration
|
||||||
}
|
}
|
||||||
|
|
||||||
type CoreDNSOptions struct {
|
type CoreDNSOptions struct {
|
||||||
@ -89,6 +92,7 @@ type CoreDNSOptions struct {
|
|||||||
NodeSelector map[string]string
|
NodeSelector map[string]string
|
||||||
UpdateStrategy *appsv1.DeploymentStrategy
|
UpdateStrategy *appsv1.DeploymentStrategy
|
||||||
LinearAutoscalerParams string
|
LinearAutoscalerParams string
|
||||||
|
Tolerations []v1.Toleration
|
||||||
}
|
}
|
||||||
|
|
||||||
type KubeDNSOptions struct {
|
type KubeDNSOptions struct {
|
||||||
@ -105,6 +109,7 @@ type KubeDNSOptions struct {
|
|||||||
NodeSelector map[string]string
|
NodeSelector map[string]string
|
||||||
UpdateStrategy *appsv1.DeploymentStrategy
|
UpdateStrategy *appsv1.DeploymentStrategy
|
||||||
LinearAutoscalerParams string
|
LinearAutoscalerParams string
|
||||||
|
Tolerations []v1.Toleration
|
||||||
}
|
}
|
||||||
|
|
||||||
type NodelocalOptions struct {
|
type NodelocalOptions struct {
|
||||||
@ -322,6 +327,7 @@ func (c *Cluster) deployKubeDNS(ctx context.Context, data map[string]interface{}
|
|||||||
Type: c.DNS.UpdateStrategy.Strategy,
|
Type: c.DNS.UpdateStrategy.Strategy,
|
||||||
RollingUpdate: c.DNS.UpdateStrategy.RollingUpdate,
|
RollingUpdate: c.DNS.UpdateStrategy.RollingUpdate,
|
||||||
},
|
},
|
||||||
|
Tolerations: c.DNS.Tolerations,
|
||||||
}
|
}
|
||||||
linearModeBytes, err := json.Marshal(c.DNS.LinearAutoscalerParams)
|
linearModeBytes, err := json.Marshal(c.DNS.LinearAutoscalerParams)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -358,6 +364,7 @@ func (c *Cluster) deployCoreDNS(ctx context.Context, data map[string]interface{}
|
|||||||
Type: c.DNS.UpdateStrategy.Strategy,
|
Type: c.DNS.UpdateStrategy.Strategy,
|
||||||
RollingUpdate: c.DNS.UpdateStrategy.RollingUpdate,
|
RollingUpdate: c.DNS.UpdateStrategy.RollingUpdate,
|
||||||
},
|
},
|
||||||
|
Tolerations: c.DNS.Tolerations,
|
||||||
}
|
}
|
||||||
linearModeBytes, err := json.Marshal(c.DNS.LinearAutoscalerParams)
|
linearModeBytes, err := json.Marshal(c.DNS.LinearAutoscalerParams)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -412,6 +419,7 @@ func (c *Cluster) deployMetricServer(ctx context.Context, data map[string]interf
|
|||||||
RollingUpdate: c.Monitoring.UpdateStrategy.RollingUpdate,
|
RollingUpdate: c.Monitoring.UpdateStrategy.RollingUpdate,
|
||||||
},
|
},
|
||||||
Replicas: c.Monitoring.Replicas,
|
Replicas: c.Monitoring.Replicas,
|
||||||
|
Tolerations: c.Monitoring.Tolerations,
|
||||||
}
|
}
|
||||||
tmplt, err := templates.GetVersionedTemplates(kdm.MetricsServer, data, c.Version)
|
tmplt, err := templates.GetVersionedTemplates(kdm.MetricsServer, data, c.Version)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -575,6 +583,7 @@ func (c *Cluster) deployIngress(ctx context.Context, data map[string]interface{}
|
|||||||
Type: c.Ingress.UpdateStrategy.Strategy,
|
Type: c.Ingress.UpdateStrategy.Strategy,
|
||||||
RollingUpdate: c.Ingress.UpdateStrategy.RollingUpdate,
|
RollingUpdate: c.Ingress.UpdateStrategy.RollingUpdate,
|
||||||
},
|
},
|
||||||
|
Tolerations: c.Ingress.Tolerations,
|
||||||
}
|
}
|
||||||
// since nginx ingress controller 0.16.0, it can be run as non-root and doesn't require privileged anymore.
|
// since nginx ingress controller 0.16.0, it can be run as non-root and doesn't require privileged anymore.
|
||||||
// So we can use securityContext instead of setting privileges via initContainer.
|
// So we can use securityContext instead of setting privileges via initContainer.
|
||||||
|
@ -257,6 +257,7 @@ const (
|
|||||||
NodeSubnet = "NodeSubnet"
|
NodeSubnet = "NodeSubnet"
|
||||||
NodeSelector = "NodeSelector"
|
NodeSelector = "NodeSelector"
|
||||||
UpdateStrategy = "UpdateStrategy"
|
UpdateStrategy = "UpdateStrategy"
|
||||||
|
Tolerations = "Tolerations"
|
||||||
)
|
)
|
||||||
|
|
||||||
var EtcdPortList = []string{
|
var EtcdPortList = []string{
|
||||||
@ -354,6 +355,7 @@ func (c *Cluster) doCalicoDeploy(ctx context.Context, data map[string]interface{
|
|||||||
RollingUpdate: c.Network.UpdateStrategy.RollingUpdate,
|
RollingUpdate: c.Network.UpdateStrategy.RollingUpdate,
|
||||||
},
|
},
|
||||||
FlexVolPluginDir: c.Network.Options[CalicoFlexVolPluginDirectory],
|
FlexVolPluginDir: c.Network.Options[CalicoFlexVolPluginDirectory],
|
||||||
|
Tolerations: c.Network.Tolerations,
|
||||||
}
|
}
|
||||||
pluginYaml, err := c.getNetworkPluginManifest(calicoConfig, data)
|
pluginYaml, err := c.getNetworkPluginManifest(calicoConfig, data)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -399,6 +401,7 @@ func (c *Cluster) doCanalDeploy(ctx context.Context, data map[string]interface{}
|
|||||||
RollingUpdate: c.Network.UpdateStrategy.RollingUpdate,
|
RollingUpdate: c.Network.UpdateStrategy.RollingUpdate,
|
||||||
},
|
},
|
||||||
FlexVolPluginDir: c.Network.Options[CanalFlexVolPluginDirectory],
|
FlexVolPluginDir: c.Network.Options[CanalFlexVolPluginDirectory],
|
||||||
|
Tolerations: c.Network.Tolerations,
|
||||||
}
|
}
|
||||||
pluginYaml, err := c.getNetworkPluginManifest(canalConfig, data)
|
pluginYaml, err := c.getNetworkPluginManifest(canalConfig, data)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -389,6 +389,8 @@ type NetworkConfig struct {
|
|||||||
NodeSelector map[string]string `yaml:"node_selector" json:"nodeSelector,omitempty"`
|
NodeSelector map[string]string `yaml:"node_selector" json:"nodeSelector,omitempty"`
|
||||||
// Network plugin daemonset upgrade strategy
|
// Network plugin daemonset upgrade strategy
|
||||||
UpdateStrategy *DaemonSetUpdateStrategy `yaml:"update_strategy" json:"updateStrategy,omitempty"`
|
UpdateStrategy *DaemonSetUpdateStrategy `yaml:"update_strategy" json:"updateStrategy,omitempty"`
|
||||||
|
// Tolerations for Deployments
|
||||||
|
Tolerations []v1.Toleration `yaml:"tolerations" json:"tolerations,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type AuthWebhookConfig struct {
|
type AuthWebhookConfig struct {
|
||||||
@ -439,6 +441,8 @@ type IngressConfig struct {
|
|||||||
HTTPSPort int `yaml:"https_port" json:"httpsPort,omitempty"`
|
HTTPSPort int `yaml:"https_port" json:"httpsPort,omitempty"`
|
||||||
// NetworkMode selector for ingress controller pods. Default is HostNetwork
|
// NetworkMode selector for ingress controller pods. Default is HostNetwork
|
||||||
NetworkMode string `yaml:"network_mode" json:"networkMode,omitempty"`
|
NetworkMode string `yaml:"network_mode" json:"networkMode,omitempty"`
|
||||||
|
// Tolerations for Deployments
|
||||||
|
Tolerations []v1.Toleration `yaml:"tolerations" json:"tolerations,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type ExtraEnv struct {
|
type ExtraEnv struct {
|
||||||
@ -895,6 +899,8 @@ type MonitoringConfig struct {
|
|||||||
UpdateStrategy *DeploymentStrategy `yaml:"update_strategy" json:"updateStrategy,omitempty"`
|
UpdateStrategy *DeploymentStrategy `yaml:"update_strategy" json:"updateStrategy,omitempty"`
|
||||||
// Number of monitoring addon pods
|
// Number of monitoring addon pods
|
||||||
Replicas *int32 `yaml:"replicas" json:"replicas,omitempty" norman:"default=1"`
|
Replicas *int32 `yaml:"replicas" json:"replicas,omitempty" norman:"default=1"`
|
||||||
|
// Tolerations for Deployments
|
||||||
|
Tolerations []v1.Toleration `yaml:"tolerations" json:"tolerations,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type RestoreConfig struct {
|
type RestoreConfig struct {
|
||||||
@ -925,6 +931,8 @@ type DNSConfig struct {
|
|||||||
UpdateStrategy *DeploymentStrategy `yaml:"update_strategy" json:"updateStrategy,omitempty"`
|
UpdateStrategy *DeploymentStrategy `yaml:"update_strategy" json:"updateStrategy,omitempty"`
|
||||||
// Autoscaler fields to determine number of dns replicas
|
// Autoscaler fields to determine number of dns replicas
|
||||||
LinearAutoscalerParams *LinearAutoscalerParams `yaml:"linear_autoscaler_params" json:"linearAutoscalerParams,omitempty"`
|
LinearAutoscalerParams *LinearAutoscalerParams `yaml:"linear_autoscaler_params" json:"linearAutoscalerParams,omitempty"`
|
||||||
|
// Tolerations for Deployments
|
||||||
|
Tolerations []v1.Toleration `yaml:"tolerations" json:"tolerations,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type Nodelocal struct {
|
type Nodelocal struct {
|
||||||
|
Loading…
Reference in New Issue
Block a user