Skip to content

WIP: Application load balancer controller#3

Open
fischerman wants to merge 73 commits into
mainfrom
albc
Open

WIP: Application load balancer controller#3
fischerman wants to merge 73 commits into
mainfrom
albc

Conversation

@fischerman

Copy link
Copy Markdown
Member

No description provided.

@ske-prow ske-prow Bot added do-not-merge/needs-kind Indicates a PR lacks a `kind/foo` label and requires one. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Jun 24, 2026
@nschad nschad changed the title Draft: Application load balancer controller WIP: Application load balancer controller Jun 25, 2026
@ske-prow ske-prow Bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jun 25, 2026
@nschad

nschad commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

@fischerman either mark the PR as "Draft" or use "WIP" as the title. The PR will then automatically marked as WIP/Draft

@ske-prow

ske-prow Bot commented Jun 25, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign dergeberl for approval. For more information see the Code Review Process.

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

Details 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

@ske-prow ske-prow Bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jun 25, 2026
WithRule("my-host.local", WithPath("/", new(networkingv1.PathTypePrefix), service.Name, networkingv1.ServiceBackendPort{Number: 80})),
)
testutil.CreateKubernetesResourceAndDeferDeletion(ctx, k8sClient, &ingress)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We also shpuld check that the IP is set in the status of the ingress.

expected: true,
},
{
name: "https certificates changed",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

we should add the same but with also 2 Ids.

expected: true,
},
{
name: "target pool tls validation changed",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We should also add targets itself and test.

@@ -0,0 +1,302 @@
package ingress

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

In the update.go are multiple functions which also should be tested, like getServicesForIngresses, getTLSSecretsFromIngresses, getCertificatesForIngressClass. But also the logic for duplicateCerts should get tested.

"k8s.io/utils/ptr"
)

func Test_updateNeeded(t *testing.T) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

let's stick to ginkgo tests

)

Expect(errs).To(HaveLen(1))
Expect(errs[0].Description).To(Equal("invalid certificate: tls: failed to find any PEM data in certificate input"))

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Same as in test should return an error when the TLS secret isn't of type TLS

Expect(tree.GetMissingCertificates(nil)).To(ConsistOf(
WorkTreeCertificate{
PublicKey: testdata.FixtureTLS1PublicKey,
PrivateKey: testdata.FixtureTLS1PrivateKey,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This test is failing as the reutrn also contains Ports: {443: nil},

Suggested change
PrivateKey: testdata.FixtureTLS1PrivateKey,
PrivateKey: testdata.FixtureTLS1PrivateKey,
Ports: map[int16]any{443: nil},

Comment thread pkg/controller/ingress/spec/worktree.go Outdated

tree := &WorkTreeALB{
ingressClass: ingressClass,
planID: GetAnnotation(AnnotationPlanID, "", ingressClass),

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Should we validate that we only get working PlanIDs. For NLBs we check that in cloud-provider-stackit

@@ -0,0 +1,658 @@
package spec

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We should also add tests for:

  • the AnnotationHTTPSOnly and that it not serves HTTP.
  • the sorting based on AnnotationPriority and creation timestamp.
  • AnnotationPlanID
  • the handling when setting not allowed values in annotation (like no valid int/port, not valid cidr in source range)
  • GetUnusedCertificates

@@ -0,0 +1,85 @@
apiVersion: apps/v1

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We should align this with the deploy of CSI and CCM in cloud-provider-stackit (which are also not perfect, see stackitcloud/cloud-provider-stackit#1162).
For example:

  • we can use also the kube-system namespace as this is also a system component like CSI and CCM
  • the cloud config don't need to be a secret
  • the mount path of the service account and cloud config
  • the apiEndpoints don't need to be in the example (this is only internally needed)
  • lets also create a /deploy folder instead if the /samples/deploy/
  • we need to find a image tag which is working and don't need to be updated like latest (not sure if this will be tagged on release)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

With #6 we get a latest tag for tagged versions. Lets use that in the deployment.

Comment on lines +27 to +34
// +kubebuilder:rbac:groups=core,resources=services,verbs=get;list;watch
// +kubebuilder:rbac:groups=core,resources=secrets,verbs=get;list;watch
// +kubebuilder:rbac:groups=core,resources=nodes,verbs=get;list;watch
// +kubebuilder:rbac:groups=core,resources=events,verbs=create;patch
// +kubebuilder:rbac:groups=networking.k8s.io,resources=ingressclasses,verbs=get;list;watch;update;patch
// +kubebuilder:rbac:groups=networking.k8s.io,resources=ingresses,verbs=get;list;watch
// +kubebuilder:rbac:groups=networking.k8s.io,resources=ingresses/status,verbs=get;update;patch

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We don't use anything from kubebuilder in that repo, lets not add this here.

ConditionNodeTermination corev1.NodeConditionType = "Terminating"
)

func isNodeTerminating(node *corev1.Node) bool {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

That changes also need to be added to the nodePredicate().

Comment on lines +161 to +175
if !httpsOnly && (httpPort <= 0 || httpPort > math.MaxUint16) {
errors = append(errors, ErrorEvent{
Ingress: ingress,
Description: "HTTP port is out of range.",
})
continue
}
if len(ingress.Spec.TLS) > 0 && (httpsPort <= 0 || httpsPort > math.MaxUint16) {
errors = append(errors, ErrorEvent{
Ingress: ingress,
Description: "HTTPS port is out of range.",
})
continue
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We should add a test for that.

@ske-prow

ske-prow Bot commented Jun 30, 2026

Copy link
Copy Markdown

@fischerman: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
pull-application-load-balancer-controller-verify 3fec1b5 link true /test pull-application-load-balancer-controller-verify

Full PR test history. Your PR dashboard. Command help for this repository.
Please help us cut down on flakes by linking this test failure to an open flake report or filing a new flake report if you can't find an existing one. Also see the gardener testing guideline for how to avoid and hunt flakes.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

Comment on lines +76 to +78
albOpts := []sdkconfig.ConfigurationOption{
sdkconfig.WithUserAgent("application-load-balancer-controller"),
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The SDK client should use the instrumented HTTP client that collects metrics about API requests, especially failed requests.

Suggested change
albOpts := []sdkconfig.ConfigurationOption{
sdkconfig.WithUserAgent("application-load-balancer-controller"),
}
albOpts := []sdkconfig.ConfigurationOption{
sdkconfig.WithUserAgent("application-load-balancer-controller"),
sdkconfig.WithHTTPClient(metrics.NewInstrumentedHTTPClient()),
}

(stackitcloud/cloud-provider-stackit#1228 will extend the coverage of the metrics soon)

Comment on lines +83 to +85
certOpts := []sdkconfig.ConfigurationOption{
sdkconfig.WithUserAgent("application-load-balancer-controller"),
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

(see my comment above for albOpts)

Suggested change
certOpts := []sdkconfig.ConfigurationOption{
sdkconfig.WithUserAgent("application-load-balancer-controller"),
}
certOpts := []sdkconfig.ConfigurationOption{
sdkconfig.WithHTTPClient(metrics.NewInstrumentedHTTPClient()),
sdkconfig.WithUserAgent("application-load-balancer-controller"),
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

do-not-merge/needs-kind Indicates a PR lacks a `kind/foo` label and requires one. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants