Skip to content

Commit e42c008

Browse files
authored
Merge pull request #218 from RedHatInsights/ingress-annotations
Ingress annotations
2 parents 406c072 + 43f9bdc commit e42c008

File tree

9 files changed

+269
-13
lines changed

9 files changed

+269
-13
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"`

api/v1alpha1/zz_generated.deepcopy.go

+7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/crd/bases/cloud.redhat.com_frontendenvironments.yaml

+7
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,13 @@ spec:
7272
hostname:
7373
description: Hostname
7474
type: string
75+
ingressAnnotations:
76+
additionalProperties:
77+
type: string
78+
description: |-
79+
Ingress annotations
80+
These annotations will be applied to the ingress objects created by the frontend
81+
type: object
7582
ingressClass:
7683
description: Ingress class
7784
type: string

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 {

deploy.yml

+8
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,14 @@ objects:
276276
hostname:
277277
description: Hostname
278278
type: string
279+
ingressAnnotations:
280+
additionalProperties:
281+
type: string
282+
description: 'Ingress annotations
283+
284+
These annotations will be applied to the ingress objects created
285+
by the frontend'
286+
type: object
279287
ingressClass:
280288
description: Ingress class
281289
type: string

docs/antora/modules/ROOT/pages/api_reference.adoc

+148-13
Original file line numberDiff line numberDiff line change
@@ -117,15 +117,12 @@ BundleList contains a list of Bundle
117117

118118

119119

120-
120+
Deprecated: Use ChromeNavItem instead, has to be switched for the updated reconciliation, needs to exist to prevent breaking changes for the Fronted resources and legacy NavItems attribute
121121

122122

123123

124124
.Appears In:
125125
****
126-
- xref:{anchor_prefix}-6github.com-redhatinsights-frontend-operator-api-v1alpha1-bundlespec[$$BundleSpec$$]
127-
- xref:{anchor_prefix}-6github.com-redhatinsights-frontend-operator-api-v1alpha1-computedbundle[$$ComputedBundle$$]
128-
- xref:{anchor_prefix}-6github.com-redhatinsights-frontend-operator-api-v1alpha1-extranavitem[$$ExtraNavItem$$]
129126
- xref:{anchor_prefix}-6github.com-redhatinsights-frontend-operator-api-v1alpha1-frontendspec[$$FrontendSpec$$]
130127
****
131128

@@ -209,10 +206,51 @@ BundleSpec defines the desired state of Bundle
209206
| *`appList`* __string array__ | | |
210207
| *`envName`* __string__ | | |
211208
| *`extraNavItems`* __xref:{anchor_prefix}-6github.com-redhatinsights-frontend-operator-api-v1alpha1-extranavitem[$$ExtraNavItem$$] array__ | | |
212-
| *`customNav`* __xref:{anchor_prefix}-6github.com-redhatinsights-frontend-operator-api-v1alpha1-bundlenavitem[$$BundleNavItem$$] array__ | | |
209+
| *`customNav`* __xref:{anchor_prefix}-6github.com-redhatinsights-frontend-operator-api-v1alpha1-chromenavitem[$$ChromeNavItem$$] array__ | | |
210+
|===
211+
212+
213+
214+
215+
[id="{anchor_prefix}-6github.com-redhatinsights-frontend-operator-api-v1alpha1-chromenavitem"]
216+
==== ChromeNavItem
217+
218+
219+
220+
221+
222+
223+
224+
.Appears In:
225+
****
226+
- xref:{anchor_prefix}-6github.com-redhatinsights-frontend-operator-api-v1alpha1-bundlespec[$$BundleSpec$$]
227+
- xref:{anchor_prefix}-6github.com-redhatinsights-frontend-operator-api-v1alpha1-chromenavitem[$$ChromeNavItem$$]
228+
- xref:{anchor_prefix}-6github.com-redhatinsights-frontend-operator-api-v1alpha1-computedbundle[$$ComputedBundle$$]
229+
- xref:{anchor_prefix}-6github.com-redhatinsights-frontend-operator-api-v1alpha1-extranavitem[$$ExtraNavItem$$]
230+
- xref:{anchor_prefix}-6github.com-redhatinsights-frontend-operator-api-v1alpha1-navigationsegment[$$NavigationSegment$$]
231+
****
232+
233+
[cols="20a,50a,15a,15a", options="header"]
213234
|===
235+
| Field | Description | Default | Validation
236+
| *`isHidden`* __boolean__ | | |
237+
| *`expandable`* __boolean__ | | |
238+
| *`href`* __string__ | | |
239+
| *`appId`* __string__ | | |
240+
| *`isExternal`* __boolean__ | | |
241+
| *`title`* __string__ | | |
242+
| *`groupId`* __string__ | | |
243+
| *`id`* __string__ | | |
244+
| *`product`* __string__ | | |
245+
| *`notifier`* __string__ | | |
246+
| *`icon`* __string__ | | |
247+
| *`isBeta`* __boolean__ | | |
248+
| *`navItems`* __xref:{anchor_prefix}-6github.com-redhatinsights-frontend-operator-api-v1alpha1-chromenavitem[$$ChromeNavItem$$] array__ | kubebuilder struggles validating recursive fields, it has to be helped a bit + | | Schemaless: {} +
214249

250+
| *`routes`* __xref:{anchor_prefix}-6github.com-redhatinsights-frontend-operator-api-v1alpha1-chromenavitem[$$ChromeNavItem$$] array__ | | | Schemaless: {} +
215251

252+
| *`permissions`* __xref:{anchor_prefix}-6github.com-redhatinsights-frontend-operator-api-v1alpha1-permission[$$Permission$$] array__ | | |
253+
|===
216254

217255

218256

@@ -260,7 +298,7 @@ EmbeddedRoutes allow deeply nested navs to have support for routes
260298
|===
261299
| Field | Description | Default | Validation
262300
| *`name`* __string__ | | |
263-
| *`navItem`* __xref:{anchor_prefix}-6github.com-redhatinsights-frontend-operator-api-v1alpha1-bundlenavitem[$$BundleNavItem$$]__ | | |
301+
| *`navItem`* __xref:{anchor_prefix}-6github.com-redhatinsights-frontend-operator-api-v1alpha1-chromenavitem[$$ChromeNavItem$$]__ | | |
264302
|===
265303

266304

@@ -406,6 +444,8 @@ FrontendEnvironmentSpec defines the desired state of FrontendEnvironment
406444
| Field | Description | Default | Validation
407445
| *`sso`* __string__ | Foo is an example field of FrontendEnvironment. Edit FrontendEnvironment_types.go to remove/update + | |
408446
| *`ingressClass`* __string__ | Ingress class + | |
447+
| *`ingressAnnotations`* __object (keys:string, values:string)__ | Ingress annotations +
448+
These annotations will be applied to the ingress objects created by the frontend + | |
409449
| *`hostname`* __string__ | Hostname + | |
410450
| *`whitelist`* __string array__ | Whitelist CIDRs + | |
411451
| *`monitoring`* __xref:{anchor_prefix}-6github.com-redhatinsights-frontend-operator-api-v1alpha1-monitoringconfig[$$MonitoringConfig$$]__ | MonitorMode determines where a ServiceMonitor object will be placed +
@@ -422,6 +462,7 @@ do this in epehemeral environments but not in production + | |
422462
| *`akamaiSecretName`* __string__ | The name of the secret we will use to get the akamai credentials + | |
423463
| *`targetNamespaces`* __string array__ | List of namespaces that should receive a copy of the frontend configuration as a config map +
424464
By configurations we mean the fed-modules.json, navigation files, etc. + | |
465+
| *`serviceCategories`* __xref:{anchor_prefix}-6github.com-redhatinsights-frontend-operator-api-v1alpha1-frontendservicecategory[$$FrontendServiceCategory$$]__ | For the ChromeUI to render additional global components + | |
425466
|===
426467

427468

@@ -470,6 +511,77 @@ FrontendList contains a list of Frontend
470511
|===
471512

472513

514+
[id="{anchor_prefix}-6github.com-redhatinsights-frontend-operator-api-v1alpha1-frontendservicecategory"]
515+
==== FrontendServiceCategory
516+
517+
518+
519+
FrontendServiceCategory defines the category to which service can inject ServiceTiles
520+
Chroming UI will use this to render the service dropdown component
521+
522+
523+
524+
.Appears In:
525+
****
526+
- xref:{anchor_prefix}-6github.com-redhatinsights-frontend-operator-api-v1alpha1-frontendenvironmentspec[$$FrontendEnvironmentSpec$$]
527+
****
528+
529+
[cols="20a,50a,15a,15a", options="header"]
530+
|===
531+
| Field | Description | Default | Validation
532+
| *`id`* __string__ | | |
533+
| *`title`* __string__ | | |
534+
| *`groups`* __xref:{anchor_prefix}-6github.com-redhatinsights-frontend-operator-api-v1alpha1-frontendservicecategorygroup[$$FrontendServiceCategoryGroup$$] array__ | | |
535+
|===
536+
537+
538+
539+
540+
[id="{anchor_prefix}-6github.com-redhatinsights-frontend-operator-api-v1alpha1-frontendservicecategorygroup"]
541+
==== FrontendServiceCategoryGroup
542+
543+
544+
545+
546+
547+
548+
549+
.Appears In:
550+
****
551+
- xref:{anchor_prefix}-6github.com-redhatinsights-frontend-operator-api-v1alpha1-frontendservicecategory[$$FrontendServiceCategory$$]
552+
****
553+
554+
[cols="20a,50a,15a,15a", options="header"]
555+
|===
556+
| Field | Description | Default | Validation
557+
| *`id`* __string__ | | |
558+
| *`title`* __string__ | | |
559+
|===
560+
561+
562+
[id="{anchor_prefix}-6github.com-redhatinsights-frontend-operator-api-v1alpha1-frontendservicecategorygroupgenerated"]
563+
==== FrontendServiceCategoryGroupGenerated
564+
565+
566+
567+
568+
569+
570+
571+
.Appears In:
572+
****
573+
- xref:{anchor_prefix}-6github.com-redhatinsights-frontend-operator-api-v1alpha1-frontendservicecategorygenerated[$$FrontendServiceCategoryGenerated$$]
574+
****
575+
576+
[cols="20a,50a,15a,15a", options="header"]
577+
|===
578+
| Field | Description | Default | Validation
579+
| *`id`* __string__ | | |
580+
| *`title`* __string__ | | |
581+
| *`tiles`* __xref:{anchor_prefix}-6github.com-redhatinsights-frontend-operator-api-v1alpha1-servicetile[$$ServiceTile$$]__ | | |
582+
|===
583+
584+
473585
[id="{anchor_prefix}-6github.com-redhatinsights-frontend-operator-api-v1alpha1-frontendspec"]
474586
==== FrontendSpec
475587

@@ -498,6 +610,7 @@ FrontendSpec defines the desired state of Frontend
498610
| *`serviceMonitor`* __xref:{anchor_prefix}-6github.com-redhatinsights-frontend-operator-api-v1alpha1-servicemonitorconfig[$$ServiceMonitorConfig$$]__ | | |
499611
| *`module`* __xref:{anchor_prefix}-6github.com-redhatinsights-frontend-operator-api-v1alpha1-fedmodule[$$FedModule$$]__ | | |
500612
| *`navItems`* __xref:{anchor_prefix}-6github.com-redhatinsights-frontend-operator-api-v1alpha1-bundlenavitem[$$BundleNavItem$$] array__ | | |
613+
| *`navigationSegments`* __xref:{anchor_prefix}-6github.com-redhatinsights-frontend-operator-api-v1alpha1-navigationsegment[$$NavigationSegment$$] array__ | navigation segments for the frontend + | |
501614
| *`assetsPrefix`* __string__ | | |
502615
| *`akamaiCacheBustDisable`* __boolean__ | Akamai cache bust opt-out + | |
503616
| *`akamaiCacheBustPaths`* __string array__ | Files to cache bust + | |
@@ -611,8 +724,8 @@ FrontendSpec defines the desired state of Frontend
611724
|===
612725

613726

614-
[id="{anchor_prefix}-6github.com-redhatinsights-frontend-operator-api-v1alpha1-permission"]
615-
==== Permission
727+
[id="{anchor_prefix}-6github.com-redhatinsights-frontend-operator-api-v1alpha1-navigationsegment"]
728+
==== NavigationSegment
616729

617730

618731

@@ -622,19 +735,39 @@ FrontendSpec defines the desired state of Frontend
622735

623736
.Appears In:
624737
****
625-
- xref:{anchor_prefix}-6github.com-redhatinsights-frontend-operator-api-v1alpha1-route[$$Route$$]
626-
- xref:{anchor_prefix}-6github.com-redhatinsights-frontend-operator-api-v1alpha1-widgetconfig[$$WidgetConfig$$]
738+
- xref:{anchor_prefix}-6github.com-redhatinsights-frontend-operator-api-v1alpha1-frontendspec[$$FrontendSpec$$]
627739
****
628740

629741
[cols="20a,50a,15a,15a", options="header"]
630742
|===
631743
| Field | Description | Default | Validation
632-
| *`method`* __string__ | | |
633-
| *`apps`* __string array__ | | |
634-
| *`args`* __link:https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.22/#json-v1-apiextensions-k8s-io[$$JSON$$]__ | | |
744+
| *`sectionId`* __string__ | | |
745+
| *`bundleId`* __string__ | Id of the bundle to which the segment should be injected + | |
746+
| *`position`* __integer__ | A position of the segment within the bundle +
747+
0 is the first position +
748+
The position "steps" should be at least 100 to make sure there is enough space in case some segments should be injected between existing ones + | |
749+
| *`navItems`* __xref:{anchor_prefix}-6github.com-redhatinsights-frontend-operator-api-v1alpha1-chromenavitem[$$ChromeNavItem$$]__ | | |
635750
|===
636751

637752

753+
[id="{anchor_prefix}-6github.com-redhatinsights-frontend-operator-api-v1alpha1-permission"]
754+
==== Permission
755+
756+
_Underlying type:_ _xref:{anchor_prefix}-6github.com-redhatinsights-frontend-operator-api-v1alpha1-struct-method string -json-method- yaml-method- apps -string -json-apps-omitempty- yaml-apps-omitempty- args -k8s-io-apiextensions-apiserver-pkg-apis-apiextensions-v1-json -json-args-omitempty- yaml-args-omitempty-[$$struct{Method string "json:\"method\" yaml:\"method\""; Apps []string "json:\"apps,omitempty\" yaml:\"apps,omitempty\""; Args *k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1.JSON "json:\"args,omitempty\" yaml:\"args,omitempty\""}$$]_
757+
758+
759+
760+
761+
762+
.Appears In:
763+
****
764+
- xref:{anchor_prefix}-6github.com-redhatinsights-frontend-operator-api-v1alpha1-chromenavitem[$$ChromeNavItem$$]
765+
- xref:{anchor_prefix}-6github.com-redhatinsights-frontend-operator-api-v1alpha1-route[$$Route$$]
766+
- xref:{anchor_prefix}-6github.com-redhatinsights-frontend-operator-api-v1alpha1-widgetconfig[$$WidgetConfig$$]
767+
****
768+
769+
770+
638771
[id="{anchor_prefix}-6github.com-redhatinsights-frontend-operator-api-v1alpha1-route"]
639772
==== Route
640773

@@ -721,6 +854,7 @@ FrontendSpec defines the desired state of Frontend
721854

722855
.Appears In:
723856
****
857+
- xref:{anchor_prefix}-6github.com-redhatinsights-frontend-operator-api-v1alpha1-frontendservicecategorygroupgenerated[$$FrontendServiceCategoryGroupGenerated$$]
724858
- xref:{anchor_prefix}-6github.com-redhatinsights-frontend-operator-api-v1alpha1-frontendspec[$$FrontendSpec$$]
725859
****
726860

@@ -732,6 +866,7 @@ FrontendSpec defines the desired state of Frontend
732866
| *`id`* __string__ | | |
733867
| *`href`* __string__ | | |
734868
| *`title`* __string__ | | |
869+
| *`description`* __string__ | | |
735870
| *`icon`* __string__ | | |
736871
| *`isExternal`* __boolean__ | | |
737872
|===
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
apiVersion: v1
3+
kind: Namespace
4+
metadata:
5+
name: test-ingress-annotations
6+
spec:
7+
finalizers:
8+
- kubernetes
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
---
2+
apiVersion: cloud.redhat.com/v1alpha1
3+
kind: FrontendEnvironment
4+
metadata:
5+
name: test-ingress-annotations-environment
6+
spec:
7+
generateNavJSON: false
8+
ssl: false
9+
hostname: foo.redhat.com
10+
sso: https://sso.foo.redhat.com
11+
ingressAnnotations:
12+
"nginx.ingress.kubernetes.io/rewrite-target" : "/"
13+
---
14+
apiVersion: cloud.redhat.com/v1alpha1
15+
kind: Frontend
16+
metadata:
17+
name: chrome
18+
namespace: test-ingress-annotations
19+
spec:
20+
API:
21+
versions:
22+
- v1
23+
frontend:
24+
paths:
25+
- /
26+
deploymentRepo: https://github.com/RedHatInsights/insights-chrome
27+
envName: test-ingress-annotations-environment
28+
image: quay.io/cloudservices/insights-chrome-frontend:720317c
29+
module:
30+
config:
31+
ssoUrl: 'https://'
32+
manifestLocation: /apps/chrome/js/fed-mods.json
33+
title: Chrome
34+

0 commit comments

Comments
 (0)