use of io.kubernetes.client.models.V1ObjectMeta in project weblogic-kubernetes-operator by oracle.
the class ServiceWatcher method getServiceChannelName.
static String getServiceChannelName(V1Service service) {
V1ObjectMeta meta = service.getMetadata();
Map<String, String> labels = meta.getLabels();
if (labels != null) {
return labels.get(LabelConstants.CHANNELNAME_LABEL);
}
return null;
}
use of io.kubernetes.client.models.V1ObjectMeta in project weblogic-kubernetes-operator by oracle.
the class ServiceWatcher method getServiceDomainUID.
static String getServiceDomainUID(V1Service service) {
V1ObjectMeta meta = service.getMetadata();
Map<String, String> labels = meta.getLabels();
if (labels != null) {
return labels.get(LabelConstants.DOMAINUID_LABEL);
}
return null;
}
use of io.kubernetes.client.models.V1ObjectMeta in project weblogic-kubernetes-operator by oracle.
the class Watcher method getResourceVersionFromMetadata.
private String getResourceVersionFromMetadata(Object object) {
try {
Method getMetadata = object.getClass().getDeclaredMethod("getMetadata");
V1ObjectMeta metadata = (V1ObjectMeta) getMetadata.invoke(object);
return metadata.getResourceVersion();
} catch (Exception e) {
LOGGER.warning(MessageKeys.EXCEPTION, e);
return IGNORED_RESOURCE_VERSION;
}
}
use of io.kubernetes.client.models.V1ObjectMeta in project weblogic-kubernetes-operator by oracle.
the class SecretHelperTest method createSecret.
// Create a named secret with username / password in specified name
private V1Secret createSecret(String name, String namespace) throws Exception {
CallBuilderFactory factory = new CallBuilderFactory(null);
try {
V1Secret existing = factory.create().readSecret(name, namespace);
if (existing != null)
return existing;
} catch (ApiException ignore) {
// Just ignore and try to create it
}
if (isVersion18)
return null;
V1Secret body = new V1Secret();
// Set the required api version and kind of resource
body.setApiVersion("v1");
body.setKind("Secret");
// Setup the standard object metadata
V1ObjectMeta meta = new V1ObjectMeta();
meta.setName(name);
meta.setNamespace(namespace);
body.setMetadata(meta);
Map<String, byte[]> data = new HashMap<String, byte[]>();
data.put(SecretHelper.ADMIN_SERVER_CREDENTIALS_USERNAME, USERNAME.getBytes());
data.put(SecretHelper.ADMIN_SERVER_CREDENTIALS_PASSWORD, PASSWORD.getBytes());
body.setData(data);
try {
return factory.create().createSecret(namespace, body);
} catch (Exception e) {
e.printStackTrace(System.out);
throw e;
}
}
use of io.kubernetes.client.models.V1ObjectMeta in project weblogic-kubernetes-operator by oracle.
the class SecretHelperTest method createNamespace.
// Create a named namespace
private V1Namespace createNamespace(String name) throws Exception {
CallBuilderFactory factory = new CallBuilderFactory(null);
try {
V1Namespace existing = factory.create().readNamespace(name);
if (existing != null)
return existing;
} catch (ApiException ignore) {
// Just ignore and try to create it
}
V1Namespace body = new V1Namespace();
// Set the required api version and kind of resource
body.setApiVersion("v1");
body.setKind("Namespace");
// Setup the standard object metadata
V1ObjectMeta meta = new V1ObjectMeta();
meta.setName(name);
body.setMetadata(meta);
return factory.create().createNamespace(body);
}
Aggregations