All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.quarkiverse.operatorsdk.it.ReadOnlyDependentResource Maven / Gradle / Ivy

package io.quarkiverse.operatorsdk.it;

import java.util.Collections;
import java.util.Optional;
import java.util.Set;

import io.fabric8.kubernetes.api.model.ConfigMap;
import io.fabric8.kubernetes.api.model.apps.Deployment;
import io.javaoperatorsdk.operator.api.reconciler.Context;
import io.javaoperatorsdk.operator.api.reconciler.ResourceDiscriminator;
import io.javaoperatorsdk.operator.api.reconciler.dependent.DependentResource;
import io.javaoperatorsdk.operator.processing.dependent.kubernetes.KubernetesDependent;
import io.javaoperatorsdk.operator.processing.dependent.kubernetes.KubernetesDependentResource;
import io.javaoperatorsdk.operator.processing.dependent.workflow.Condition;
import io.javaoperatorsdk.operator.processing.event.ResourceID;
import io.javaoperatorsdk.operator.processing.event.source.SecondaryToPrimaryMapper;
import io.quarkiverse.operatorsdk.it.ReadOnlyDependentResource.ReadOnlyResourceDiscriminator;

@KubernetesDependent(labelSelector = ReadOnlyDependentResource.LABEL_SELECTOR, resourceDiscriminator = ReadOnlyResourceDiscriminator.class)
public class ReadOnlyDependentResource extends KubernetesDependentResource implements
        SecondaryToPrimaryMapper {

    public static final String LABEL_SELECTOR = "readonly";
    public static final String NAME = "read-only";

    public ReadOnlyDependentResource() {
        super(Deployment.class);
    }

    @Override
    public Set toPrimaryResourceIDs(Deployment deployment) {
        return Collections.emptySet();
    }

    public static class ReadOnlyReadyCondition implements Condition {

        @Override
        public boolean isMet(DependentResource dependentResource,
                ConfigMap configMap, Context context) {
            return false;
        }
    }

    public static class ReadOnlyResourceDiscriminator implements ResourceDiscriminator {

        @Override
        public Optional distinguish(Class aClass, ConfigMap configMap,
                Context context) {
            return Optional.empty();
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy