You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by as...@apache.org on 2023/03/02 07:42:03 UTC
[camel-k] 02/08: feat: Add annotations option to ingress trait
This is an automated email from the ASF dual-hosted git repository.
astefanutti pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-k.git
commit 6edfeaf42759679a884ee9d633ecefc3261aa887
Author: Antonin Stefanutti <an...@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{