Remove references to Gossip-specific ClusterSpec fields from nodeup

This commit is contained in:
John Gardiner Myers 2023-07-15 22:13:54 -07:00
parent 7e7a36f1d7
commit 683761a816
2 changed files with 21 additions and 9 deletions

View File

@ -184,7 +184,7 @@ func (t *ProtokubeBuilder) ProtokubeFlags() (*ProtokubeFlags, error) {
f.ClusterID = fi.PtrTo(t.NodeupConfig.ClusterName)
zone := t.Cluster.Spec.DNSZone
zone := t.NodeupConfig.DNSZone
if zone != "" {
if strings.Contains(zone, ".") {
// match by name
@ -202,15 +202,15 @@ func (t *ProtokubeBuilder) ProtokubeFlags() (*ProtokubeFlags, error) {
if t.UsesLegacyGossip() {
klog.Warningf("using (legacy) gossip DNS", t.NodeupConfig.ClusterName)
f.Gossip = fi.PtrTo(true)
if t.Cluster.Spec.GossipConfig != nil {
f.GossipProtocol = t.Cluster.Spec.GossipConfig.Protocol
f.GossipListen = t.Cluster.Spec.GossipConfig.Listen
f.GossipSecret = t.Cluster.Spec.GossipConfig.Secret
if t.NodeupConfig.GossipConfig != nil {
f.GossipProtocol = t.NodeupConfig.GossipConfig.Protocol
f.GossipListen = t.NodeupConfig.GossipConfig.Listen
f.GossipSecret = t.NodeupConfig.GossipConfig.Secret
if t.Cluster.Spec.GossipConfig.Secondary != nil {
f.GossipProtocolSecondary = t.Cluster.Spec.GossipConfig.Secondary.Protocol
f.GossipListenSecondary = t.Cluster.Spec.GossipConfig.Secondary.Listen
f.GossipSecretSecondary = t.Cluster.Spec.GossipConfig.Secondary.Secret
if t.NodeupConfig.GossipConfig.Secondary != nil {
f.GossipProtocolSecondary = t.NodeupConfig.GossipConfig.Secondary.Protocol
f.GossipListenSecondary = t.NodeupConfig.GossipConfig.Secondary.Listen
f.GossipSecretSecondary = t.NodeupConfig.GossipConfig.Secondary.Secret
}
}

View File

@ -94,6 +94,10 @@ type Config struct {
// APIServerConfig is additional configuration for nodes running an APIServer.
APIServerConfig *APIServerConfig `json:",omitempty"`
// GossipConfig is configuration for gossip DNS.
GossipConfig *kops.GossipConfig `json:",omitempty"`
// DNSZone is the DNS zone we should use when configuring DNS.
DNSZone string `json:",omitempty"`
// NvidiaGPU contains the configuration for nvidia
NvidiaGPU *kops.NvidiaGPUConfig `json:",omitempty"`
@ -329,6 +333,14 @@ func NewConfig(cluster *kops.Cluster, instanceGroup *kops.InstanceGroup) (*Confi
config.Networking.EgressProxy = cluster.Spec.Networking.EgressProxy
}
if instanceGroup.IsControlPlane() || cluster.UsesLegacyGossip() {
config.DNSZone = cluster.Spec.DNSZone
}
if cluster.UsesLegacyGossip() {
config.GossipConfig = cluster.Spec.GossipConfig
}
if len(instanceGroup.Spec.SysctlParameters) > 0 {
config.SysctlParameters = append(config.SysctlParameters,
"# Custom sysctl parameters from instance group spec",