diff --git a/cmd/cluster/resize/infra_node.go b/cmd/cluster/resize/infra_node.go index e26d7d545..3df34df70 100644 --- a/cmd/cluster/resize/infra_node.go +++ b/cmd/cluster/resize/infra_node.go @@ -1,7 +1,6 @@ package resize // cspell:ignore embiggen - import ( "context" "errors" @@ -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" + infraNodeLabel = "node-role.kubernetes.io/infra" + temporaryInfraNodeLabel = "osdctl.openshift.io/infra-resize-temporary-machinepool" ) func newCmdResizeInfra() *cobra.Command { @@ -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", @@ -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 {