Skip to content

feat: optional dependent resource #2240

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

Closed
wants to merge 54 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
a1235bc
chore: set version to 5.0.0-SNAPSHOT (#2200)
csviri Jan 18, 2024
0463ce7
improve: java version minimal 11, tested on 21 (#2207)
csviri Jan 18, 2024
ff2bbfa
improve: remove deprecated EventFilter (#2208)
csviri Jan 18, 2024
9eb3fac
docs: 5.0 migration guide skeleton (#2210)
csviri Jan 19, 2024
c0a741c
improve: managed dependent reconciliation results not optional (#2212)
csviri Jan 22, 2024
76bbc6c
improve: remove deprecated RetryConfiguration (#2211)
csviri Jan 22, 2024
1df8a80
feat: JDK client is now the default (#2235)
csviri Feb 6, 2024
2389cda
fix: update SCM information (#2237)
metacosm Feb 7, 2024
4b15cbb
feat: move name is directly to dependent resource (#2250)
csviri Mar 4, 2024
ac439f1
format
csviri Mar 7, 2024
f17e872
fix: test after rebase on master (#2270)
csviri Mar 7, 2024
77ff66e
feat: use java 17 as baseline (#2271)
csviri Mar 8, 2024
c237145
improve: matcher always considers metadata (#2273)
csviri Mar 9, 2024
869bb6a
feat: API to check if next reconciliation is imminent (#2272)
csviri Mar 11, 2024
b8d0668
feat: Workflow extracted to a separate annotation (#2274)
csviri Mar 11, 2024
a795edd
fix: pom properties cleanup (#2280)
csviri Mar 11, 2024
cee25b2
improve: remove EventSourceInitializer (#2257)
csviri Mar 12, 2024
5c998c7
refactor: make loadFromProperties private (#2287)
metacosm Mar 13, 2024
717d077
feat: distinguish resources based on desired state (#2252)
csviri Mar 13, 2024
fd2f74d
feat: explicit workflow invocation (#2289)
csviri Mar 18, 2024
17a103f
feat: use ssa for status update by default from `UpdateControl` (#2278)
csviri Mar 18, 2024
1a5cae9
refactor: make WorkflowSpec an interface (#2300)
metacosm Mar 20, 2024
f5242be
improve: replace current formatting plugins with spotless plugin (#2…
csviri Mar 21, 2024
464e9d5
refactor: make ManagedWorkflowSupport public to be able to reuse it (…
metacosm Mar 21, 2024
8f306f6
fix: package fix leader election sample (#2303)
csviri Mar 24, 2024
c490451
feat: remove resource discriminator (#2299)
csviri Mar 25, 2024
1db0fa6
refactor: remove deprecated getTerminationTimeoutSeconds and associat…
metacosm Mar 26, 2024
d7c3576
improve: additional logging to mysql schema e2e test (#2320)
csviri Mar 27, 2024
6821b16
feat: handle clustered resource on secondary to primary mapper init (…
metacosm Mar 27, 2024
4ca321d
feat: using SSA for finalizer and primary patch (#2305)
csviri Apr 8, 2024
a8147db
fix: error with java docs validation (#2336)
csviri Apr 8, 2024
c096f87
fix: format after rebase
csviri Apr 10, 2024
1ada74d
fix: remove now unneeded okhttp dependency override, wrong comment (#…
metacosm Apr 11, 2024
37dbf1f
feat: run spotless on compile (#2330)
metacosm Apr 12, 2024
d3a15e4
refactor: clean-up (#2325)
metacosm Apr 12, 2024
599dd46
improve: samples correctly create status object for SSA (#2365)
csviri Apr 25, 2024
1e56113
improve: named event sources and related changes (#2340)
csviri Apr 28, 2024
16bb1b3
feat: silent exception handling in managed workflows (#2363)
csviri Apr 29, 2024
486c750
feat: feature flag to not clone secondary resource on access (#2364)
csviri May 2, 2024
f036f86
fix: unit test for event processor stopping (#2373)
csviri May 2, 2024
27ca97c
feat: all event source is resource event source (#2367)
csviri May 2, 2024
fa2f06a
feat: read-only bulk dependent (#2372)
csviri May 14, 2024
9acfda6
feat: remove automatic observed generation handling (#2382)
csviri May 14, 2024
dc4dc90
docs: bulk dependent resource migration (#2383)
csviri May 15, 2024
04febbd
fix: correct default secondary to primary mapper (#2386)
csviri May 15, 2024
463ee73
improve: secondaryToPrimary check type of owner reference (#2371)
csviri May 16, 2024
9119c59
improve: remove deprecated APIs (#2375)
csviri May 16, 2024
78b0586
improve: ensure unique name on event sources (#2370)
csviri May 16, 2024
cc57156
fix: pom formatting
csviri May 17, 2024
5337e79
docs: migrate v5 changes to docsy (#2397)
csviri May 21, 2024
4105421
docs: @Workflow usage (#2413)
csviri Jun 12, 2024
705c9b1
feat: API to check if next reconciliation is imminent (#2272)
csviri Mar 11, 2024
2d22dd2
feat: optional dependent
csviri Feb 13, 2024
405d64a
fix
csviri Jun 13, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
8 changes: 3 additions & 5 deletions .github/workflows/e2e-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
sample_operators_tests:
strategy:
matrix:
sample_dir:
sample:
- "sample-operators/mysql-schema"
- "sample-operators/tomcat-operator"
- "sample-operators/webpage"
Expand Down Expand Up @@ -48,12 +48,10 @@ jobs:
run: mvn install -DskipTests

- name: Run integration tests in local mode
working-directory: ${{ matrix.sample_dir }}
run: |
mvn test -P end-to-end-tests
mvn test -P end-to-end-tests -pl ${{ matrix.sample }}

- name: Run E2E tests as a deployment
working-directory: ${{ matrix.sample_dir }}
run: |
eval $(minikube -p minikube docker-env)
mvn jib:dockerBuild test -P end-to-end-tests -Dtest.deployment=remote
mvn jib:dockerBuild test -P end-to-end-tests -Dtest.deployment=remote -pl ${{ matrix.sample }}
2 changes: 1 addition & 1 deletion .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ on:
http-client:
type: string
required: false
default: 'okhttp'
default: 'jdk'
experimental:
type: boolean
required: false
Expand Down
7 changes: 3 additions & 4 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,14 @@ jobs:
cache: 'maven'
- name: Check code format
run: |
./mvnw ${MAVEN_ARGS} formatter:validate -Dconfigfile=$PWD/contributing/eclipse-google-style.xml -pl '!operator-framework-bom' --file pom.xml
./mvnw ${MAVEN_ARGS} impsort:check -pl '!operator-framework-bom' --file pom.xml
./mvnw ${MAVEN_ARGS} spotless:check --file pom.xml
- name: Run unit tests
run: ./mvnw ${MAVEN_ARGS} clean install --file pom.xml

integration_tests:
strategy:
matrix:
java: [ 11, 17 ]
java: [ 17, 21 ]
kubernetes: [ 'v1.26.13', 'v1.27.10', 'v1.28.6', 'v1.29.1' ]
uses: ./.github/workflows/integration-tests.yml
with:
Expand All @@ -56,7 +55,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
java: [ 11, 17 ]
java: [ 17, 21 ]
steps:
- uses: actions/checkout@v4
- name: Set up Java and Maven
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release-project-in-dir.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
- name: Set up Java and Maven
uses: actions/setup-java@v4
with:
java-version: 11
java-version: 17
distribution: temurin
cache: 'maven'

Expand Down Expand Up @@ -61,7 +61,7 @@ jobs:
- name: Set up Java and Maven
uses: actions/setup-java@v4
with:
java-version: 11
java-version: 17
distribution: temurin
cache: 'maven'

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/snapshot-releases.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 11
java-version: 17
cache: 'maven'
- name: Build and test project
run: ./mvnw ${MAVEN_ARGS} clean install --file pom.xml
Expand All @@ -34,7 +34,7 @@ jobs:
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 11
java-version: 17
cache: 'maven'
- name: Release Maven package
uses: samuelmeuli/action-maven-publish@v1
Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ It makes it easy to implement best practices and patterns for an Operator. Featu
* Handling dependent resources, related events, and caching.
* Automatic Retries
* Smart event scheduling
* Handling Observed Generations automatically
* Easy to use Error Handling
* ... and everything that a batteries included framework needs

Expand Down
58 changes: 29 additions & 29 deletions bootstrapper-maven-plugin/pom.xml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<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/maven-v4_0_0.xsd">
<?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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<artifactId>java-operator-sdk</artifactId>
<groupId>io.javaoperatorsdk</groupId>
<version>4.9.1-SNAPSHOT</version>
<artifactId>java-operator-sdk</artifactId>
<version>5.0.0-SNAPSHOT</version>
</parent>

<artifactId>bootstrapper</artifactId>
Expand All @@ -14,10 +14,10 @@
<description>Operator SDK - Bootstrapper Maven Plugin</description>

<properties>
<maven-plugin-annotations.version>3.13.0</maven-plugin-annotations.version>
<maven-plugin-annotations.version>3.12.0</maven-plugin-annotations.version>
<maven-plugin-api.version>3.9.6</maven-plugin-api.version>
<templating-maven-plugin.version>3.0.0</templating-maven-plugin.version>
<maven-plugin-plugin.version>3.13.0</maven-plugin-plugin.version>
<maven-plugin-plugin.version>3.12.0</maven-plugin-plugin.version>
</properties>

<dependencies>
Expand Down Expand Up @@ -72,29 +72,29 @@
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-plugin-plugin</artifactId>
<version>${maven-plugin-plugin.version}</version>
<configuration>
<goalPrefix>josdk-bootstrapper</goalPrefix>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>templating-maven-plugin</artifactId>
<version>${templating-maven-plugin.version}</version>
<executions>
<execution>
<id>filtering-java-templates</id>
<goals>
<goal>filter-sources</goal>
</goals>
</execution>
</executions>
</plugin>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-plugin-plugin</artifactId>
<version>${maven-plugin-plugin.version}</version>
<configuration>
<goalPrefix>josdk-bootstrapper</goalPrefix>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>templating-maven-plugin</artifactId>
<version>${templating-maven-plugin.version}</version>
<executions>
<execution>
<id>filtering-java-templates</id>
<goals>
<goal>filter-sources</goal>
</goals>
</execution>
</executions>
</plugin>

</plugins>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public class Bootstrapper {

private static final Logger log = LoggerFactory.getLogger(Bootstrapper.class);

private MustacheFactory mustacheFactory = new DefaultMustacheFactory();
private final MustacheFactory mustacheFactory = new DefaultMustacheFactory();

private static final List<String> TOP_LEVEL_STATIC_FILES =
List.of(".gitignore", "README.md");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,20 @@
import io.fabric8.kubernetes.api.model.ObjectMetaBuilder;
import io.javaoperatorsdk.operator.api.config.informer.InformerConfiguration;
import io.javaoperatorsdk.operator.api.reconciler.Reconciler;
import io.javaoperatorsdk.operator.api.reconciler.EventSourceInitializer;
import io.javaoperatorsdk.operator.api.reconciler.UpdateControl;
import io.javaoperatorsdk.operator.api.reconciler.Context;
import io.javaoperatorsdk.operator.api.reconciler.EventSourceContext;
import io.javaoperatorsdk.operator.api.reconciler.ControllerConfiguration;
import io.javaoperatorsdk.operator.api.reconciler.dependent.Dependent;
import io.javaoperatorsdk.operator.api.reconciler.Workflow;
import io.javaoperatorsdk.operator.processing.event.source.EventSource;
import io.javaoperatorsdk.operator.processing.event.source.informer.InformerEventSource;

import java.util.Map;
import java.util.Optional;

@ControllerConfiguration(dependents = {@Dependent(type = ConfigMapDependentResource.class)})
@Workflow(dependents = {@Dependent(type = ConfigMapDependentResource.class)})
@ControllerConfiguration
public class {{artifactClassId}}Reconciler implements Reconciler<{{artifactClassId}}CustomResource> {

public UpdateControl<{{artifactClassId}}CustomResource> reconcile({{artifactClassId}}CustomResource primary,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package {{groupId}};

import io.javaoperatorsdk.operator.api.ObservedGenerationAwareStatus;

public class {{artifactClassId}}Status extends ObservedGenerationAwareStatus {
public class {{artifactClassId}}Status {

}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<packaging>jar</packaging>

<properties>
<java.version>11</java.version>
<java.version>17</java.version>
<maven.compiler.source>${java.version}</maven.compiler.source>
<maven.compiler.target>${java.version}</maven.compiler.target>
<josdk.version>{{josdkVersion}}</josdk.version>
Expand Down
19 changes: 6 additions & 13 deletions caffeine-bounded-cache-support/pom.xml
Original file line number Diff line number Diff line change
@@ -1,22 +1,15 @@
<?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">
<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">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>java-operator-sdk</artifactId>
<groupId>io.javaoperatorsdk</groupId>
<version>4.9.1-SNAPSHOT</version>
<artifactId>java-operator-sdk</artifactId>
<version>5.0.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>caffeine-bounded-cache-support</artifactId>
<name>Operator SDK - Caffeine Bounded Cache Support</name>

<properties>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
</properties>

<dependencies>
<dependency>
<groupId>io.javaoperatorsdk</groupId>
Expand Down Expand Up @@ -70,10 +63,10 @@
However, this is needed to compile the tests so let's disable apt just for the compile phase -->
<execution>
<id>default-compile</id>
<phase>compile</phase>
<goals>
<goal>compile</goal>
</goals>
<phase>compile</phase>
<configuration>
<compilerArgs>
<arg>-proc:none</arg>
Expand All @@ -85,4 +78,4 @@
</plugins>
</build>

</project>
</project>
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package io.javaoperatorsdk.operator.processing.event.source.cache.sample;

import java.time.Duration;
import java.util.List;
import java.util.Map;

import org.slf4j.Logger;
Expand Down Expand Up @@ -28,7 +29,7 @@
import com.github.benmanes.caffeine.cache.Caffeine;

public abstract class AbstractTestReconciler<P extends CustomResource<BoundedCacheTestSpec, BoundedCacheTestStatus>>
implements Reconciler<P>, EventSourceInitializer<P> {
implements Reconciler<P> {

private static final Logger log =
LoggerFactory.getLogger(BoundedCacheClusterScopeTestReconciler.class);
Expand Down Expand Up @@ -69,7 +70,7 @@ protected void createConfigMap(P resource, Context<P> context) {
}

@Override
public Map<String, EventSource> prepareEventSources(
public List<EventSource> prepareEventSources(
EventSourceContext<P> context) {

var boundedItemStore =
Expand All @@ -79,10 +80,11 @@ public Map<String, EventSource> prepareEventSources(
var es = new InformerEventSource<>(InformerConfiguration.from(ConfigMap.class, context)
.withItemStore(boundedItemStore)
.withSecondaryToPrimaryMapper(
Mappers.fromOwnerReference(this instanceof BoundedCacheClusterScopeTestReconciler))
Mappers.fromOwnerReferences(context.getPrimaryResourceClass(),
this instanceof BoundedCacheClusterScopeTestReconciler))
.build(), context);

return EventSourceInitializer.nameEventSources(es);
return List.of(es);
}

private void ensureStatus(P resource) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
package io.javaoperatorsdk.operator.processing.event.source.cache.sample.namespacescope;

import io.javaoperatorsdk.operator.api.ObservedGenerationAwareStatus;

public class BoundedCacheTestStatus extends ObservedGenerationAwareStatus {
public class BoundedCacheTestStatus {
}
4 changes: 3 additions & 1 deletion docs/_data/sidebar.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,6 @@
- title: Migrating from v4.3 to v4.4
url: /docs/v4-4-migration
- title: Migrating from v4.4 to v4.5
url: /docs/v4-5-migration
url: /docs/v4-5-migration
- title: Migrating from v4.7 to v5.0
url: /docs/v5-0-migration
Loading
Loading