Skip to content

Commit

Permalink
Merge pull request kubernetes-sigs#57 from kahun/fix/autoscaler_condi…
Browse files Browse the repository at this point in the history
…tions

Fix autoscaler conditions
  • Loading branch information
kahun authored Mar 8, 2023
2 parents 6b91814 + 55b5d7f commit 3e025f4
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
4 changes: 2 additions & 2 deletions pkg/cluster/internal/create/actions/cluster/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,8 @@ type WorkerNodes []struct {
AZ string `yaml:"az"`
SSHKey string `yaml:"ssh_key"`
Spot bool `yaml:"spot" validate:"omitempty,boolean"`
NodeGroupMaxSize int `yaml:"max_size" validate:"required,numeric,gtefield=Quantity,gt=0"`
NodeGroupMinSize int `yaml:"min_size" validate:"required,numeric,ltefield=Quantity,gt=0"`
NodeGroupMaxSize int `yaml:"max_size" validate:"omitempty,numeric,required_with=NodeGroupMinSize,gtefield=Quantity,gt=0"`
NodeGroupMinSize int `yaml:"min_size" validate:"omitempty,numeric,required_with=NodeGroupMaxSize,ltefield=Quantity,gt=0"`
RootVolume struct {
Size int `yaml:"size" validate:"numeric"`
Type string `yaml:"type"`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ spec:
apiVersion: cluster.x-k8s.io/v1beta1
kind: MachineDeployment
metadata:
{{- if and $node.NodeGroupMaxSize $node.NodeGroupMinSize }}
{{- if and (gt $node.NodeGroupMaxSize 0) (gt $node.NodeGroupMinSize 0) }}
annotations:
cluster.x-k8s.io/cluster-api-autoscaler-node-group-max-size: '{{ $n.MaxSize }}'
cluster.x-k8s.io/cluster-api-autoscaler-node-group-min-size: '{{ $n.MinSize }}'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,13 +127,11 @@ spec:
apiVersion: cluster.x-k8s.io/v1beta1
kind: MachineDeployment
metadata:
{{- if and (gt $node.NodeGroupMaxSize 0) (gt $node.NodeGroupMinSize 0) }}
annotations:
{{- if $node.NodeGroupMaxSize }}
cluster.x-k8s.io/cluster-api-autoscaler-node-group-max-size: '{{ $n.MaxSize }}'
{{- end }}
{{- if $node.NodeGroupMinSize }}
cluster.x-k8s.io/cluster-api-autoscaler-node-group-min-size: '{{ $n.MinSize }}'
{{- end }}
{{- end }}
name: "{{ $node.Name }}-md-{{ $index }}"
namespace: "cluster-{{ $.Descriptor.ClusterID }}"
spec:
Expand Down

0 comments on commit 3e025f4

Please sign in to comment.