This repository has been archived by the owner on May 29, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(operator): Add Quarkus Operator
- Loading branch information
Showing
23 changed files
with
664 additions
and
2 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
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: apiextensions.k8s.io/v1beta1 | ||
kind: CustomResourceDefinition | ||
metadata: | ||
name: launchers.launcher.fabric8.io | ||
namespace: launcher | ||
spec: | ||
group: launcher.fabric8.io | ||
version: v1beta1 | ||
scope: Namespaced | ||
names: | ||
kind: Launcher | ||
listKind: LauncherList | ||
plural: launchers | ||
singular: launcher |
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,4 @@ | ||
apiVersion: v1 | ||
kind: Namespace | ||
metadata: | ||
name: launcher |
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,48 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: launcher-operator | ||
spec: | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
name: launcher-operator | ||
template: | ||
metadata: | ||
labels: | ||
name: launcher-operator | ||
spec: | ||
serviceAccountName: launcher-operator | ||
containers: | ||
- name: launcher-operator | ||
image: quay.io/gastaldi/launcher-operator:latest | ||
imagePullPolicy: Always | ||
readinessProbe: | ||
httpGet: | ||
path: /health | ||
port: 8080 | ||
scheme: HTTP | ||
initialDelaySeconds: 4 | ||
periodSeconds: 10 | ||
timeoutSeconds: 10 | ||
failureThreshold: 1 | ||
livenessProbe: | ||
httpGet: | ||
path: /health | ||
port: 8080 | ||
scheme: HTTP | ||
initialDelaySeconds: 4 | ||
periodSeconds: 10 | ||
timeoutSeconds: 10 | ||
failureThreshold: 1 | ||
ports: | ||
- containerPort: 8080 | ||
env: | ||
- name: POD_NAMESPACE | ||
valueFrom: | ||
fieldRef: | ||
fieldPath: metadata.namespace | ||
- name: POD_NAME | ||
valueFrom: | ||
fieldRef: | ||
fieldPath: metadata.name |
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,62 @@ | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: ClusterRole | ||
metadata: | ||
name: launcher-operator | ||
rules: | ||
- apiGroups: | ||
- "" | ||
resources: | ||
- pods | ||
- services | ||
- endpoints | ||
- persistentvolumeclaims | ||
- events | ||
- configmaps | ||
- secrets | ||
- processedtemplates.template.openshift.io | ||
verbs: | ||
- '*' | ||
- apiGroups: | ||
- template.openshift.io | ||
resources: | ||
- processedtemplates | ||
verbs: [ get, list, create, update, delete, deletecollection, watch] | ||
- apiGroups: | ||
- apps.openshift.io | ||
resources: | ||
- deploymentconfigs | ||
- deploymentconfigs/instantiate | ||
verbs: [ get, list, create, update, delete, deletecollection, watch] | ||
- apiGroups: | ||
- route.openshift.io | ||
resources: | ||
- routes | ||
- routes/custom-host | ||
verbs: [ get, list, create, update, delete, deletecollection, watch] | ||
- apiGroups: | ||
- "" | ||
resources: | ||
- namespaces | ||
verbs: | ||
- get | ||
- apiGroups: | ||
- apps | ||
resources: | ||
- deployments | ||
- daemonsets | ||
- replicasets | ||
- statefulsets | ||
verbs: | ||
- '*' | ||
- apiGroups: | ||
- launcher.fabric8.io | ||
resources: | ||
- '*' | ||
verbs: | ||
- '*' | ||
- apiGroups: | ||
- apiextensions.k8s.io | ||
resources: | ||
- customresourcedefinitions | ||
verbs: | ||
- get |
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,12 @@ | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: ClusterRoleBinding | ||
metadata: | ||
name: launcher-operator | ||
subjects: | ||
- kind: ServiceAccount | ||
name: launcher-operator | ||
namespace: launcher | ||
roleRef: | ||
kind: ClusterRole | ||
name: launcher-operator | ||
apiGroup: rbac.authorization.k8s.io |
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,4 @@ | ||
apiVersion: v1 | ||
kind: ServiceAccount | ||
metadata: | ||
name: launcher-operator |
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 @@ | ||
apiVersion: launcher.fabric8.io/v1beta1 | ||
kind: Launcher | ||
metadata: | ||
name: example-launcher | ||
spec: | ||
openshift: | ||
consoleUrl: consoleUrl | ||
git: | ||
providers: | ||
- id: GitHub | ||
name: "GitHub" | ||
apiUrl: https://api.github.com | ||
repositoryUrl: https://github.com | ||
type: GITHUB | ||
clientProperties: | ||
clientId: CHANGE_TO_CLIENT_ID | ||
serverProperties: | ||
oauthUrl: https://github.com/login/oauth/access_token | ||
clientSecret: CHANGE_TO_CLIENT_SECRET |
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,36 @@ | ||
apiVersion: launcher.fabric8.io/v1beta1 | ||
kind: Launcher | ||
metadata: | ||
name: example-launcher | ||
spec: | ||
environment: production | ||
catalog: | ||
repositoryUrl: http://github.com/fabric8-launcher/launcher-booster-catalog | ||
repositoryRef: master | ||
filter: filter expression | ||
openshift: | ||
apiUrl: https://api.cluster.openshift.com | ||
consoleUrl: https://console.cluster.openshift.com | ||
username: username | ||
password: password | ||
token: token | ||
impersonate: true | ||
clientId: launcher | ||
git: | ||
providers: | ||
- id: GitHub | ||
name: "GitHub" | ||
apiUrl: https://api.github.com | ||
repositoryUrl: https://github.com | ||
type: GITHUB | ||
clientProperties: | ||
clientId: CHANGE_TO_CLIENT_ID | ||
serverProperties: | ||
oauthUrl: https://github.com/login/oauth/access_token | ||
clientSecret: CHANGE_TO_CLIENT_SECRET | ||
username: username | ||
token: token | ||
keycloak: | ||
url: https://sso.openshift.io/auth | ||
realm: rh-developers-launch | ||
clientId: launcher |
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,13 @@ | ||
apiVersion: launcher.fabric8.io/v1beta1 | ||
kind: Launcher | ||
metadata: | ||
name: launcher | ||
spec: | ||
|
||
####### OpenShift Configuration | ||
openshift: | ||
consoleUrl: #<the OpenShift Console Url (ex: 'https://192.168.64.4:8443')># | ||
|
||
####### OAuth Configuration | ||
oauth: | ||
enabled: true |
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,112 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<parent> | ||
<artifactId>launcher-parent</artifactId> | ||
<groupId>io.fabric8.launcher</groupId> | ||
<version>1-SNAPSHOT</version> | ||
</parent> | ||
<modelVersion>4.0.0</modelVersion> | ||
<artifactId>launcher-operator</artifactId> | ||
<dependencies> | ||
<dependency> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-kubernetes-client</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-smallrye-health</artifactId> | ||
</dependency> | ||
<!-- Test dependencies --> | ||
<dependency> | ||
<groupId>io.fabric8.launcher</groupId> | ||
<artifactId>launcher-base-test</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-junit5</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-test-kubernetes-client</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<finalName>launcher-operator</finalName> | ||
<plugins> | ||
<plugin> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-maven-plugin</artifactId> | ||
<executions> | ||
<execution> | ||
<goals> | ||
<goal>build</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
<plugin> | ||
<artifactId>maven-surefire-plugin</artifactId> | ||
<configuration> | ||
<systemProperties> | ||
<java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager> | ||
</systemProperties> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
|
||
<profiles> | ||
<profile> | ||
<id>native</id> | ||
<activation> | ||
<property> | ||
<name>operatorNative</name> | ||
</property> | ||
</activation> | ||
<properties> | ||
<native-image.docker-build>true</native-image.docker-build> | ||
</properties> | ||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-maven-plugin</artifactId> | ||
<executions> | ||
<execution> | ||
<goals> | ||
<goal>native-image</goal> | ||
</goals> | ||
<configuration> | ||
<enableHttpUrlHandler>true</enableHttpUrlHandler> | ||
<additionalBuildArgs>-H:IncludeResources=../templates/openshift/launcher-template.yaml</additionalBuildArgs> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
<plugin> | ||
<artifactId>maven-failsafe-plugin</artifactId> | ||
<executions> | ||
<execution> | ||
<goals> | ||
<goal>integration-test</goal> | ||
<goal>verify</goal> | ||
</goals> | ||
<configuration> | ||
<systemProperties> | ||
<native.image.path>${project.build.directory}/${project.build.finalName}-runner</native.image.path> | ||
</systemProperties> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</profile> | ||
</profiles> | ||
</project> |
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 @@ | ||
#### | ||
# This Dockerfile is used in order to build a container that runs the Quarkus application in JVM mode | ||
# | ||
# Before building the docker image run: | ||
# | ||
# mvn package | ||
# | ||
# Then, build the image with: | ||
# | ||
# docker build -f src/main/docker/Dockerfile.jvm -t quarkus/operator-example-jvm . | ||
# | ||
# Then run the container using: | ||
# | ||
# docker run -i --rm -p 8080:8080 quarkus/operator-example-jvm | ||
# | ||
### | ||
FROM fabric8/java-alpine-openjdk8-jre | ||
ENV JAVA_OPTIONS="-Dquarkus.http.host=0.0.0.0 -Djava.util.logging.manager=org.jboss.logmanager.LogManager" | ||
ENV AB_ENABLED=jmx_exporter | ||
COPY target/lib/* /deployments/lib/ | ||
COPY target/*-runner.jar /deployments/app.jar | ||
ENTRYPOINT [ "/deployments/run-java.sh" ] |
Oops, something went wrong.