-
Notifications
You must be signed in to change notification settings - Fork 4.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Configure ginkgo to use the KUBE_BASTION_SSH
env variable
#16008
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,6 +28,7 @@ import ( | |
"k8s.io/klog/v2" | ||
"k8s.io/kops/pkg/apis/kops" | ||
"k8s.io/kops/pkg/cloudinstances" | ||
"k8s.io/kops/upup/pkg/fi" | ||
) | ||
|
||
// DeleteGroup deletes a cloud of instances controlled by an Instance Group Manager | ||
|
@@ -171,13 +172,18 @@ func getCloudGroups(c GCECloud, cluster *kops.Cluster, instancegroups []*kops.In | |
|
||
for _, i := range instances { | ||
id := i.Instance | ||
name := LastComponent(id) | ||
instance, err := c.Compute().Instances().Get(project, zoneName, name) | ||
if err != nil { | ||
return nil, fmt.Errorf("error getting Instance: %v", err) | ||
} | ||
cm := &cloudinstances.CloudInstance{ | ||
ID: id, | ||
ID: instance.SelfLink, | ||
CloudInstanceGroup: g, | ||
} | ||
addCloudInstanceData(cm, instance) | ||
|
||
// Try first by provider ID | ||
name := LastComponent(id) | ||
providerID := "gce://" + project + "/" + zoneName + "/" + name | ||
node := nodesByProviderID[providerID] | ||
|
||
|
@@ -257,3 +263,30 @@ func matchInstanceGroup(mig *compute.InstanceGroupManager, c *kops.Cluster, inst | |
} | ||
return matches[0], nil | ||
} | ||
|
||
func addCloudInstanceData(cm *cloudinstances.CloudInstance, instance *compute.Instance) { | ||
cm.MachineType = LastComponent(instance.MachineType) | ||
cm.Status = instance.Status | ||
if instance.Status == "RUNNING" { | ||
cm.State = cloudinstances.CloudInstanceStatusUpToDate | ||
} | ||
isControlPlane := false | ||
for k := range instance.Labels { | ||
if !strings.HasPrefix(k, GceLabelNameRolePrefix) { | ||
continue | ||
} | ||
role := strings.TrimPrefix(k, GceLabelNameRolePrefix) | ||
if role == "master" || role == "control-plane" { | ||
isControlPlane = true | ||
} else { | ||
cm.Roles = append(cm.Roles, role) | ||
cm.PrivateIP = fi.ValueOf(&instance.NetworkInterfaces[0].NetworkIP) | ||
cm.ExternalIP = fi.ValueOf(&instance.NetworkInterfaces[0].AccessConfigs[0].NatIP) | ||
} | ||
} | ||
if isControlPlane { | ||
cm.Roles = append(cm.Roles, "control-plane") | ||
cm.PrivateIP = fi.ValueOf(&instance.NetworkInterfaces[0].NetworkIP) | ||
cm.ExternalIP = fi.ValueOf(&instance.NetworkInterfaces[0].AccessConfigs[0].NatIP) | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why does this avoid setting the PrivateIP and ExternalIP when there is no role label? Why not unconditionally set those regardless of the role label? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It doesn't, look at 282 to 284. |
||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For a three-node control plane we would set KUBE_SSH_BASTION three times?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Forgot about that, we need just one IP.