Skip to content
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
* Copyright Java Operator SDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.javaoperatorsdk.operator.workflow.onedependentactivationcondition;

import io.fabric8.kubernetes.client.CustomResource;
import io.fabric8.kubernetes.model.annotation.Group;
import io.fabric8.kubernetes.model.annotation.ShortNames;
import io.fabric8.kubernetes.model.annotation.Version;

@Group("sample.javaoperatorsdk")
@Version("v1")
Comment thread
csviri marked this conversation as resolved.
@ShortNames("nacr")
public class NotAvailableCustomResource extends CustomResource<Void, Void> {}
Original file line number Diff line number Diff line change
Expand Up @@ -15,25 +15,24 @@
*/
package io.javaoperatorsdk.operator.workflow.onedependentactivationcondition;

import io.fabric8.kubernetes.api.model.ConfigMap;
import io.fabric8.kubernetes.api.model.ObjectMetaBuilder;
import io.javaoperatorsdk.operator.api.reconciler.Context;
import io.javaoperatorsdk.operator.processing.dependent.kubernetes.CRUDKubernetesDependentResource;

public class ConfigMapDependentResource
public class NotAvailableDependentResource
extends CRUDKubernetesDependentResource<
ConfigMap, OneDependentActivationConditionCustomResource> {
NotAvailableCustomResource, OneDependentActivationConditionCustomResource> {

@Override
protected ConfigMap desired(
protected NotAvailableCustomResource desired(
OneDependentActivationConditionCustomResource primary,
Context<OneDependentActivationConditionCustomResource> context) {
ConfigMap configMap = new ConfigMap();
configMap.setMetadata(
NotAvailableCustomResource resource = new NotAvailableCustomResource();
resource.setMetadata(
new ObjectMetaBuilder()
.withName(primary.getMetadata().getName())
.withNamespace(primary.getMetadata().getNamespace())
.build());
return configMap;
return resource;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;

import io.fabric8.kubernetes.api.model.ConfigMap;
import io.fabric8.kubernetes.api.model.ObjectMetaBuilder;
import io.javaoperatorsdk.operator.junit.LocallyRunOperatorExtension;

Expand Down Expand Up @@ -48,10 +47,6 @@ void handlesOnlyNonActiveDependent() {
.getNumberOfReconciliationExecution())
.isPositive();
});

// ConfigMap should not be created since the activation condition is false
var cm = extension.get(ConfigMap.class, TEST_RESOURCE_NAME);
assertThat(cm).isNull();
}

private OneDependentActivationConditionCustomResource testResource() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
@Workflow(
dependents = {
@Dependent(
type = ConfigMapDependentResource.class,
type = NotAvailableDependentResource.class,
activationCondition = FalseActivationCondition.class)
})
Comment thread
csviri marked this conversation as resolved.
@ControllerConfiguration
Expand Down
Loading