本文整理了Java中io.fabric8.kubernetes.api.model.Namespace.getMetadata()
方法的一些代码示例,展示了Namespace.getMetadata()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Namespace.getMetadata()
方法的具体详情如下:
包路径:io.fabric8.kubernetes.api.model.Namespace
类名称:Namespace
方法名:getMetadata
暂无
代码示例来源:origin: LendingClub/mercator
public void scanNamespace(Namespace ns) {
ObjectNode n = mapper.createObjectNode();
ObjectMeta md = ns.getMetadata();
n.put("uid", ns.getMetadata().getUid());
n.put("name", ns.getMetadata().getName());
n.put("selfLink", md.getSelfLink());
n.put("clusterId", getClusterId());
getNeoRxClient().execCypher("merge (a:KubeNamespace {uid:{uid}}) set a+={props}, a.updateTs=timestamp()", "uid",
md.getUid(), "props", n);
}
代码示例来源:origin: EnMasseProject/enmasse
public Set<String> listNamespaces() {
return client.namespaces().list().getItems().stream()
.map(ns -> ns.getMetadata().getName())
.collect(Collectors.toSet());
}
代码示例来源:origin: jenkinsci/kubernetes-ci-plugin
private List<String> getNamespacesInternal(KubernetesClient kubeClient) {
List<String> returnList = new ArrayList<>();
for (Namespace namespace: kubeClient.namespaces().list().getItems() ) {
returnList.add(namespace.getMetadata().getName() );
}
return returnList;
}
}
代码示例来源:origin: fabric8io/jube
@Override
public NamespaceList getNamespaces() {
// TODO - Hacking in a quick default for now...
NamespaceList answer = new NamespaceList();
answer.setApiVersion(NamespaceList.ApiVersion.V_1);
List<Namespace> items = new ArrayList<Namespace>();
Namespace _default = new Namespace();
_default.setMetadata(new ObjectMeta());
_default.getMetadata().setName("default");
items.add(_default);
answer.setItems(items);
return answer;
}
代码示例来源:origin: jenkinsci/kubernetes-pipeline-plugin
private void createEnvironment(String environment, Controller controller) {
boolean found = false;
OpenShiftClient oClient = openShiftClient();
if (isOpenShift() && oClient.supportsOpenShiftAPIGroup(OpenShiftAPIGroups.PROJECT)) {
ProjectList ps = oClient.projects().list();
for(Project p : ps.getItems()){
listener.getLogger().println("Found namespace " +p.getMetadata().getName());
if (environment.equalsIgnoreCase(p.getMetadata().getName())){
found = true;
listener.getLogger().println("Found existing environment " + environment);
break;
}
}
} else {
NamespaceList ns = getKubernetes().namespaces().list();
for(Namespace n : ns.getItems()){
listener.getLogger().println("Found namespace " +n.getMetadata().getName());
if (environment.equalsIgnoreCase(n.getMetadata().getName())){
found = true;
listener.getLogger().println("Found existing environment " + environment);
break;
}
}
}
if (!found){
listener.getLogger().println("Creating environment " + environment);
controller.applyNamespace(environment);
}
}
代码示例来源:origin: io.fabric8.pipeline/kubernetes-pipeline-devops-steps
private void createEnvironment(String environment, Controller controller) {
boolean found = false;
OpenShiftClient oClient = openShiftClient();
if (isOpenShift() && oClient.supportsOpenShiftAPIGroup(OpenShiftAPIGroups.PROJECT)) {
ProjectList ps = oClient.projects().list();
for(Project p : ps.getItems()){
listener.getLogger().println("Found namespace " +p.getMetadata().getName());
if (environment.equalsIgnoreCase(p.getMetadata().getName())){
found = true;
listener.getLogger().println("Found existing environment " + environment);
break;
}
}
} else {
NamespaceList ns = getKubernetes().namespaces().list();
for(Namespace n : ns.getItems()){
listener.getLogger().println("Found namespace " +n.getMetadata().getName());
if (environment.equalsIgnoreCase(n.getMetadata().getName())){
found = true;
listener.getLogger().println("Found existing environment " + environment);
break;
}
}
}
if (!found){
listener.getLogger().println("Creating environment " + environment);
controller.applyNamespace(environment);
}
}
代码示例来源:origin: jenkinsci/kubernetes-ci-plugin
@Override
public Namespace createNamespece(String kubeName, String namespace, KeyValuePair<String, String>... labels)
throws RepositoryException {
Namespace newNamespace = new NamespaceBuilder().withNewMetadata().withName(namespace).endMetadata().build();
if (labels.length > 0) {
Map<String, String> labelsMap = new HashMap<>();
for (KeyValuePair<String, String> label: Arrays.asList(labels) ) {
labelsMap.put(label.getKey(), label.getValue() );
}
newNamespace.getMetadata().setLabels(labelsMap);
}
return getClient(kubeName).namespaces().create(newNamespace);
}
代码示例来源:origin: jenkinsci/kubernetes-cd-plugin
@Override
Namespace applyResource(Namespace original, Namespace current) {
return client
.namespaces()
.withName(getName())
.edit()
.withMetadata(current.getMetadata())
.withSpec(current.getSpec())
.done();
}
代码示例来源:origin: org.domeos/kubernetes-model
public NamespaceBuilder(NamespaceFluent<?> fluent,Namespace instance,Boolean validationEnabled){
this.fluent = fluent;
fluent.withApiVersion(instance.getApiVersion());
fluent.withKind(instance.getKind());
fluent.withMetadata(instance.getMetadata());
fluent.withSpec(instance.getSpec());
fluent.withStatus(instance.getStatus());
this.validationEnabled = validationEnabled;
}
public NamespaceBuilder(Namespace instance){
代码示例来源:origin: org.domeos/kubernetes-model
public NamespaceBuilder(Namespace instance,Boolean validationEnabled){
this.fluent = this;
this.withApiVersion(instance.getApiVersion());
this.withKind(instance.getKind());
this.withMetadata(instance.getMetadata());
this.withSpec(instance.getSpec());
this.withStatus(instance.getStatus());
this.validationEnabled = validationEnabled;
}
代码示例来源:origin: org.domeos/kubernetes-model
public NamespaceFluentImpl(Namespace instance){
this.withApiVersion(instance.getApiVersion());
this.withKind(instance.getKind());
this.withMetadata(instance.getMetadata());
this.withSpec(instance.getSpec());
this.withStatus(instance.getStatus());
}
代码示例来源:origin: io.fabric8.schemagenerator/kubernetes-model
public NamespaceBuilder( NamespaceFluent<?> fluent , Namespace instance ){
this.fluent = fluent; fluent.withApiVersion(instance.getApiVersion()); fluent.withKind(instance.getKind()); fluent.withMetadata(instance.getMetadata()); fluent.withSpec(instance.getSpec()); fluent.withStatus(instance.getStatus());
}
public NamespaceBuilder( Namespace instance ){
代码示例来源:origin: org.apache.stratos/kubernetes-model
public NamespaceBuilder( NamespaceFluent<?> fluent , Namespace instance ){
this.fluent = fluent; fluent.withApiVersion(instance.getApiVersion()); fluent.withKind(instance.getKind()); fluent.withMetadata(instance.getMetadata()); fluent.withSpec(instance.getSpec()); fluent.withStatus(instance.getStatus());
}
public NamespaceBuilder( Namespace instance ){
代码示例来源:origin: org.apache.stratos/kubernetes-model
public NamespaceBuilder( Namespace instance ){
this.fluent = this; this.withApiVersion(instance.getApiVersion()); this.withKind(instance.getKind()); this.withMetadata(instance.getMetadata()); this.withSpec(instance.getSpec()); this.withStatus(instance.getStatus());
}
代码示例来源:origin: io.fabric8.schemagenerator/kubernetes-model
public NamespaceBuilder( Namespace instance ){
this.fluent = this; this.withApiVersion(instance.getApiVersion()); this.withKind(instance.getKind()); this.withMetadata(instance.getMetadata()); this.withSpec(instance.getSpec()); this.withStatus(instance.getStatus());
}
代码示例来源:origin: org.apache.brooklyn/brooklyn-locations-container
createSecrets(namespace.getMetadata().getName(), secrets);
Container container = buildContainer(namespace.getMetadata().getName(), metadata, deploymentName, imageName, inboundPorts, env, limits, privileged);
deploy(namespace.getMetadata().getName(), entity, metadata, deploymentName, container, replicas, secrets);
Service service = exposeService(namespace.getMetadata().getName(), metadata, deploymentName, inboundPorts);
Pod pod = getPod(namespace.getMetadata().getName(), metadata);
entity.sensors().set(KubernetesPod.KUBERNETES_NAMESPACE, namespace.getMetadata().getName());
entity.sensors().set(KubernetesPod.KUBERNETES_DEPLOYMENT, deploymentName);
entity.sensors().set(KubernetesPod.KUBERNETES_POD, pod.getMetadata().getName());
.configure(KubernetesMachineLocation.KUBERNETES_NAMESPACE, namespace.getMetadata().getName())
.configure(KubernetesMachineLocation.KUBERNETES_RESOURCE_NAME, deploymentName)
.configure(KubernetesMachineLocation.KUBERNETES_RESOURCE_TYPE, getContainerResourceType());
内容来源于网络,如有侵权,请联系作者删除!