Skip to content

Commit

Permalink
RHIDP-1703: Revert querying of OCP Cluster Ingress
Browse files Browse the repository at this point in the history
Revert the automatic querying of the OCP Cluster Ingress for the domain
to use for the clusterRouterBase as regular users do not have access
to this resource, only cluster admins.
  • Loading branch information
coreydaley committed Mar 21, 2024
1 parent 7746cf2 commit 93d52bb
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 25 deletions.
2 changes: 1 addition & 1 deletion charts/backstage/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,4 @@ sources:
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 2.15.0
version: 2.15.1
17 changes: 12 additions & 5 deletions charts/backstage/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,15 @@ helm repo add redhat-developer https://redhat-developer.github.io/rhdh-chart

Once the chart has been added, install this chart. However before doing so, please review the default `values.yaml` and adjust as needed.

- To get proper connection between frontend and backend of Backstage please update the `apps.example.com` to match your cluster host:

```yaml
global:
clusterRouterBase: apps.example.com
```

> Tip: you can use `helm upgrade -i --set global.clusterRouterBase=apps.example.com ...` instead of a value file
- If your cluster doesn't provide PVCs, you should disable PostgreSQL persistence via:

```yaml
Expand Down Expand Up @@ -128,11 +137,11 @@ Kubernetes: `>= 1.25.0-0`
| global.auth.backend.enabled | Enable backend service to service authentication, unless configured otherwise it generates a secret value | bool | `true` |
| global.auth.backend.existingSecret | Instead of generating a secret value, refer to existing secret | string | `""` |
| global.auth.backend.value | Instead of generating a secret value, use the following value | string | `""` |
| global.clusterRouterBase | Shorthand for users who do not want to specify a custom HOSTNAME. Used ONLY with the DEFAULT upstream.backstage.appConfig value and with OCP Route enabled. | string | `""` |
| global.clusterRouterBase | Shorthand for users who do not want to specify a custom HOSTNAME. Used ONLY with the DEFAULT upstream.backstage.appConfig value and with OCP Route enabled. | string | `"apps.example.com"` |
| global.dynamic.includes | Array of YAML files listing dynamic plugins to include with those listed in the `plugins` field. Relative paths are resolved from the working directory of the initContainer that will install the plugins (`/opt/app-root/src`). | list | `["dynamic-plugins.default.yaml"]` |
| global.dynamic.includes[0] | List of dynamic plugins included inside the `janus-idp/backstage-showcase` container image, some of which are disabled by default. This file ONLY works with the `janus-idp/backstage-showcase` container image. | string | `"dynamic-plugins.default.yaml"` |
| global.dynamic.plugins | List of dynamic plugins, possibly overriding the plugins listed in `includes` files. Every item defines the plugin `package` as a [NPM package spec](https://docs.npmjs.com/cli/v10/using-npm/package-spec), an optional `pluginConfig` with plugin-specific backstage configuration, and an optional `disabled` flag to disable/enable a plugin listed in `includes` files. It also includes an `integrity` field that is used to verify the plugin package [integrity](https://w3c.github.io/webappsec-subresource-integrity/#integrity-metadata-description). | list | `[]` |
| global.host | Custom hostname shorthand, overrides `global.clusterRouterBase`, `upstream.ingress.host`, `route.host`, and url values in `upstream.backstage.appConfig`. If neither `global.clusterRouterBase` nor `global.host` are set, the helm chart will attempt to autofill with the hostname of the [OCP Ingress configuration](https://access.redhat.com/documentation/en-us/openshift_container_platform/4.14/html/networking/configuring-ingress#nw-installation-ingress-config-asset_configuring-ingress) | string | `""` |
| global.host | Custom hostname shorthand, overrides `global.clusterRouterBase`, `upstream.ingress.host`, `route.host`, and url values in `upstream.backstage.appConfig`. | string | `""` |
| route | OpenShift Route parameters | object | `{"annotations":{},"enabled":true,"host":"{{ .Values.global.host }}","path":"/","tls":{"caCertificate":"","certificate":"","destinationCACertificate":"","enabled":true,"insecureEdgeTerminationPolicy":"Redirect","key":"","termination":"edge"},"wildcardPolicy":"None"}` |
| route.annotations | Route specific annotations | object | `{}` |
| route.enabled | Enable the creation of the route resource | bool | `true` |
Expand Down Expand Up @@ -193,8 +202,6 @@ OpenShift routes are enabled by default. In order to use the chart without it, p

Routes can be further configured via the `route` field.

By default, the chart expects you to expose Backstage via the autogenerated hostname, which is automatically obtained from the OpenShift Ingress Configurations.

To manually provide the Backstage pod with the right context, please add the following value:

```yaml
Expand Down Expand Up @@ -239,7 +246,7 @@ In order to deploy this chart on vanilla Kubernetes or any other non-OCP platfor
```yaml
# values.yaml
global:
host: # Specify your own Ingress host as automatic hostname discovery is not supported outside of OpenShift
host: # Specify your own Ingress host
route:
enabled: false # OpenShift Routes do not exist on vanilla Kubernetes
upstream:
Expand Down
13 changes: 10 additions & 3 deletions charts/backstage/README.md.gotmpl
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,15 @@ helm repo add redhat-developer https://redhat-developer.github.io/rhdh-chart

Once the chart has been added, install this chart. However before doing so, please review the default `values.yaml` and adjust as needed.

- To get proper connection between frontend and backend of Backstage please update the `apps.example.com` to match your cluster host:

```yaml
global:
clusterRouterBase: apps.example.com
```

> Tip: you can use `helm upgrade -i --set global.clusterRouterBase=apps.example.com ...` instead of a value file

- If your cluster doesn't provide PVCs, you should disable PostgreSQL persistence via:

```yaml
Expand Down Expand Up @@ -149,8 +158,6 @@ OpenShift routes are enabled by default. In order to use the chart without it, p

Routes can be further configured via the `route` field.

By default, the chart expects you to expose Backstage via the autogenerated hostname, which is automatically obtained from the OpenShift Ingress Configurations.

To manually provide the Backstage pod with the right context, please add the following value:

```yaml
Expand Down Expand Up @@ -195,7 +202,7 @@ In order to deploy this chart on vanilla Kubernetes or any other non-OCP platfor
```yaml
# values.yaml
global:
host: # Specify your own Ingress host as automatic hostname discovery is not supported outside of OpenShift
host: # Specify your own Ingress host
route:
enabled: false # OpenShift Routes do not exist on vanilla Kubernetes
upstream:
Expand Down
12 changes: 1 addition & 11 deletions charts/backstage/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,8 @@ Returns custom hostname
{{- .Values.global.host -}}
{{- else if .Values.global.clusterRouterBase -}}
{{- printf "%s-%s.%s" (include "common.names.fullname" .) .Release.Namespace .Values.global.clusterRouterBase -}}
{{/*
Attempt to obtain a fallback value for the hostname from the openshift cluster if both global.host and global.clusterRouterBase are "" and if deployed on Openshift
*/}}
{{- else if .Capabilities.APIVersions.Has "config.openshift.io/v1/Ingress" }}
{{- $cluster := (lookup "config.openshift.io/v1" "Ingress" "" "cluster") -}}
{{- if and (hasKey $cluster "spec") (hasKey $cluster.spec "domain") }}
{{- printf "%s-%s.%s" (include "common.names.fullname" .) .Release.Namespace $cluster.spec.domain -}}
{{- else -}}
{{ fail "Unable to generate hostname, OCP Ingress Resource is missing `spec.domain` field. Please provide a valid hostname in `global.host` or `global.clusterRouterBase` instead" }}
{{- end }}
{{- else -}}
{{ fail "Unable to generate hostname, please provide a valid hostname in `global.host` or `global.clusterRouterBase`" }}
{{ fail "Unable to generate hostname" }}
{{- end -}}
{{- end -}}

Expand Down
4 changes: 2 additions & 2 deletions charts/backstage/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"type": "object"
},
"clusterRouterBase": {
"default": "",
"default": "apps.example.com",
"title": "Shorthand for users who do not want to specify a custom HOSTNAME. Used ONLY with the DEFAULT upstream.backstage.appConfig value and with OCP Route enabled.",
"type": "string"
},
Expand Down Expand Up @@ -6996,4 +6996,4 @@
},
"title": "Root Schema",
"type": "object"
}
}
2 changes: 1 addition & 1 deletion charts/backstage/values.schema.tmpl.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"clusterRouterBase": {
"title": "Shorthand for users who do not want to specify a custom HOSTNAME. Used ONLY with the DEFAULT upstream.backstage.appConfig value and with OCP Route enabled.",
"type": "string",
"default": ""
"default": "apps.example.com"
},
"host": {
"title": "Custom hostname shorthand, overrides `global.clusterRouterBase`, `upstream.ingress.host`, `route.host`, and url values in `upstream.backstage.appConfig`",
Expand Down
3 changes: 1 addition & 2 deletions charts/backstage/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,8 @@ global:
plugins: []

# -- Shorthand for users who do not want to specify a custom HOSTNAME. Used ONLY with the DEFAULT upstream.backstage.appConfig value and with OCP Route enabled.
clusterRouterBase: ""
clusterRouterBase: "apps.example.com"
# -- Custom hostname shorthand, overrides `global.clusterRouterBase`, `upstream.ingress.host`, `route.host`, and url values in `upstream.backstage.appConfig`.
# If neither `global.clusterRouterBase` nor `global.host` are set, the helm chart will attempt to autofill with the hostname of the [OCP Ingress configuration](https://access.redhat.com/documentation/en-us/openshift_container_platform/4.14/html/networking/configuring-ingress#nw-installation-ingress-config-asset_configuring-ingress)
host: ""
# -- Enable service authentication within Backstage instance
auth:
Expand Down

0 comments on commit 93d52bb

Please sign in to comment.