mirror of
https://github.com/rancher/rke.git
synced 2025-04-27 19:25:44 +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"
|
||||
"gopkg.in/yaml.v2"
|
||||
appsv1 "k8s.io/api/apps/v1"
|
||||
v1 "k8s.io/api/core/v1"
|
||||
)
|
||||
|
||||
const (
|
||||
@ -66,6 +67,7 @@ type ingressOptions struct {
|
||||
HTTPSPort int
|
||||
NetworkMode string
|
||||
UpdateStrategy *appsv1.DaemonSetUpdateStrategy
|
||||
Tolerations []v1.Toleration
|
||||
}
|
||||
|
||||
type MetricsServerOptions struct {
|
||||
@ -76,6 +78,7 @@ type MetricsServerOptions struct {
|
||||
Version string
|
||||
UpdateStrategy *appsv1.DeploymentStrategy
|
||||
Replicas *int32
|
||||
Tolerations []v1.Toleration
|
||||
}
|
||||
|
||||
type CoreDNSOptions struct {
|
||||
@ -89,6 +92,7 @@ type CoreDNSOptions struct {
|
||||
NodeSelector map[string]string
|
||||
UpdateStrategy *appsv1.DeploymentStrategy
|
||||
LinearAutoscalerParams string
|
||||
Tolerations []v1.Toleration
|
||||
}
|
||||
|
||||
type KubeDNSOptions struct {
|
||||
@ -105,6 +109,7 @@ type KubeDNSOptions struct {
|
||||
NodeSelector map[string]string
|
||||
UpdateStrategy *appsv1.DeploymentStrategy
|
||||
LinearAutoscalerParams string
|
||||
Tolerations []v1.Toleration
|
||||
}
|
||||
|
||||
type NodelocalOptions struct {
|
||||
@ -322,6 +327,7 @@ func (c *Cluster) deployKubeDNS(ctx context.Context, data map[string]interface{}
|
||||
Type: c.DNS.UpdateStrategy.Strategy,
|
||||
RollingUpdate: c.DNS.UpdateStrategy.RollingUpdate,
|
||||
},
|
||||
Tolerations: c.DNS.Tolerations,
|
||||
}
|
||||
linearModeBytes, err := json.Marshal(c.DNS.LinearAutoscalerParams)
|
||||
if err != nil {
|
||||
@ -358,6 +364,7 @@ func (c *Cluster) deployCoreDNS(ctx context.Context, data map[string]interface{}
|
||||
Type: c.DNS.UpdateStrategy.Strategy,
|
||||
RollingUpdate: c.DNS.UpdateStrategy.RollingUpdate,
|
||||
},
|
||||
Tolerations: c.DNS.Tolerations,
|
||||
}
|
||||
linearModeBytes, err := json.Marshal(c.DNS.LinearAutoscalerParams)
|
||||
if err != nil {
|
||||
@ -411,7 +418,8 @@ func (c *Cluster) deployMetricServer(ctx context.Context, data map[string]interf
|
||||
Type: c.Monitoring.UpdateStrategy.Strategy,
|
||||
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)
|
||||
if err != nil {
|
||||
@ -575,6 +583,7 @@ func (c *Cluster) deployIngress(ctx context.Context, data map[string]interface{}
|
||||
Type: c.Ingress.UpdateStrategy.Strategy,
|
||||
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.
|
||||
// So we can use securityContext instead of setting privileges via initContainer.
|
||||
|
@ -257,6 +257,7 @@ const (
|
||||
NodeSubnet = "NodeSubnet"
|
||||
NodeSelector = "NodeSelector"
|
||||
UpdateStrategy = "UpdateStrategy"
|
||||
Tolerations = "Tolerations"
|
||||
)
|
||||
|
||||
var EtcdPortList = []string{
|
||||
@ -354,6 +355,7 @@ func (c *Cluster) doCalicoDeploy(ctx context.Context, data map[string]interface{
|
||||
RollingUpdate: c.Network.UpdateStrategy.RollingUpdate,
|
||||
},
|
||||
FlexVolPluginDir: c.Network.Options[CalicoFlexVolPluginDirectory],
|
||||
Tolerations: c.Network.Tolerations,
|
||||
}
|
||||
pluginYaml, err := c.getNetworkPluginManifest(calicoConfig, data)
|
||||
if err != nil {
|
||||
@ -399,6 +401,7 @@ func (c *Cluster) doCanalDeploy(ctx context.Context, data map[string]interface{}
|
||||
RollingUpdate: c.Network.UpdateStrategy.RollingUpdate,
|
||||
},
|
||||
FlexVolPluginDir: c.Network.Options[CanalFlexVolPluginDirectory],
|
||||
Tolerations: c.Network.Tolerations,
|
||||
}
|
||||
pluginYaml, err := c.getNetworkPluginManifest(canalConfig, data)
|
||||
if err != nil {
|
||||
|
@ -389,6 +389,8 @@ type NetworkConfig struct {
|
||||
NodeSelector map[string]string `yaml:"node_selector" json:"nodeSelector,omitempty"`
|
||||
// Network plugin daemonset upgrade strategy
|
||||
UpdateStrategy *DaemonSetUpdateStrategy `yaml:"update_strategy" json:"updateStrategy,omitempty"`
|
||||
// Tolerations for Deployments
|
||||
Tolerations []v1.Toleration `yaml:"tolerations" json:"tolerations,omitempty"`
|
||||
}
|
||||
|
||||
type AuthWebhookConfig struct {
|
||||
@ -439,6 +441,8 @@ type IngressConfig struct {
|
||||
HTTPSPort int `yaml:"https_port" json:"httpsPort,omitempty"`
|
||||
// NetworkMode selector for ingress controller pods. Default is HostNetwork
|
||||
NetworkMode string `yaml:"network_mode" json:"networkMode,omitempty"`
|
||||
// Tolerations for Deployments
|
||||
Tolerations []v1.Toleration `yaml:"tolerations" json:"tolerations,omitempty"`
|
||||
}
|
||||
|
||||
type ExtraEnv struct {
|
||||
@ -895,6 +899,8 @@ type MonitoringConfig struct {
|
||||
UpdateStrategy *DeploymentStrategy `yaml:"update_strategy" json:"updateStrategy,omitempty"`
|
||||
// Number of monitoring addon pods
|
||||
Replicas *int32 `yaml:"replicas" json:"replicas,omitempty" norman:"default=1"`
|
||||
// Tolerations for Deployments
|
||||
Tolerations []v1.Toleration `yaml:"tolerations" json:"tolerations,omitempty"`
|
||||
}
|
||||
|
||||
type RestoreConfig struct {
|
||||
@ -925,6 +931,8 @@ type DNSConfig struct {
|
||||
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"`
|
||||
// Tolerations for Deployments
|
||||
Tolerations []v1.Toleration `yaml:"tolerations" json:"tolerations,omitempty"`
|
||||
}
|
||||
|
||||
type Nodelocal struct {
|
||||
|
Loading…
Reference in New Issue
Block a user