本文整理了Java中io.fabric8.kubernetes.api.model.Namespace
类的一些代码示例,展示了Namespace
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Namespace
类的具体详情如下:
包路径:io.fabric8.kubernetes.api.model.Namespace
类名称:Namespace
暂无
代码示例来源: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 NamespaceBuilder(Boolean validationEnabled){
this(new Namespace(), validationEnabled);
}
public NamespaceBuilder(NamespaceFluent<?> fluent){
代码示例来源: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: 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-cd-plugin
@Override
Namespace applyResource(Namespace original, Namespace current) {
return client
.namespaces()
.withName(getName())
.edit()
.withMetadata(current.getMetadata())
.withSpec(current.getSpec())
.done();
}
代码示例来源:origin: org.apache.brooklyn/brooklyn-locations-container
@Override
public String getFailureMessage() {
Namespace actualNamespace = client.namespaces().withName(name).get();
return "Namespace for " + name + " " + (actualNamespace == null ? "absent" : " status " + actualNamespace.getStatus());
}
};
代码示例来源:origin: EnMasseProject/enmasse
public Set<String> listNamespaces() {
return client.namespaces().list().getItems().stream()
.map(ns -> ns.getMetadata().getName())
.collect(Collectors.toSet());
}
代码示例来源:origin: org.apache.brooklyn/brooklyn-locations-container
@Override
public Boolean call() {
Namespace actualNamespace = client.namespaces().withName(name).get();
return actualNamespace != null && actualNamespace.getStatus().getPhase().equals(PHASE_ACTIVE);
}
代码示例来源: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: 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: io.fabric8.schemagenerator/kubernetes-model
public NamespaceBuilder(){
this(new Namespace());
}
public NamespaceBuilder( NamespaceFluent<?> fluent ){
代码示例来源:origin: org.apache.brooklyn/brooklyn-locations-container
protected synchronized void deleteEmptyNamespace(final String name) {
if (!name.equals("default") && isNamespaceEmpty(name)) {
if (client.namespaces().withName(name).get() != null &&
!client.namespaces().withName(name).get().getStatus().getPhase().equals(PHASE_TERMINATING)) {
client.namespaces().withName(name).delete();
ExitCondition exitCondition = new ExitCondition() {
@Override
public Boolean call() {
return client.namespaces().withName(name).get() == null;
}
@Override
public String getFailureMessage() {
return "Namespace " + name + " still present";
}
};
waitForExitCondition(exitCondition);
}
}
}
代码示例来源: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.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: org.apache.stratos/kubernetes-model
public NamespaceBuilder(){
this(new Namespace());
}
public NamespaceBuilder( NamespaceFluent<?> fluent ){
代码示例来源: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: 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.schemagenerator/kubernetes-model
public NamespaceBuilder( NamespaceFluent<?> fluent ){
this(fluent, new Namespace());
}
public NamespaceBuilder( NamespaceFluent<?> fluent , 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: 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);
}
内容来源于网络,如有侵权,请联系作者删除!