lsergio opened a new issue, #5401:
URL: https://github.com/apache/camel-k/issues/5401
### What happened?
Create an integration that uses annotations on the knative-service trait, as
in this example:
```
apiVersion: camel.apache.org/v1
kind: Integration
metadata:
name: annotations-test
spec:
sources:
- name: main.groovy
content: |-
from('rest:get:/test')
.log("It Worked!")
traits:
knative-service:
enabled: true
annotations:
autoscaling.knative.dev/class: "hpa.autoscaling.knative.dev"
autoscaling.knative.dev/metric: "cpu"
autoscaling.knative.dev/target: "75"
autoscaling.knative.dev/minScale: "1"
autoscaling.knative.dev/maxScale: "10"
```
Apply this content to your kubernetes cluster and monitor the operator logs.
It will display an error when creating the Knative Service object:
```
{"level":"error","ts":"2024-04-22T20:27:22Z","msg":"Reconciler
error","controller":"integration-controller","controllerGroup":"camel.apache.org","controllerKind":"Integration","Integration":{"name":"annotations-test","namespace":"a1b2c3d4e5"},"namespace":"a1b2c3d4e5","name":"annotations-test","reconcileID":"63b0dd87-66be-4641-80b4-697349eeacf0","error":"error
executing post actions: error during apply resource:
a1b2c3d4e5/annotations-test: admission webhook
\"validation.webhook.serving.knative.dev\" denied the request: validation
failed: invalid key name \"autoscaling.knative.dev/class\":
metadata.annotations\nautoscaling annotations must be put under
\"spec.template.metadata.annotations\" to work\ninvalid key name
\"autoscaling.knative.dev/maxScale\": metadata.annotations\nautoscaling
annotations must be put under \"spec.template.metadata.annotations\" to
work\ninvalid key name \"autoscaling.knative.dev/metric\":
metadata.annotations\nautoscaling annotations must be put under \"s
pec.template.metadata.annotations\" to work\ninvalid key name
\"autoscaling.knative.dev/minScale\": metadata.annotations\nautoscaling
annotations must be put under \"spec.template.metadata.annotations\" to
work\ninvalid key name \"autoscaling.knative.dev/target\":
metadata.annotations\nautoscaling annotations must be put under
\"spec.template.metadata.annotations\" to
work","stacktrace":"sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).reconcileHandler\n\tsigs.k8s.io/[email protected]/pkg/internal/controller/controller.go:324\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).processNextWorkItem\n\tsigs.k8s.io/[email protected]/pkg/internal/controller/controller.go:265\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Start.func2.2\n\tsigs.k8s.io/[email protected]/pkg/internal/controller/controller.go:226"}
```
### Steps to reproduce
_No response_
### Relevant log output
_No response_
### Camel K version
v2.2.0
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]