default List<SidecarConfig> getSidecarConfigs(AccountDeploymentDetails<KubernetesAccount> details) { //attempt to get the service name specific sidecars first List<SidecarConfig> sidecarConfigs = details.getDeploymentConfiguration() .getDeploymentEnvironment() .getSidecars() .getOrDefault(getService().getServiceName(), new ArrayList<>()); if (sidecarConfigs.isEmpty()) { sidecarConfigs = details.getDeploymentConfiguration() .getDeploymentEnvironment() .getSidecars() .getOrDefault(getService().getBaseCanonicalName(), new ArrayList<>()); } return sidecarConfigs; }
default List<String> getInitContainers(AccountDeploymentDetails<KubernetesAccount> details) { List<Map> initContainersConfig = details.getDeploymentConfiguration() .getDeploymentEnvironment() .getInitContainers() .getOrDefault(getService().getServiceName(), new ArrayList<>()); if (initContainersConfig.isEmpty()) { initContainersConfig = details.getDeploymentConfiguration() .getDeploymentEnvironment() .getInitContainers() .getOrDefault(getService().getBaseCanonicalName(), new ArrayList<>()); } List<String> initContainers = initContainersConfig .stream() .map(o -> { try { return getObjectMapper().writeValueAsString(o); } catch (JsonProcessingException e) { throw new HalException(Problem.Severity.FATAL, "Invalid init container format: " + e.getMessage(), e); } }).collect(Collectors.toList()); return initContainers; }
default List<String> getHostAliases(AccountDeploymentDetails<KubernetesAccount> details) { //attempt to get the service name specific sidecars first List<Map> hostAliasesConfig = details.getDeploymentConfiguration() .getDeploymentEnvironment() .getHostAliases() .getOrDefault(getService().getServiceName(), new ArrayList<>()); if (hostAliasesConfig.isEmpty()) { hostAliasesConfig = details.getDeploymentConfiguration() .getDeploymentEnvironment() .getHostAliases() .getOrDefault(getService().getBaseCanonicalName(), new ArrayList<>()); } List<String> hostAliases = hostAliasesConfig .stream() .map(o -> { try { return getObjectMapper().writeValueAsString(o); } catch (JsonProcessingException e) { throw new HalException(Problem.Severity.FATAL, "Invalid host alias format: " + e.getMessage(), e); } }).collect(Collectors.toList()); return hostAliases; }