Search in sources :

Example 1 with V1PersistentVolumeClaimVolumeSourceBuilder

use of io.kubernetes.client.openapi.models.V1PersistentVolumeClaimVolumeSourceBuilder in project pravega by pravega.

the class K8SequentialExecutor method getTestPod.

private V1Pod getTestPod(String className, String methodName, String podName) {
    log.info("Running test pod with security enabled :{}, transport enabled: {}", Utils.AUTH_ENABLED, Utils.TLS_AND_AUTH_ENABLED);
    V1Pod pod = new V1PodBuilder().withNewMetadata().withName(podName).withNamespace(NAMESPACE).withLabels(ImmutableMap.of("POD_NAME", podName, "app", APP)).endMetadata().withNewSpec().withServiceAccountName(SERVICE_ACCOUNT).withAutomountServiceAccountToken(true).withVolumes(new V1VolumeBuilder().withName("task-pv-storage").withPersistentVolumeClaim(new V1PersistentVolumeClaimVolumeSourceBuilder().withClaimName("task-pv-claim").build()).build()).addNewContainer().withName(// container name is same as that of the pod.
    podName).withImage(TEST_POD_IMAGE).withImagePullPolicy("IfNotPresent").withCommand("/bin/sh").withArgs("-c", "java" + getArgs() + " -cp /data/test-collection.jar io.pravega.test.system.SingleJUnitTestRunner " + className + "#" + methodName + /*+ " > server.log 2>&1 */
    "; exit $?").withVolumeMounts(new V1VolumeMountBuilder().withMountPath("/data").withName("task-pv-storage").build()).endContainer().withRestartPolicy("Never").endSpec().build();
    if (Utils.TLS_AND_AUTH_ENABLED) {
        pod = new V1PodBuilder(pod).editSpec().withVolumes(new V1VolumeBuilder().withName("tls-certs").withSecret(new V1SecretVolumeSourceBuilder().withSecretName(Utils.TLS_SECRET_NAME).build()).build()).editContainer(0).withVolumeMounts(new V1VolumeMountBuilder().withMountPath(Utils.TLS_MOUNT_PATH).withName("tls-secret").build()).endContainer().endSpec().build();
    }
    return pod;
}
Also used : V1VolumeBuilder(io.kubernetes.client.openapi.models.V1VolumeBuilder) V1SecretVolumeSourceBuilder(io.kubernetes.client.openapi.models.V1SecretVolumeSourceBuilder) V1PodBuilder(io.kubernetes.client.openapi.models.V1PodBuilder) V1Pod(io.kubernetes.client.openapi.models.V1Pod) V1VolumeMountBuilder(io.kubernetes.client.openapi.models.V1VolumeMountBuilder) V1PersistentVolumeClaimVolumeSourceBuilder(io.kubernetes.client.openapi.models.V1PersistentVolumeClaimVolumeSourceBuilder)

Aggregations

V1PersistentVolumeClaimVolumeSourceBuilder (io.kubernetes.client.openapi.models.V1PersistentVolumeClaimVolumeSourceBuilder)1 V1Pod (io.kubernetes.client.openapi.models.V1Pod)1 V1PodBuilder (io.kubernetes.client.openapi.models.V1PodBuilder)1 V1SecretVolumeSourceBuilder (io.kubernetes.client.openapi.models.V1SecretVolumeSourceBuilder)1 V1VolumeBuilder (io.kubernetes.client.openapi.models.V1VolumeBuilder)1 V1VolumeMountBuilder (io.kubernetes.client.openapi.models.V1VolumeMountBuilder)1