Init completes initialization of the object, for example pre-parsing the kubernetes version
()
| 90 | |
| 91 | // Init completes initialization of the object, for example pre-parsing the kubernetes version |
| 92 | func (c *NodeupModelContext) Init() error { |
| 93 | k8sVersion, err := kopsmodel.ParseKubernetesVersion(c.NodeupConfig.KubernetesVersion) |
| 94 | if err != nil { |
| 95 | return fmt.Errorf("unable to parse KubernetesVersion %q: %w", c.NodeupConfig.KubernetesVersion, err) |
| 96 | } |
| 97 | c.kubernetesVersion = k8sVersion |
| 98 | c.bootstrapCerts = map[string]*nodetasks.BootstrapCert{} |
| 99 | c.bootstrapKeypairIDs = map[string]string{} |
| 100 | |
| 101 | role := c.BootConfig.InstanceGroupRole |
| 102 | |
| 103 | if role == kops.InstanceGroupRoleControlPlane { |
| 104 | c.IsMaster = true |
| 105 | } |
| 106 | |
| 107 | if role == kops.InstanceGroupRoleControlPlane || role == kops.InstanceGroupRoleAPIServer { |
| 108 | c.HasAPIServer = true |
| 109 | } |
| 110 | |
| 111 | c.usesNoneDNS = c.NodeupConfig.UsesNoneDNS |
| 112 | c.usesLegacyGossip = c.NodeupConfig.UsesLegacyGossip |
| 113 | c.discoveryService = c.NodeupConfig.DiscoveryService |
| 114 | |
| 115 | return nil |
| 116 | } |
| 117 | |
| 118 | func (c *NodeupModelContext) APIInternalName() string { |
| 119 | return "api.internal." + c.NodeupConfig.ClusterName |