Skip to content

Commit

Permalink
Make monitoring stanza optional
Browse files Browse the repository at this point in the history
  • Loading branch information
psav committed Oct 14, 2022
1 parent a75ce34 commit 9357e53
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 22 deletions.
2 changes: 1 addition & 1 deletion api/v1alpha1/frontendenvironment_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ type FrontendEnvironmentSpec struct {
//MonitorMode determines where a ServiceMonitor object will be placed
// local will add it to the frontend's namespace
// app-interface will add it to "openshift-customer-monitoring"
Monitoring MonitoringConfig `json:"monitoring"`
Monitoring *MonitoringConfig `json:"monitoring,omitempty"`
}

type MonitoringConfig struct {
Expand Down
6 changes: 5 additions & 1 deletion api/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ spec:
type: string
type: array
required:
- monitoring
- sso
type: object
status:
Expand Down
10 changes: 5 additions & 5 deletions controllers/frontend_controller_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ var _ = Describe("Frontend controller with image", func() {
Spec: crd.FrontendEnvironmentSpec{
SSO: "https://something-auth",
Hostname: "something",
Monitoring: crd.MonitoringConfig{
Monitoring: &crd.MonitoringConfig{
Mode: "app-interface",
},
},
Expand Down Expand Up @@ -250,7 +250,7 @@ var _ = Describe("Frontend controller with service", func() {
"192.168.0.0/24",
"10.10.0.0/24",
},
Monitoring: crd.MonitoringConfig{
Monitoring: &crd.MonitoringConfig{
Mode: "local",
},
},
Expand Down Expand Up @@ -524,7 +524,7 @@ var _ = Describe("Frontend controller with chrome", func() {
Spec: crd.FrontendEnvironmentSpec{
SSO: "https://something-auth",
Hostname: "something",
Monitoring: crd.MonitoringConfig{
Monitoring: &crd.MonitoringConfig{
Mode: "app-interface",
},
},
Expand Down Expand Up @@ -672,7 +672,7 @@ var _ = Describe("ServiceMonitor Creation", func() {
Spec: crd.FrontendEnvironmentSpec{
SSO: "https://something-auth",
Hostname: "something",
Monitoring: crd.MonitoringConfig{
Monitoring: &crd.MonitoringConfig{
Mode: "app-interface",
},
},
Expand Down Expand Up @@ -875,7 +875,7 @@ var _ = Describe("Dependencies", func() {
Spec: crd.FrontendEnvironmentSpec{
SSO: "https://something-auth",
Hostname: "something",
Monitoring: crd.MonitoringConfig{
Monitoring: &crd.MonitoringConfig{
Mode: "app-interface",
},
},
Expand Down
2 changes: 1 addition & 1 deletion controllers/reconcile.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func (r *FrontendReconciliation) run() error {
return err
}

if !r.Frontend.Spec.ServiceMonitor.Disabled && !r.FrontendEnvironment.Spec.Monitoring.Disabled {
if r.FrontendEnvironment.Spec.Monitoring != nil && !r.Frontend.Spec.ServiceMonitor.Disabled && !r.FrontendEnvironment.Spec.Monitoring.Disabled {
if err := r.createServiceMonitor(); err != nil {
return err
}
Expand Down
1 change: 0 additions & 1 deletion deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,6 @@ objects:
type: string
type: array
required:
- monitoring
- sso
type: object
status:
Expand Down
35 changes: 23 additions & 12 deletions docs/antora/modules/ROOT/pages/api_reference.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ BundleList contains a list of Bundle
| *`kind`* __string__ | `BundleList`
| *`metadata`* __link:https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.22/#listmeta-v1-meta[$$ListMeta$$]__ | Refer to Kubernetes API documentation for fields of `metadata`.

| *`items`* __xref:{anchor_prefix}-github-com-redhatinsights-frontend-operator-api-v1alpha1-bundle[$$Bundle$$]__ |
| *`items`* __xref:{anchor_prefix}-github-com-redhatinsights-frontend-operator-api-v1alpha1-bundle[$$Bundle$$] array__ |
|===


Expand Down Expand Up @@ -104,8 +104,8 @@ BundleList contains a list of Bundle
| *`product`* __string__ |
| *`isExternal`* __boolean__ |
| *`filterable`* __boolean__ |
| *`permissions`* __xref:{anchor_prefix}-github-com-redhatinsights-frontend-operator-api-v1alpha1-bundlepermission[$$BundlePermission$$]__ |
| *`routes`* __xref:{anchor_prefix}-github-com-redhatinsights-frontend-operator-api-v1alpha1-embeddedroute[$$EmbeddedRoute$$]__ |
| *`permissions`* __xref:{anchor_prefix}-github-com-redhatinsights-frontend-operator-api-v1alpha1-bundlepermission[$$BundlePermission$$] array__ |
| *`routes`* __xref:{anchor_prefix}-github-com-redhatinsights-frontend-operator-api-v1alpha1-embeddedroute[$$EmbeddedRoute$$] array__ |
| *`expandable`* __boolean__ |
| *`dynamicNav`* __string__ |
|===
Expand All @@ -126,10 +126,20 @@ BundleList contains a list of Bundle
|===
| Field | Description
| *`method`* __string__ |
| *`args`* __string array__ |
| *`args`* __string array array__ |
|===


[id="{anchor_prefix}-github-com-redhatinsights-frontend-operator-api-v1alpha1-bundlepermissionargs"]
==== BundlePermissionArgs



.Appears In:
****
- xref:{anchor_prefix}-github-com-redhatinsights-frontend-operator-api-v1alpha1-bundlepermission[$$BundlePermission$$]
****



[id="{anchor_prefix}-github-com-redhatinsights-frontend-operator-api-v1alpha1-bundlespec"]
Expand All @@ -149,8 +159,8 @@ BundleSpec defines the desired state of Bundle
| *`title`* __string__ |
| *`appList`* __string array__ |
| *`envName`* __string__ |
| *`extraNavItems`* __xref:{anchor_prefix}-github-com-redhatinsights-frontend-operator-api-v1alpha1-extranavitem[$$ExtraNavItem$$]__ |
| *`customNav`* __xref:{anchor_prefix}-github-com-redhatinsights-frontend-operator-api-v1alpha1-bundlenavitem[$$BundleNavItem$$]__ |
| *`extraNavItems`* __xref:{anchor_prefix}-github-com-redhatinsights-frontend-operator-api-v1alpha1-extranavitem[$$ExtraNavItem$$] array__ |
| *`customNav`* __xref:{anchor_prefix}-github-com-redhatinsights-frontend-operator-api-v1alpha1-bundlenavitem[$$BundleNavItem$$] array__ |
|===


Expand Down Expand Up @@ -291,7 +301,7 @@ FrontendEnvironmentList contains a list of FrontendEnvironment
| *`kind`* __string__ | `FrontendEnvironmentList`
| *`metadata`* __link:https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.22/#listmeta-v1-meta[$$ListMeta$$]__ | Refer to Kubernetes API documentation for fields of `metadata`.

| *`items`* __xref:{anchor_prefix}-github-com-redhatinsights-frontend-operator-api-v1alpha1-frontendenvironment[$$FrontendEnvironment$$]__ |
| *`items`* __xref:{anchor_prefix}-github-com-redhatinsights-frontend-operator-api-v1alpha1-frontendenvironment[$$FrontendEnvironment$$] array__ |
|===


Expand Down Expand Up @@ -349,7 +359,7 @@ FrontendList contains a list of Frontend
| *`kind`* __string__ | `FrontendList`
| *`metadata`* __link:https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.22/#listmeta-v1-meta[$$ListMeta$$]__ | Refer to Kubernetes API documentation for fields of `metadata`.

| *`items`* __xref:{anchor_prefix}-github-com-redhatinsights-frontend-operator-api-v1alpha1-frontend[$$Frontend$$]__ |
| *`items`* __xref:{anchor_prefix}-github-com-redhatinsights-frontend-operator-api-v1alpha1-frontend[$$Frontend$$] array__ |
|===


Expand All @@ -375,9 +385,8 @@ FrontendSpec defines the desired state of Frontend
| *`service`* __string__ |
| *`serviceMonitor`* __xref:{anchor_prefix}-github-com-redhatinsights-frontend-operator-api-v1alpha1-servicemonitorconfig[$$ServiceMonitorConfig$$]__ |
| *`module`* __xref:{anchor_prefix}-github-com-redhatinsights-frontend-operator-api-v1alpha1-fedmodule[$$FedModule$$]__ |
| *`navItems`* __xref:{anchor_prefix}-github-com-redhatinsights-frontend-operator-api-v1alpha1-bundlenavitem[$$BundleNavItem$$]__ |
| *`navItems`* __xref:{anchor_prefix}-github-com-redhatinsights-frontend-operator-api-v1alpha1-bundlenavitem[$$BundleNavItem$$] array__ |
| *`assetsPrefix`* __string__ |
| *`customConfig`* __JSON__ |
|===


Expand Down Expand Up @@ -405,8 +414,8 @@ FrontendSpec defines the desired state of Frontend
| *`filterable`* __boolean__ |
| *`expandable`* __boolean__ |
| *`notifier`* __string__ |
| *`routes`* __xref:{anchor_prefix}-github-com-redhatinsights-frontend-operator-api-v1alpha1-embeddedroute[$$EmbeddedRoute$$]__ |
| *`permissions`* __xref:{anchor_prefix}-github-com-redhatinsights-frontend-operator-api-v1alpha1-bundlepermission[$$BundlePermission$$]__ |
| *`routes`* __xref:{anchor_prefix}-github-com-redhatinsights-frontend-operator-api-v1alpha1-embeddedroute[$$EmbeddedRoute$$] array__ |
| *`permissions`* __xref:{anchor_prefix}-github-com-redhatinsights-frontend-operator-api-v1alpha1-bundlepermission[$$BundlePermission$$] array__ |
|===


Expand All @@ -426,6 +435,8 @@ FrontendSpec defines the desired state of Frontend
| *`id`* __string__ |
| *`module`* __string__ |
| *`routes`* __xref:{anchor_prefix}-github-com-redhatinsights-frontend-operator-api-v1alpha1-route[$$Route$$] array__ |
| *`dependencies`* __string array__ |
| *`optionalDependencies`* __string array__ |
|===


Expand Down

0 comments on commit 9357e53

Please sign in to comment.