forked from openshift/installer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
worker.go
70 lines (66 loc) · 1.96 KB
/
worker.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
// Package openstack generates Machine objects for openstack.
package openstack
import (
"text/template"
"github.com/openshift/installer/pkg/types/openstack"
)
// Config is used to generate the machine.
type Config struct {
CloudName string
ClusterName string
Replicas int64
Image string
Tags map[string]string
Region string
Machine openstack.MachinePool
Trunk bool
}
// WorkerMachineSetTmpl is template for worker machineset.
var WorkerMachineSetTmpl = template.Must(template.New("openstack-worker-machineset").Parse(`
apiVersion: cluster.k8s.io/v1alpha1
kind: MachineSet
metadata:
name: {{.ClusterName}}-worker
namespace: openshift-cluster-api
labels:
sigs.k8s.io/cluster-api-cluster: {{.ClusterName}}
sigs.k8s.io/cluster-api-machine-role: worker
sigs.k8s.io/cluster-api-machine-type: worker
spec:
replicas: {{.Replicas}}
selector:
matchLabels:
sigs.k8s.io/cluster-api-machineset: {{.ClusterName}}-worker
sigs.k8s.io/cluster-api-cluster: {{.ClusterName}}
template:
metadata:
labels:
sigs.k8s.io/cluster-api-machineset: {{.ClusterName}}-worker
sigs.k8s.io/cluster-api-cluster: {{.ClusterName}}
sigs.k8s.io/cluster-api-machine-role: worker
sigs.k8s.io/cluster-api-machine-type: worker
spec:
providerSpec:
value:
apiVersion: openstack.cluster.k8s.io/v1alpha1
kind: OpenStackMachineProviderConfig
cloudName: {{.CloudName}}
cloudsSecret: "openstack-credentials"
image: {{.Image}}
flavor: {{.Machine.FlavorName}}
placement:
region: {{.Region}}
networks:
{{- range $key,$value := .Tags}}
- filter:
tags: "{{$key}}={{$value}}"
{{- end}}
securityGroups:
- worker
userDataSecret:
name: worker-user-data
trunk: {{.Trunk}}
versions:
kubelet: "v1.11.0"
controlPlane: ""
`))