@Test public void containsKind() throws Exception { HasMetadata ret = getResource(PlatformMode.kubernetes, DEFAULT_RESOURCE_VERSIONING, new File(jshiftDir, "contains_kind.yml"), "app"); assertEquals("ReplicationController", ret.getKind()); }
public static HasMetadata getResource(PlatformMode platformMode, ResourceVersioning apiVersions, File file, String appName) throws IOException { Map<String,Object> fragment = readAndEnrichFragment(platformMode, apiVersions, file, appName); ObjectMapper mapper = new ObjectMapper(); try { return mapper.convertValue(fragment, HasMetadata.class); } catch (ClassCastException exp) { throw new IllegalArgumentException(String.format("Resource fragment %s has an invalid syntax (%s)", file.getPath(), exp.getMessage())); } }
KubernetesResourceUtil { public static HasMetadata getResource(PlatformMode platformMode, ResourceVersioning apiVersions, File file, String appName) throws IOException { Map<String,Object> fragment = readAndEnrichFragment(platformMode, apiVersions, file, appName); ObjectMapper mapper = new ObjectMapper(); try { return mapper.convertValue(fragment, HasMetadata.class); } catch (ClassCastException exp) { throw new IllegalArgumentException(String.format("Resource fragment %s has an invalid syntax (%s)", file.getPath(), exp.getMessage())); } } }
KubernetesResourceUtil { public static HasMetadata getResource(PlatformMode platformMode, ResourceVersioning apiVersions, File file, String appName) throws IOException { Map<String,Object> fragment = readAndEnrichFragment(platformMode, apiVersions, file, appName); ObjectMapper mapper = new ObjectMapper(); try { return mapper.convertValue(fragment, HasMetadata.class); } catch (ClassCastException exp) { throw new IllegalArgumentException(String.format("Resource fragment %s has an invalid syntax (%s)", file.getPath(), exp.getMessage())); } }  }
KubernetesResourceUtil { public static HasMetadata getResource(PlatformMode platformMode, ResourceVersioning apiVersions, File file, String appName) throws IOException { Map<String,Object> fragment = readAndEnrichFragment(platformMode, apiVersions, file, appName); ObjectMapper mapper = new ObjectMapper(); try { return mapper.convertValue(fragment, HasMetadata.class); } catch (ClassCastException exp) { throw new IllegalArgumentException(String.format("Resource fragment %s has an invalid syntax (%s)", file.getPath(), exp.getMessage())); } }  static KubernetesListBuilder readResourceFragmentsFrom(PlatformMode platformMode, ResourceVersioning apiVersions,
                                                                  String defaultName,
                                                                  File[] resourceFiles); static HasMetadata getResource(PlatformMode platformMode, ResourceVersioning apiVersions,
                                          File file, String appName); static File[] listResourceFragments(File localResourceDir, List<String> remotes, KitLogger log); static File[] listResourceFragments(File resourceDir); static File[] listRemoteResourceFragments(List<String> remotes, KitLogger log); final static void updateKindFilenameMapper(final Map<String, List<String>> mappings); static void removeItemFromKubernetesBuilder(KubernetesListBuilder builder, HasMetadata item); static String getNameWithSuffix(String name, String kind); static String extractContainerName(GroupArtifactVersion groupArtifactVersion, ImageConfiguration imageConfig); static Map<String, String> removeVersionSelector(Map<String, String> selector); static boolean checkForKind(KubernetesListBuilder builder, String... kinds); static boolean addPort(List<ContainerPort> ports, String portNumberText, String portName, KitLogger log); static boolean setEnvVar(List<EnvVar> envVarList, String name, String value); static String getEnvVar(List<EnvVar> envVarList, String name, String defaultValue); static boolean removeEnvVar(List<EnvVar> envVarList, String name); static List<EnvVar> convertToEnvVarList(Map<String, String> envVars); static void validateKubernetesMasterUrl(URL masterUrl); static void handleKubernetesClientException(KubernetesClientException e, KitLogger logger); static String getBuildStatusPhase(Build build); static String getBuildStatusReason(Build build); static Pod getNewestPod(Collection<Pod> pods); static Date getCreationTimestamp(HasMetadata hasMetadata); static Date parseDate(String text); static boolean podHasContainerImage(Pod pod, String imageName); static String getDockerContainerID(Pod pod); static boolean isNewerResource(HasMetadata newer, HasMetadata older); static void mergeSimpleFields(Object targetValues, Object defaultValues); static String mergePodSpec(PodSpecBuilder builder, PodSpec defaultPodSpec, String defaultName); static String mergePodSpec(PodSpecBuilder builder, PodSpec defaultPodSpec, String defaultName, boolean sidecarEnabled); static String getSourceUrlAnnotation(HasMetadata item); static void setSourceUrlAnnotationIfNotSet(HasMetadata item, String sourceUrl); static boolean isAppCatalogResource(HasMetadata templateOrConfigMap); static Set<HasMetadata> loadResources(File manifest); static LabelSelector getPodLabelSelector(Set<HasMetadata> entities); static LabelSelector getPodLabelSelector(HasMetadata entity); static HasMetadata mergeResources(HasMetadata item1, HasMetadata item2, KitLogger log, boolean switchOnLocalCustomisation); }
KubernetesResourceUtil { public static HasMetadata getResource(PlatformMode platformMode, ResourceVersioning apiVersions, File file, String appName) throws IOException { Map<String,Object> fragment = readAndEnrichFragment(platformMode, apiVersions, file, appName); ObjectMapper mapper = new ObjectMapper(); try { return mapper.convertValue(fragment, HasMetadata.class); } catch (ClassCastException exp) { throw new IllegalArgumentException(String.format("Resource fragment %s has an invalid syntax (%s)", file.getPath(), exp.getMessage())); } }  static KubernetesListBuilder readResourceFragmentsFrom(PlatformMode platformMode, ResourceVersioning apiVersions,
                                                                  String defaultName,
                                                                  File[] resourceFiles); static HasMetadata getResource(PlatformMode platformMode, ResourceVersioning apiVersions,
                                          File file, String appName); static File[] listResourceFragments(File localResourceDir, List<String> remotes, KitLogger log); static File[] listResourceFragments(File resourceDir); static File[] listRemoteResourceFragments(List<String> remotes, KitLogger log); final static void updateKindFilenameMapper(final Map<String, List<String>> mappings); static void removeItemFromKubernetesBuilder(KubernetesListBuilder builder, HasMetadata item); static String getNameWithSuffix(String name, String kind); static String extractContainerName(GroupArtifactVersion groupArtifactVersion, ImageConfiguration imageConfig); static Map<String, String> removeVersionSelector(Map<String, String> selector); static boolean checkForKind(KubernetesListBuilder builder, String... kinds); static boolean addPort(List<ContainerPort> ports, String portNumberText, String portName, KitLogger log); static boolean setEnvVar(List<EnvVar> envVarList, String name, String value); static String getEnvVar(List<EnvVar> envVarList, String name, String defaultValue); static boolean removeEnvVar(List<EnvVar> envVarList, String name); static List<EnvVar> convertToEnvVarList(Map<String, String> envVars); static void validateKubernetesMasterUrl(URL masterUrl); static void handleKubernetesClientException(KubernetesClientException e, KitLogger logger); static String getBuildStatusPhase(Build build); static String getBuildStatusReason(Build build); static Pod getNewestPod(Collection<Pod> pods); static Date getCreationTimestamp(HasMetadata hasMetadata); static Date parseDate(String text); static boolean podHasContainerImage(Pod pod, String imageName); static String getDockerContainerID(Pod pod); static boolean isNewerResource(HasMetadata newer, HasMetadata older); static void mergeSimpleFields(Object targetValues, Object defaultValues); static String mergePodSpec(PodSpecBuilder builder, PodSpec defaultPodSpec, String defaultName); static String mergePodSpec(PodSpecBuilder builder, PodSpec defaultPodSpec, String defaultName, boolean sidecarEnabled); static String getSourceUrlAnnotation(HasMetadata item); static void setSourceUrlAnnotationIfNotSet(HasMetadata item, String sourceUrl); static boolean isAppCatalogResource(HasMetadata templateOrConfigMap); static Set<HasMetadata> loadResources(File manifest); static LabelSelector getPodLabelSelector(Set<HasMetadata> entities); static LabelSelector getPodLabelSelector(HasMetadata entity); static HasMetadata mergeResources(HasMetadata item1, HasMetadata item2, KitLogger log, boolean switchOnLocalCustomisation); static final String API_VERSION; static final String API_EXTENSIONS_VERSION; static final String API_APPS_VERSION; static final String JOB_VERSION; static final String OPENSHIFT_V1_VERSION; static final ResourceVersioning DEFAULT_RESOURCE_VERSIONING; static final HashSet<Class<?>> SIMPLE_FIELD_TYPES; static final String CONTAINER_NAME_REGEX; }