Skip to content

Commit bcc91a7

Browse files
committedOct 31, 2024
Add arbitrary annotations to ingresses via FrontendEnvironment
1 parent fabc1c1 commit bcc91a7

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed
 

‎api/v1alpha1/frontendenvironment_types.go

+3
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,9 @@ type FrontendEnvironmentSpec struct {
6161

6262
// Ingress class
6363
IngressClass string `json:"ingressClass,omitempty"`
64+
// Ingress annotations
65+
// These annotations will be applied to the ingress objects created by the frontend
66+
IngressAnnotations map[string]string `json:"ingressAnnotations,omitempty"`
6467

6568
// Hostname
6669
Hostname string `json:"hostname,omitempty"`

‎controllers/reconcile.go

+11
Original file line numberDiff line numberDiff line change
@@ -658,6 +658,17 @@ func (r *FrontendReconciliation) createAnnotationsAndPopulate(nn types.Namespace
658658
ingressClass = "nginx"
659659
}
660660

661+
if r.FrontendEnvironment.Spec.IngressAnnotations != nil {
662+
annotations := netobj.GetAnnotations()
663+
if annotations == nil {
664+
annotations = map[string]string{}
665+
}
666+
for k, v := range r.FrontendEnvironment.Spec.IngressAnnotations {
667+
annotations[k] = v
668+
}
669+
netobj.SetAnnotations(annotations)
670+
}
671+
661672
if len(r.FrontendEnvironment.Spec.Whitelist) != 0 {
662673
annotations := netobj.GetAnnotations()
663674
if annotations == nil {

0 commit comments

Comments
 (0)
Please sign in to comment.