forked from siderolabs/contrib
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtalos.go
51 lines (44 loc) · 1.09 KB
/
talos.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
package main
import (
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
"github.com/siderolabs/pulumi-provider-talos/sdk/go/talos"
)
func (ri *ResourceInfo) createConfigs(ctx *pulumi.Context) error {
clusterSecrets, err := talos.NewClusterSecrets(
ctx,
ClusterName+"-cluster-secrets",
&talos.ClusterSecretsArgs{})
if err != nil {
return err
}
cc, err := talos.NewClusterConfig(
ctx,
ClusterName+"-cluster-config",
&talos.ClusterConfigArgs{
AdditionalSans: ri.CPPubIPs,
ClusterEndpoint: pulumi.Sprintf("https://%s:6443", ri.LBPubIP.IpAddress),
ClusterName: pulumi.String(ClusterName),
Secrets: clusterSecrets.Secrets,
},
)
if err != nil {
return err
}
ri.TalosClusterSecrets = clusterSecrets
ri.TalosClusterConfig = cc
return nil
}
func (ri *ResourceInfo) bootstrapTalos(ctx *pulumi.Context) error {
_, err := talos.NewNodeBootstrap(
ctx,
ClusterName+"-bootstrap",
&talos.NodeBootstrapArgs{
Endpoint: ri.CPPubIPs[0],
Node: ri.CPPubIPs[0],
TalosConfig: ri.TalosClusterSecrets.TalosConfig,
})
if err != nil {
return err
}
return nil
}