This is an automated email from the ASF dual-hosted git repository. astefanutti pushed a commit to branch release-1.12.x in repository https://gitbox.apache.org/repos/asf/camel-k.git
commit cd3833e40bb111d16865fdda63c8fae3ed9331ac Author: Antonin Stefanutti <anto...@stefanutti.fr> AuthorDate: Tue Feb 28 15:17:24 2023 +0100 feat: Add annotations option to ingress trait --- pkg/apis/camel/v1/trait/ingress.go | 4 ++++ pkg/trait/ingress.go | 10 ++++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/pkg/apis/camel/v1/trait/ingress.go b/pkg/apis/camel/v1/trait/ingress.go index 3d93f4aa1..6a0ee71c6 100644 --- a/pkg/apis/camel/v1/trait/ingress.go +++ b/pkg/apis/camel/v1/trait/ingress.go @@ -25,6 +25,10 @@ package trait // +camel-k:trait=ingress. type IngressTrait struct { Trait `property:",squash" json:",inline"` + // The annotations added to the ingress. + // This can be used to set controller specific annotations, e.g., when using the NGINX Ingress controller: + // See https://github.com/kubernetes/ingress-nginx/blob/main/docs/user-guide/nginx-configuration/annotations.md + Annotations map[string]string `property:"annotations" json:"annotations,omitempty"` // To configure the host exposed by the ingress. Host string `property:"host" json:"host,omitempty"` // To configure the path exposed by the ingress (default `/`). diff --git a/pkg/trait/ingress.go b/pkg/trait/ingress.go index ea9eb0a44..8f0243cfa 100644 --- a/pkg/trait/ingress.go +++ b/pkg/trait/ingress.go @@ -39,8 +39,9 @@ func newIngressTrait() Trait { return &ingressTrait{ BaseTrait: NewBaseTrait("ingress", 2400), IngressTrait: traitv1.IngressTrait{ - Host: "", - Path: "/", + Annotations: map[string]string{}, + Host: "", + Path: "/", }, } } @@ -94,8 +95,9 @@ func (t *ingressTrait) Apply(e *Environment) error { APIVersion: networkingv1.SchemeGroupVersion.String(), }, ObjectMeta: metav1.ObjectMeta{ - Name: service.Name, - Namespace: service.Namespace, + Name: service.Name, + Namespace: service.Namespace, + Annotations: t.Annotations, }, Spec: networkingv1.IngressSpec{ Rules: []networkingv1.IngressRule{