apache / camel-k

Apache Camel K is a lightweight integration platform, born on Kubernetes, with serverless superpowers
https://camel.apache.org/camel-k
Apache License 2.0
848 stars 345 forks source link

Add TLS configuration in the ingress trait #5635

Closed romain-pfund closed 1 week ago

romain-pfund commented 2 weeks ago

Requirement

As an integration developper using camel-k, I want to user TLS on my ingresses so I can securely contact my camel-k integrations

Problem

To fully configure TLS on an ingress, we need to set the spec.tls part (hosts and secretName). https://kubernetes.io/docs/concepts/services-networking/ingress/#tls But this is actually not covered by the actual ingress trait

Proposal

Implement this configuration properties:

ingress.tls.hosts      |  list[string]
ingress.tls.secretName |  string

to set

apiVersion: networking.k8s.io/v1
kind: Ingress
...
spec:
  tls:
  - hosts:
      - {{ingress.tls.hosts[]}}
    secretName: {{ingress.tls.secretName}}
 ...

Open questions

No response

squakez commented 2 weeks ago

Thanks. Contributions are welcomed as usual!

romain-pfund commented 2 weeks ago

I've never done Go development, I may look at it this weekend or monday From what I saw, I mainly on

squakez commented 2 weeks ago

I've never done Go development, I may look at it this weekend or monday From what I saw, I mainly on

* pkg/apis/camel/v1/trait/ingress.go

* pkg/trait/ingress.go

* pkg/trait/ingress_test.go

Yeah, that's correct. This particular development should not require the knowledge of the entire operator. If the unit tests are passing, then, we should be fine. Have a look at https://camel.apache.org/camel-k/next/contributing/developers.html and feel free to ping either here on in Zulip chat to get any support.

romain-pfund commented 2 weeks ago

hi, got trouble to test it on minikube. I've updated the 3 files, add a test in pkg/trait/ingress_test.go which is passing

From https://camel.apache.org/camel-k/2.3.x/contributing/developers.html#_for_minikube, ran

make
make images
./kamel install -olm=false

but I keep having Integration in version "v1" cannot be handled as a Integration: strict decoding error: unknown field "spec.traits.ingress.tlsHosts"

sure I'm missing a simple thing

squakez commented 2 weeks ago

Ah, yes, you need to make generate before making the image in order to regen the CRDs.