Proper kustomize setup for the operator

This commit is contained in:
andreaTP 2022-01-13 10:34:35 +00:00 committed by Pedro Igor
parent e2ac7b38f4
commit 90d6432d16
6 changed files with 63 additions and 16 deletions

View file

@ -33,8 +33,20 @@ Compile the project and generate the Docker image with JIB:
mvn clean package -Doperator -Dquarkus.container-image.build=true -Dquarkus.kubernetes.deployment-target=minikube
```
Install the CRD definition and the operator in the cluster:
Install the CRD definition and the operator in the cluster in the `keycloak` namespace:
```bash
kubectl apply -k .
kubectl apply -k target
```
to install in the `default` namespace:
```bash
kubectl apply -k overlays/default-namespace
```
Remove the created resources with:
```bash
kubectl delete -k <previously-used-folder>
```

View file

@ -1,4 +0,0 @@
resources:
- target/kubernetes/keycloaks.keycloak.org-v1.yml
- target/kubernetes/minikube.yml
- kubernetes/deployments-role.yaml

View file

@ -0,0 +1,7 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- ../../target
namespace: default

View file

@ -123,16 +123,37 @@
</pluginManagement>
<plugins>
<plugin>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-maven-plugin</artifactId>
<version>${quarkus.version}</version>
<executions>
<execution>
<goals>
<goal>build</goal>
</goals>
</execution>
</executions>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-maven-plugin</artifactId>
<version>${quarkus.version}</version>
<executions>
<execution>
<goals>
<goal>build</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<executions>
<execution>
<id>copy-resources</id>
<phase>validate</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${basedir}/target</outputDirectory>
<resources>
<resource>
<directory>src/main/kubernetes</directory>
<filtering>true</filtering>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>

View file

@ -0,0 +1,11 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: keycloak
resources:
- kubernetes/keycloaks.keycloak.org-v1.yml
- kubernetes/kubernetes.yml
patches:
- kubernetes/minikube.yml