Skip to content

Commit

Permalink
Merge pull request #3822 from jparrill/r4.14/HOSTEDCP-1322
Browse files Browse the repository at this point in the history
[release-4.14] HOSTEDCP-1322: NodeUpgradeType defaulted by provider
  • Loading branch information
openshift-merge-bot[bot] committed Apr 2, 2024
2 parents 8de7bff + aa0d690 commit 741a78d
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 5 deletions.
21 changes: 20 additions & 1 deletion api/fixtures/example.go
Original file line number Diff line number Diff line change
Expand Up @@ -571,6 +571,9 @@ func (o ExampleOptions) Resources() *ExampleResources {
case hyperv1.AWSPlatform:
for _, zone := range o.AWS.Zones {
nodePool := defaultNodePool(fmt.Sprintf("%s-%s", cluster.Name, zone.Name))
if nodePool.Spec.Management.UpgradeType == "" {
nodePool.Spec.Management.UpgradeType = hyperv1.UpgradeTypeReplace
}
nodePool.Spec.Platform.AWS = &hyperv1.AWSNodePoolPlatform{
InstanceType: o.AWS.InstanceType,
InstanceProfile: o.AWS.InstanceProfile,
Expand All @@ -593,6 +596,9 @@ func (o ExampleOptions) Resources() *ExampleResources {
}
case hyperv1.KubevirtPlatform:
nodePool := defaultNodePool(cluster.Name)
if nodePool.Spec.Management.UpgradeType == "" {
nodePool.Spec.Management.UpgradeType = hyperv1.UpgradeTypeReplace
}
nodePool.Spec.Platform.Kubevirt = ExampleKubeVirtTemplate(o.Kubevirt)
nodePools = append(nodePools, nodePool)
val, exists := o.Annotations[hyperv1.AllowUnsupportedKubeVirtRHCOSVariantsAnnotation]
Expand All @@ -603,11 +609,18 @@ func (o ExampleOptions) Resources() *ExampleResources {
nodePool.Annotations[hyperv1.AllowUnsupportedKubeVirtRHCOSVariantsAnnotation] = val
}
case hyperv1.NonePlatform, hyperv1.AgentPlatform:
nodePools = append(nodePools, defaultNodePool(cluster.Name))
nodePool := defaultNodePool(cluster.Name)
if nodePool.Spec.Management.UpgradeType == "" {
nodePool.Spec.Management.UpgradeType = hyperv1.UpgradeTypeInPlace
}
nodePools = append(nodePools, nodePool)
case hyperv1.AzurePlatform:
if len(o.Azure.AvailabilityZones) > 0 {
for _, availabilityZone := range o.Azure.AvailabilityZones {
nodePool := defaultNodePool(fmt.Sprintf("%s-%s", cluster.Name, availabilityZone))
if nodePool.Spec.Management.UpgradeType == "" {
nodePool.Spec.Management.UpgradeType = hyperv1.UpgradeTypeReplace
}
nodePool.Spec.Platform.Azure = &hyperv1.AzureNodePoolPlatform{
VMSize: o.Azure.InstanceType,
ImageID: o.Azure.BootImageID,
Expand All @@ -619,6 +632,9 @@ func (o ExampleOptions) Resources() *ExampleResources {

} else {
nodePool := defaultNodePool(cluster.Name)
if nodePool.Spec.Management.UpgradeType == "" {
nodePool.Spec.Management.UpgradeType = hyperv1.UpgradeTypeReplace
}
nodePool.Spec.Platform.Azure = &hyperv1.AzureNodePoolPlatform{
VMSize: o.Azure.InstanceType,
ImageID: o.Azure.BootImageID,
Expand All @@ -628,6 +644,9 @@ func (o ExampleOptions) Resources() *ExampleResources {
}
case hyperv1.PowerVSPlatform:
nodePool := defaultNodePool(cluster.Name)
if nodePool.Spec.Management.UpgradeType == "" {
nodePool.Spec.Management.UpgradeType = hyperv1.UpgradeTypeReplace
}
nodePool.Spec.Platform.PowerVS = &hyperv1.PowerVSNodePoolPlatform{
SystemType: o.PowerVS.SysType,
ProcessorType: o.PowerVS.ProcType,
Expand Down
2 changes: 1 addition & 1 deletion cmd/cluster/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func NewCreateCommands() *cobra.Command {
NodeSelector: nil,
Log: log.Log,
NodeDrainTimeout: 0,
NodeUpgradeType: v1beta1.UpgradeTypeReplace,
NodeUpgradeType: "",
Arch: "amd64",
OLMCatalogPlacement: v1beta1.ManagementOLMCatalogPlacement,
}
Expand Down
2 changes: 1 addition & 1 deletion product-cli/cmd/cluster/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func NewCreateCommands() *cobra.Command {
Namespace: "clusters",
NodeDrainTimeout: 0,
NodeSelector: nil,
NodeUpgradeType: v1beta1.UpgradeTypeReplace,
NodeUpgradeType: "",
PullSecretFile: "",
ReleaseImage: "",
Render: false,
Expand Down
3 changes: 1 addition & 2 deletions product-cli/cmd/nodepool/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package nodepool
import (
"github.com/spf13/cobra"

hyperv1 "github.com/openshift/hypershift/api/v1beta1"
"github.com/openshift/hypershift/cmd/nodepool/core"
"github.com/openshift/hypershift/product-cli/cmd/nodepool/agent"
"github.com/openshift/hypershift/product-cli/cmd/nodepool/aws"
Expand All @@ -22,7 +21,7 @@ func NewCreateCommand() *cobra.Command {
ClusterName: "example",
Namespace: "clusters",
NodeCount: 2,
NodeUpgradeType: hyperv1.UpgradeTypeReplace,
NodeUpgradeType: "",
ReleaseImage: "",
}

Expand Down

0 comments on commit 741a78d

Please sign in to comment.