Skip to content

Commit eb3e36f

Browse files
authored
Fix API and parameterize port number (#67)
The console plugin API has been made GA quite a few OpenShift versions back (in OCP 4.12). * Update the API version to make the plugin work on newer versions of OpenShift. * Makes the port number a variable. * Bump the Helm chart version. * Update the image build. * Update the documentation.
1 parent 6ea9ea1 commit eb3e36f

File tree

8 files changed

+220
-21
lines changed

8 files changed

+220
-21
lines changed

Dockerfile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11

22
FROM registry.access.redhat.com/ubi8/nodejs-16:latest AS builder
33
USER root
4-
RUN npm install -g corepack
5-
RUN corepack enable yarn
4+
RUN command -v yarn || npm i -g yarn
65

76
COPY . /opt/app-root/src
87
RUN yarn install --frozen-lockfile && yarn build

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,15 @@ Dynamic plugin for the OpenShift console which adds GPU capabilities.
55
## OCP version compatibility
66
| NVIDIA GPU plugin | OCP Console |
77
| ---------------------- | ----------- |
8-
| latest | 4.11+ |
9-
| release-0.0.1 | 4.10+ |
8+
| latest | 4.12+ |
9+
| release-0.2.4 | 4.11 |
10+
| release-0.0.1 | 4.10 |
1011

1112
## QuickStart
1213

1314
### Prerequisites
1415

15-
- [Red Hat OpenShift](https://www.redhat.com/en/technologies/cloud-computing/openshift) 4.11+
16+
- [Red Hat OpenShift](https://www.redhat.com/en/technologies/cloud-computing/openshift) 4.12+
1617
- [NVIDIA GPU operator](https://github.com/NVIDIA/gpu-operator)
1718
- [Helm](https://helm.sh/docs/intro/install/)
1819

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
apiVersion: v2
22
appVersion: latest
33
description: |
4-
Red Hat OpenShift dynamic console plugin that leverages the NVIDIA GPU operator metrics and serves the respective console-extensions. Requires Red Hat OpenShift version 4.11+
4+
Red Hat OpenShift dynamic console plugin that leverages the NVIDIA GPU operator metrics and serves the respective console-extensions. Requires Red Hat OpenShift version 4.12+
55
name: console-plugin-nvidia-gpu
66
sources:
77
- https://github.com/rh-ecosystem-edge/console-plugin-nvidia-gpu
@@ -11,7 +11,7 @@ keywords:
1111
- nvidia
1212
- gpu
1313
type: application
14-
version: 0.2.4
14+
version: 0.2.5
1515
maintainers:
1616
- name: mresvanis
1717

deployment/console-plugin-nvidia-gpu/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ in order to serve the respective [console-extensions](https://github.com/openshi
99

1010
### Prerequisites
1111

12-
- [Red Hat OpenShift](https://www.redhat.com/en/technologies/cloud-computing/openshift) 4.11+
12+
- [Red Hat OpenShift](https://www.redhat.com/en/technologies/cloud-computing/openshift) 4.12+
1313
- [NVIDIA GPU operator](https://github.com/NVIDIA/gpu-operator)
1414
- [Helm](https://helm.sh/docs/intro/install/)
1515

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
1-
apiVersion: console.openshift.io/v1alpha1
1+
apiVersion: console.openshift.io/v1
22
kind: ConsolePlugin
33
metadata:
44
name: {{ include "console-plugin-nvidia-gpu.fullname" . }}
5+
namespace: {{ .Release.Namespace }}
56
labels:
67
{{- include "console-plugin-nvidia-gpu.labels" . | nindent 4 }}
78
spec:
89
displayName: 'Console Plugin NVIDIA GPU Template'
9-
service:
10-
name: {{ include "console-plugin-nvidia-gpu.fullname" . }}
11-
namespace: {{ .Release.Namespace }}
12-
port: 9443
13-
basePath: '/'
10+
backend:
11+
type: Service
12+
service:
13+
name: {{ include "console-plugin-nvidia-gpu.fullname" . }}
14+
namespace: {{ .Release.Namespace }}
15+
port: {{ .Values.plugin.port }}
16+
basePath: {{ .Values.plugin.basePath }}

deployment/console-plugin-nvidia-gpu/templates/service.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
apiVersion: v1
22
kind: Service
33
metadata:
4+
annotations:
5+
service.alpha.openshift.io/serving-cert-secret-name: plugin-serving-cert
46
name: {{ include "console-plugin-nvidia-gpu.fullname" . }}
57
labels:
68
{{- include "console-plugin-nvidia-gpu.labels" . | nindent 4 }}
7-
annotations:
8-
service.alpha.openshift.io/serving-cert-secret-name: plugin-serving-cert
99
spec:
1010
ports:
11-
- name: 9443-tcp
12-
protocol: TCP
13-
port: 9443
14-
targetPort: 9443
11+
- name: {{ .Values.plugin.port }}-tcp
12+
protocol: TCP
13+
port: {{ .Values.plugin.port }}
14+
targetPort: {{ .Values.plugin.port }}
1515
selector:
1616
{{- include "console-plugin-nvidia-gpu.selectorLabels" . | nindent 4 }}
1717
type: ClusterIP

deployment/console-plugin-nvidia-gpu/values.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,7 @@ nodeSelector: {}
2727
tolerations: []
2828

2929
affinity: {}
30+
31+
plugin:
32+
port: 9443
33+
basePath: /

deployment/hack/crds/consoleplugin.customresourcedefinition.yaml

Lines changed: 193 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,198 @@ spec:
1313
singular: consoleplugin
1414
scope: Cluster
1515
versions:
16+
- name: v1
17+
schema:
18+
openAPIV3Schema:
19+
description: "ConsolePlugin is an extension for customizing OpenShift web
20+
console by dynamically loading code from another service running on the
21+
cluster. \n Compatibility level 1: Stable within a major release for a minimum
22+
of 12 months or 3 minor releases (whichever is longer)."
23+
properties:
24+
apiVersion:
25+
description: 'APIVersion defines the versioned schema of this representation
26+
of an object. Servers should convert recognized schemas to the latest
27+
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
28+
type: string
29+
kind:
30+
description: 'Kind is a string value representing the REST resource this
31+
object represents. Servers may infer this from the endpoint the client
32+
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
33+
type: string
34+
metadata:
35+
type: object
36+
spec:
37+
description: ConsolePluginSpec is the desired plugin configuration.
38+
properties:
39+
backend:
40+
description: backend holds the configuration of backend which is serving
41+
console's plugin .
42+
properties:
43+
service:
44+
description: service is a Kubernetes Service that exposes the
45+
plugin using a deployment with an HTTP server. The Service must
46+
use HTTPS and Service serving certificate. The console backend
47+
will proxy the plugins assets from the Service using the service
48+
CA bundle.
49+
properties:
50+
basePath:
51+
default: /
52+
description: basePath is the path to the plugin's assets.
53+
The primary asset it the manifest file called `plugin-manifest.json`,
54+
which is a JSON document that contains metadata about the
55+
plugin and the extensions.
56+
maxLength: 256
57+
minLength: 1
58+
pattern: ^[a-zA-Z0-9.\-_~!$&'()*+,;=:@\/]*$
59+
type: string
60+
name:
61+
description: name of Service that is serving the plugin assets.
62+
maxLength: 128
63+
minLength: 1
64+
type: string
65+
namespace:
66+
description: namespace of Service that is serving the plugin
67+
assets.
68+
maxLength: 128
69+
minLength: 1
70+
type: string
71+
port:
72+
description: port on which the Service that is serving the
73+
plugin is listening to.
74+
format: int32
75+
maximum: 65535
76+
minimum: 1
77+
type: integer
78+
required:
79+
- name
80+
- namespace
81+
- port
82+
type: object
83+
type:
84+
description: "type is the backend type which servers the console's
85+
plugin. Currently only \"Service\" is supported. \n ---"
86+
enum:
87+
- Service
88+
type: string
89+
required:
90+
- type
91+
type: object
92+
displayName:
93+
description: displayName is the display name of the plugin. The dispalyName
94+
should be between 1 and 128 characters.
95+
maxLength: 128
96+
minLength: 1
97+
type: string
98+
i18n:
99+
description: i18n is the configuration of plugin's localization resources.
100+
properties:
101+
loadType:
102+
description: loadType indicates how the plugin's localization
103+
resource should be loaded. Valid values are Preload, Lazy and
104+
the empty string. When set to Preload, all localization resources
105+
are fetched when the plugin is loaded. When set to Lazy, localization
106+
resources are lazily loaded as and when they are required by
107+
the console. When omitted or set to the empty string, the behaviour
108+
is equivalent to Lazy type.
109+
enum:
110+
- Preload
111+
- Lazy
112+
- ""
113+
type: string
114+
required:
115+
- loadType
116+
type: object
117+
proxy:
118+
description: proxy is a list of proxies that describe various service
119+
type to which the plugin needs to connect to.
120+
items:
121+
description: ConsolePluginProxy holds information on various service
122+
types to which console's backend will proxy the plugin's requests.
123+
properties:
124+
alias:
125+
description: "alias is a proxy name that identifies the plugin's
126+
proxy. An alias name should be unique per plugin. The console
127+
backend exposes following proxy endpoint: \n /api/proxy/plugin/<plugin-name>/<proxy-alias>/<request-path>?<optional-query-parameters>
128+
\n Request example path: \n /api/proxy/plugin/acm/search/pods?namespace=openshift-apiserver"
129+
maxLength: 128
130+
minLength: 1
131+
pattern: ^[A-Za-z0-9-_]+$
132+
type: string
133+
authorization:
134+
default: None
135+
description: authorization provides information about authorization
136+
type, which the proxied request should contain
137+
enum:
138+
- UserToken
139+
- None
140+
type: string
141+
caCertificate:
142+
description: caCertificate provides the cert authority certificate
143+
contents, in case the proxied Service is using custom service
144+
CA. By default, the service CA bundle provided by the service-ca
145+
operator is used.
146+
pattern: ^-----BEGIN CERTIFICATE-----([\s\S]*)-----END CERTIFICATE-----\s?$
147+
type: string
148+
endpoint:
149+
description: endpoint provides information about endpoint to
150+
which the request is proxied to.
151+
properties:
152+
service:
153+
description: 'service is an in-cluster Service that the
154+
plugin will connect to. The Service must use HTTPS. The
155+
console backend exposes an endpoint in order to proxy
156+
communication between the plugin and the Service. Note:
157+
service field is required for now, since currently only
158+
"Service" type is supported.'
159+
properties:
160+
name:
161+
description: name of Service that the plugin needs to
162+
connect to.
163+
maxLength: 128
164+
minLength: 1
165+
type: string
166+
namespace:
167+
description: namespace of Service that the plugin needs
168+
to connect to
169+
maxLength: 128
170+
minLength: 1
171+
type: string
172+
port:
173+
description: port on which the Service that the plugin
174+
needs to connect to is listening on.
175+
format: int32
176+
maximum: 65535
177+
minimum: 1
178+
type: integer
179+
required:
180+
- name
181+
- namespace
182+
- port
183+
type: object
184+
type:
185+
description: "type is the type of the console plugin's proxy.
186+
Currently only \"Service\" is supported. \n ---"
187+
enum:
188+
- Service
189+
type: string
190+
required:
191+
- type
192+
type: object
193+
required:
194+
- alias
195+
- endpoint
196+
type: object
197+
type: array
198+
required:
199+
- backend
200+
- displayName
201+
type: object
202+
required:
203+
- metadata
204+
- spec
205+
type: object
206+
served: true
207+
storage: true
16208
- name: v1alpha1
17209
schema:
18210
openAPIV3Schema:
@@ -160,4 +352,4 @@ spec:
160352
- spec
161353
type: object
162354
served: true
163-
storage: true
355+
storage: false

0 commit comments

Comments
 (0)