Skip to content
This repository has been archived by the owner on Oct 7, 2021. It is now read-only.

Commit

Permalink
[kops-private-topology] Align with current auto-scaler implementation (
Browse files Browse the repository at this point in the history
  • Loading branch information
Nuru authored Sep 7, 2019
1 parent ff794c9 commit 37c79a2
Showing 1 changed file with 33 additions and 17 deletions.
50 changes: 33 additions & 17 deletions templates/kops/kops-private-topology.yaml.gotmpl
Original file line number Diff line number Diff line change
Expand Up @@ -32,19 +32,6 @@ spec:
"ec2:DescribeTags"
],
"Resource": "*"
{{- if bool (getenv "KOPS_CLUSTER_AUTOSCALER_ENABLED" "false") }}
},
{
"Effect": "Allow",
"Action": [
"autoscaling:DescribeAutoScalingGroups",
"autoscaling:DescribeAutoScalingInstances",
"autoscaling:DescribeTags",
"autoscaling:SetDesiredCapacity",
"autoscaling:TerminateInstanceInAutoScalingGroup"
],
"Resource": "*"
{{- end }}
}
]
api:
Expand Down Expand Up @@ -92,10 +79,6 @@ spec:
channel: stable
cloudLabels:
Cluster: {{ getenv "KOPS_CLUSTER_NAME" }}
{{- if bool (getenv "KOPS_CLUSTER_AUTOSCALER_ENABLED" "false") }}
k8s.io/cluster-autoscaler/enabled: "true"
kubernetes.io/cluster/{{ getenv "KOPS_CLUSTER_NAME" }}: "owned"
{{- end }}
cloudProvider: aws
configBase: {{ getenv "KOPS_STATE_STORE" }}/{{ getenv "KOPS_CLUSTER_NAME" }}
{{- if getenv "KOPS_DNS_ZONE" }}
Expand Down Expand Up @@ -328,6 +311,33 @@ spec:
- {{ . }}
{{- end }}

{{- if getenv "NODE_MAX_SIZE_PER_AZ" }}
{{ range (getenv "KOPS_NODES_AVAILABILITY_ZONES" ( getenv "KOPS_AVAILABILITY_ZONES" ) | strings.Split ",") }}
---
apiVersion: kops/v1alpha2
kind: InstanceGroup
metadata:
labels:
kops.k8s.io/cluster: {{ getenv "KOPS_CLUSTER_NAME" }}
name: nodes-{{ . }}
spec:
detailedInstanceMonitoring: {{ getenv "KOPS_CLOUDWATCH_DETAILED_MONITORING" "false" }}
associatePublicIp: false
{{- if bool (getenv "KOPS_CLUSTER_AUTOSCALER_ENABLED" "false") }}
cloudLabels:
k8s.io/cluster-autoscaler/enabled: "true"
k8s.io/cluster-autoscaler/{{ getenv "KOPS_CLUSTER_NAME" }}: "owned"
{{- end }}
image: {{ getenv "KOPS_BASE_IMAGE" }}
machineType: {{ getenv "NODE_MACHINE_TYPE" }}
maxSize: {{ getenv "NODE_MAX_SIZE_PER_AZ" }}
minSize: {{ getenv "NODE_MIN_SIZE_PER_AZ" "1" }}
role: Node
subnets:
- {{ . }}
{{- end }}

{{- else }}
---
apiVersion: kops/v1alpha2
kind: InstanceGroup
Expand All @@ -338,6 +348,11 @@ metadata:
spec:
detailedInstanceMonitoring: {{ getenv "KOPS_CLOUDWATCH_DETAILED_MONITORING" "false" }}
associatePublicIp: false
{{- if bool (getenv "KOPS_CLUSTER_AUTOSCALER_ENABLED" "false") }}
cloudLabels:
k8s.io/cluster-autoscaler/enabled: "true"
k8s.io/cluster-autoscaler/{{ getenv "KOPS_CLUSTER_NAME" }}: "owned"
{{- end }}
image: {{ getenv "KOPS_BASE_IMAGE" }}
machineType: {{ getenv "NODE_MACHINE_TYPE" }}
maxSize: {{ getenv "NODE_MAX_SIZE" }}
Expand All @@ -347,6 +362,7 @@ spec:
{{- range (getenv "KOPS_NODES_AVAILABILITY_ZONES" ( getenv "KOPS_AVAILABILITY_ZONES" ) | strings.Split ",") }}
- {{ . }}
{{- end }}
{{- end }}

{{/* Allow the manifest to be extended via a datasource */}}
{{- if (datasourceExists "extensions") -}}
Expand Down

0 comments on commit 37c79a2

Please sign in to comment.