Skip to content

Commit

Permalink
CAPIM: Enable update for coreDNS and kube-proxy
Browse files Browse the repository at this point in the history
Signed-off-by: killianmuldoon <kmuldoon@vmware.com>
  • Loading branch information
killianmuldoon committed Jun 21, 2023
1 parent 125ee96 commit 77a7d55
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 5 deletions.
38 changes: 38 additions & 0 deletions test/infrastructure/inmemory/internal/server/api/const.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,19 @@ var (
Version: "v1",
},
},
{
Name: "apps",
Versions: []metav1.GroupVersionForDiscovery{
{
GroupVersion: "apps/v1",
Version: "v1",
},
},
PreferredVersion: metav1.GroupVersionForDiscovery{
GroupVersion: "apps/v1",
Version: "v1",
},
},
},
}

Expand Down Expand Up @@ -200,4 +213,29 @@ var (
},
},
}
appsV1ResourceList = &metav1.APIResourceList{
GroupVersion: "apps/v1",
APIResources: []metav1.APIResource{
{
Name: "daemonsets",
SingularName: "daemonset",
Namespaced: true,
Kind: "DaemonSet",
Verbs: []string{
"create",
"delete",
"deletecollection",
"get",
"list",
"patch",
"update",
"watch",
},
ShortNames: []string{
"ds",
},
StorageVersionHash: "",
},
},
}
)
11 changes: 11 additions & 0 deletions test/infrastructure/inmemory/internal/server/api/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,14 @@ func (h *apiServerHandler) apisDiscovery(req *restful.Request, resp *restful.Res
}
return
}
if req.PathParameter("group") == "apps" && req.PathParameter("version") == "v1" {
if err := resp.WriteEntity(appsV1ResourceList); err != nil {
_ = resp.WriteErrorString(http.StatusInternalServerError, err.Error())
return
}
return
}

_ = resp.WriteErrorString(http.StatusInternalServerError, fmt.Sprintf("discovery info not defined for %s/%s", req.PathParameter("group"), req.PathParameter("version")))
return
}
Expand Down Expand Up @@ -535,6 +543,9 @@ func getAPIResourceList(req *restful.Request) *metav1.APIResourceList {
if req.PathParameter("group") == "rbac.authorization.k8s.io" && req.PathParameter("version") == "v1" {
return rbacv1APIResourceList
}
if req.PathParameter("group") == "apps" && req.PathParameter("version") == "v1" {
return appsV1ResourceList
}
return nil
}
return corev1APIResourceList
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,6 @@ spec:
controlPlane:
metadata:
annotations:
# The in-memory provider currently does not support looking up coredns
# and kube-proxy information and leads to reconcile errors in KCP.
# With these annotations KCP will skip processing those steps.
controlplane.cluster.x-k8s.io/skip-coredns: ""
controlplane.cluster.x-k8s.io/skip-kube-proxy: ""
machineInfrastructure:
ref:
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha1
Expand Down

0 comments on commit 77a7d55

Please sign in to comment.