1
0
mirror of https://github.com/rancher/types.git synced 2025-06-24 20:51:33 +00:00

Make updateStrategy and replicas configurable for addons

This commit is contained in:
rajashree 2019-12-16 09:53:19 +05:30
parent 878bd5752e
commit d930fe035e
2 changed files with 24 additions and 1 deletions

View File

@ -2,6 +2,7 @@ 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"
@ -376,6 +377,8 @@ type NetworkConfig struct {
WeaveNetworkProvider *WeaveNetworkProvider `yaml:"weave_network_provider,omitempty" json:"weaveNetworkProvider,omitempty"`
// 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"`
}
type AuthWebhookConfig struct {
@ -418,6 +421,8 @@ type IngressConfig struct {
ExtraVolumes []ExtraVolume `yaml:"extra_volumes" json:"extraVolumes,omitempty" norman:"type=array[json]"`
// 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"`
}
type ExtraEnv struct {
@ -804,6 +809,10 @@ type MonitoringConfig struct {
Options map[string]string `yaml:"options" json:"options,omitempty"`
// NodeSelector key pair
NodeSelector map[string]string `yaml:"node_selector" json:"nodeSelector,omitempty"`
// Update strategy
UpdateStrategy *appsv1.DeploymentStrategy `yaml:"update_strategy" json:"updateStrategy,omitempty"`
// Number of monitoring addon pods
Replicas *int32 `yaml:"replicas" json:"replicas,omitempty" norman:"default=1"`
}
type RestoreConfig struct {
@ -830,12 +839,25 @@ type DNSConfig struct {
NodeSelector map[string]string `yaml:"node_selector" json:"nodeSelector,omitempty"`
// Nodelocal DNS
Nodelocal *Nodelocal `yaml:"nodelocal" json:"nodelocal,omitempy"`
// Update strategy
UpdateStrategy *appsv1.DeploymentStrategy `yaml:"update_strategy" json:"updateStrategy,omitempty"`
// Autoscaler fields to determine number of dns replicas
LinearAutoscalerParams *LinearAutoscalerParams `yaml:"linear_autoscaler_params" json:"linearAutoscalerParams,omitempty"`
}
type Nodelocal struct {
IPAddress string `yaml:"ipaddress" json:"ipAddress,omitempy"`
}
// LinearAutoscalerParams contains fields expected by the cluster-proportional-autoscaler https://github.com/kubernetes-incubator/cluster-proportional-autoscaler/blob/0c61e63fc81449abdd52315aa27179a17e5d1580/pkg/autoscaler/controller/linearcontroller/linear_controller.go#L50
type LinearAutoscalerParams struct {
CoresPerReplica float64 `yaml:"cores_per_replica" json:"coresPerReplica,omitempty" norman:"default=128"`
NodesPerReplica float64 `yaml:"nodes_per_replica" json:"nodesPerReplica,omitempty" norman:"default=4"`
Min int `yaml:"min" json:"min,omitempty" norman:"default=1"`
Max int `yaml:"max" json:"max,omitempty"`
PreventSinglePointFailure bool `yaml:"prevent_single_point_failure" json:"preventSinglePointFailure,omitempty" norman:"default=true"`
}
type RKETaint struct {
Key string `json:"key,omitempty" yaml:"key"`
Value string `json:"value,omitempty" yaml:"value"`

View File

@ -71,7 +71,8 @@ func rkeTypes(schemas *types.Schemas) *types.Schemas {
).
MustImport(&Version, v3.ExtraEnv{}).
MustImport(&Version, v3.ExtraVolume{}).
MustImport(&Version, v3.ExtraVolumeMount{})
MustImport(&Version, v3.ExtraVolumeMount{}).
MustImport(&Version, v3.LinearAutoscalerParams{})
}
func schemaTypes(schemas *types.Schemas) *types.Schemas {