kubernetes-retired / cluster-api-provider-nested

Cluster API Provider for Nested Clusters
Apache License 2.0
301 stars 67 forks source link

Keep reporting spec different for SVC in syncer's log #159

Closed vincent-pli closed 3 years ago

vincent-pli commented 3 years ago

What steps did you take and what happened: There are tons of warning in log of syncer, said:

W0705 16:50:52.915165       1 checker.go:119] spec of service default-a32f71-vc-sample-1-default/kubernetes diff in super&tenant master

The problem is related to the kubernetes version, The tenant cluster version is:

Server Version: version.Info{Major:"1", Minor:"16", GitVersion:"v1.16.2", GitCommit:"c97fe5036ef3df2967d086711e6c0c405941e14b", GitTreeState:"clean", BuildDate:"2019-10-15T19:09:08Z", GoVersion:"go1.12.10", Compiler:"gc", Platform:"linux/amd64"}

and the version in super cluster is:

Server Version: version.Info{Major:"1", Minor:"20", GitVersion:"v1.20.2", GitCommit:"faecb196815e248d3ecfb03c680a4507229c2a56", GitTreeState:"clean", BuildDate:"2021-01-21T01:11:42Z", GoVersion:"go1.15.5", Compiler:"gc", Platform:"linux/amd64"}

In version: v1.20, the kubernetes do enhancement for SVC:

Add dual-stack Services (alpha). This is a BREAKING CHANGE to an alpha API. It changes the dual-stack API wrt Service from a single ipFamily field to 3 fields: ipFamilyPolicy (SingleStack, PreferDualStack, RequireDualStack), ipFamilies (a list of families assigned), and clusterIPs (inclusive of clusterIP). Most users do not need to set anything at all, defaulting will handle it for them. Services are single-stack unless the user asks for dual-stack. This is all gated by the "IPv6DualStack" feature gate. (#91824, @khenidak) [SIG API Machinery, Apps, CLI, Network, Node, Scheduling and Testing]

Basically, in latest version of kubernetes, if you create a SVC without define the ClusterIPs, the kubernetes will generate it automatic based on ClusterIP, like this:

spec:
  clusterIP: 10.96.178.195
  clusterIPs:
  - 10.96.178.195

It will make svc in super cluster and tenant cluster always different.

Anything else you would like to add: [Miscellaneous information that will assist in solving the issue.]

Environment:

/kind bug [One or more /area label. See https://github.com/kubernetes-sigs/cluster-api-provider-nested/labels?q=area for the list of labels]