kubernetes: Changing service from headless to cluster IP does not fail
What happened?
Used kubectl apply to switch an existing headless service to a cluster IP service.
The apply succeeds but the service remains unchanged.
The response body shows spec.clusterIP is “”, but it is not.
What did you expect to happen?
The update to fail.
How can we reproduce it (as minimally and precisely as possible)?
kubectl apply -f headless.yaml
kubectl apply -f clusterip.yaml
headless.yaml
apiVersion: v1
kind: Service
metadata:
name: test
spec:
clusterIP: None
ports:
- name: http
port: 8080
protocol: TCP
targetPort: http
selector:
app.kubernetes.io/name: test
type: ClusterIP
clusterip.yaml
apiVersion: v1
kind: Service
metadata:
name: test
spec:
clusterIP: ""
ports:
- name: http
protocol: TCP
port: 8080
targetPort: http
selector:
app.kubernetes.io/name: test
type: ClusterIP
Anything else we need to know?
No response
Kubernetes version
$ kubectl version
Server Version: version.Info{Major:"1", Minor:"27", GitVersion:"v1.27.3", GitCommit:"25b4e43193bcda6c7328a6d147b1fb73a33f1598", GitTreeState:"clean", BuildDate:"2023-06-15T00:36:28Z", GoVersion:"go1.20.5", Compiler:"gc", Platform:"linux/amd64"}
Cloud provider
Kind
EKS
OS version
# On Linux:
$ cat /etc/os-release
# paste output here
$ uname -a
# paste output here
# On Windows:
C:\> wmic os get Caption, Version, BuildNumber, OSArchitecture
# paste output here
Install tools
Container runtime (CRI) and version (if applicable)
Related plugins (CNI, CSI, …) and versions (if applicable)
About this issue
- Original URL
- State: closed
- Created 9 months ago
- Comments: 19 (19 by maintainers)
Ok, so the problem is not in the stored data, that is good, I was worried we were mutating the stored service.
The problem is the output returned then, I will try to get to it if @thockin doesn’t beat me 😃, @HirazawaUi this logic is super complex and there were important refactor after that linked PR. I will review your PR too