-
Notifications
You must be signed in to change notification settings - Fork 7
/
capv.go
44 lines (37 loc) · 1.14 KB
/
capv.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
package provider
import (
"context"
"io"
"github.com/giantswarm/k8sclient/v5/pkg/k8sclient"
"github.com/giantswarm/microerror"
"github.com/giantswarm/kubectl-gs/cmd/template/cluster/provider/templates/vsphere"
"github.com/giantswarm/kubectl-gs/internal/key"
)
func WriteVSphereTemplate(ctx context.Context, client k8sclient.Interface, out io.Writer, config ClusterCRsConfig) error {
data := struct {
Description string
KubernetesVersion string
Name string
Namespace string
Organization string
PodsCIDR string
ReleaseVersion string
}{
Description: config.Description,
KubernetesVersion: "v1.20.1",
Name: config.Name,
Namespace: key.OrganizationNamespaceFromName(config.Organization),
Organization: config.Organization,
PodsCIDR: config.PodsCIDR,
ReleaseVersion: config.ReleaseVersion,
}
var templates []templateConfig
for _, t := range vsphere.GetTemplates() {
templates = append(templates, templateConfig(t))
}
err := runMutation(ctx, client, data, templates, out)
if err != nil {
return microerror.Mask(err)
}
return nil
}