knative / operator

Combined operator for Knative.
Apache License 2.0
181 stars 98 forks source link

Add possibility to assign annotations to Kourier LoadBalancer #1627

Closed timosur closed 4 months ago

timosur commented 8 months ago

Problem Currently it is not possible to assign annotations to the Kourier LoadBalancer. We currently have a hard requirement to do that as we need to set azure-load-balancer-internal annotation. Otherwise our LoadBalancer will just be rejected by our company Azure Policies.

Persona: Which persona is this feature for? System Operator

Exit Criteria A measurable (binary) test that would indicate that the problem has been resolved. It is possible to assign azure-load-balancer-internal to the Kourier LoadBalancer.

github-actions[bot] commented 5 months ago

This issue is stale because it has been open for 90 days with no activity. It will automatically close after 30 more days of inactivity. Reopen the issue with /reopen. Mark the issue as fresh by adding the comment /remove-lifecycle stale.

norbjd commented 4 months ago

Hello @timosur, we had a similar need (with another annotation), and found a solution by using the spec.services.annotations field in KnativeServing object:

$ kubectl explain knativeserving.spec.services.annotations
GROUP:      operator.knative.dev
KIND:       KnativeServing
VERSION:    v1beta1

FIELD: annotations <map[string]string>

DESCRIPTION:
    Annotations overrides labels for the service

To define annotations on kourier service, just use:

apiVersion: operator.knative.dev/v1beta1
kind: KnativeServing
metadata:
  name: knative-serving
  namespace: knative-serving
spec:
  ingress:
    kourier:
      enabled: true
  services:
    - name: kourier
      annotations:
        azure-load-balancer-internal: "the-value-you-want"

The kourier service will now have the azure-load-balancer-internal annotation. Hope that helps.