- context:
cluster: 192-168-64-25:8443
namespace: test
user: admin/192-168-64-25:8443
- name: test/192-168-64-25:8443
user:
token: ht5VTElCs4nlpaTgNXSdDeZi1agXaS3nzVA0qInhQtAconfig = new ConfigBuilder()
.withMasterUrl(cmdArgs.url)
.withTrustCerts(true)
.withOauthToken(cmdArgs.token)
.withNamespace(cmdArgs.namespace)
.build();
}
KubernetesClient kubernetesClient = new DefaultKubernetesClient(config);
OpenShiftClient client = kubernetesClient.adapt(OpenShiftClient.class);
try {
// Let's create the project if it doesn't exist
ProjectRequest request = null;
try {
Project project = project = client.projects().withName(cmdArgs.namespace).get();
} catch(KubernetesClientException kubex) {
log("ERROR : The project " + cmdArgs.namespace + " doesn't exists for the current context !!!");
request = client.projectrequests().createNew()
.withNewMetadata()
.withName(cmdArgs.namespace)
.endMetadata()
.done(); // LINE 102 -> FORBIDDEN IS RETURNED
log("The project " + cmdArgs.namespace + " has been created !");io.fabric8.kubernetes.client.KubernetesClientException: Failure executing: POST at: https://192.168.64.25:8443/oapi/v1/projectrequests. Message: Forbidden! User demo/192-168-64-25:8443 doesn't have permission..
at io.fabric8.kubernetes.client.dsl.base.OperationSupport.requestFailure(OperationSupport.java:315)
at io.fabric8.kubernetes.client.dsl.base.OperationSupport.assertResponseCode(OperationSupport.java:266)
at io.fabric8.kubernetes.client.dsl.base.OperationSupport.handleResponse(OperationSupport.java:237)
at io.fabric8.kubernetes.client.dsl.base.OperationSupport.handleResponse(OperationSupport.java:230)
at io.fabric8.kubernetes.client.dsl.base.OperationSupport.handleCreate(OperationSupport.java:208)
at io.fabric8.openshift.client.dsl.internal.ProjectRequestsOperationImpl.create(ProjectRequestsOperationImpl.java:67)
at io.fabric8.openshift.client.dsl.internal.ProjectRequestsOperationImpl$1.apply(ProjectRequestsOperationImpl.java:84)
at io.fabric8.openshift.client.dsl.internal.ProjectRequestsOperationImpl$1.apply(ProjectRequestsOperationImpl.java:80)
at io.fabric8.openshift.api.model.DoneableProjectRequest.done(DoneableProjectRequest.java:27)
at org.jboss.OpenShiftCommand.main(OpenShiftCommand.java:102)--
You received this message because you are subscribed to the Google Groups "fabric8" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fabric8+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
kubectl config set-context NAME--
You received this message because you are subscribed to the Google Groups "fabric8" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fabric8+u...@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to fabric8+unsubscribe@googlegroups.com.
oc config current-context
test/192-168-64-25:8443/test2017-03-23 12:47:38 INFO OpenShiftCommand:179 - Username : test2017-03-23 12:47:38 INFO OpenShiftCommand:179 - Namespace : test2017-03-23 12:47:38 INFO OpenShiftCommand:179 - Master URL : https://192.168.64.25:8443/2017-03-23 12:47:38 INFO OpenShiftCommand:179 - ==========================2017-03-23 12:47:38 INFO OpenShiftCommand:179 - ERROR : The project test doesn't exists for the current context !!!io.fabric8.kubernetes.client.KubernetesClientException: Failure executing: POST at: https://192.168.64.25:8443/oapi/v1/projectrequests. Message: Forbidden! User test/192-168-64-25:8443 doesn't have permission.. at io.fabric8.kubernetes.client.dsl.base.OperationSupport.requestFailure(OperationSupport.java:315) at io.fabric8.kubernetes.client.dsl.base.OperationSupport.assertResponseCode(OperationSupport.java:266) at io.fabric8.kubernetes.client.dsl.base.OperationSupport.handleResponse(OperationSupport.java:237) at io.fabric8.kubernetes.client.dsl.base.OperationSupport.handleResponse(OperationSupport.java:230) at io.fabric8.kubernetes.client.dsl.base.OperationSupport.handleCreate(OperationSupport.java:208) at io.fabric8.openshift.client.dsl.internal.ProjectRequestsOperationImpl.create(ProjectRequestsOperationImpl.java:67) at io.fabric8.openshift.client.dsl.internal.ProjectRequestsOperationImpl$1.apply(ProjectRequestsOperationImpl.java:84) at io.fabric8.openshift.client.dsl.internal.ProjectRequestsOperationImpl$1.apply(ProjectRequestsOperationImpl.java:80) at io.fabric8.openshift.api.model.DoneableProjectRequest.done(DoneableProjectRequest.java:27) at org.jboss.OpenShiftCommand.main(OpenShiftCommand.java:102)
--
You received this message because you are subscribed to the Google Groups "fabric8" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fabric8+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.