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

configure HA webhook according to replicas in the helm chart #918

Open
wants to merge 2 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 openstack

What this PR does / why we need it:
Allows you to run the extension with a single replica. For 2+ replicas it should be no-op.

Which issue(s) this PR fixes:
Fixes #

Special notes for your reviewer:

Release note:

Adjust replica count from high-availability webhook mutation according to the helm chart.

@kon-angelo kon-angelo requested review from a team as code owners November 29, 2024 15:35
@gardener-robot gardener-robot added area/control-plane Control plane related kind/enhancement Enhancement, improvement, extension platform/openstack OpenStack platform/infrastructure needs/review Needs review size/xs Size of pull request is tiny (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
@gardener-robot gardener-robot added the needs/rebase Needs git rebase label Nov 30, 2024
@gardener-robot
Copy link

@kon-angelo You need rebase this pull request with latest master branch. Please check.

@gardener-robot-ci-3 gardener-robot-ci-3 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 30, 2024
@gardener-robot-ci-2 gardener-robot-ci-2 removed 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 30, 2024
@gardener-robot-ci-3 gardener-robot-ci-3 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 30, 2024
@gardener-robot-ci-2 gardener-robot-ci-2 removed 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 30, 2024
Copy link
Contributor

@hebelsan hebelsan left a comment

Choose a reason for hiding this comment

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

/lgtm

@gardener-robot gardener-robot added reviewed/lgtm Has approval for merging and removed needs/rebase Needs git rebase needs/review Needs review labels Dec 1, 2024
@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 Dec 1, 2024
Copy link
Member

@MartinWeindel MartinWeindel left a comment

Choose a reason for hiding this comment

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

Looking into the code of the resource manager webhook, it will not work as expected.
See inline comment.

Comment on lines +10 to 13
high-availability-config.resources.gardener.cloud/replicas: {{ .Values.replicaCount }}
labels:
{{ include "labels" . | indent 4 }}
high-availability-config.resources.gardener.cloud/type: server
Copy link
Member

@MartinWeindel MartinWeindel Dec 4, 2024

Choose a reason for hiding this comment

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

If you look into the code of the resourcemanager webhook, you see that it would overwrite the value calculated by the presence of the label high-availability-config.resources.gardener.cloud/type: server. Instead of 2, we would have 3 according to the current values we are using in the ControllerDeployment

See: https://github.com/gardener/gardener/blob/ee2de9addf3f9b2842b2ba167aa3e0cca62e8dc7/pkg/resourcemanager/webhook/highavailabilityconfig/handler.go#L329

Instead I suggest to use the controller settings in this case.
See: https://github.com/gardener/gardener/blob/145d6c7a55b928c9c9df7049ccb340f777d53803/pkg/utils/kubernetes/highavailability_test.go#L30

Suggested change
high-availability-config.resources.gardener.cloud/replicas: {{ .Values.replicaCount }}
labels:
{{ include "labels" . | indent 4 }}
high-availability-config.resources.gardener.cloud/type: server
{{- if eq Values.replicaCount 1 }}
high-availability-config.resources.gardener.cloud/failure-tolerance-type: ""
{{- end }}
labels:
{{ include "labels" . | indent 4 }}
{{- if ne Values.replicaCount 1 }}
high-availability-config.resources.gardener.cloud/type: server
{{- else }}
high-availability-config.resources.gardener.cloud/type: controller
{{- end }}

Copy link
Member

Choose a reason for hiding this comment

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

As discussed off-line, this alternative relies on some detailed behaviour of the HA webhook, which makes it hard to understand.
Maybe an boolean flag to set the annotation high-availability-config.resources.gardener.cloud/replicas: "1" is a better solution for the moment.

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/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) platform/openstack OpenStack platform/infrastructure reviewed/lgtm Has approval for merging reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) size/xs Size of pull request is tiny (see gardener-robot robot/bots/size.py)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants