Skip to content

Commit

Permalink
docs: improve documentation for operator-level namespaces property (#635
Browse files Browse the repository at this point in the history
)

* test: re-enable test that should now be passing

* docs: improve documentation for operator-level namespaces property

Also add test to check default works correctly

* fix: force testing on 3.2.0.Final

* chore: prepare for 6.2.0 release
  • Loading branch information
metacosm authored Jun 29, 2023
1 parent 12fb3d7 commit 48a5b74
Show file tree
Hide file tree
Showing 7 changed files with 54 additions and 12 deletions.
4 changes: 2 additions & 2 deletions .github/project.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: Java Operator SDK Extension
release:
current-version: 6.2.0.CR1
next-version: 6.2.0-SNAPSHOT
current-version: 6.2.0
next-version: 6.2.1-SNAPSHOT

4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ jobs:
java-version: [ 11, 17 ]
# quarkus-version-jq-cmd:
# - '.platforms[0]."current-stream-id" as $current | .platforms[0].streams[] | select(.id == $current) | .releases[0].version'
# - '.platforms[0].streams[] | select(.id == "3.1") | .releases[0].version'
# - '.platforms[0].streams[] | select(.id == "3.2") | .releases[0].version'
uses: ./.github/workflows/build-for-quarkus-version.yml
with:
quarkus-version-jq-cmd: ${{ matrix.quarkus-version-jq-cmd }}
java-version: ${{ matrix.java-version }}
branch: ${{ needs.extract-branch-name.outputs.branch_name }}
native-modules: "integration-tests"
quarkus-version: "3.2.0.CR1"
quarkus-version: "3.2.0.Final"
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package io.quarkiverse.operatorsdk.test;

import static org.junit.jupiter.api.Assertions.assertEquals;

import jakarta.inject.Inject;

import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;

import io.javaoperatorsdk.operator.api.config.ConfigurationService;
import io.javaoperatorsdk.operator.api.reconciler.Constants;
import io.quarkiverse.operatorsdk.test.sources.*;
import io.quarkus.test.QuarkusUnitTest;

public class DefaultConfigurationTest {

@RegisterExtension
static QuarkusUnitTest runner = new QuarkusUnitTest()
.withApplicationRoot(
jar -> jar.addClasses(SimpleReconciler.class, SimpleCR.class, SimpleStatus.class, SimpleSpec.class));

@Inject
ConfigurationService configurationService;

@Inject
SimpleReconciler testReconciler;

@Test
void checkDefaultOperatorLevelNamespaces() {
final var config = configurationService.getConfigurationFor(testReconciler);
assertEquals(Constants.DEFAULT_NAMESPACES_SET, config.getNamespaces());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import jakarta.inject.Inject;
import jakarta.inject.Singleton;

import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;

Expand All @@ -18,7 +17,6 @@
import io.quarkus.jackson.ObjectMapperCustomizer;
import io.quarkus.test.QuarkusUnitTest;

@Disabled("Until https://github.com/quarkusio/quarkus/pull/34259 is backported to 3.2")
public class KubernetesClientSerializationCustomizerTest {

@Inject
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import java.util.Map;
import java.util.Optional;

import io.javaoperatorsdk.operator.api.reconciler.Constants;
import io.quarkus.runtime.annotations.ConfigItem;
import io.quarkus.runtime.annotations.ConfigPhase;
import io.quarkus.runtime.annotations.ConfigRoot;
Expand All @@ -45,10 +46,18 @@ public class RunTimeOperatorConfiguration {
public Optional<Integer> terminationTimeoutSeconds;

/**
* An optional list of comma-separated namespace names all controllers will watch if not specified. If this
* property is left empty then controllers will watch all namespaces by default. Sets the default value for all controllers.
* The value can be set to "JOSDK_WATCH_CURRENT" to watch the current (default) namespace from kube config.
* Constant(s) can be found in at {@link io.javaoperatorsdk.operator.api.reconciler.Constants}".
* An optional list of comma-separated namespace names all controllers will watch if they do not specify their own list. If
* a controller specifies its own list either via the
* {@link io.javaoperatorsdk.operator.api.reconciler.ControllerConfiguration} annotation or via the associated
* {@code application.properties} property, that value will be used instead of the operator-level default value that this
* configuration option provides.
*
* <p>
* If this property is left empty then controllers will watch all namespaces by default (which is equivalent to setting this
* property to {@link Constants#WATCH_ALL_NAMESPACES}, assuming they do not provide their own list of namespaces to watch. .
* The value can be set to {@link Constants#WATCH_CURRENT_NAMESPACE} to make all controllers watch the current namespace as
* specified by the kube config file the operator uses.
* </p>
*/
@ConfigItem
public Optional<List<String>> namespaces;
Expand Down
2 changes: 1 addition & 1 deletion docs/modules/ROOT/pages/includes/attributes.adoc
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
:project-version: 6.2.0.CR1
:project-version: 6.2.0

:examples-dir: ./../examples/
4 changes: 3 additions & 1 deletion docs/modules/ROOT/pages/includes/quarkus-operator-sdk.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,9 @@ a| [[quarkus-operator-sdk_quarkus.operator-sdk.namespaces]]`link:#quarkus-operat

[.description]
--
An optional list of comma-separated namespace names all controllers will watch if not specified. If this property is left empty then controllers will watch all namespaces by default. Sets the default value for all controllers. The value can be set to "JOSDK_WATCH_CURRENT" to watch the current (default) namespace from kube config. Constant(s) can be found in at `io.javaoperatorsdk.operator.api.reconciler.Constants`".
An optional list of comma-separated namespace names all controllers will watch if they do not specify their own list. If a controller specifies its own list either via the `io.javaoperatorsdk.operator.api.reconciler.ControllerConfiguration` annotation or via the associated `application.properties` property, that value will be used instead of the operator-level default value that this configuration option provides.

If this property is left empty then controllers will watch all namespaces by default (which is equivalent to setting this property to `Constants++#++WATCH_ALL_NAMESPACES`, assuming they do not provide their own list of namespaces to watch. . The value can be set to `Constants++#++WATCH_CURRENT_NAMESPACE` to make all controllers watch the current namespace as specified by the kube config file the operator uses.

ifdef::add-copy-button-to-env-var[]
Environment variable: env_var_with_copy_button:+++QUARKUS_OPERATOR_SDK_NAMESPACES+++[]
Expand Down

0 comments on commit 48a5b74

Please sign in to comment.