func writeVolumeMount(m map[string]interface{}, item *api.VolumeMount) {
	if x, ok := m["name"].(string); ok {
		item.Name = x
	}
	if x, ok := m["read_only"].(bool); ok {
		item.ReadOnly = x
	}
	if x, ok := m["mount_path"].(string); ok {
		item.MountPath = x
	}
}
func VolumeMounts(userVolumeMounts []interface{}) []api.VolumeMount {
	if len(userVolumeMounts) == 0 {
		return nil
	}

	var volumeMounts []api.VolumeMount

	for _, v := range userVolumeMounts {
		userVolumeMount := v.(map[string]interface{})

		volumeMount := api.VolumeMount{
			Name:      userVolumeMount["name"].(string),
			MountPath: userVolumeMount["mount_path"].(string),
		}

		if _, ok := userVolumeMount["read_only"]; ok {
			volumeMount.ReadOnly = userVolumeMount["read_only"].(bool)
		}

		volumeMounts = append(volumeMounts, volumeMount)
	}
	return volumeMounts
}
Ejemplo n.º 3
0
func deepCopy_api_VolumeMount(in api.VolumeMount, out *api.VolumeMount, c *conversion.Cloner) error {
	out.Name = in.Name
	out.ReadOnly = in.ReadOnly
	out.MountPath = in.MountPath
	return nil
}