Skip to content
38 changes: 26 additions & 12 deletions cmd/cluster/resize/infra_node.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package resize

// cspell:ignore embiggen

import (
"context"
"errors"
Expand All @@ -27,11 +26,12 @@ import (
)

const (
twentyMinuteTimeout = 20 * time.Minute
twentySecondIncrement = 20 * time.Second
resizedInfraNodeServiceLogTemplate = "https://raw.githubusercontent.com/openshift/managed-notifications/master/osd/infranode_resized_auto.json"
infraNodeLabel = "node-role.kubernetes.io/infra"
temporaryInfraNodeLabel = "osdctl.openshift.io/infra-resize-temporary-machinepool"
twentyMinuteTimeout = 20 * time.Minute
twentySecondIncrement = 20 * time.Second
resizedInfraNodeServiceLogTemplate = "https://raw.githubusercontent.com/openshift/managed-notifications/master/osd/infranode_resized_auto.json"
GCPresizedInfraNodeServiceLogTemplate = "https://raw.githubusercontent.com/openshift/managed-notifications/master/osd/gcp/GCP_infranode_resized_auto.json"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think the service log listed here as "GCP" is any better - the documentation it links to still only talks about ROSA

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mjlshen GCP SL points to OSD documentation not the ROSA documentation. We do not have a separate documentation for GCP on OSD. AWS on OSD and GCP on OSD are in single documentation.

infraNodeLabel = "node-role.kubernetes.io/infra"
temporaryInfraNodeLabel = "osdctl.openshift.io/infra-resize-temporary-machinepool"
)

func newCmdResizeInfra() *cobra.Command {
Expand Down Expand Up @@ -353,7 +353,7 @@ func (r *Resize) RunInfra(ctx context.Context) error {
}
}

postCmd := generateServiceLog(r.instanceType, r.clusterId)
postCmd := generateServiceLog(tempMp, r.instanceType, r.clusterId)
if err := postCmd.Run(); err != nil {
fmt.Println("Failed to generate service log. Please manually send a service log to the customer for the blocked egresses with:")
fmt.Printf("osdctl servicelog post %v -t %v -p %v\n",
Expand Down Expand Up @@ -456,12 +456,26 @@ func getInstanceType(mp *hivev1.MachinePool) (string, error) {
return "", errors.New("unsupported platform, only AWS and GCP are supported")
}

func generateServiceLog(instanceType, clusterId string) servicelog.PostCmdOptions {
return servicelog.PostCmdOptions{
Template: resizedInfraNodeServiceLogTemplate,
ClusterId: clusterId,
TemplateParams: []string{fmt.Sprintf("INSTANCE_TYPE=%s", instanceType)},
//Adding change in serviceLog as per the cloud provider.

func generateServiceLog(mp *hivev1.MachinePool, instanceType, clusterId string) servicelog.PostCmdOptions {

if mp.Spec.Platform.AWS != nil {

return servicelog.PostCmdOptions{
Template: resizedInfraNodeServiceLogTemplate,
ClusterId: clusterId,
TemplateParams: []string{fmt.Sprintf("INSTANCE_TYPE=%s", instanceType)},
}
} else if mp.Spec.Platform.GCP != nil {

return servicelog.PostCmdOptions{
Template: GCPresizedInfraNodeServiceLogTemplate,
ClusterId: clusterId,
TemplateParams: []string{fmt.Sprintf("INSTANCE_TYPE=%s", instanceType)},
}
}
return servicelog.PostCmdOptions{}
}

func (r *Resize) terminateCloudInstances(ctx context.Context, nodeList *corev1.NodeList) error {
Expand Down