@Override public String updateReplicationController(@PathParam("controllerId") @NotNull String s, ReplicationController replicationController, @QueryParam("namespace") String s1) throws Exception { getOrCreateMetadata(replicationController).setNamespace(namespace); return updateReplicationController(s, replicationController); }
@Override public String updatePod(@NotNull String podId, Pod pod, String namespace) throws Exception { getOrCreateMetadata(pod).setNamespace(namespace); return updatePod(podId, pod); }
@Override public String updateService(@NotNull String serviceId, Service service, String namespace) throws Exception { getOrCreateMetadata(service).setNamespace(namespace); return updateService(serviceId, service); }
@Override public String createReplicationController(ReplicationController replicationController, String namespace) throws Exception { getOrCreateMetadata(replicationController).setNamespace(namespace); return createReplicationController(replicationController); }
@Override public String createService(Service service, String namespace) throws Exception { getOrCreateMetadata(service).setNamespace(namespace); return createService(service); }
@Override public String createPod(Pod pod, String namespace) throws Exception { getOrCreateMetadata(pod).setNamespace(namespace); return createPod(pod); }
protected <T extends HasMetadata> void updateNamed(String namespace, String name, T entity) throws IOException { File entityFile = getResourceFile(namespace, name, entity.getClass()); ObjectMeta metadata = KubernetesHelper.getOrCreateMetadata(entity); metadata.setNamespace(namespace); metadata.setName(name); if (entityFile != null) { KubernetesHelper.saveJson(entityFile, entity); // TODO sendEvent(entity); } else { throw new WebApplicationException("No metadata.name supplied!"); } }
protected <T extends HasMetadata> void updateNamed(String namespace, String name, T entity) throws IOException { File entityFile = getResourceFile(namespace, name, entity.getClass()); ObjectMeta metadata = KubernetesHelper.getOrCreateMetadata(entity); metadata.setNamespace(namespace); metadata.setName(name); if (entityFile != null) { KubernetesHelper.saveJson(entityFile, entity); // TODO sendEvent(entity); } else { throw new WebApplicationException("No metadata.name supplied!"); } }
public String updateReplicationController(@NotNull String controllerId, ReplicationController replicationController) throws Exception { // lets ensure there's a default namespace set String namespace = KubernetesHelper.getNamespace(replicationController); if (Strings.isBlank(namespace)) { getOrCreateMetadata(replicationController).setNamespace(DEFAULT_NAMESPACE); } model.updateReplicationController(controllerId, replicationController); return null; }
private static void cleanupItem(KubernetesClient client, Session session, HasMetadata item, List<Throwable> errors) { String sessionNamespace = session.getNamespace(); KubernetesHelper.getOrCreateMetadata(item).setNamespace(sessionNamespace); client.resource(item).inNamespace(sessionNamespace).cascading(true).delete(); }
public String updateService(@NotNull String id, Service entity) throws Exception { // lets set the IP ServiceSpec spec = entity.getSpec(); if (spec == null) { spec = new ServiceSpec(); entity.setSpec(spec); } if (!HEADLESS_PORTAL_IP.equals(spec.getPortalIP())) { spec.setPortalIP(getHostName()); } // lets ensure there's a default namespace set String namespace = KubernetesHelper.getNamespace(entity); if (Strings.isBlank(namespace)) { getOrCreateMetadata(entity).setNamespace(DEFAULT_NAMESPACE); } model.updateService(id, entity); return null; }
getOrCreateMetadata(pod).setNamespace(DEFAULT_NAMESPACE);
getOrCreateMetadata(pod).setLabels(KubernetesHelper.getLabels(podTemplate.getMetadata()));
OAuthClient oc = (OAuthClient) entity; ObjectMeta metadata = KubernetesHelper.getOrCreateMetadata(oc); String name = metadata.getName(); if (isOpenshift) {