forked from redhat-cop/gitops-catalog
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
11d35cd
commit 53e0937
Showing
7 changed files
with
169 additions
and
0 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 |
---|---|---|
|
@@ -6,3 +6,6 @@ namespace: openshift-operators | |
|
||
resources: | ||
- subscription.yaml | ||
|
||
components: | ||
- ../components/enable-console-plugin |
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,22 @@ | ||
# OpenShift Pipelines Components | ||
|
||
The included components are intended to be common patching patterns used on top of the default OpenShift Pipelines operator to configure additional features of the operator. Components are composable patches that can be added at the overlays layer on top of a base or overlay | ||
|
||
This repo currently contains the following components: | ||
|
||
* [enable-console-plugin](enable-console-plugin) | ||
|
||
## Usage | ||
|
||
Components can be added to a base by adding the `components` section to your overlay `kustomization.yaml` file: | ||
|
||
``` | ||
apiVersion: kustomize.config.k8s.io/v1beta1 | ||
kind: Kustomization | ||
resources: | ||
- ../../base | ||
components: | ||
- ../../components/enable-console-plugin | ||
``` |
19 changes: 19 additions & 0 deletions
19
openshift-pipelines-operator/components/enable-console-plugin/README.md
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,19 @@ | ||
# enable-console-plugin | ||
|
||
## Purpose | ||
This component is designed to enable the OpenShift Pipelines Console Plugin. | ||
|
||
## Usage | ||
|
||
This component can be added to a base by adding the `components` section to your overlay `kustomization.yaml` file: | ||
|
||
``` | ||
apiVersion: kustomize.config.k8s.io/v1beta1 | ||
kind: Kustomization | ||
resources: | ||
- ../../base | ||
components: | ||
- ../../components/enable-console-plugin | ||
``` |
30 changes: 30 additions & 0 deletions
30
openshift-pipelines-operator/components/enable-console-plugin/console-plugin-job.sh
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,30 @@ | ||
#!/usr/bin/env bash | ||
|
||
enable_console_plugin(){ | ||
[ -z "${PLUGIN_NAME}" ] && return 1 | ||
|
||
echo "Attempting to enable ${PLUGIN_NAME} plugin" | ||
echo "" | ||
|
||
# Create the plugins section on the object if it doesn't exist | ||
if [ -z "$(oc get consoles.operator.openshift.io cluster -o=jsonpath='{.spec.plugins}')" ]; then | ||
echo "Creating plugins object" | ||
oc patch consoles.operator.openshift.io cluster --patch '{ "spec": { "plugins": [] } }' --type=merge | ||
fi | ||
|
||
INSTALLED_PLUGINS=$(oc get consoles.operator.openshift.io cluster -o=jsonpath='{.spec.plugins}') | ||
echo "Current plugins:" | ||
echo "${INSTALLED_PLUGINS}" | ||
|
||
if [[ "${INSTALLED_PLUGINS}" == *"${PLUGIN_NAME}"* ]]; then | ||
echo "${PLUGIN_NAME} is already enabled" | ||
else | ||
echo "Enabling plugin: ${PLUGIN_NAME}" | ||
oc patch consoles.operator.openshift.io cluster --type=json --patch '[{"op": "add", "path": "/spec/plugins/-", "value": "'"${PLUGIN_NAME}"'"}]' | ||
fi | ||
|
||
sleep 6 | ||
oc get consoles.operator.openshift.io cluster -o=jsonpath='{.spec.plugins}' | ||
} | ||
|
||
enable_console_plugin |
64 changes: 64 additions & 0 deletions
64
openshift-pipelines-operator/components/enable-console-plugin/console-plugin-job.yaml
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,64 @@ | ||
--- | ||
apiVersion: v1 | ||
kind: ServiceAccount | ||
metadata: | ||
name: job-tekton-console-plugin | ||
--- | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: ClusterRole | ||
metadata: | ||
name: job-tekton-console-plugin | ||
rules: | ||
- apiGroups: | ||
- operator.openshift.io | ||
resources: | ||
- consoles | ||
verbs: | ||
- get | ||
- list | ||
- patch | ||
- label | ||
--- | ||
kind: ClusterRoleBinding | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
metadata: | ||
name: job-tekton-console-plugin | ||
subjects: | ||
- kind: ServiceAccount | ||
name: job-tekton-console-plugin | ||
roleRef: | ||
apiGroup: rbac.authorization.k8s.io | ||
kind: ClusterRole | ||
name: job-tekton-console-plugin | ||
--- | ||
apiVersion: batch/v1 | ||
kind: Job | ||
metadata: | ||
name: job-tekton-console-plugin | ||
annotations: | ||
argocd.argoproj.io/sync-wave: "10" | ||
spec: | ||
template: | ||
spec: | ||
containers: | ||
- name: minion | ||
image: registry.redhat.io/openshift4/ose-cli | ||
env: | ||
- name: PLUGIN_NAME | ||
value: pipelines-console-plugin | ||
command: | ||
- /bin/bash | ||
- -c | ||
- /scripts/console-plugin-job.sh | ||
volumeMounts: | ||
- name: scripts | ||
mountPath: /scripts | ||
volumes: | ||
- name: scripts | ||
configMap: | ||
name: job-tekton-console-plugin | ||
defaultMode: 0755 | ||
restartPolicy: Never | ||
serviceAccount: job-tekton-console-plugin | ||
serviceAccountName: job-tekton-console-plugin | ||
backoffLimit: 4 |
17 changes: 17 additions & 0 deletions
17
openshift-pipelines-operator/components/enable-console-plugin/console-plugin.yaml
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,17 @@ | ||
apiVersion: console.openshift.io/v1 | ||
kind: ConsolePlugin | ||
metadata: | ||
name: pipelines-console-plugin | ||
labels: | ||
app.kubernetes.io/part-of: tekton-config | ||
spec: | ||
backend: | ||
service: | ||
basePath: / | ||
name: pipelines-console-plugin | ||
namespace: openshift-pipelines | ||
port: 8443 | ||
type: Service | ||
displayName: Pipelines Console Plugin | ||
i18n: | ||
loadType: Preload |
14 changes: 14 additions & 0 deletions
14
openshift-pipelines-operator/components/enable-console-plugin/kustomization.yaml
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,14 @@ | ||
apiVersion: kustomize.config.k8s.io/v1alpha1 | ||
kind: Component | ||
|
||
resources: | ||
- console-plugin-job.yaml | ||
- console-plugin.yaml | ||
|
||
generatorOptions: | ||
disableNameSuffixHash: true | ||
|
||
configMapGenerator: | ||
- name: job-tekton-console-plugin | ||
files: | ||
- console-plugin-job.sh |