io.fabric8.kubernetes.api.model.ConfigMapVolumeSource Java Examples

The following examples show how to use io.fabric8.kubernetes.api.model.ConfigMapVolumeSource. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: VolumeUtils.java    From strimzi-kafka-operator with Apache License 2.0 6 votes vote down vote up
/**
 * Creates a Kubernetes volume which will map to ConfigMap
 *
 * @param name              Name of the Volume
 * @param configMapName     Name of the ConfigMap
 * @return                  The newly created Volume
 */
public static Volume createConfigMapVolume(String name, String configMapName) {
    String validName = getValidVolumeName(name);

    ConfigMapVolumeSource configMapVolumeSource = new ConfigMapVolumeSourceBuilder()
            .withName(configMapName)
            .build();

    Volume volume = new VolumeBuilder()
            .withName(validName)
            .withConfigMap(configMapVolumeSource)
            .build();

    log.trace("Created configMap Volume named '{}' with source configMap '{}'", validName, configMapName);

    return volume;
}
 
Example #2
Source File: HadoopConfMountDecoratorTest.java    From flink with Apache License 2.0 6 votes vote down vote up
@Test
public void testPodWithHadoopConfVolume() throws IOException {
	setHadoopConfDirEnv();
	generateHadoopConfFileItems();
	final FlinkPod resultFlinkPod = hadoopConfMountDecorator.decorateFlinkPod(baseFlinkPod);

	final List<Volume> resultVolumes = resultFlinkPod.getPod().getSpec().getVolumes();
	assertEquals(1, resultVolumes.size());

	final Volume resultVolume = resultVolumes.get(0);
	assertEquals(Constants.HADOOP_CONF_VOLUME, resultVolume.getName());

	final ConfigMapVolumeSource resultVolumeConfigMap = resultVolume.getConfigMap();
	assertEquals(HadoopConfMountDecorator.getHadoopConfConfigMapName(CLUSTER_ID),
		resultVolumeConfigMap.getName());

	final Map<String, String> expectedKeyToPaths = new HashMap<String, String>() {
		{
			put("hdfs-site.xml", "hdfs-site.xml");
			put("core-site.xml", "core-site.xml");
		}
	};
	final Map<String, String> resultKeyToPaths = resultVolumeConfigMap.getItems().stream()
		.collect(Collectors.toMap(KeyToPath::getKey, KeyToPath::getPath));
	assertEquals(expectedKeyToPaths, resultKeyToPaths);
}
 
Example #3
Source File: ExternalConfigurationVolumeSource.java    From strimzi-kafka-operator with Apache License 2.0 5 votes vote down vote up
@Description("Reference to a key in a ConfigMap. " +
        "Exactly one Secret or ConfigMap has to be specified.")
@KubeLink(group = "core", version = "v1", kind = "configmapvolumesource")
@JsonInclude(value = JsonInclude.Include.NON_NULL)
public ConfigMapVolumeSource getConfigMap() {
    return configMap;
}
 
Example #4
Source File: VcsSslCertificateProvisionerTest.java    From che with Eclipse Public License 2.0 5 votes vote down vote up
private void verifyVolumeIsPresent(Pod pod) {
  List<Volume> podVolumes = pod.getSpec().getVolumes();
  assertEquals(podVolumes.size(), 1);
  Volume certVolume = podVolumes.get(0);
  assertEquals(certVolume.getName(), CHE_GIT_SELF_SIGNED_VOLUME);
  ConfigMapVolumeSource volumeConfigMap = certVolume.getConfigMap();
  assertNotNull(volumeConfigMap);
  assertEquals(volumeConfigMap.getName(), EXPECTED_CERT_NAME);
}
 
Example #5
Source File: ExternalConfigurationVolumeSource.java    From strimzi-kafka-operator with Apache License 2.0 4 votes vote down vote up
public void setConfigMap(ConfigMapVolumeSource configMap) {
    this.configMap = configMap;
}