Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DBZ-6738 Suport for watching all namespaces and OLM #9

Merged
merged 6 commits into from
Oct 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@
Debezium operator provides an easy way to run the Debezium Server on Kubernetes or Openshift.

## Installation steps

The debezium operator currently support per namespace installation. To install the operator to your kubernetes cluster,
The debezium operator currently support only per namespace installation unless installing via OLM. To install the operator to your kubernetes cluster,
simply create the descriptors available in the `k8` directory.

```bash
kubectl create -f k8/ -n $NAMESPACE
kubectl create -f k8/ -n $NAMESPACE
```

_Note: In the future the operator will support OLM and Helm chart installations._

### Quickstart Example

The `exmaples/postgres` directory contains an example deployment of debezium server with PostgreSQL source and kafka
Expand Down
31 changes: 18 additions & 13 deletions k8/kubernetes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ apiVersion: v1
kind: ServiceAccount
metadata:
labels:
app.kubernetes.io/name: debezium-operator
app.kubernetes.io/managed-by: quarkus
app.kubernetes.io/name: debezium-operator
name: debezium-operator
---
apiVersion: rbac.authorization.k8s.io/v1
Expand Down Expand Up @@ -49,10 +49,10 @@ rules:
- get
- list
- watch
- create
- patch
- update
- delete
- create
- apiGroups:
- rbac.authorization.k8s.io
resources:
Expand All @@ -61,10 +61,22 @@ rules:
- get
- list
- watch
- patch
- update
- delete
- create
- apiGroups:
- rbac.authorization.k8s.io
resources:
- roles
verbs:
- get
- list
- watch
- patch
- update
- delete
- create
- apiGroups:
- ""
resources:
Expand All @@ -73,10 +85,10 @@ rules:
- get
- list
- watch
- create
- patch
- update
- delete
- create
- apiGroups:
- apps
resources:
Expand All @@ -85,10 +97,10 @@ rules:
- get
- list
- watch
- create
- patch
- update
- delete
- create
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
Expand Down Expand Up @@ -139,10 +151,6 @@ spec:
port: 80
protocol: TCP
targetPort: 8080
- name: https
port: 443
protocol: TCP
targetPort: 8443
selector:
app.kubernetes.io/name: debezium-operator
type: ClusterIP
Expand All @@ -151,8 +159,8 @@ apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app.kubernetes.io/name: debezium-operator
app.kubernetes.io/managed-by: quarkus
app.kubernetes.io/name: debezium-operator
name: debezium-operator
spec:
replicas: 1
Expand All @@ -162,8 +170,8 @@ spec:
template:
metadata:
labels:
app.kubernetes.io/name: debezium-operator
app.kubernetes.io/managed-by: quarkus
app.kubernetes.io/name: debezium-operator
spec:
containers:
- env:
Expand All @@ -185,9 +193,6 @@ spec:
timeoutSeconds: 10
name: debezium-operator
ports:
- containerPort: 8443
name: https
protocol: TCP
- containerPort: 8080
name: http
protocol: TCP
Expand Down
135 changes: 111 additions & 24 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,35 +20,58 @@
</scm>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<maven.compiler.release>17</maven.compiler.release>
<maven.compiler.testRelease>17</maven.compiler.testRelease>
<maven.build.timestamp.format>yyyy-MM-dd'T'HH:mm:ss'Z'</maven.build.timestamp.format>

<!-- Debezium version -->
<version.debezium>${project.version}</version.debezium>

<compiler-plugin.version>3.11.0</compiler-plugin.version>
<maven.compiler.release>17</maven.compiler.release>
<maven.compiler.testRelease>17</maven.compiler.testRelease>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<quarkus.platform.artifact-id>quarkus-bom</quarkus.platform.artifact-id>
<quarkus.platform.group-id>io.quarkus.platform</quarkus.platform.group-id>
<quarkus.platform.version>3.0.1.Final</quarkus.platform.version>
<quarkus.operator.sdk.version>6.1.0</quarkus.operator.sdk.version>
<skipITs>true</skipITs>
<surefire-plugin.version>3.0.0</surefire-plugin.version>
<!-- Plugin versions -->
<version.buildhelper.plugin>3.4.0</version.buildhelper.plugin>
<version.surefire.version>3.0.0</version.surefire.version>
<version.compiler.plugin>3.11.0</version.compiler.plugin>
<version.resources.plugin>3.3.1</version.resources.plugin>
<version.docker.maven.plugin>0.43.4</version.docker.maven.plugin>

<!-- Dependency versions -->
<version.assertj>3.24.2</version.assertj>

<!-- OLM configuration -->
<olm.bundle.name>debezium-operator.v${olm.bundle.version}</olm.bundle.name>
<olm.bundle.channels>alpha</olm.bundle.channels>
<olm.bundle.version>${parsedVersion.majorVersion}.${parsedVersion.minorVersion}.${parsedVersion.incrementalVersion}-nightly</olm.bundle.version>
<olm.bundle.replaces></olm.bundle.replaces>
<olm.bundle.containerImage>${quarkus.container-image.registry}/${quarkus.container-image.group}/${quarkus.container-image.name}:${quarkus.container-image.tag}</olm.bundle.containerImage>
<olm.bundle.createdAt>${maven.build.timestamp}</olm.bundle.createdAt>
<olm.bundle.package.name>debezium-operator</olm.bundle.package.name>

<!-- Quarkus configuration and versions-->
<quarkus.platform.artifact-id>quarkus-bom</quarkus.platform.artifact-id>
<quarkus.platform.group-id>io.quarkus</quarkus.platform.group-id>
<quarkus.platform.version>3.2.4.Final</quarkus.platform.version>
<quarkus.operator.sdk.version>6.3.3</quarkus.operator.sdk.version>

<!-- Operator and Image configuration -->
<quarkus.operator-sdk.crd.validate>false</quarkus.operator-sdk.crd.validate>
<quarkus.operator-sdk.bundle.package-name>${project.artifactId}</quarkus.operator-sdk.bundle.package-name>
<quarkus.operator-sdk.bundle.channels>alpha</quarkus.operator-sdk.bundle.channels>
<quarkus.operator-sdk.bundle.version>${olm.bundle.version}</quarkus.operator-sdk.bundle.version>
<quarkus.operator-sdk.bundle.version.replaces>${olm.bundle.replaces}</quarkus.operator-sdk.bundle.version.replaces>
<quarkus.operator-sdk.bundle.package-name>${olm.bundle.package.name}</quarkus.operator-sdk.bundle.package-name>
<quarkus.container-image.registry>quay.io</quarkus.container-image.registry>
<quarkus.container-image.group>debezium</quarkus.container-image.group>
<quarkus.container-image.name>operator</quarkus.container-image.name>
<quarkus.container-image.tag>nightly</quarkus.container-image.tag>
<quarkus.kubernetes.name>debezium-operator</quarkus.kubernetes.name>
<quarkus.kubernetes.idempotent>true</quarkus.kubernetes.idempotent>

<!-- Formatting configuration -->
<format.imports.source.compliance>17</format.imports.source.compliance>
<!-- Example properties -->
<examples.image.tag>${quarkus.container-image.tag}</examples.image.tag>
<!-- Outputting dollar sign has to be done through property-->
<dollar>$$</dollar>
</properties>

<repositories>
Expand Down Expand Up @@ -120,6 +143,20 @@

<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>${version.buildhelper.plugin}</version>
<executions>
<execution>
<phase>initialize</phase>
<id>parse-version</id>
<goals>
<goal>parse-version</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>${quarkus.platform.group-id}</groupId>
<artifactId>quarkus-maven-plugin</artifactId>
Expand All @@ -137,7 +174,7 @@
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>${compiler-plugin.version}</version>
<version>${version.compiler.plugin}</version>
<configuration>
<compilerArgs>
<arg>-parameters</arg>
Expand All @@ -146,7 +183,7 @@
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>${surefire-plugin.version}</version>
<version>${version.surefire.plugin}</version>
<configuration>
<systemPropertyVariables>
<java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
Expand All @@ -156,7 +193,7 @@
</plugin>
<plugin>
<artifactId>maven-failsafe-plugin</artifactId>
<version>${surefire-plugin.version}</version>
<version>${version.surefire.plugin}</version>
<executions>
<execution>
<goals>
Expand All @@ -174,6 +211,32 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>${version.resources.plugin}</version>
<executions>
<execution>
<id>olm-bundle-process</id>
<phase>package</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/olm/bundles/${olm.bundle.name}</outputDirectory>
<resources>
<resource>
<!-- Outputting ${olm.bundle.name} without actually expanding the property -->
<directory>${project.build.directory}/bundle/${dollar}{olm.bundle.name}</directory>
<include>**/*</include>
<filtering>true</filtering>
</resource>
</resources>
<fileNameFiltering>true</fileNameFiltering>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>

Expand All @@ -194,13 +257,22 @@
<id>stable</id>
<properties>
<quarkus.container-image.tag>${project.parent.version}</quarkus.container-image.tag>
<quarkus.operator-sdk.bundle.channels>${olm.bundle.channels}</quarkus.operator-sdk.bundle.channels>
<olm.bundle.version>${project.parent.version}</olm.bundle.version>
<olm.bundle.channels>debezium-${parsedVersion.majorVersion}.${parsedVersion.minorVersion}.x</olm.bundle.channels>
</properties>
</profile>
<profile>
<id>k8update</id>
<!-- This must be defined later than stable profile to ensure correct property resolution!!! -->
<!-- See: https://maven.apache.org/guides/introduction/introduction-to-profiles.html#profile-order -->
<!-- The purpose of this channel is to release the OLM bundle into the debezium-latest OLM channel -->
<id>olmLatest</id>
<properties>
<quarkus.kubernetes.idempotent>true</quarkus.kubernetes.idempotent>
<quarkus.operator-sdk.bundle.channels>debezium-latest,${olm.bundle.channels}</quarkus.operator-sdk.bundle.channels>
</properties>
</profile>
<profile>
<id>k8update</id>
<build>
<plugins>
<plugin>
Expand Down Expand Up @@ -255,20 +327,35 @@
<artifactId>maven-assembly-plugin</artifactId>
<version>${version.assembly.plugin}</version>
<configuration>
<appendAssemblyId>false</appendAssemblyId>
<attach>true</attach> <!-- we want attach & deploy these to Maven -->
<descriptors>
<descriptor>src/main/resources/assembly.xml</descriptor>
</descriptors>
<attach>true</attach> <!-- we want to attach & deploy these to Maven -->
<tarLongFileMode>posix</tarLongFileMode>
</configuration>
<executions>
<execution>
<id>distribution</id>
<id>operator-package</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<appendAssemblyId>false</appendAssemblyId>
<descriptors>
<descriptor>src/main/assemblies/operator.xml</descriptor>
</descriptors>
</configuration>
</execution>
<execution>
<id>olm-bundle-package</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<appendAssemblyId>true</appendAssemblyId>
<descriptors>
<descriptor>src/main/assemblies/olm.xml</descriptor>
</descriptors>
</configuration>
</execution>
</executions>
</plugin>
Expand Down
33 changes: 33 additions & 0 deletions src/main/assemblies/olm.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<assembly xmlns="http://maven.apache.org/ASSEMBLY/2.2.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/ASSEMBLY/2.2.0 https://maven.apache.org/xsd/assembly-2.2.0.xsd">
<id>olm-bundle</id>
<formats>
<format>tar.gz</format>
<format>zip</format>
</formats>

<includeBaseDirectory>false</includeBaseDirectory>
<fileSets>
<fileSet>
<!-- Get the files from the top-level directory -->
<directory>${project.basedir}.</directory>
<!-- <outputDirectory>${project.artifactId}</outputDirectory>-->
<includes>
<include>README*</include>
<include>CHANGELOG*</include>
<include>CONTRIBUTE*</include>
<include>COPYRIGHT*</include>
<include>LICENSE*</include>
</includes>
<useDefaultExcludes>true</useDefaultExcludes>
</fileSet>
<fileSet>
<directory>${project.build.directory}/olm/bundles/</directory>
<outputDirectory>.</outputDirectory>
<includes>
<include>**/**</include>
</includes>
</fileSet>
</fileSets>
</assembly>
File renamed without changes.
Loading