Skip to content
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

Availability set deprecation #1025

Merged
merged 4 commits into from
Dec 3, 2024

Conversation

kon-angelo
Copy link
Contributor

How to categorize this PR?

/area control-plane
/kind enhancement
/platform azure

What this PR does / why we need it:

Which issue(s) this PR fixes:
Fixes #

Special notes for your reviewer:

Release note:

Disable the creation of Availability-Set-based shoots.
VMSS-Flex based shoots are not the default deployment for non-zonal shoots.
Introduce an annotation to migrate the availability-set shoots to VMSS-Flex shoots.

@kon-angelo kon-angelo requested review from a team as code owners November 29, 2024 08:42
@kon-angelo
Copy link
Contributor Author

/test

@gardener-robot gardener-robot added the needs/review Needs review label Nov 29, 2024
@testmachinery
Copy link

testmachinery bot commented Nov 29, 2024

Testrun: e2e-xn69g
Workflow: e2e-xn69g-wf
Phase: Succeeded

+---------------------+---------------------------+-----------+----------+
|        NAME         |           STEP            |   PHASE   | DURATION |
+---------------------+---------------------------+-----------+----------+
| infrastructure-test | infra-flow-test           | Succeeded | 21m14s   |
| infrastructure-test | infra-flow-migration-test | Succeeded | 26m21s   |
| bastion-test        | bastion-test              | Succeeded | 9m4s     |
| infrastructure-test | infrastructure-test       | Succeeded | 23m8s    |
+---------------------+---------------------------+-----------+----------+

@gardener-robot gardener-robot added kind/api-change API change with impact on API users needs/second-opinion Needs second review by someone else area/control-plane Control plane related kind/enhancement Enhancement, improvement, extension platform/azure Microsoft Azure platform/infrastructure size/xl Size of pull request is huge (see gardener-robot robot/bots/size.py) labels Nov 29, 2024
@gardener-robot-ci-2 gardener-robot-ci-2 added reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) needs/ok-to-test Needs approval for testing (check PR in detail before setting this label because PR is run on CI/CD) and removed reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) labels Nov 29, 2024
@kon-angelo kon-angelo changed the title Availability set depraction Availability set deprecation Nov 29, 2024
Comment on lines 769 to 776
if err := fctx.client.Get(ctx, k8sclient.ObjectKey{
Namespace: fctx.infra.Namespace,
Name: azure.CloudControllerManagerName,
}, deployment); k8sclient.IgnoreNotFound(err) != nil {
return err
} else if k8sclient.IgnoreNotFound(err) != nil {
return nil
}
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
if err := fctx.client.Get(ctx, k8sclient.ObjectKey{
Namespace: fctx.infra.Namespace,
Name: azure.CloudControllerManagerName,
}, deployment); k8sclient.IgnoreNotFound(err) != nil {
return err
} else if k8sclient.IgnoreNotFound(err) != nil {
return nil
}
if err := fctx.client.Get(ctx, k8sclient.ObjectKey{
Namespace: fctx.infra.Namespace,
Name: azure.CloudControllerManagerName,
}, deployment); k8sclient.IgnoreNotFound(err) != nil {
return err
}

Not sure if this is the right one to keep

pkg/azure/client/loadbalancers.go Show resolved Hide resolved
@gardener-robot-ci-1 gardener-robot-ci-1 added the reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) label Nov 29, 2024
@gardener-robot-ci-2 gardener-robot-ci-2 added reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) and removed reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) labels Nov 29, 2024
@@ -171,7 +177,16 @@ func (fctx *FlowContext) EnsureAvailabilitySet(ctx context.Context) error {
return nil
}

avset, err := fctx.ensureAvailabilitySet(ctx, log, *avsetCfg)
// complete AS migration.
if v := fctx.whiteboard.GetChild("migration").GetChild(KindAvailabilitySet.String()).Get("complete"); v != nil && *v == "true" {
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: I think it would be nice we define such keys as "migration" and "complete" somewhere as constants.

Comment on lines 752 to 764
// return early if the migration has already been complete
if v := fctx.whiteboard.GetChild("migration").GetChild(KindAvailabilitySet.String()).Get("complete"); v != nil && *v == "true" {
return nil
}
// return early if the cluster does not have AS.
if fctx.whiteboard.GetChild(ChildKeyIDs).Get(KindAvailabilitySet.String()) == nil {
return nil
}

// IF VMOs are not needed, or the migration is already done, return early.
if !helper.HasShootVmoMigrationAnnotation(fctx.cluster.Shoot.GetAnnotations()) {
return nil
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: Aren't these all dependencies for the migration task - maybe we could put them into a separate function and use this function as task dependency.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

These checks as a group are used in one place. The separate function will just be giving a name to preflight checks but I can oblige

Copy link
Contributor Author

@kon-angelo kon-angelo Nov 29, 2024

Choose a reason for hiding this comment

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

Rethinking your question:

  • Do you mean as a shared.DoIf ?
    It's a question of when are the dependencies of a task evaluated (at build or at runtime) and AFAIK they are on build time. At that point you may not have the KindAvailabilitySet in the state for example.

  • Do you mean as a shared.Dependency ?
    I am actually not sure if this will block a child Task in the graph from being executed. I would need to test the scemantics. It may either mark the skipped parent as completed (so the childen are always executed), or it may really prune the tree (what you suggested I believe). But I need to check first.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

Valid arguments.
I think I was a bit too quick here and didn't think it through completely.
Let's leave it as is.

}

// IsVmoRequiredForInfrastructure determines if VMO is required.
func (ia *InfrastructureAdapter) IsVmoRequiredForInfrastructure() bool {
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 see where this function is used?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

old artifact - thank you

Comment on lines 38 to 40
if lb.Properties == nil || len(lb.Properties.FrontendIPConfigurations) == 0 {
return nil
}
Copy link
Contributor

Choose a reason for hiding this comment

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

duplicated check

@gardener-robot-ci-1 gardener-robot-ci-1 added reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) and removed reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) labels Nov 29, 2024
AndreasBurger
AndreasBurger previously approved these changes Dec 2, 2024
Comment on lines 810 to 818
}
log.Info("Deleting load balancer", "Name", fctx.infra.Namespace)
if err := loadbalancerClient.Delete(ctx, fctx.adapter.ResourceGroupName(), fctx.adapter.TechnicalName()); err != nil {
return err
}
log.Info("Deleting internal load balancer", "Name", fctx.infra.Namespace)
if err := loadbalancerClient.Delete(ctx, fctx.adapter.ResourceGroupName(), fmt.Sprintf("%s-internal", fctx.adapter.TechnicalName())); err != nil {
return err
}
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
}
log.Info("Deleting load balancer", "Name", fctx.infra.Namespace)
if err := loadbalancerClient.Delete(ctx, fctx.adapter.ResourceGroupName(), fctx.adapter.TechnicalName()); err != nil {
return err
}
log.Info("Deleting internal load balancer", "Name", fctx.infra.Namespace)
if err := loadbalancerClient.Delete(ctx, fctx.adapter.ResourceGroupName(), fmt.Sprintf("%s-internal", fctx.adapter.TechnicalName())); err != nil {
return err
}
}
loadbalancerName := fctx.adapter.TechnicalName()
log.Info("Deleting load balancer", "Name", loadbalancerName)
if err := loadbalancerClient.Delete(ctx, fctx.adapter.ResourceGroupName(), loadbalancerName); err != nil {
return err
}
loadbalancerName = fmt.Sprintf("%s-internal", fctx.adapter.TechnicalName())
log.Info("Deleting internal load balancer", "Name", loadbalancerName )
if err := loadbalancerClient.Delete(ctx, fctx.adapter.ResourceGroupName(), loadbalancerName ); err != nil {
return err
}

deployment.Spec.Replicas = ptr.To(int32(0))
// Apply the patch on the "scale" subresource
if err := c.SubResource("scale").Patch(ctx, deployment, patch); err != nil {
return fmt.Errorf("failed to patch deployment %s with replicas: %w", key.String(), err)
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
return fmt.Errorf("failed to patch deployment %s with replicas: %w", key.String(), err)
return fmt.Errorf("failed to patch deployment %s with replicas: %w", key, err)

should not be needed

if ia.config.Zoned {
return false
}
// If the infrastructureStatus already exists that mean the Infrastucture is already created.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
// If the infrastructureStatus already exists that mean the Infrastucture is already created.
// If the infrastructureStatus already exists that means the Infrastucture is already created.

@gardener-robot-ci-2 gardener-robot-ci-2 added reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) and removed reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) labels Dec 2, 2024
@kon-angelo
Copy link
Contributor Author

/test

@testmachinery
Copy link

testmachinery bot commented Dec 3, 2024

Testrun: e2e-f5mbk
Workflow: e2e-f5mbk-wf
Phase: Succeeded

+---------------------+---------------------------+-----------+----------+
|        NAME         |           STEP            |   PHASE   | DURATION |
+---------------------+---------------------------+-----------+----------+
| infrastructure-test | infrastructure-test       | Succeeded | 22m44s   |
| infrastructure-test | infra-flow-test           | Succeeded | 20m5s    |
| infrastructure-test | infra-flow-migration-test | Succeeded | 25m4s    |
| bastion-test        | bastion-test              | Succeeded | 9m30s    |
+---------------------+---------------------------+-----------+----------+

@kon-angelo kon-angelo merged commit 3f41c47 into gardener:master Dec 3, 2024
11 checks passed
@kon-angelo kon-angelo deleted the avset-deprecation3 branch December 3, 2024 16:05
@gardener-robot gardener-robot added the status/closed Issue is closed (either delivered or triaged) label Dec 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/control-plane Control plane related kind/api-change API change with impact on API users kind/enhancement Enhancement, improvement, extension needs/ok-to-test Needs approval for testing (check PR in detail before setting this label because PR is run on CI/CD) needs/review Needs review needs/second-opinion Needs second review by someone else platform/azure Microsoft Azure platform/infrastructure size/xl Size of pull request is huge (see gardener-robot robot/bots/size.py) status/closed Issue is closed (either delivered or triaged)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants