mirror of
https://github.com/edgelesssys/constellation.git
synced 2025-07-23 07:20:37 -04:00
Add Secrets / Volumes / VolumeMounts / Env to cluster-autoscaler deployment
This commit is contained in:
parent
efdd88459b
commit
1e7794b4c2
9 changed files with 83 additions and 11 deletions
|
@ -21,7 +21,8 @@ type autoscalerDeployment struct {
|
|||
Deployment apps.Deployment
|
||||
}
|
||||
|
||||
func NewDefaultAutoscalerDeployment() *autoscalerDeployment {
|
||||
// NewDefaultAutoscalerDeployment creates a new *autoscalerDeployment, customized for the CSP.
|
||||
func NewDefaultAutoscalerDeployment(extraVolumes []k8s.Volume, extraVolumeMounts []k8s.VolumeMount, env []k8s.EnvVar) *autoscalerDeployment {
|
||||
return &autoscalerDeployment{
|
||||
PodDisruptionBudget: policy.PodDisruptionBudget{
|
||||
TypeMeta: v1.TypeMeta{
|
||||
|
@ -433,7 +434,7 @@ func NewDefaultAutoscalerDeployment() *autoscalerDeployment {
|
|||
Containers: []k8s.Container{
|
||||
{
|
||||
Name: "cluster-autoscaler",
|
||||
Image: "k8s.gcr.io/autoscaling/cluster-autoscaler:v1.21.1",
|
||||
Image: "k8s.gcr.io/autoscaling/cluster-autoscaler:v1.23.0",
|
||||
ImagePullPolicy: k8s.PullIfNotPresent,
|
||||
LivenessProbe: &k8s.Probe{
|
||||
ProbeHandler: k8s.ProbeHandler{
|
||||
|
@ -448,8 +449,11 @@ func NewDefaultAutoscalerDeployment() *autoscalerDeployment {
|
|||
ContainerPort: 8085,
|
||||
},
|
||||
},
|
||||
VolumeMounts: extraVolumeMounts,
|
||||
Env: env,
|
||||
},
|
||||
},
|
||||
Volumes: extraVolumes,
|
||||
ServiceAccountName: "constellation-cluster-autoscaler",
|
||||
Tolerations: []k8s.Toleration{
|
||||
{
|
||||
|
|
|
@ -11,7 +11,7 @@ func TestAutoscalerDeploymentMarshalUnmarshal(t *testing.T) {
|
|||
require := require.New(t)
|
||||
assert := assert.New(t)
|
||||
|
||||
autoscalerDepl := NewDefaultAutoscalerDeployment()
|
||||
autoscalerDepl := NewDefaultAutoscalerDeployment(nil, nil, nil)
|
||||
|
||||
data, err := autoscalerDepl.Marshal()
|
||||
require.NoError(err)
|
||||
|
@ -27,7 +27,7 @@ func TestAutoscalerDeploymentWithCommandMarshalUnmarshal(t *testing.T) {
|
|||
require := require.New(t)
|
||||
assert := assert.New(t)
|
||||
|
||||
autoscalerDepl := NewDefaultAutoscalerDeployment()
|
||||
autoscalerDepl := NewDefaultAutoscalerDeployment(nil, nil, nil)
|
||||
autoscalerDepl.SetAutoscalerCommand("someProvider", []string{"group1", "group2"})
|
||||
|
||||
data, err := autoscalerDepl.Marshal()
|
||||
|
|
|
@ -25,7 +25,7 @@ type ClusterUtil interface {
|
|||
InitCluster(initConfig []byte) (*kubeadm.BootstrapTokenDiscovery, error)
|
||||
JoinCluster(joinConfig []byte) error
|
||||
SetupPodNetwork(kubectl Client, podNetworkConfiguration resources.Marshaler) error
|
||||
SetupAutoscaling(kubectl Client, clusterAutoscalerConfiguration resources.Marshaler) error
|
||||
SetupAutoscaling(kubectl Client, clusterAutoscalerConfiguration resources.Marshaler, secrets resources.Marshaler) error
|
||||
SetupCloudControllerManager(kubectl Client, cloudControllerManagerConfiguration resources.Marshaler, configMaps resources.Marshaler, secrets resources.Marshaler) error
|
||||
SetupCloudNodeManager(kubectl Client, cloudNodeManagerConfiguration resources.Marshaler) error
|
||||
RestartKubelet() error
|
||||
|
@ -113,7 +113,10 @@ func (k *KubernetesUtil) SetupPodNetwork(kubectl Client, podNetworkConfiguration
|
|||
}
|
||||
|
||||
// SetupAutoscaling deploys the k8s cluster autoscaler.
|
||||
func (k *KubernetesUtil) SetupAutoscaling(kubectl Client, clusterAutoscalerConfiguration resources.Marshaler) error {
|
||||
func (k *KubernetesUtil) SetupAutoscaling(kubectl Client, clusterAutoscalerConfiguration resources.Marshaler, secrets resources.Marshaler) error {
|
||||
if err := kubectl.Apply(secrets, true); err != nil {
|
||||
return fmt.Errorf("applying cluster-autoscaler Secrets failed: %w", err)
|
||||
}
|
||||
return kubectl.Apply(clusterAutoscalerConfiguration, true)
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue