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

✨ Allow adding custom HA proxy config for CAPD load balancer #8785

Merged
merged 2 commits into from
Jul 21, 2023
Merged

✨ Allow adding custom HA proxy config for CAPD load balancer #8785

merged 2 commits into from
Jul 21, 2023

Conversation

alexander-demicev
Copy link
Contributor

What this PR does / why we need it:

Allow adding custom HA proxy config for CAPD load balancer. With this change, an additional load balancer configuration can be added using a config map. For more details see #7684

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):
Fixes #7684

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jun 5, 2023
@alexander-demicev
Copy link
Contributor Author

/test pull-cluster-api-e2e-full-main

// should be equal to 'value'.
// The content of the config map will be appended to the HAProxy config file. Please use it with caution,
// as there are no checks to ensure the validity of the configuration.
AdditionalProxyConfigRef *corev1.LocalObjectReference `json:"additionalProxyConfigRef,omitempty"`
Copy link
Member

Choose a reason for hiding this comment

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

What about

Suggested change
AdditionalProxyConfigRef *corev1.LocalObjectReference `json:"additionalProxyConfigRef,omitempty"`
UnsafeHAProxyConfigTemplateRef *corev1.LocalObjectReference `json:"additionalProxyConfigRef,omitempty"`

So we are explicity about "use at your own risk"; also, dropped additional according to latest discussion in the issue (it should be replace)

test/infrastructure/docker/internal/docker/loadbalancer.go Outdated Show resolved Hide resolved
@alexander-demicev
Copy link
Contributor Author

/test pull-cluster-api-e2e-full-main

// where the key is the server name and the value is the address. This map is dynamic and is updated every time a new control plane
// node is added or removed. The template will also support the JoinHostPort function to join the host and port of the backend server.
// +optional
UnsafeHAProxyConfigTemplateRef *corev1.LocalObjectReference `json:"additionalProxyConfigRef,omitempty"`
Copy link
Member

Choose a reason for hiding this comment

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

Not sure i like the use of Unsafe as that sounds scary 💀 Could we use something like CustomHAProxyConfigTemplateRef or CustomLoadBalancerConfigRef

@@ -53,6 +54,17 @@ type DockerClusterSpec struct {
type DockerLoadBalancer struct {
// ImageMeta allows customizing the image used for the cluster load balancer.
ImageMeta `json:",inline"`

// UnsafeHAProxyConfigTemplateRef allows you to replace the HAProxy config file.
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
// UnsafeHAProxyConfigTemplateRef allows you to replace the HAProxy config file.
// UnsafeHAProxyConfigTemplateRef allows you to replace the default HAProxy config file.

test/infrastructure/docker/internal/loadbalancer/config.go Outdated Show resolved Hide resolved
Copy link
Member

@fabriziopandini fabriziopandini left a comment

Choose a reason for hiding this comment

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

Just two nits from my side

@fabriziopandini
Copy link
Member

/lgtm
@chrischdi @elmiko PTAL

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jul 4, 2023
@k8s-ci-robot
Copy link
Contributor

LGTM label has been added.

Git tree hash: 3a72949a4180f9981c207ba1a3e11e0ee06455e0

Copy link
Member

@chrischdi chrischdi left a comment

Choose a reason for hiding this comment

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

Some smaller nits :-)

@k8s-ci-robot k8s-ci-robot added needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. and removed lgtm "Looks good to me", indicates that a PR is ready to be merged. labels Jul 8, 2023
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 10, 2023
@alexander-demicev
Copy link
Contributor Author

@chrischdi Thanks! all fixed

@fabriziopandini
Copy link
Member

/test pull-cluster-api-e2e-full-main

@fabriziopandini
Copy link
Member

/lgtm
Waiting for a final test run before approving

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jul 10, 2023
@k8s-ci-robot
Copy link
Contributor

LGTM label has been added.

Git tree hash: 166a5864042e1fdafd44a0bb9313586112cb1747

Copy link
Member

@chrischdi chrischdi left a comment

Choose a reason for hiding this comment

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

One last nit but also ok to do it in a follow up :-)

As of that lgtm 👍

// where the key is the server name and the value is the address. This map is dynamic and is updated every time a new control plane
// node is added or removed. The template will also support the JoinHostPort function to join the host and port of the backend server.
// +optional
UnsafeHAProxyConfigTemplateRef *corev1.LocalObjectReference `json:"unsafeHAProxyConfigTemplateRef,omitempty"`
Copy link
Member

Choose a reason for hiding this comment

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

Re-raising this as i think it got lost.

Not sure i like the use of Unsafe as that sounds scary 💀 Could we use something like CustomHAProxyConfigTemplateRef or CustomLoadBalancerConfigRef ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't have a strong opinion here, not sure what other think

Copy link
Member

Choose a reason for hiding this comment

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

No big opinions on my side either :-) I think the unsafe comes from:

Let's [...] make sure to clearly document the contract about it: e.g. no validation, use at your own risk, etc.

[0]

Copy link
Member

Choose a reason for hiding this comment

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

There are a number of areas where there is no/little validation, and you can do lots of damage. For example PreKubeadmCommands.

If we have a warning in the documentation of the field that states "you better know what you are doing" then that's probably enough.

Copy link
Member

Choose a reason for hiding this comment

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

I agree with Richard. I think we don't need Unsafe in the field name

There are so many ways to misconfigure Cluster API easily in which it's totally impossible for us to validate. I think it's not necessary to additional communicate it here by adding an Unsafe prefix to the field.

@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jul 12, 2023
Copy link
Member

@chrischdi chrischdi left a comment

Choose a reason for hiding this comment

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

/lgtm

pending the naming discussion :-)

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jul 12, 2023
@k8s-ci-robot
Copy link
Contributor

LGTM label has been added.

Git tree hash: 6b2485fb36b25688ff1f397857d201b8b0c177e2

@sbueringer
Copy link
Member

/lgtm

pending getting consensus on the field name (no strong opinion from my side)

@fabriziopandini
Copy link
Member

/unassign

@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jul 19, 2023
@richardcase
Copy link
Member

Thanks @alexander-demicev for the name change :) For me:

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jul 19, 2023
@k8s-ci-robot
Copy link
Contributor

LGTM label has been added.

Git tree hash: 616f0c5b39a6ea9067b2d43db9842dc741bd4f5f

@fabriziopandini
Copy link
Member

/lgtm

@sbueringer
Copy link
Member

Thank you very much!

/lgtm
/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: sbueringer

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jul 21, 2023
@k8s-ci-robot k8s-ci-robot merged commit de0ed1e into kubernetes-sigs:main Jul 21, 2023
19 checks passed
@k8s-ci-robot k8s-ci-robot added this to the v1.6 milestone Jul 21, 2023
@alexander-demicev alexander-demicev deleted the capdloadbalancer branch July 21, 2023 12:34
@g-gaston
Copy link
Contributor

/area provider/infrastructure-docker

@k8s-ci-robot k8s-ci-robot added the area/provider/infrastructure-docker Issues or PRs related to the docker infrastructure provider label Oct 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. area/provider/infrastructure-docker Issues or PRs related to the docker infrastructure provider cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support custom HA proxy config in CAPD
7 participants