Skip to content

Commit a5ee15f

Browse files
committed
Initial camel openshift console plugin
1 parent d02ba08 commit a5ee15f

File tree

113 files changed

+16787
-3
lines changed

Some content is hidden

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

113 files changed

+16787
-3
lines changed

.github/workflows/main.yml

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Build
2+
3+
on:
4+
push:
5+
branches:
6+
- "main"
7+
jobs:
8+
docker:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Checkout
12+
uses: actions/checkout@v2
13+
- name: Set up Docker Buildx
14+
uses: docker/setup-buildx-action@v2
15+
- name: Login to Quay.io
16+
uses: docker/login-action@v2
17+
with:
18+
registry: quay.io
19+
username: ${{ secrets.QUAY_USERNAME }}
20+
password: ${{ secrets.QUAY_ROBOT_TOKEN }}
21+
- name: Build Plugin Image
22+
uses: docker/build-push-action@v3
23+
with:
24+
context: ./plugin
25+
push: true
26+
tags: cmiranda/camel-openshift-console-plugin:latest
27+
cache-from: type=gha
28+
cache-to: type=gha,mode=max
29+
username: ${{ secrets.QUAY_USERNAME }}
30+
password: ${{ secrets.QUAY_ROBOT_TOKEN }}
31+
- name: Setup Java
32+
uses: actions/setup-java@v3
33+
with:
34+
java-version: 17
35+
distribution: 'temurin'
36+
cache: 'maven'
37+
- name: Build Service Proxy
38+
run: cd service-proxy && mvn package
39+
- name: Build Serivce Proxy Image
40+
uses: docker/build-push-action@v3
41+
with:
42+
context: ./service-proxy
43+
file: ./service-proxy/src/main/docker/Dockerfile.jvm
44+
push: true
45+
tags: cmiranda/camel-openshift-console-service-proxy:latest
46+
cache-from: type=gha
47+
cache-to: type=gha,mode=max
48+
username: ${{ secrets.QUAY_USERNAME }}
49+
password: ${{ secrets.QUAY_ROBOT_TOKEN }}
50+

.github/workflows/release.yml

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*.*.*'
7+
jobs:
8+
docker:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Checkout
12+
uses: actions/checkout@v2
13+
- name: Set up Docker Buildx
14+
uses: docker/setup-buildx-action@v2
15+
- name: Login to Quay.io
16+
uses: docker/login-action@v2
17+
with:
18+
registry: quay.io
19+
username: ${{ secrets.QUAY_USERNAME }}
20+
password: ${{ secrets.QUAY_ROBOT_TOKEN }}
21+
- name: Build Plugin Image
22+
uses: docker/build-push-action@v3
23+
with:
24+
context: ./plugin
25+
push: true
26+
tags: cmiranda/camel-openshift-console-plugin:{{ github.ref_name }}
27+
cache-from: type=gha
28+
cache-to: type=gha,mode=max
29+
username: ${{ secrets.QUAY_USERNAME }}
30+
password: ${{ secrets.QUAY_ROBOT_TOKEN }}
31+
- name: Setup Java
32+
uses: actions/setup-java@v3
33+
with:
34+
java-version: 17
35+
distribution: 'temurin'
36+
cache: 'maven'
37+
- name: Build Service Proxy
38+
run: cd service-proxy && mvn package
39+
- name: Build Serivce Proxy Image
40+
uses: docker/build-push-action@v3
41+
with:
42+
context: ./service-proxy
43+
file: ./service-proxy/src/main/docker/Dockerfile.jvm
44+
push: true
45+
tags: cmiranda/camel-openshift-console-service-proxy:{{ github.ref_name }}
46+
cache-from: type=gha
47+
cache-to: type=gha,mode=max
48+
username: ${{ secrets.QUAY_USERNAME }}
49+
password: ${{ secrets.QUAY_ROBOT_TOKEN }}
50+

.gitignore

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
node_modules/
2+
dist/
3+
.devcontainer/dev.env
4+
integration-tests/videos
5+
integration-tests/screenshots
6+
integration-tests/.DS_Store
7+
yarn-error.log
8+
.DS_Store
9+
.vscode/
10+

LICENSE

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Apache License
1+
Apache License
22
Version 2.0, January 2004
33
http://www.apache.org/licenses/
44

@@ -178,15 +178,15 @@
178178
APPENDIX: How to apply the Apache License to your work.
179179

180180
To apply the Apache License to your work, attach the following
181-
boilerplate notice, with the fields enclosed by brackets "[]"
181+
boilerplate notice, with the fields enclosed by brackets "{}"
182182
replaced with your own identifying information. (Don't include
183183
the brackets!) The text should be enclosed in the appropriate
184184
comment syntax for the file format. We also recommend that a
185185
file or class name and description of purpose be included on the
186186
same "printed page" as the copyright notice for easier
187187
identification within third-party archives.
188188

189-
Copyright [yyyy] [name of copyright owner]
189+
Copyright 2018 Red Hat, Inc.
190190

191191
Licensed under the Apache License, Version 2.0 (the "License");
192192
you may not use this file except in compliance with the License.
@@ -199,3 +199,4 @@
199199
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200200
See the License for the specific language governing permissions and
201201
limitations under the License.
202+

Makefile

+58
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one or more
2+
# contributor license agreements. See the NOTICE file distributed with
3+
# this work for additional information regarding copyright ownership.
4+
# The ASF licenses this file to You under the Apache License, Version 2.0
5+
# (the "License"); you may not use this file except in compliance with
6+
# the License. You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
#
16+
# Use bash explicitly in this Makefile to avoid unexpected platform
17+
# incompatibilities among Linux distros.
18+
#
19+
20+
IMAGE_NAME_PLUGIN=quay.io/cmiranda/camel-openshift-console-plugin
21+
IMAGE_NAME_SERVICE_PROXY=quay.io/cmiranda/camel-openshift-console-service-proxy
22+
23+
plugin:
24+
cd plugin && yarn build && yarn install
25+
26+
service-proxy:
27+
cd service-proxy && mvn clean install
28+
29+
service-proxy-image: service-proxy
30+
docker build -t $(IMAGE_NAME_SERVICE_PROXY):latest servcie-proxy -f service-proxy/src/main/docker/Dockerfile.jvm
31+
32+
plugin-image: plugin
33+
docker build -t $(IMAGE_NAME_PLUGIN):latest plugin
34+
35+
images: plugin-image service-proxy-iamge
36+
37+
push-service-proxy: service-proxy-image
38+
docker push $(IMAGE_NAME_SERVICE_PROXY):latest
39+
40+
push-plugin: plugin-image
41+
docker push $(IMAGE_NAME_PLUGIN):latest
42+
43+
push: push-plugin push-service-proxy
44+
45+
deploy-plugin:
46+
./bin/camel-install-openshift-console-plugin
47+
48+
deploy-proxy:
49+
cd service-proxy && \
50+
mvn clean install && \
51+
camel deploy openshift --image-build --namespace plugin-camel-openshift-console-plugin
52+
53+
deploy: deploy-plugin deploy-proxy
54+
55+
undeploy:
56+
helm uninstall camel-openshift-console-plugin --namespace=plugin-camel-openshift-console-plugin
57+
58+
all: images push deploy

OWNERS

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
approvers:
2+
- christianvogt
3+
- florkbr
4+
- spadgett
5+
- vojtechszocs
6+
component: Management Console

README.md

+75
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
# Camel OpenShift Console Plugin
2+
3+
This project provides a [console plugin](https://github.com/openshift/console/tree/master/frontend/packages/console-dynamic-plugin-sdk) for [Camel](https://camel.apache.org).
4+
The project is created using [openshift console plugin template](https://github.com/openshift/console-plugin-template)
5+
6+
# Local Development
7+
8+
For development you can login to an existing [OpenShift](https://www.redhat.com/en/technologies/cloud-computing/openshift) and run the console with the plugin included locally.
9+
**Note**: Works well with [OpenShift Sandbox](https://developers.redhat.com/developer-sandbox).
10+
11+
In one terminal window, run:
12+
13+
```sh
14+
cd plugin
15+
yarn install
16+
yarn run start
17+
```
18+
19+
In another terminal window, run:
20+
21+
After running `oc login` (requires [oc](https://console.redhat.com/openshift/downloads) and an [OpenShift cluster](https://console.redhat.com/openshift/create))
22+
23+
```sh
24+
cd plugin
25+
yarn run start-console
26+
```
27+
(requires [Docker](https://www.docker.com) or [podman 3.2.0+](https://podman.io))
28+
29+
30+
This will run the OpenShift console in a container connected to the cluster
31+
you've logged into. The plugin HTTP server runs on port 9001 with CORS enabled.
32+
Navigate to <http://localhost:9000/example> to see the running plugin.
33+
34+
# Deployment to OpenShift
35+
36+
To deploy the console plugin to an actual [OpenShift](https://www.redhat.com/en/technologies/cloud-computing/openshift) cluster the following are needed:
37+
38+
- [oc](https://console.redhat.com/openshift/downloads)
39+
- [helm](https://helm.sh)
40+
41+
### Building the images locally
42+
43+
```sh
44+
docker build -t quay.io/cmiranda/camel-openshift-console-plugin:latest .
45+
docker push quay.io/cmiranda/camel-openshift-console-plugin:latest
46+
```
47+
48+
**Note**: The image `quay.io/cmiranda/camel-openshift-console-plguin:latest` is published so it can be pulled instead.
49+
50+
### Deploying the plugin using Helm
51+
52+
```sh
53+
oc new-project plugin-camel-openshift-console-plugin
54+
helm upgrade -i camel-openshift-console-plugin charts/openshift-console-plugin --namespace plugin-camel-openshift-console-plugin --set plugin.image=quay.io/cmiranda/camel-openshift-console-plugin:latest
55+
```
56+
57+
# The Camel Tab
58+
59+
In the developer perpective the Camel section is now shown:
60+
[![The Camel Plugin Home](screenshots/home.png)](screenshots/home.png)
61+
62+
63+
# Development notes
64+
65+
The frontend is able to retrieve information from the console using the following APIs:
66+
67+
## Kubernetes API /api/kubernetes
68+
**Examples**:
69+
- /api/kubernetes/apis/apps/v1/namespaces/<namespace>/deployments
70+
- /api/kubernetes/apis/apps.openshift.io/v1/namespaces/<namespace>/deploymentconfigs
71+
72+
## Prometheus API /api/prometheus
73+
74+
**Examples**:
75+
- /api/prometheus/api/v1/query_range
+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#!/bin/bash
2+
TOKEN=""
3+
SERVER=""
4+
IMAGE="quay.io/cmiranda/camel-openshift-console-plugin:latest"
5+
while [[ $# -gt 0 ]]; do
6+
case $1 in
7+
--token)
8+
TOKEN="$2"
9+
shift # past argument
10+
shift # past value
11+
;;
12+
--server)
13+
SERVER_URL="$2"
14+
shift # past argument
15+
shift # past value
16+
;;
17+
--token=*)
18+
TOKEN=`echo $1 | sed -e 's/^[^=]*=//g'`
19+
shift # past argument
20+
;;
21+
--server=*)
22+
SERVER=`echo $1 | sed -e 's/^[^=]*=//g'`
23+
shift # past argument
24+
;;
25+
-*|--*)
26+
echo "Unknown option $1"
27+
exit 1
28+
;;
29+
*)
30+
POSITIONAL_ARGS+=("$1") # save positional arg
31+
shift # past argument
32+
;;
33+
esac
34+
done
35+
36+
if [ -n "$TOKEN" ] && [ -n "$SERVER" ]; then
37+
echo "Login to server: $SERVER using token: $TOKEN."
38+
oc login --token=$TOKEN --server=$SERVER
39+
fi
40+
41+
EXISTING_PROJECT=`oc get projects | grep plugin-camel-openshift-console-plugin`
42+
if [ -z "$EXISTING_PROJECT" ]; then
43+
oc new-project plugin-camel-openshift-console-plugin
44+
fi
45+
helm upgrade -i camel-openshift-console-plugin charts/openshift-console-plugin --namespace plugin-camel-openshift-console-plugin --set plugin.image=quay.io/cmiranda/camel-openshift-console-plugin:latest
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Patterns to ignore when building packages.
2+
# This supports shell glob matching, relative path matching, and
3+
# negation (prefixed with !). Only one pattern per line.
4+
.DS_Store
5+
# Common VCS dirs
6+
.git/
7+
.gitignore
8+
.bzr/
9+
.bzrignore
10+
.hg/
11+
.hgignore
12+
.svn/
13+
# Common backup files
14+
*.swp
15+
*.bak
16+
*.tmp
17+
*.orig
18+
*~
19+
# Various IDEs
20+
.project
21+
.idea/
22+
*.tmproj
23+
.vscode/
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
apiVersion: v2
2+
name: openshift-console-plugin
3+
description: A Helm chart for Kubernetes
4+
type: application
5+
version: 0.1.0

0 commit comments

Comments
 (0)