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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

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

@@ -28,6 +29,14 @@ const (
defaultLongTimeout = 4 * time.Minute
)

var setSeparator = sync.OnceFunc(func() {
shared.Separator = "|"
Copy link
Member

Choose a reason for hiding this comment

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

I'm confused, Why do you change the separator here?
Also, is setSeparator the set separator or does it set the separator?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The setSeparator is supposed to change the separator used in the state once. The separator is changed from "/" to "|" because some of the strings that we save do use "/" internally and when the state is restored the slashes interfere with really restoring the state.

We can refactor the strings that we save, or escape the strings or just change the separator. Previous to this PR (and I believe after removing much of the code post-deprecation) we didn't really need to restore things from the state which is why this is only introduced now.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Also, is setSeparator the set separator or does it set the separator?

Is the function to set the separator once. It is executed on package import with the init couple lines below.

func (c *LoadBalancersClient) Get(ctx context.Context, resourceGroupName, name string) (*armnetwork.LoadBalancer, error) {
res, err := c.client.Get(ctx, resourceGroupName, name, nil)
if err != nil {
return nil, FilterNotFoundError(err)
Copy link
Member

Choose a reason for hiding this comment

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

Haven't checked around, but is this how we usually do it? This get method will always shadow notFound, I think this should be done when calling this function (if the caller wants it)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is also how the other client implementations work. The comment is fair, but for local consistency it would be applied in a separate PR.

@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.

}

// 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
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)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants