You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using the CRUDKubernetesDependentResource with a cluster-scoped secondary resource results in KubernetesClientException: namespace cannot be null
#1682
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.
It creates, updates and deletes the namespace according to changes in the primary resource.
What did you see instead? Under which circumstances?
As soon as I've created the primary resource, the operator logs the following exception:
Caused by: io.fabric8.kubernetes.client.KubernetesClientException: namespace cannot be null
at io.javaoperatorsdk.operator.processing.dependent.workflow.WorkflowResult.throwAggregateExceptionIfErrorsPresent(WorkflowResult.java:40)
at io.javaoperatorsdk.operator.processing.dependent.workflow.WorkflowReconcileResult.throwAggregateExceptionIfErrorsPresent(WorkflowReconcileResult.java:9)
at io.javaoperatorsdk.operator.processing.dependent.workflow.DefaultWorkflow.reconcile(DefaultWorkflow.java:92)
at io.javaoperatorsdk.operator.processing.Controller$1.execute(Controller.java:140)
at io.javaoperatorsdk.operator.processing.Controller$1.execute(Controller.java:103)
at io.javaoperatorsdk.operator.api.monitoring.Metrics.timeControllerExecution(Metrics.java:206)
at io.javaoperatorsdk.operator.processing.Controller.reconcile(Controller.java:102)
at io.javaoperatorsdk.operator.processing.event.ReconciliationDispatcher.reconcileExecution(ReconciliationDispatcher.java:141)
at io.javaoperatorsdk.operator.processing.event.ReconciliationDispatcher.handleReconcile(ReconciliationDispatcher.java:121)
at io.javaoperatorsdk.operator.processing.event.ReconciliationDispatcher.handleDispatch(ReconciliationDispatcher.java:91)
at io.javaoperatorsdk.operator.processing.event.ReconciliationDispatcher.handleExecution(ReconciliationDispatcher.java:64)
at io.javaoperatorsdk.operator.processing.event.EventProcessor$ReconcilerExecutor.run(EventProcessor.java:415)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
at java.base/java.lang.Thread.run(Thread.java:833)
Environment
Kubernetes cluster type:
I'm using a local minikube on libvirt and CRI-O.
$ Mention java-operator-sdk version from pom.xml file
java-operator-sdk version used: 4.2.0
$ java -version
openjdk version "17.0.5" 2022-10-18
OpenJDK Runtime Environment GraalVM CE 22.3.0 (build 17.0.5+8-jvmci-22.3-b08)
OpenJDK 64-Bit Server VM GraalVM CE 22.3.0 (build 17.0.5+8-jvmci-22.3-b08, mixed mode, sharing)
A possible fix would be to check in KubernetesDependentResource.prepare() whether the secondary resource implements Namespaced:
@OverrideprotectedResource<R> prepare(Rdesired, Pprimary, StringactionName) {
log.debug("{} target resource with type: {}, with id: {}",
actionName,
desired.getClass(),
ResourceID.fromResource(desired));
if (addOwnerReference()) {
desired.addOwnerReference(primary);
} elseif (useDefaultAnnotationsToIdentifyPrimary()) {
addDefaultSecondaryToPrimaryMapperAnnotations(desired, primary);
}
if (desiredinstanceofNamespaced) {
returnclient.resource(desired).inNamespace(desired.getMetadata().getNamespace());
} else {
returnclient.resource(desired);
}
}
Additional context
I'm using the Quarkiverse Operator SDK extension for Quarkus to integrate the Operator SDK with Quarkus, but this should be causing the issue.
The text was updated successfully, but these errors were encountered:
silenium-dev
changed the title
Using the CRUDKubernetesDependentResource with a namespace results in KubernetesClientException: namespace cannot be null
Using the CRUDKubernetesDependentResource with cluster-scoped secondary resource results in KubernetesClientException: namespace cannot be null
Dec 26, 2022
silenium-dev
changed the title
Using the CRUDKubernetesDependentResource with cluster-scoped secondary resource results in KubernetesClientException: namespace cannot be null
Using the CRUDKubernetesDependentResource with a cluster-scoped secondary resource results in KubernetesClientException: namespace cannot be null
Dec 26, 2022
Uh oh!
There was an error while loading. Please reload this page.
Bug Report
What did you do?
I've used a namespace with the Dependent Resource Feature, the dependent resource implementation below:
What did you expect to see?
It creates, updates and deletes the namespace according to changes in the primary resource.
What did you see instead? Under which circumstances?
As soon as I've created the primary resource, the operator logs the following exception:
Environment
Kubernetes cluster type:
I'm using a local minikube on libvirt and CRI-O.
$ Mention java-operator-sdk version from pom.xml file
java-operator-sdk version used: 4.2.0
$ java -version
$ kubectl version
Possible Solution
A possible fix would be to check in
KubernetesDependentResource.prepare()
whether the secondary resource implementsNamespaced
:Additional context
I'm using the Quarkiverse Operator SDK extension for Quarkus to integrate the Operator SDK with Quarkus, but this should be causing the issue.
The text was updated successfully, but these errors were encountered: