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

templates.ConfigMapDependentResource Maven / Gradle / Ivy

There is a newer version: 4.9.7
Show newest version
package {{groupId}};

import java.util.HashMap;
import java.util.Map;

import io.fabric8.kubernetes.api.model.ConfigMap;
import io.fabric8.kubernetes.api.model.ConfigMapBuilder;
import io.fabric8.kubernetes.api.model.ObjectMetaBuilder;
import io.javaoperatorsdk.operator.api.reconciler.Context;
import io.javaoperatorsdk.operator.processing.dependent.kubernetes.CRUDKubernetesDependentResource;
import io.javaoperatorsdk.operator.processing.dependent.kubernetes.KubernetesDependent;
import {{groupId}}.{{artifactClassId}}CustomResource;

@KubernetesDependent
public class ConfigMapDependentResource
        extends CRUDKubernetesDependentResource {

    public static final String KEY = "key";

    public ConfigMapDependentResource() {
        super(ConfigMap.class);
    }

    @Override
    protected ConfigMap desired({{artifactClassId}}CustomResource primary,
                                Context<{{artifactClassId}}CustomResource> context) {
        return new ConfigMapBuilder()
                .withMetadata(
                        new ObjectMetaBuilder()
                                .withName(primary.getMetadata().getName())
                                .withNamespace(primary.getMetadata().getNamespace())
                                .build())
                .withData(Map.of(KEY, primary.getSpec().getValue()))
                .build();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy