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
24 changed files
with
761 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,15 @@ | ||
apiVersion: apiextensions.k8s.io/v1beta1 | ||
kind: CustomResourceDefinition | ||
metadata: | ||
name: launchers.launcher.fabric8.io | ||
spec: | ||
group: launcher.fabric8.io | ||
names: | ||
kind: Launcher | ||
listKind: LauncherList | ||
plural: launchers | ||
singular: launcher | ||
scope: Namespaced | ||
version: v1alpha2 | ||
subresources: | ||
status: {} |
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,51 @@ | ||
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 | ||
ports: | ||
- containerPort: 60000 | ||
name: metrics | ||
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 | ||
env: | ||
- name: WATCH_NAMESPACE | ||
valueFrom: | ||
fieldRef: | ||
fieldPath: metadata.namespace | ||
- name: POD_NAME | ||
valueFrom: | ||
fieldRef: | ||
fieldPath: metadata.name | ||
- name: OPERATOR_NAME | ||
value: "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,71 @@ | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: Role | ||
metadata: | ||
name: launcher-operator | ||
rules: | ||
- apiGroups: | ||
- "" | ||
resources: | ||
- pods | ||
- services | ||
- endpoints | ||
- persistentvolumeclaims | ||
- events | ||
- configmaps | ||
- secrets | ||
- serviceaccounts | ||
- 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: | ||
- monitoring.coreos.com | ||
resources: | ||
- servicemonitors | ||
verbs: | ||
- get | ||
- create | ||
- apiGroups: | ||
- launcher.fabric8.io | ||
resources: | ||
- '*' | ||
verbs: | ||
- '*' | ||
- apiGroups: | ||
- apiextensions.k8s.io | ||
resources: | ||
- customresourcedefinitions | ||
verbs: | ||
- list |
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,11 @@ | ||
kind: RoleBinding | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
metadata: | ||
name: launcher-operator | ||
subjects: | ||
- kind: ServiceAccount | ||
name: launcher-operator | ||
roleRef: | ||
kind: Role | ||
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/v1alpha2 | ||
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/v1alpha2 | ||
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/v1alpha2 | ||
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,120 @@ | ||
<?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> | ||
<dependency> | ||
<groupId>io.fabric8.launcher</groupId> | ||
<artifactId>launcher-service-git-api</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.fabric8.launcher</groupId> | ||
<artifactId>launcher-service-openshift-api</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.