Skip to content

Commit 9731777

Browse files
authored
Initial commit
0 parents  commit 9731777

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+10475
-0
lines changed

.ci-operator.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
build_root_image:
2+
name: nodejs-16
3+
namespace: openshift
4+
tag: latest

.devcontainer/Dockerfile.console

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
FROM quay.io/openshift/origin-console:latest
2+
COPY --from=openshift/origin-cli:latest /usr/bin/oc /usr/local/bin/oc
3+
4+
ENV OC_URL=$OC_URL
5+
ENV OC_PASS=$OC_PASS
6+
ENV OC_USER=$OC_USER
7+
ENV OC_PLUGIN_NAME=$OC_PLUGIN_NAME
8+
9+
USER root
10+
CMD eval "oc login $OC_URL -u $OC_USER -p $OC_PASS --insecure-skip-tls-verify" && \
11+
/opt/bridge/bin/bridge -public-dir=/opt/bridge/static \
12+
-i18n-namespaces plugin__$OC_PLUGIN_NAME \
13+
-plugins $OC_PLUGIN_NAME=http://localhost:9001 \
14+
-k8s-mode-off-cluster-thanos=$(oc -n openshift-config-managed get configmap monitoring-shared-config -o jsonpath='{.data.thanosPublicURL}') \
15+
-k8s-mode-off-cluster-endpoint=$(oc whoami --show-server) \
16+
-k8s-mode-off-cluster-skip-verify-tls=true \
17+
-k8s-auth-bearer-token=$(oc whoami --show-token) \
18+
-k8s-auth="bearer-token" \
19+
-user-auth="disabled" \
20+
-k8s-mode="off-cluster"

.devcontainer/Dockerfile.plugin

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
FROM mcr.microsoft.com/vscode/devcontainers/typescript-node:16 as build
2+
COPY --from=openshift/origin-cli:latest /usr/bin/oc /usr/local/bin/oc

.devcontainer/devcontainer.json

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{
2+
"name": "Console + Plugin",
3+
"dockerComposeFile": "docker-compose.yml",
4+
"service": "plugin",
5+
"workspaceFolder": "/workspace",
6+
7+
"initializeCommand": ".devcontainer/init.sh",
8+
"postCreateCommand": "yarn && eval 'oc login $OC_URL -u $OC_USER -p $OC_PASS --insecure-skip-tls-verify'",
9+
"forwardPorts": [9000, 9001],
10+
"portsAttributes": {
11+
"9000": {
12+
"label": "Console"
13+
},
14+
"9001": {
15+
"label": "Plugin static files",
16+
"onAutoForward": "silent"
17+
}
18+
},
19+
"features": {},
20+
"customizations": {
21+
"vscode": {
22+
"settings": {},
23+
"extensions": [
24+
"ms-azuretools.vscode-docker",
25+
"ms-vscode.vscode-typescript-next",
26+
"dbaeumer.vscode-eslint",
27+
"esbenp.prettier-vscode"
28+
]
29+
}
30+
}
31+
}

.devcontainer/docker-compose.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
version: '3.8'
2+
# create dev.env with the following values:
3+
# OC_URL
4+
# OC_USER
5+
# OC_PASS
6+
# OC_PLUGIN_NAME
7+
services:
8+
console:
9+
build:
10+
context: ..
11+
dockerfile: .devcontainer/Dockerfile.console
12+
env_file: dev.env
13+
restart: unless-stopped
14+
healthcheck:
15+
test: oc whoami
16+
interval: 1m30s
17+
timeout: 10s
18+
retries: 5
19+
20+
plugin:
21+
build:
22+
context: ..
23+
dockerfile: .devcontainer/Dockerfile.plugin
24+
env_file: dev.env
25+
depends_on:
26+
- console
27+
network_mode: service:console
28+
# Overrides default command so things don't shut down after the process ends.
29+
command: sleep infinity
30+
# Cache local workspace and copy shell history.
31+
volumes:
32+
- ..:/workspace:cached
33+
- ~/.bash_history:/root/.bash_history
34+
- ~/.zsh_history:/root/.zsh_history

.devcontainer/init.sh

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#!/bin/bash
2+
3+
if [[ ! -f .devcontainer/dev.env ]]
4+
then
5+
cat << EOF
6+
env file 'dev.env' does not exist in .devcontainer, please create it and add the the correct values for your cluster.
7+
OC_PLUGIN_NAME=my-plugin
8+
OC_URL=https://api.example.com:6443
9+
OC_USER=kubeadmin
10+
OC_PASS=<password>
11+
EOF
12+
exit 2
13+
else
14+
echo 'found 'dev.env' in .devcontainer'
15+
fi
16+
17+
# if one of the variables are missing, abort the build.
18+
success=1
19+
! grep -q OC_PLUGIN_NAME= ".devcontainer/dev.env" && success=0
20+
! grep -q OC_URL= ".devcontainer/dev.env" && success=0
21+
! grep -q OC_USER= ".devcontainer/dev.env" && success=0
22+
! grep -q OC_PASS= ".devcontainer/dev.env" && success=0
23+
24+
if ((success)); then
25+
echo 'dev.env is formatted correctly, proceeding.'
26+
else
27+
cat << EOF
28+
dev.env is not formatted correctly, please add the the correct values for your cluster.
29+
OC_PLUGIN_NAME=my-plugin
30+
OC_URL=https://api.example.com:6443
31+
OC_USER=kubeadmin
32+
OC_PASS=<password>
33+
EOF
34+
exit 2
35+
fi

.eslintrc.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
env:
2+
browser: true
3+
es2021: true
4+
extends:
5+
- eslint:recommended
6+
- plugin:react/recommended
7+
- plugin:@typescript-eslint/recommended
8+
- prettier
9+
parser: '@typescript-eslint/parser'
10+
parserOptions:
11+
ecmaFeatures:
12+
jsx: true
13+
ecmaVersion: 2016
14+
sourceType: module
15+
plugins:
16+
- prettier
17+
- react
18+
- '@typescript-eslint'
19+
rules:
20+
prettier/prettier:
21+
- error
22+
settings:
23+
react:
24+
version: detect

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
**/node_modules
2+
**/dist
3+
**/.DS_Store
4+
.devcontainer/dev.env
5+
integration-tests/videos
6+
integration-tests/screenshots

.prettierrc.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
arrowParens: always
2+
printWidth: 100
3+
singleQuote: true
4+
trailingComma: all

.stylelintrc.yaml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
extends:
2+
- stylelint-config-standard
3+
rules:
4+
# Disallow color names and hex colors as these don't work well with dark mode.
5+
# Use PF global variables instead:
6+
# https://patternfly-react-main.surge.sh/developer-resources/global-css-variables#global-css-variables
7+
color-named: never
8+
color-no-hex: true
9+
# PatternFly CSS vars don't conform to stylelint's regex. Disable this rule.
10+
custom-property-pattern: null
11+
function-disallowed-list:
12+
- rgb
13+
# Disable the standard rule to allow BEM-style classnames with underscores.
14+
selector-class-pattern: null
15+
# Disallow CSS classnames prefixed with .pf- or .co- as these prefixes are
16+
# reserved by PatternFly and OpenShift console.
17+
selector-disallowed-list:
18+
- "*"
19+
- /\.(pf|co)-/
20+
# Plugins should avoid naked element selectors like `table` and `li` since
21+
# this can impact layout of existing pages in console.
22+
selector-max-type:
23+
- 0
24+
- ignore:
25+
- compounded
26+
- descendant

.vscode/settings.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"typescript.tsdk": "./node_modules/typescript/lib",
3+
"search.exclude": {
4+
"**/node_modules": true
5+
},
6+
"files.watcherExclude": {
7+
"**/node_modules/**": true
8+
},
9+
"files.associations": {
10+
"**/console-extensions.json": "jsonc"
11+
},
12+
"json.schemas": [
13+
{
14+
"fileMatch": ["**/console-extensions.json"],
15+
"url": "./node_modules/@openshift-console/dynamic-plugin-sdk-webpack/schema/console-extensions.json"
16+
}
17+
]
18+
}

Dockerfile

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
FROM registry.access.redhat.com/ubi8/nodejs-16:latest AS build
2+
USER root
3+
RUN command -v yarn || npm i -g yarn
4+
5+
ADD . /usr/src/app
6+
WORKDIR /usr/src/app
7+
RUN yarn install && yarn build
8+
9+
FROM registry.access.redhat.com/ubi8/nginx-120:latest
10+
11+
COPY --from=build /usr/src/app/dist /usr/share/nginx/html
12+
USER 1001
13+
14+
ENTRYPOINT ["nginx", "-g", "daemon off;"]

0 commit comments

Comments
 (0)