|
| 1 | +{{- if include "openshell.rbacCreate" . }} |
| 2 | +{{- /* RBAC for service ingress reconciliation. |
| 3 | + All reconciled objects (OpenShift Routes, Gateway API HTTPRoutes, and |
| 4 | + networking.k8s.io Ingresses) are created in the gateway's own |
| 5 | + namespace, so a namespaced Role is sufficient — no cluster-scoped |
| 6 | + permissions are required for this feature. The rules cover every |
| 7 | + supported kind because the reconciled kind is selected by |
| 8 | + configuration. */ -}} |
| 9 | +{{- $gatewayConfig := .Values.gatewayConfig | default dict -}} |
| 10 | +{{- $serviceIngressTOML := get $gatewayConfig "openshell.drivers.kubernetes.service_ingress" | default dict -}} |
| 11 | +{{- $serviceIngressEnabled := false -}} |
| 12 | +{{- if hasKey $serviceIngressTOML "enabled" -}} |
| 13 | +{{- $serviceIngressEnabled = get $serviceIngressTOML "enabled" -}} |
| 14 | +{{- else if hasKey .Values "serviceIngress" -}} |
| 15 | +{{- $serviceIngressEnabled = .Values.serviceIngress.enabled -}} |
| 16 | +{{- end -}} |
| 17 | +{{- if $serviceIngressEnabled }} |
| 18 | +# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. |
| 19 | +# SPDX-License-Identifier: Apache-2.0 |
| 20 | + |
| 21 | +apiVersion: rbac.authorization.k8s.io/v1 |
| 22 | +kind: Role |
| 23 | +metadata: |
| 24 | + name: {{ include "openshell.fullname" . }}-service-ingress |
| 25 | + namespace: {{ .Release.Namespace }} |
| 26 | + labels: |
| 27 | + {{- include "openshell.labels" . | nindent 4 }} |
| 28 | +rules: |
| 29 | + - apiGroups: |
| 30 | + - route.openshift.io |
| 31 | + resources: |
| 32 | + - routes |
| 33 | + verbs: |
| 34 | + - get |
| 35 | + - list |
| 36 | + - create |
| 37 | + - delete |
| 38 | + # Setting a custom spec.host on an OpenShift Route requires the |
| 39 | + # custom-host subresource in addition to routes themselves. |
| 40 | + - apiGroups: |
| 41 | + - route.openshift.io |
| 42 | + resources: |
| 43 | + - routes/custom-host |
| 44 | + verbs: |
| 45 | + - create |
| 46 | + - patch |
| 47 | + - update |
| 48 | + - apiGroups: |
| 49 | + - gateway.networking.k8s.io |
| 50 | + resources: |
| 51 | + - httproutes |
| 52 | + verbs: |
| 53 | + - get |
| 54 | + - list |
| 55 | + - create |
| 56 | + - delete |
| 57 | + - apiGroups: |
| 58 | + - networking.k8s.io |
| 59 | + resources: |
| 60 | + - ingresses |
| 61 | + verbs: |
| 62 | + - get |
| 63 | + - list |
| 64 | + - create |
| 65 | + - delete |
| 66 | +--- |
| 67 | +apiVersion: rbac.authorization.k8s.io/v1 |
| 68 | +kind: RoleBinding |
| 69 | +metadata: |
| 70 | + name: {{ include "openshell.fullname" . }}-service-ingress |
| 71 | + namespace: {{ .Release.Namespace }} |
| 72 | + labels: |
| 73 | + {{- include "openshell.labels" . | nindent 4 }} |
| 74 | +roleRef: |
| 75 | + apiGroup: rbac.authorization.k8s.io |
| 76 | + kind: Role |
| 77 | + name: {{ include "openshell.fullname" . }}-service-ingress |
| 78 | +subjects: |
| 79 | + - kind: ServiceAccount |
| 80 | + name: {{ include "openshell.serviceAccountName" . }} |
| 81 | + namespace: {{ .Release.Namespace }} |
| 82 | +{{- end }} |
| 83 | +{{- end }} |
0 commit comments