Skip to content

Commit 9aa8fb4

Browse files
committed
Orchestrator chart merged to rhdh
1 parent f054034 commit 9aa8fb4

9 files changed

Lines changed: 767 additions & 5 deletions

File tree

charts/backstage/README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,23 @@ Kubernetes: `>= 1.25.0-0`
191191
| 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"` |
192192
| 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 | `[]` |
193193
| global.host | Custom hostname shorthand, overrides `global.clusterRouterBase`, `upstream.ingress.host`, `route.host`, and url values in `upstream.backstage.appConfig`. | string | `""` |
194+
| orchestrator.enabled | | bool | `true` |
195+
| orchestrator.orchestrator.sonataflowPlatform.eventing.broker.name | | string | `""` |
196+
| orchestrator.orchestrator.sonataflowPlatform.eventing.broker.namespace | | string | `""` |
197+
| orchestrator.orchestrator.sonataflowPlatform.monitoring.enabled | | bool | `true` |
198+
| orchestrator.orchestrator.sonataflowPlatform.resources.limits.cpu | | string | `"500m"` |
199+
| orchestrator.orchestrator.sonataflowPlatform.resources.limits.memory | | string | `"1Gi"` |
200+
| orchestrator.orchestrator.sonataflowPlatform.resources.requests.cpu | | string | `"250m"` |
201+
| orchestrator.orchestrator.sonataflowPlatform.resources.requests.memory | | string | `"64Mi"` |
202+
| orchestrator.postgres.authSecret.name | | string | `"sonataflow-psql-postgresql"` |
203+
| orchestrator.postgres.authSecret.passwordKey | | string | `"postgres-password"` |
204+
| orchestrator.postgres.authSecret.userKey | | string | `"postgres-username"` |
205+
| orchestrator.postgres.database | | string | `"sonataflow"` |
206+
| orchestrator.postgres.serviceName | | string | `"sonataflow-psql-postgresql"` |
207+
| orchestrator.postgres.serviceNamespace | | string | `""` |
208+
| orchestrator.rhdhPlugins.npmRegistry | | string | `""` |
209+
| orchestrator.serverlessLogicOperator.enabled | | bool | `true` |
210+
| orchestrator.serverlessOperator.enabled | | bool | `true` |
194211
| 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"}` |
195212
| route.annotations | Route specific annotations | object | `{}` |
196213
| route.enabled | Enable the creation of the route resource | bool | `true` |

charts/backstage/templates/_helpers.tpl

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,3 +48,55 @@ Referenced from: https://github.com/bitnami/charts/blob/main/bitnami/postgresql/
4848
{{- printf "%s" (include "common.names.fullname" .) -}}
4949
{{- end -}}
5050
{{- end -}}
51+
52+
{{/* Helepr functions */}}
53+
54+
{{- define "unmanaged-resource-exists" -}}
55+
{{- $api := index . 0 -}}
56+
{{- $kind := index . 1 -}}
57+
{{- $namespace := index . 2 -}}
58+
{{- $name := index . 3 -}}
59+
{{- $releaseName := index . 4 -}}
60+
{{- $apiCapabilities := index . 5 -}}
61+
{{- $unmanagedSubscriptionExists := "true" -}}
62+
{{- if $apiCapabilities.Has (printf "%s/%s" $api $kind) }}
63+
{{- $existingOperator := lookup $api $kind $namespace $name -}}
64+
{{- if empty $existingOperator -}}
65+
{{- "false" -}}
66+
{{- else -}}
67+
{{- $isManagedResource := include "is-managed-resource" (list $existingOperator $releaseName) -}}
68+
{{- if eq $isManagedResource "true" -}}
69+
{{- "false" -}}
70+
{{- else -}}
71+
{{- "true" -}}
72+
{{- end -}}
73+
{{- end -}}
74+
{{- else -}}
75+
{{- "false" -}}
76+
{{- end -}}
77+
{{- end -}}
78+
79+
{{- define "is-managed-resource" -}}
80+
{{- $resource := index . 0 -}}
81+
{{- $releaseName := index . 1 -}}
82+
{{- $resourceReleaseName := dig "metadata" "annotations" (dict "meta.helm.sh/release-name" "NA") $resource -}}
83+
{{- if eq (get $resourceReleaseName "meta.helm.sh/release-name") $releaseName -}}
84+
{{- "true" -}}
85+
{{- else -}}
86+
{{- "false" -}}
87+
{{- end -}}
88+
{{- end -}}
89+
90+
{{- define "cluster.domain" -}}
91+
{{- if .Capabilities.APIVersions.Has "config.openshift.io/v1/Ingress" -}}
92+
{{- $cluster := (lookup "config.openshift.io/v1" "Ingress" "" "cluster") -}}
93+
{{- if and (hasKey $cluster "spec") (hasKey $cluster.spec "domain") -}}
94+
{{- printf "%s" $cluster.spec.domain -}}
95+
{{- else -}}
96+
{{ fail "Unable to obtain cluster domain, OCP Ingress Resource is missing the `spec.domain` field." }}
97+
{{- end }}
98+
{{- else -}}
99+
{{ fail "Unable to obtain cluster domain, config.openshift.io/v1/Ingress is missing" }}
100+
{{- end -}}
101+
{{- end -}}
102+

charts/backstage/templates/dynamic-plugins-configmap.yaml

Lines changed: 88 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,92 @@ kind: ConfigMap
33
metadata:
44
name: {{ printf "%s-dynamic-plugins" .Release.Name }}
55
data:
6+
{{- $dynamic := .Values.global.dynamic }}
7+
{{- $plugins := .Values.global.dynamic.plugins }}
68
dynamic-plugins.yaml: |
7-
{{- include "common.tplvalues.render" ( dict "value"
8-
.Values.global.dynamic "context" $) | nindent 4 }}
9+
{{- if .Values.orchestrator.enabled }}
10+
{{- $orchestratorPlugins := include "orchestrator.plugins" . | fromYaml }}
11+
{{- range $orchestratorPlugins.plugins }}
12+
{{- $plugins = append $plugins . }}
13+
{{- end }}
14+
{{- $dynamic = merge $dynamic (dict "plugins" $plugins) }}
15+
{{- end }}
16+
{{- include "common.tplvalues.render" (dict "value" $dynamic "context" $) | nindent 4 }}
17+
18+
{{- if .Values.orchestrator.enabled }}
19+
---
20+
apiVersion: v1
21+
kind: Secret
22+
metadata:
23+
name: dynamic-plugins-npmrc
24+
namespace: {{ .Release.Namespace | quote }}
25+
type: Opaque
26+
stringData:
27+
.npmrc: |
28+
registry={{ .Values.orchestrator.rhdhPlugins.npmRegistry }}
29+
{{- end }}
30+
---
31+
{{- define "orchestrator.plugins" }}
32+
plugins:
33+
- disabled: false
34+
package: "{{ include "orchestrator.plugins.config" . | fromYaml | dig "orchestratorPlugins" "scope" }}/{{ include "orchestrator.plugins.config" . | fromYaml | dig "orchestratorPlugins" "orchestratorBackend" "package" }}"
35+
integrity: "{{ include "orchestrator.plugins.config" . | fromYaml | dig "orchestratorPlugins" "orchestratorBackend" "integrity" }}"
36+
pluginConfig:
37+
orchestrator:
38+
dataIndexService:
39+
url: http://sonataflow-platform-data-index-service.{{ .Release.Namespace }}
40+
- disabled: false
41+
package: "{{ include "orchestrator.plugins.config" . | fromYaml | dig "orchestratorPlugins" "scope" }}/{{ include "orchestrator.plugins.config" . | fromYaml | dig "orchestratorPlugins" "orchestrator" "package" }}"
42+
integrity: "{{ include "orchestrator.plugins.config" . | fromYaml | dig "orchestratorPlugins" "orchestrator" "integrity" }}"
43+
pluginConfig:
44+
dynamicPlugins:
45+
frontend:
46+
red-hat-developer-hub.backstage-plugin-orchestrator:
47+
appIcons:
48+
- importName: OrchestratorIcon
49+
module: OrchestratorPlugin
50+
name: orchestratorIcon
51+
dynamicRoutes:
52+
- importName: OrchestratorPage
53+
menuItem:
54+
icon: orchestratorIcon
55+
text: Orchestrator
56+
module: OrchestratorPlugin
57+
path: /orchestrator
58+
- disabled: true
59+
package: ./dynamic-plugins/dist/backstage-plugin-notifications
60+
pluginConfig:
61+
dynamicPlugins:
62+
frontend:
63+
backstage.plugin-notifications:
64+
dynamicRoutes:
65+
- importName: NotificationsPage
66+
menuItem:
67+
config:
68+
props:
69+
titleCounterEnabled: true
70+
webNotificationsEnabled: false
71+
importName: NotificationsSidebarItem
72+
path: /notifications
73+
- disabled: true
74+
package: ./dynamic-plugins/dist/backstage-plugin-signals
75+
pluginConfig:
76+
dynamicPlugins:
77+
frontend:
78+
backstage.plugin-signals: {}
79+
- disabled: true
80+
package: ./dynamic-plugins/dist/backstage-plugin-notifications-backend-dynamic
81+
- disabled: true
82+
package: ./dynamic-plugins/dist/backstage-plugin-signals-backend-dynamic
83+
{{- end }}
84+
---
85+
{{- define "orchestrator.plugins.config" }}
86+
orchestratorPlugins:
87+
scope: "https://github.com/rhdhorchestrator/orchestrator-plugins-internal-release/releases/download/1.4.0"
88+
orchestrator:
89+
package: "backstage-plugin-orchestrator-1.4.0.tgz"
90+
integrity: sha512-2yasbfBZ3iKntArIfK+hk9tvv4b/dy9+WKXOcWIotqkI1gv+Nhvy+m55KAUWi2vmfM0rj3EoG6YP+3Zajn1KyA==
91+
orchestratorBackend:
92+
package: "backstage-plugin-orchestrator-backend-dynamic-1.4.0.tgz"
93+
integrity: sha512-2aOHDLFrGMAtyHFiyGZwVBZ9Op+TmKYUwfZxwoaGJ1s6JSy/0qgqineEEE0K3dn/f17XBUj+H1dwa5Al598Ugw==
94+
{{- end }}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{{- if and .Values.orchestrator.enabled .Values.orchestrator.serverlessOperator.enabled }}
2+
{{- $knativeServing := lookup "operator.knative.dev/v1beta1" "KnativeServing" "knative-serving" "knative-serving" }}
3+
{{- if not $knativeServing }}
4+
---
5+
apiVersion: operator.knative.dev/v1beta1
6+
kind: KnativeServing
7+
metadata:
8+
name: knative-serving
9+
namespace: knative-serving
10+
annotations:
11+
"meta.helm.sh/release-name": {{ .Release.Name }}
12+
spec:
13+
controller-custom-certs:
14+
name: ""
15+
type: ""
16+
registry: {}
17+
{{- end }}
18+
19+
{{- $knativeEventing := lookup "operator.knative.dev/v1beta1" "KnativeEventing" "knative-eventing" "knative-eventing" }}
20+
{{- if not $knativeEventing }}
21+
---
22+
apiVersion: operator.knative.dev/v1beta1
23+
kind: KnativeEventing
24+
metadata:
25+
name: knative-eventing
26+
namespace: knative-eventing
27+
annotations:
28+
"meta.helm.sh/release-name": {{ .Release.Name }}
29+
spec:
30+
Registry: {}
31+
{{- end }}
32+
{{- end }}
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
{{- if .Values.orchestrator.serverlessLogicOperator.enabled }}
2+
apiVersion: networking.k8s.io/v1
3+
kind: NetworkPolicy
4+
metadata:
5+
name: allow-knative-to-sonataflow-and-workflows
6+
# Sonataflow and Workflows are using the RHDH target namespace.
7+
namespace: {{ .Release.Namespace | quote }}
8+
spec:
9+
podSelector: {}
10+
ingress:
11+
- from:
12+
- namespaceSelector:
13+
matchLabels:
14+
# Allow knative events to be delivered to workflows.
15+
kubernetes.io/metadata.name: knative-eventing
16+
- namespaceSelector:
17+
matchLabels:
18+
# Allow auxiliary knative function for workflow (such as m2k-save-transformation)
19+
kubernetes.io/metadata.name: knative-serving
20+
---
21+
# NetworkPolicy to unblock incoming traffic to the namespace
22+
apiVersion: networking.k8s.io/v1
23+
kind: NetworkPolicy
24+
metadata:
25+
name: allow-external-communication
26+
namespace: {{ .Release.Namespace | quote }}
27+
spec:
28+
podSelector: {}
29+
ingress:
30+
- from:
31+
- namespaceSelector:
32+
matchLabels:
33+
# Allow knative events to be delivered to workflows.
34+
kubernetes.io/metadata.name: openshift-ingress
35+
---
36+
apiVersion: networking.k8s.io/v1
37+
kind: NetworkPolicy
38+
metadata:
39+
name: allow-intra-network
40+
namespace: {{ .Release.Namespace | quote }}
41+
spec:
42+
# Apply this policy to all pods in the namespace
43+
podSelector: {}
44+
# Specify policy type as 'Ingress' to control incoming traffic rules
45+
policyTypes:
46+
- Ingress
47+
ingress:
48+
- from:
49+
# Allow ingress from any pod within the same namespace
50+
- podSelector: {}
51+
52+
53+
{{- end }}
54+
---
55+
{{- if .Values.orchestrator.orchestrator.sonataflowPlatform.monitoring.enabled }}
56+
# NetworkPolicy to allow openshift-user-workload-monitoring pods to access all pods within the workflow's namespace
57+
apiVersion: networking.k8s.io/v1
58+
kind: NetworkPolicy
59+
metadata:
60+
name: allow-monitoring-to-sonataflow-and-workflows
61+
namespace: {{ .Release.Namespace | quote }}
62+
spec:
63+
# Apply this policy to all pods in the namespace
64+
podSelector: {}
65+
# Specify policy type as 'Ingress' to control incoming traffic rules
66+
policyTypes:
67+
- Ingress
68+
ingress:
69+
- from:
70+
- namespaceSelector:
71+
matchLabels:
72+
# Allow openshift-user-workload-monitoring pods to access the workflow.
73+
kubernetes.io/metadata.name: openshift-user-workload-monitoring
74+
{{- end }}
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
{{- if and .Values.orchestrator.enabled .Values.orchestrator.serverlessLogicOperator.enabled }}
2+
{{- $workflowNamespace := .Release.Namespace }}
3+
---
4+
apiVersion: sonataflow.org/v1alpha08
5+
kind: SonataFlowPlatform
6+
metadata:
7+
name: sonataflow-platform
8+
namespace: {{ $workflowNamespace }}
9+
annotations:
10+
"meta.helm.sh/release-name": {{ .Release.Name}}
11+
spec:
12+
monitoring:
13+
enabled: {{ .Values.orchestrator.orchestrator.sonataflowPlatform.monitoring.enabled }}
14+
build:
15+
template:
16+
resources:
17+
requests:
18+
memory: {{ .Values.orchestrator.orchestrator.sonataflowPlatform.resources.requests.memory }}
19+
cpu: {{ .Values.orchestrator.orchestrator.sonataflowPlatform.resources.requests.cpu }}
20+
limits:
21+
memory: {{ .Values.orchestrator.orchestrator.sonataflowPlatform.resources.limits.memory }}
22+
cpu: {{ .Values.orchestrator.orchestrator.sonataflowPlatform.resources.limits.cpu }}
23+
{{- if (and (.Values.orchestrator.orchestrator.sonataflowPlatform.eventing.broker.name) (.Values.orchestrator.orchestrator.sonataflowPlatform.eventing.broker.namespace)) }}
24+
eventing:
25+
broker:
26+
ref:
27+
apiVersion: eventing.knative.dev/v1
28+
kind: Broker
29+
name: {{ .Values.orchestrator.orchestrator.sonataflowPlatform.eventing.broker.name }}
30+
namespace: {{ .Values.orchestrator.orchestrator.sonataflowPlatform.eventing.broker.namespace }}
31+
{{- end }}
32+
services:
33+
dataIndex:
34+
enabled: true
35+
persistence:
36+
postgresql:
37+
secretRef:
38+
name: {{ .Values.orchestrator.postgres.authSecret.name }}
39+
userKey: {{ .Values.orchestrator.postgres.authSecret.userKey }}
40+
passwordKey: {{ .Values.orchestrator.postgres.authSecret.passwordKey }}
41+
serviceRef:
42+
name: {{ .Values.orchestrator.postgres.serviceName }}
43+
namespace: {{ .Values.orchestrator.postgres.serviceNamespace }}
44+
{{- if .Values.orchestrator.orchestrator.sonataflowPlatform.dataIndexImage }}
45+
podTemplate:
46+
container:
47+
image: {{ .Values.orchestrator.orchestrator.sonataflowPlatform.dataIndexImage }}
48+
{{- end }}
49+
jobService:
50+
enabled: true
51+
persistence:
52+
postgresql:
53+
secretRef:
54+
name: {{ .Values.orchestrator.postgres.authSecret.name }}
55+
userKey: {{ .Values.orchestrator.postgres.authSecret.userKey }}
56+
passwordKey: {{ .Values.orchestrator.postgres.authSecret.passwordKey }}
57+
serviceRef:
58+
name: {{ .Values.orchestrator.postgres.serviceName }}
59+
namespace: {{ .Values.orchestrator.postgres.serviceNamespace }}
60+
{{- if .Values.orchestrator.orchestrator.sonataflowPlatform.jobServiceImage }}
61+
podTemplate:
62+
container:
63+
image: {{ .Values.orchestrator.orchestrator.sonataflowPlatform.jobServiceImage }}
64+
{{- end }}
65+
{{- end }}

0 commit comments

Comments
 (0)