Search in sources :

Example 1 with Operator

use of io.javaoperatorsdk.operator.Operator in project keycloak by keycloak.

the class ClusterOperatorTest method createRBACresourcesAndOperatorDeployment.

private static void createRBACresourcesAndOperatorDeployment() throws FileNotFoundException {
    Log.info("Creating RBAC into Namespace " + namespace);
    List<HasMetadata> hasMetadata = k8sclient.load(new FileInputStream(TARGET_KUBERNETES_GENERATED_YML_FOLDER + deploymentTarget + ".yml")).inNamespace(namespace).get();
    hasMetadata.stream().map(b -> {
        if ("Deployment".equalsIgnoreCase(b.getKind()) && b.getMetadata().getName().contains("operator")) {
            ((Deployment) b).getSpec().getTemplate().getSpec().getContainers().get(0).setImagePullPolicy("Never");
        }
        return b;
    }).forEach(c -> {
        Log.info("processing part : " + c.getKind() + "--" + c.getMetadata().getName() + " -- " + namespace);
        k8sclient.resource(c).inNamespace(namespace).createOrReplace();
    });
}
Also used : BeforeEach(org.junit.jupiter.api.BeforeEach) Assertions.assertThat(org.assertj.core.api.Assertions.assertThat) AfterAll(org.junit.jupiter.api.AfterAll) OperatorProducer(io.quarkiverse.operatorsdk.runtime.OperatorProducer) Reconciler(io.javaoperatorsdk.operator.api.reconciler.Reconciler) Operator(io.javaoperatorsdk.operator.Operator) BeforeAll(org.junit.jupiter.api.BeforeAll) TypeLiteral(javax.enterprise.util.TypeLiteral) Duration(java.time.Duration) Log(io.quarkus.logging.Log) DefaultKubernetesClient(io.fabric8.kubernetes.client.DefaultKubernetesClient) Instance(javax.enterprise.inject.Instance) FileWriter(java.io.FileWriter) CDI(javax.enterprise.inject.spi.CDI) FileInputStream(java.io.FileInputStream) UUID(java.util.UUID) HasMetadata(io.fabric8.kubernetes.api.model.HasMetadata) File(java.io.File) FileNotFoundException(java.io.FileNotFoundException) Keycloak(org.keycloak.operator.v2alpha1.crds.Keycloak) TimeUnit(java.util.concurrent.TimeUnit) Config(io.fabric8.kubernetes.client.Config) AfterEach(org.junit.jupiter.api.AfterEach) List(java.util.List) ConfigProvider(org.eclipse.microprofile.config.ConfigProvider) NamespaceBuilder(io.fabric8.kubernetes.api.model.NamespaceBuilder) KubernetesClient(io.fabric8.kubernetes.client.KubernetesClient) ConfigBuilder(io.fabric8.kubernetes.client.ConfigBuilder) QuarkusConfigurationService(io.quarkiverse.operatorsdk.runtime.QuarkusConfigurationService) Deployment(io.fabric8.kubernetes.api.model.apps.Deployment) Awaitility(org.awaitility.Awaitility) HasMetadata(io.fabric8.kubernetes.api.model.HasMetadata) Deployment(io.fabric8.kubernetes.api.model.apps.Deployment) FileInputStream(java.io.FileInputStream)

Example 2 with Operator

use of io.javaoperatorsdk.operator.Operator in project keycloak by keycloak.

the class ClusterOperatorTest method createOperator.

private static void createOperator() {
    operator = new Operator(k8sclient, configuration);
    operator.getConfigurationService().getClientConfiguration().setNamespace(namespace);
}
Also used : Operator(io.javaoperatorsdk.operator.Operator)

Aggregations

Operator (io.javaoperatorsdk.operator.Operator)2 HasMetadata (io.fabric8.kubernetes.api.model.HasMetadata)1 NamespaceBuilder (io.fabric8.kubernetes.api.model.NamespaceBuilder)1 Deployment (io.fabric8.kubernetes.api.model.apps.Deployment)1 Config (io.fabric8.kubernetes.client.Config)1 ConfigBuilder (io.fabric8.kubernetes.client.ConfigBuilder)1 DefaultKubernetesClient (io.fabric8.kubernetes.client.DefaultKubernetesClient)1 KubernetesClient (io.fabric8.kubernetes.client.KubernetesClient)1 Reconciler (io.javaoperatorsdk.operator.api.reconciler.Reconciler)1 OperatorProducer (io.quarkiverse.operatorsdk.runtime.OperatorProducer)1 QuarkusConfigurationService (io.quarkiverse.operatorsdk.runtime.QuarkusConfigurationService)1 Log (io.quarkus.logging.Log)1 File (java.io.File)1 FileInputStream (java.io.FileInputStream)1 FileNotFoundException (java.io.FileNotFoundException)1 FileWriter (java.io.FileWriter)1 Duration (java.time.Duration)1 List (java.util.List)1 UUID (java.util.UUID)1 TimeUnit (java.util.concurrent.TimeUnit)1