Skip to content

Commit

Permalink
Merge pull request kubernetes-sigs#54 from kahun/feature/EOS_11009_ad…
Browse files Browse the repository at this point in the history
…d_labels_to_node_groups

[EOS-11009] Add labels to node groups
  • Loading branch information
kahun authored Mar 14, 2023
2 parents c0d447f + 524b3a8 commit 251490d
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 12 deletions.
23 changes: 12 additions & 11 deletions pkg/cluster/internal/create/actions/cluster/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,17 +102,18 @@ type AWS struct {
}

type WorkerNodes []struct {
Name string `yaml:"name" validate:"required"`
AmiID string `yaml:"ami_id"`
Quantity int `yaml:"quantity" validate:"required,numeric,gt=0"`
Size string `yaml:"size" validate:"required"`
Image string `yaml:"image" validate:"required_if=InfraProvider gcp"`
ZoneDistribution string `yaml:"zone_distribution" validate:"omitempty,oneof='balanced' 'unbalanced'"`
AZ string `yaml:"az"`
SSHKey string `yaml:"ssh_key"`
Spot bool `yaml:"spot" validate:"omitempty,boolean"`
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"`
Name string `yaml:"name" validate:"required"`
AmiID string `yaml:"ami_id"`
Quantity int `yaml:"quantity" validate:"required,numeric,gt=0"`
Size string `yaml:"size" validate:"required"`
Image string `yaml:"image" validate:"required_if=InfraProvider gcp"`
ZoneDistribution string `yaml:"zone_distribution" validate:"omitempty,oneof='balanced' 'unbalanced'"`
AZ string `yaml:"az"`
SSHKey string `yaml:"ssh_key"`
Spot bool `yaml:"spot" validate:"omitempty,boolean"`
Labels map[string]string `yaml:"labels"`
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 @@ -131,6 +131,10 @@ metadata:
name: "{{ $node.Name }}-md-{{ $index }}"
namespace: "cluster-{{ $.Descriptor.ClusterID }}"
spec:
template: {}
template: {{ if not $node.Labels }}{}{{- else }}
spec:
kubeletExtraArgs:
node-labels: \"{{ range $key, $value := $node.Labels }}{{ $key }}={{ $value }},{{- end }}\"
{{- end }}
{{- end }}
{{- end }}
Original file line number Diff line number Diff line change
Expand Up @@ -206,5 +206,6 @@ spec:
name: {{`'{{ ds.meta_data.local_hostname.split(\".\")[0] }}'`}}
kubeletExtraArgs:
cloud-provider: gce
node-labels: \"{{ if $node.Labels }}{{ range $key, $value := $node.Labels }}{{ $key }}={{ $value }},{{- end }}{{- end }}\"
{{- end }}
{{- end }}

0 comments on commit 251490d

Please sign in to comment.