Search in sources :

Example 1 with ResourceItem

use of io.strimzi.systemtest.resources.ResourceItem in project strimzi by strimzi.

the class TracingST method deployJaegerInstance.

/**
 * Install of Jaeger instance
 */
void deployJaegerInstance(ExtensionContext extensionContext, String namespaceName) {
    LOGGER.info("=== Applying jaeger instance install file ===");
    String instanceYamlContent = TestUtils.getContent(new File(jaegerInstancePath), TestUtils::toYamlString);
    cmdKubeClient(namespaceName).applyContent(instanceYamlContent.replaceAll("image: 'jaegertracing/all-in-one:*'", "image: 'jaegertracing/all-in-one:" + JAEGER_VERSION.substring(0, 4) + "'"));
    ResourceManager.STORED_RESOURCES.computeIfAbsent(extensionContext.getDisplayName(), k -> new Stack<>());
    ResourceManager.STORED_RESOURCES.get(extensionContext.getDisplayName()).push(new ResourceItem(() -> cmdKubeClient(namespaceName).deleteContent(instanceYamlContent)));
    DeploymentUtils.waitForDeploymentAndPodsReady(namespaceName, JAEGER_INSTANCE_NAME, 1);
}
Also used : TestUtils(io.strimzi.test.TestUtils) ResourceItem(io.strimzi.systemtest.resources.ResourceItem) File(java.io.File)

Example 2 with ResourceItem

use of io.strimzi.systemtest.resources.ResourceItem in project strimzi by strimzi.

the class TracingST method deployJaegerOperator.

private void deployJaegerOperator(ExtensionContext extensionContext) throws IOException, FileNotFoundException {
    LOGGER.info("=== Applying jaeger operator install files ===");
    deployJaegerContent(extensionContext);
    ResourceManager.STORED_RESOURCES.computeIfAbsent(extensionContext.getDisplayName(), k -> new Stack<>());
    ResourceManager.STORED_RESOURCES.get(extensionContext.getDisplayName()).push(new ResourceItem(() -> this.deleteJaeger()));
    DeploymentUtils.waitForDeploymentAndPodsReady(namespace, JAEGER_OPERATOR_DEPLOYMENT_NAME, 1);
    NetworkPolicy networkPolicy = new NetworkPolicyBuilder().withApiVersion("networking.k8s.io/v1").withKind(Constants.NETWORK_POLICY).withNewMetadata().withName("jaeger-allow").withNamespace(namespace).endMetadata().withNewSpec().addNewIngress().endIngress().withNewPodSelector().addToMatchLabels("app", "jaeger").endPodSelector().withPolicyTypes("Ingress").endSpec().build();
    LOGGER.debug("Creating NetworkPolicy: {}", networkPolicy.toString());
    resourceManager.createResource(extensionContext, networkPolicy);
    LOGGER.info("Network policy for jaeger successfully created");
}
Also used : NetworkPolicy(io.fabric8.kubernetes.api.model.networking.v1.NetworkPolicy) ResourceItem(io.strimzi.systemtest.resources.ResourceItem) NetworkPolicyBuilder(io.fabric8.kubernetes.api.model.networking.v1.NetworkPolicyBuilder)

Example 3 with ResourceItem

use of io.strimzi.systemtest.resources.ResourceItem in project strimzi-kafka-operator by strimzi.

the class TracingST method deployJaegerInstance.

/**
 * Install of Jaeger instance
 */
void deployJaegerInstance(ExtensionContext extensionContext, String namespaceName) {
    LOGGER.info("=== Applying jaeger instance install file ===");
    String instanceYamlContent = TestUtils.getContent(new File(jaegerInstancePath), TestUtils::toYamlString);
    cmdKubeClient(namespaceName).applyContent(instanceYamlContent.replaceAll("image: 'jaegertracing/all-in-one:*'", "image: 'jaegertracing/all-in-one:" + JAEGER_VERSION.substring(0, 4) + "'"));
    ResourceManager.STORED_RESOURCES.computeIfAbsent(extensionContext.getDisplayName(), k -> new Stack<>());
    ResourceManager.STORED_RESOURCES.get(extensionContext.getDisplayName()).push(new ResourceItem(() -> cmdKubeClient(namespaceName).deleteContent(instanceYamlContent)));
    DeploymentUtils.waitForDeploymentAndPodsReady(namespaceName, JAEGER_INSTANCE_NAME, 1);
}
Also used : TestUtils(io.strimzi.test.TestUtils) ResourceItem(io.strimzi.systemtest.resources.ResourceItem) File(java.io.File)

Example 4 with ResourceItem

use of io.strimzi.systemtest.resources.ResourceItem in project strimzi-kafka-operator by strimzi.

the class TracingST method deployJaegerOperator.

private void deployJaegerOperator(ExtensionContext extensionContext) throws IOException, FileNotFoundException {
    LOGGER.info("=== Applying jaeger operator install files ===");
    deployJaegerContent(extensionContext);
    ResourceManager.STORED_RESOURCES.computeIfAbsent(extensionContext.getDisplayName(), k -> new Stack<>());
    ResourceManager.STORED_RESOURCES.get(extensionContext.getDisplayName()).push(new ResourceItem(() -> this.deleteJaeger()));
    DeploymentUtils.waitForDeploymentAndPodsReady(namespace, JAEGER_OPERATOR_DEPLOYMENT_NAME, 1);
    NetworkPolicy networkPolicy = new NetworkPolicyBuilder().withApiVersion("networking.k8s.io/v1").withKind(Constants.NETWORK_POLICY).withNewMetadata().withName("jaeger-allow").withNamespace(namespace).endMetadata().withNewSpec().addNewIngress().endIngress().withNewPodSelector().addToMatchLabels("app", "jaeger").endPodSelector().withPolicyTypes("Ingress").endSpec().build();
    LOGGER.debug("Creating NetworkPolicy: {}", networkPolicy.toString());
    resourceManager.createResource(extensionContext, networkPolicy);
    LOGGER.info("Network policy for jaeger successfully created");
}
Also used : NetworkPolicy(io.fabric8.kubernetes.api.model.networking.v1.NetworkPolicy) ResourceItem(io.strimzi.systemtest.resources.ResourceItem) NetworkPolicyBuilder(io.fabric8.kubernetes.api.model.networking.v1.NetworkPolicyBuilder)

Example 5 with ResourceItem

use of io.strimzi.systemtest.resources.ResourceItem in project strimzi by strimzi.

the class HelmResource method create.

public void create(ExtensionContext extensionContext, long operationTimeout, long reconciliationInterval) {
    ResourceManager.STORED_RESOURCES.computeIfAbsent(extensionContext.getDisplayName(), k -> new Stack<>());
    ResourceManager.STORED_RESOURCES.get(extensionContext.getDisplayName()).push(new ResourceItem(this::delete));
    this.clusterOperator(operationTimeout, reconciliationInterval);
}
Also used : ResourceItem(io.strimzi.systemtest.resources.ResourceItem)

Aggregations

ResourceItem (io.strimzi.systemtest.resources.ResourceItem)6 NetworkPolicy (io.fabric8.kubernetes.api.model.networking.v1.NetworkPolicy)2 NetworkPolicyBuilder (io.fabric8.kubernetes.api.model.networking.v1.NetworkPolicyBuilder)2 TestUtils (io.strimzi.test.TestUtils)2 File (java.io.File)2