Java Code Examples for io.fabric8.kubernetes.api.model.Namespace#setMetadata()

The following examples show how to use io.fabric8.kubernetes.api.model.Namespace#setMetadata() . 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: K8sNamespaceManagerTest.java    From onos with Apache License 2.0 5 votes vote down vote up
private static Namespace createK8sNamespace(String uid, String name) {
    ObjectMeta meta = new ObjectMeta();
    meta.setUid(uid);
    meta.setName(name);

    Namespace namespace = new Namespace();
    namespace.setApiVersion("v1");
    namespace.setKind("Namespace");
    namespace.setMetadata(meta);

    return namespace;
}
 
Example 2
Source File: KubernetesLookupTest.java    From logging-log4j2 with Apache License 2.0 5 votes vote down vote up
private Namespace createNamespace() {
    Namespace namespace = new Namespace();
    ObjectMeta meta = new ObjectMeta();
    Map<String, String> annotations = new HashMap<>();
    annotations.put("test", "name");
    meta.setAnnotations(annotations);
    Map<String, String> labels = new HashMap<>();
    labels.put("ns", "my-namespace");
    meta.setLabels(labels);
    meta.setUid(UUID.randomUUID().toString());
    namespace.setMetadata(meta);
    return namespace;
}
 
Example 3
Source File: NamespaceHandler.java    From jkube with Eclipse Public License 2.0 4 votes vote down vote up
public Namespace getNamespace(String ns) {
    Namespace namespace = new Namespace();
    namespace.setMetadata(createProjectMetaData(ns));
    namespace.setStatus(new NamespaceStatusBuilder().withPhase("Active").build());
    return namespace;
}
 
Example 4
Source File: NamespaceResourceType.java    From enmasse with Apache License 2.0 4 votes vote down vote up
@Override
public void refreshResource(Namespace existing, Namespace newResource) {
    existing.setMetadata(newResource.getMetadata());
    existing.setSpec(newResource.getSpec());
    existing.setStatus(newResource.getStatus());
}