Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot change the type of the Service from ClusterIP to ExternalName #2399

Closed
stefanrosca opened this issue Aug 12, 2020 · 1 comment · Fixed by #2472
Closed

Cannot change the type of the Service from ClusterIP to ExternalName #2399

stefanrosca opened this issue Aug 12, 2020 · 1 comment · Fixed by #2472
Assignees
Labels

Comments

@stefanrosca
Copy link

stefanrosca commented Aug 12, 2020

The current implementation ignores changes to the ClusterIP field (related to: #1925), it copies the old value from the server entity and does not include it in the PATCH call.

When editing the 'type' field from ClusterIP to ExternalName the API Servers enforces the ClusterIP field to be empty making the edit impossible using the kubernetes-client.

Validation message: Message: Service "elasticsearch-logging" is invalid: spec.clusterIP: Forbidden: must be empty for ExternalName services. Received status: Status(apiVersion=v1, code=422, details=StatusDetails(causes=[StatusCause(field=spec.clusterIP, message=Forbidden: must be empty for ExternalName services, reason=FieldValueForbidden, additionalProperties={})], group=null, kind=Service, name=elasticsearch-logging, retryAfterSeconds=null, uid=null, additionalProperties={}), kind=Status, message=Service "elasticsearch-logging" is invalid: spec.clusterIP: Forbidden: must be empty for ExternalName services, metadata=ListMeta(_continue=null, remainingItemCount=null, resourceVersion=null, selfLink=null, additionalProperties={}), reason=Invalid, status=Failure, additionalProperties={}).

@rohanKanojia
Copy link
Member

We have refactored createOrReplace in #2292 to follow POST -> PATCH as a fallback approach. I think we should remove this code which seems to be adding this:

try {
Service old = fromServer().get();
return super.replace(new ServiceBuilder(item)
.editSpec()
.withClusterIP(old.getSpec().getClusterIP())
.endSpec()
.build());
} catch (Exception e) {
throw KubernetesClientException.launderThrowable(forOperationType("replace"), e);
}

@manusa manusa added the bug label Aug 24, 2020
rohanKanojia added a commit to rohanKanojia/kubernetes-client that referenced this issue Sep 9, 2020
rohanKanojia added a commit to rohanKanojia/kubernetes-client that referenced this issue Sep 9, 2020
manusa pushed a commit to rohanKanojia/kubernetes-client that referenced this issue Sep 16, 2020
manusa pushed a commit to rohanKanojia/kubernetes-client that referenced this issue Sep 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
3 participants