-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial camel openshift console plugin
- Loading branch information
Showing
113 changed files
with
16,787 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
name: Build | ||
|
||
on: | ||
push: | ||
branches: | ||
- "main" | ||
jobs: | ||
docker: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
- name: Login to Quay.io | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: quay.io | ||
username: ${{ secrets.QUAY_USERNAME }} | ||
password: ${{ secrets.QUAY_ROBOT_TOKEN }} | ||
- name: Build Plugin Image | ||
uses: docker/build-push-action@v3 | ||
with: | ||
context: ./plugin | ||
push: true | ||
tags: cmiranda/camel-openshift-console-plugin:latest | ||
cache-from: type=gha | ||
cache-to: type=gha,mode=max | ||
username: ${{ secrets.QUAY_USERNAME }} | ||
password: ${{ secrets.QUAY_ROBOT_TOKEN }} | ||
- name: Setup Java | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: 17 | ||
distribution: 'temurin' | ||
cache: 'maven' | ||
- name: Build Service Proxy | ||
run: cd service-proxy && mvn package | ||
- name: Build Serivce Proxy Image | ||
uses: docker/build-push-action@v3 | ||
with: | ||
context: ./service-proxy | ||
file: ./service-proxy/src/main/docker/Dockerfile.jvm | ||
push: true | ||
tags: cmiranda/camel-openshift-console-service-proxy:latest | ||
cache-from: type=gha | ||
cache-to: type=gha,mode=max | ||
username: ${{ secrets.QUAY_USERNAME }} | ||
password: ${{ secrets.QUAY_ROBOT_TOKEN }} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
name: Release | ||
|
||
on: | ||
push: | ||
tags: | ||
- 'v*.*.*' | ||
jobs: | ||
docker: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
- name: Login to Quay.io | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: quay.io | ||
username: ${{ secrets.QUAY_USERNAME }} | ||
password: ${{ secrets.QUAY_ROBOT_TOKEN }} | ||
- name: Build Plugin Image | ||
uses: docker/build-push-action@v3 | ||
with: | ||
context: ./plugin | ||
push: true | ||
tags: cmiranda/camel-openshift-console-plugin:{{ github.ref_name }} | ||
cache-from: type=gha | ||
cache-to: type=gha,mode=max | ||
username: ${{ secrets.QUAY_USERNAME }} | ||
password: ${{ secrets.QUAY_ROBOT_TOKEN }} | ||
- name: Setup Java | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: 17 | ||
distribution: 'temurin' | ||
cache: 'maven' | ||
- name: Build Service Proxy | ||
run: cd service-proxy && mvn package | ||
- name: Build Serivce Proxy Image | ||
uses: docker/build-push-action@v3 | ||
with: | ||
context: ./service-proxy | ||
file: ./service-proxy/src/main/docker/Dockerfile.jvm | ||
push: true | ||
tags: cmiranda/camel-openshift-console-service-proxy:{{ github.ref_name }} | ||
cache-from: type=gha | ||
cache-to: type=gha,mode=max | ||
username: ${{ secrets.QUAY_USERNAME }} | ||
password: ${{ secrets.QUAY_ROBOT_TOKEN }} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
node_modules/ | ||
dist/ | ||
.devcontainer/dev.env | ||
integration-tests/videos | ||
integration-tests/screenshots | ||
integration-tests/.DS_Store | ||
yarn-error.log | ||
.DS_Store | ||
.vscode/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
# Licensed to the Apache Software Foundation (ASF) under one or more | ||
# contributor license agreements. See the NOTICE file distributed with | ||
# this work for additional information regarding copyright ownership. | ||
# The ASF licenses this file to You under the Apache License, Version 2.0 | ||
# (the "License"); you may not use this file except in compliance with | ||
# the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
# Use bash explicitly in this Makefile to avoid unexpected platform | ||
# incompatibilities among Linux distros. | ||
# | ||
|
||
IMAGE_NAME_PLUGIN=quay.io/cmiranda/camel-openshift-console-plugin | ||
IMAGE_NAME_SERVICE_PROXY=quay.io/cmiranda/camel-openshift-console-service-proxy | ||
|
||
plugin: | ||
cd plugin && yarn build && yarn install | ||
|
||
service-proxy: | ||
cd service-proxy && mvn clean install | ||
|
||
service-proxy-image: service-proxy | ||
docker build -t $(IMAGE_NAME_SERVICE_PROXY):latest servcie-proxy -f service-proxy/src/main/docker/Dockerfile.jvm | ||
|
||
plugin-image: plugin | ||
docker build -t $(IMAGE_NAME_PLUGIN):latest plugin | ||
|
||
images: plugin-image service-proxy-iamge | ||
|
||
push-service-proxy: service-proxy-image | ||
docker push $(IMAGE_NAME_SERVICE_PROXY):latest | ||
|
||
push-plugin: plugin-image | ||
docker push $(IMAGE_NAME_PLUGIN):latest | ||
|
||
push: push-plugin push-service-proxy | ||
|
||
deploy-plugin: | ||
./bin/camel-install-openshift-console-plugin | ||
|
||
deploy-proxy: | ||
cd service-proxy && \ | ||
mvn clean install && \ | ||
camel deploy openshift --image-build --namespace plugin-camel-openshift-console-plugin | ||
|
||
deploy: deploy-plugin deploy-proxy | ||
|
||
undeploy: | ||
helm uninstall camel-openshift-console-plugin --namespace=plugin-camel-openshift-console-plugin | ||
|
||
all: images push deploy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
approvers: | ||
- christianvogt | ||
- florkbr | ||
- spadgett | ||
- vojtechszocs | ||
component: Management Console |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
# Camel OpenShift Console Plugin | ||
|
||
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). | ||
The project is created using [openshift console plugin template](https://github.com/openshift/console-plugin-template) | ||
|
||
# Local Development | ||
|
||
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. | ||
**Note**: Works well with [OpenShift Sandbox](https://developers.redhat.com/developer-sandbox). | ||
|
||
In one terminal window, run: | ||
|
||
```sh | ||
cd plugin | ||
yarn install | ||
yarn run start | ||
``` | ||
|
||
In another terminal window, run: | ||
|
||
After running `oc login` (requires [oc](https://console.redhat.com/openshift/downloads) and an [OpenShift cluster](https://console.redhat.com/openshift/create)) | ||
|
||
```sh | ||
cd plugin | ||
yarn run start-console | ||
``` | ||
(requires [Docker](https://www.docker.com) or [podman 3.2.0+](https://podman.io)) | ||
|
||
|
||
This will run the OpenShift console in a container connected to the cluster | ||
you've logged into. The plugin HTTP server runs on port 9001 with CORS enabled. | ||
Navigate to <http://localhost:9000/example> to see the running plugin. | ||
|
||
# Deployment to OpenShift | ||
|
||
To deploy the console plugin to an actual [OpenShift](https://www.redhat.com/en/technologies/cloud-computing/openshift) cluster the following are needed: | ||
|
||
- [oc](https://console.redhat.com/openshift/downloads) | ||
- [helm](https://helm.sh) | ||
|
||
### Building the images locally | ||
|
||
```sh | ||
docker build -t quay.io/cmiranda/camel-openshift-console-plugin:latest . | ||
docker push quay.io/cmiranda/camel-openshift-console-plugin:latest | ||
``` | ||
|
||
**Note**: The image `quay.io/cmiranda/camel-openshift-console-plguin:latest` is published so it can be pulled instead. | ||
|
||
### Deploying the plugin using Helm | ||
|
||
```sh | ||
oc new-project plugin-camel-openshift-console-plugin | ||
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 | ||
``` | ||
|
||
# The Camel Tab | ||
|
||
In the developer perpective the Camel section is now shown: | ||
[![The Camel Plugin Home](screenshots/home.png)](screenshots/home.png) | ||
|
||
|
||
# Development notes | ||
|
||
The frontend is able to retrieve information from the console using the following APIs: | ||
|
||
## Kubernetes API /api/kubernetes | ||
**Examples**: | ||
- /api/kubernetes/apis/apps/v1/namespaces/<namespace>/deployments | ||
- /api/kubernetes/apis/apps.openshift.io/v1/namespaces/<namespace>/deploymentconfigs | ||
|
||
## Prometheus API /api/prometheus | ||
|
||
**Examples**: | ||
- /api/prometheus/api/v1/query_range |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
#!/bin/bash | ||
TOKEN="" | ||
SERVER="" | ||
IMAGE="quay.io/cmiranda/camel-openshift-console-plugin:latest" | ||
while [[ $# -gt 0 ]]; do | ||
case $1 in | ||
--token) | ||
TOKEN="$2" | ||
shift # past argument | ||
shift # past value | ||
;; | ||
--server) | ||
SERVER_URL="$2" | ||
shift # past argument | ||
shift # past value | ||
;; | ||
--token=*) | ||
TOKEN=`echo $1 | sed -e 's/^[^=]*=//g'` | ||
shift # past argument | ||
;; | ||
--server=*) | ||
SERVER=`echo $1 | sed -e 's/^[^=]*=//g'` | ||
shift # past argument | ||
;; | ||
-*|--*) | ||
echo "Unknown option $1" | ||
exit 1 | ||
;; | ||
*) | ||
POSITIONAL_ARGS+=("$1") # save positional arg | ||
shift # past argument | ||
;; | ||
esac | ||
done | ||
|
||
if [ -n "$TOKEN" ] && [ -n "$SERVER" ]; then | ||
echo "Login to server: $SERVER using token: $TOKEN." | ||
oc login --token=$TOKEN --server=$SERVER | ||
fi | ||
|
||
EXISTING_PROJECT=`oc get projects | grep plugin-camel-openshift-console-plugin` | ||
if [ -z "$EXISTING_PROJECT" ]; then | ||
oc new-project plugin-camel-openshift-console-plugin | ||
fi | ||
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Patterns to ignore when building packages. | ||
# This supports shell glob matching, relative path matching, and | ||
# negation (prefixed with !). Only one pattern per line. | ||
.DS_Store | ||
# Common VCS dirs | ||
.git/ | ||
.gitignore | ||
.bzr/ | ||
.bzrignore | ||
.hg/ | ||
.hgignore | ||
.svn/ | ||
# Common backup files | ||
*.swp | ||
*.bak | ||
*.tmp | ||
*.orig | ||
*~ | ||
# Various IDEs | ||
.project | ||
.idea/ | ||
*.tmproj | ||
.vscode/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
apiVersion: v2 | ||
name: openshift-console-plugin | ||
description: A Helm chart for Kubernetes | ||
type: application | ||
version: 0.1.0 |
Oops, something went wrong.