mirror of
https://github.com/lingble/talos.git
synced 2025-12-02 13:53:40 +00:00
chore: rename v1 node configs to v1alpha1
This PR moves to using v1alpha1 as the inital node config version, so we can graduate these configs a little more cleanly later on. Signed-off-by: Spencer Smith <robertspencersmith@gmail.com>
This commit is contained in:
committed by
Spencer Smith
parent
be4f7e1e6a
commit
aed8c06730
64
pkg/userdata/v1alpha1/generate/init.go
Normal file
64
pkg/userdata/v1alpha1/generate/init.go
Normal file
@@ -0,0 +1,64 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
package generate
|
||||
|
||||
import (
|
||||
v1alpha1 "github.com/talos-systems/talos/pkg/userdata/v1alpha1"
|
||||
yaml "gopkg.in/yaml.v2"
|
||||
)
|
||||
|
||||
func initUd(in *Input) (string, error) {
|
||||
|
||||
machine := &v1alpha1.MachineConfig{
|
||||
Type: "init",
|
||||
Kubelet: &v1alpha1.KubeletConfig{},
|
||||
Network: &v1alpha1.NetworkConfig{},
|
||||
CA: &v1alpha1.MachineCAConfig{
|
||||
Crt: in.Certs.OsCert,
|
||||
Key: in.Certs.OsKey,
|
||||
},
|
||||
Token: in.TrustdInfo.Token,
|
||||
}
|
||||
|
||||
certSANs := in.GetAPIServerSANs()
|
||||
|
||||
cluster := &v1alpha1.ClusterConfig{
|
||||
ClusterName: in.ClusterName,
|
||||
ControlPlane: &v1alpha1.ControlPlaneConfig{
|
||||
Endpoint: in.ControlPlaneEndpoint,
|
||||
IPs: in.MasterIPs,
|
||||
Index: in.Index,
|
||||
},
|
||||
APIServer: &v1alpha1.APIServerConfig{
|
||||
CertSANs: certSANs,
|
||||
},
|
||||
ControllerManager: &v1alpha1.ControllerManagerConfig{},
|
||||
Scheduler: &v1alpha1.SchedulerConfig{},
|
||||
Etcd: &v1alpha1.EtcdConfig{},
|
||||
Network: &v1alpha1.ClusterNetworkConfig{
|
||||
DNSDomain: in.ServiceDomain,
|
||||
PodSubnet: in.PodNet,
|
||||
ServiceSubnet: in.ServiceNet,
|
||||
},
|
||||
CA: &v1alpha1.ClusterCAConfig{
|
||||
Crt: in.Certs.K8sCert,
|
||||
Key: in.Certs.K8sKey,
|
||||
},
|
||||
Token: in.KubeadmTokens.BootstrapToken,
|
||||
}
|
||||
|
||||
ud := v1alpha1.NodeConfig{
|
||||
Version: "v1alpha1",
|
||||
Machine: machine,
|
||||
Cluster: cluster,
|
||||
}
|
||||
|
||||
udMarshal, err := yaml.Marshal(ud)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return string(udMarshal), nil
|
||||
}
|
||||
Reference in New Issue
Block a user