diff --git a/pkg/controller/add_csrapprover.go b/pkg/controller/add_csrapprover.go deleted file mode 100644 index e28a408b476..00000000000 --- a/pkg/controller/add_csrapprover.go +++ /dev/null @@ -1,30 +0,0 @@ -/* -Copyright 2023 The OpenYurt Authors. - -Licensed under the Apache License, Version 2.0 (the License); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an AS IS BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package controller - -import ( - "github.com/openyurtio/openyurt/pkg/controller/csrapprover" -) - -// Note !!! @kadisi -// Do not change the name of the file @kadisi -// Auto generate by make addcontroller command !!! -// Note !!! - -func init() { - addController("csrapprover", csrapprover.Add) -} diff --git a/pkg/controller/add_daemonpodupdater.go b/pkg/controller/add_daemonpodupdater.go deleted file mode 100644 index 516f2d49264..00000000000 --- a/pkg/controller/add_daemonpodupdater.go +++ /dev/null @@ -1,30 +0,0 @@ -/* -Copyright 2023 The OpenYurt Authors. - -Licensed under the Apache License, Version 2.0 (the License); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an AS IS BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package controller - -import ( - "github.com/openyurtio/openyurt/pkg/controller/daemonpodupdater" -) - -// Note !!! @kadisi -// Do not change the name of the file @kadisi -// Auto generate by make addcontroller command !!! -// Note !!! - -func init() { - addController("daemonpodupdater", daemonpodupdater.Add) -} diff --git a/pkg/controller/add_delegatelease.go b/pkg/controller/add_delegatelease.go deleted file mode 100644 index 9f80b588215..00000000000 --- a/pkg/controller/add_delegatelease.go +++ /dev/null @@ -1,25 +0,0 @@ -/* -Copyright 2023 The OpenYurt Authors. - -Licensed under the Apache License, Version 2.0 (the License); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an AS IS BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package controller - -import ( - "github.com/openyurtio/openyurt/pkg/controller/poolcoordinator/delegatelease" -) - -func init() { - addController("delegatelease", delegatelease.Add) -} diff --git a/pkg/controller/add_gateway.go b/pkg/controller/add_gateway.go deleted file mode 100644 index 98cbc5f6576..00000000000 --- a/pkg/controller/add_gateway.go +++ /dev/null @@ -1,32 +0,0 @@ -/* -Copyright 2023 The OpenYurt Authors. - -Licensed under the Apache License, Version 2.0 (the License); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an AS IS BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package controller - -import ( - "github.com/openyurtio/openyurt/pkg/controller/gateway/gateway" - "github.com/openyurtio/openyurt/pkg/controller/gateway/service" -) - -// Note !!! @kadisi -// Do not change the name of the file @kadisi -// Auto generate by make addcontroller command !!! -// Note !!! - -func init() { - addController("gateway", gateway.Add) - addController("service", service.Add) -} diff --git a/pkg/controller/add_nodepool.go b/pkg/controller/add_nodepool.go deleted file mode 100644 index 4b09706621f..00000000000 --- a/pkg/controller/add_nodepool.go +++ /dev/null @@ -1,30 +0,0 @@ -/* -Copyright 2023 The OpenYurt Authors. - -Licensed under the Apache License, Version 2.0 (the License); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an AS IS BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package controller - -import ( - "github.com/openyurtio/openyurt/pkg/controller/nodepool" -) - -// Note !!! @kadisi -// Do not change the name of the file @kadisi -// Auto generate by make addcontroller command !!! -// Note !!! - -func init() { - addController("nodepool", nodepool.Add) -} diff --git a/pkg/controller/add_podbinding.go b/pkg/controller/add_podbinding.go deleted file mode 100644 index 8c025ffa6d9..00000000000 --- a/pkg/controller/add_podbinding.go +++ /dev/null @@ -1,25 +0,0 @@ -/* -Copyright 2023 The OpenYurt Authors. - -Licensed under the Apache License, Version 2.0 (the License); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an AS IS BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package controller - -import ( - "github.com/openyurtio/openyurt/pkg/controller/poolcoordinator/podbinding" -) - -func init() { - addController("podbinding", podbinding.Add) -} diff --git a/pkg/controller/add_poolcoordinatorcert.go b/pkg/controller/add_poolcoordinatorcert.go deleted file mode 100644 index 852e011cc73..00000000000 --- a/pkg/controller/add_poolcoordinatorcert.go +++ /dev/null @@ -1,30 +0,0 @@ -/* -Copyright 2023 The OpenYurt Authors. - -Licensed under the Apache License, Version 2.0 (the License); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an AS IS BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package controller - -import ( - poolcoordinatorcert "github.com/openyurtio/openyurt/pkg/controller/poolcoordinator/cert" -) - -// Note !!! @kadisi -// Do not change the name of the file @kadisi -// Auto generate by make addcontroller command !!! -// Note !!! - -func init() { - addController("poolcoordinatorcert", poolcoordinatorcert.Add) -} diff --git a/pkg/controller/add_servicetopology_endpoints.go b/pkg/controller/add_servicetopology_endpoints.go deleted file mode 100644 index 722ec545807..00000000000 --- a/pkg/controller/add_servicetopology_endpoints.go +++ /dev/null @@ -1,30 +0,0 @@ -/* -Copyright 2023 The OpenYurt Authors. - -Licensed under the Apache License, Version 2.0 (the License); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an AS IS BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package controller - -import ( - servicetopologyEndpoints "github.com/openyurtio/openyurt/pkg/controller/servicetopology/endpoints" -) - -// Note !!! @kadisi -// Do not change the name of the file @kadisi -// Auto generate by make addcontroller command !!! -// Note !!! - -func init() { - addController("servicetopologyEndpoints", servicetopologyEndpoints.Add) -} diff --git a/pkg/controller/add_servicetopology_endpointslice.go b/pkg/controller/add_servicetopology_endpointslice.go deleted file mode 100644 index d53214b8815..00000000000 --- a/pkg/controller/add_servicetopology_endpointslice.go +++ /dev/null @@ -1,30 +0,0 @@ -/* -Copyright 2023 The OpenYurt Authors. - -Licensed under the Apache License, Version 2.0 (the License); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an AS IS BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package controller - -import ( - servicetopologyEndpointslice "github.com/openyurtio/openyurt/pkg/controller/servicetopology/endpointslice" -) - -// Note !!! @kadisi -// Do not change the name of the file @kadisi -// Auto generate by make addcontroller command !!! -// Note !!! - -func init() { - addController("servicetopologyEndpointslice", servicetopologyEndpointslice.Add) -} diff --git a/pkg/controller/add_staticpod.go b/pkg/controller/add_staticpod.go deleted file mode 100644 index 96ee131f00b..00000000000 --- a/pkg/controller/add_staticpod.go +++ /dev/null @@ -1,30 +0,0 @@ -/* -Copyright 2023 The OpenYurt Authors. - -Licensed under the Apache License, Version 2.0 (the License); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an AS IS BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package controller - -import ( - "github.com/openyurtio/openyurt/pkg/controller/staticpod" -) - -// Note !!! @kadisi -// Do not change the name of the file @kadisi -// Auto generate by make addcontroller command !!! -// Note !!! - -func init() { - addController("staticpod", staticpod.Add) -} diff --git a/pkg/controller/add_yurtappdaemon.go b/pkg/controller/add_yurtappdaemon.go deleted file mode 100644 index ba6dc5123e0..00000000000 --- a/pkg/controller/add_yurtappdaemon.go +++ /dev/null @@ -1,30 +0,0 @@ -/* -Copyright 2023 The OpenYurt Authors. - -Licensed under the Apache License, Version 2.0 (the License); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an AS IS BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package controller - -import ( - "github.com/openyurtio/openyurt/pkg/controller/yurtappdaemon" -) - -// Note !!! @kadisi -// Do not change the name of the file @kadisi -// Auto generate by make addcontroller command !!! -// Note !!! - -func init() { - controllerAddFuncs = append(controllerAddFuncs, yurtappdaemon.Add) -} diff --git a/pkg/controller/add_yurtappset.go b/pkg/controller/add_yurtappset.go deleted file mode 100644 index 590c3ec6572..00000000000 --- a/pkg/controller/add_yurtappset.go +++ /dev/null @@ -1,30 +0,0 @@ -/* -Copyright 2023 The OpenYurt Authors. - -Licensed under the Apache License, Version 2.0 (the License); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an AS IS BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package controller - -import ( - "github.com/openyurtio/openyurt/pkg/controller/yurtappset" -) - -// Note !!! @kadisi -// Do not change the name of the file @kadisi -// Auto generate by make addcontroller command !!! -// Note !!! - -func init() { - addController("yurtappset", yurtappset.Add) -} diff --git a/pkg/controller/controller.go b/pkg/controller/controller.go index 924a8b29eaf..d7c9bf65349 100644 --- a/pkg/controller/controller.go +++ b/pkg/controller/controller.go @@ -22,7 +22,20 @@ import ( "sigs.k8s.io/controller-runtime/pkg/manager" "github.com/openyurtio/openyurt/cmd/yurt-manager/app/config" + "github.com/openyurtio/openyurt/pkg/controller/csrapprover" + "github.com/openyurtio/openyurt/pkg/controller/daemonpodupdater" + "github.com/openyurtio/openyurt/pkg/controller/gateway/gateway" + "github.com/openyurtio/openyurt/pkg/controller/gateway/service" + "github.com/openyurtio/openyurt/pkg/controller/nodepool" + poolcoordinatorcert "github.com/openyurtio/openyurt/pkg/controller/poolcoordinator/cert" + "github.com/openyurtio/openyurt/pkg/controller/poolcoordinator/delegatelease" + "github.com/openyurtio/openyurt/pkg/controller/poolcoordinator/podbinding" + servicetopologyendpoints "github.com/openyurtio/openyurt/pkg/controller/servicetopology/endpoints" + servicetopologyendpointslice "github.com/openyurtio/openyurt/pkg/controller/servicetopology/endpointslice" + "github.com/openyurtio/openyurt/pkg/controller/staticpod" "github.com/openyurtio/openyurt/pkg/controller/util" + "github.com/openyurtio/openyurt/pkg/controller/yurtappdaemon" + "github.com/openyurtio/openyurt/pkg/controller/yurtappset" ) // Note !!! @kadisi @@ -31,13 +44,22 @@ import ( // Don`t Change this Name !!!! @kadisi // TODO support feature gate @kadisi -var controllerAddFuncs map[string]func(*config.CompletedConfig, manager.Manager) error +var controllerAddFuncs = make(map[string]func(*config.CompletedConfig, manager.Manager) error) -func addController(name string, fn func(*config.CompletedConfig, manager.Manager) error) { - if controllerAddFuncs == nil { - controllerAddFuncs = make(map[string]func(*config.CompletedConfig, manager.Manager) error) - } - controllerAddFuncs[name] = fn +func init() { + controllerAddFuncs["crsapprover"] = csrapprover.Add + controllerAddFuncs["daemonpodupdater"] = daemonpodupdater.Add + controllerAddFuncs["delegatelease"] = delegatelease.Add + controllerAddFuncs["gateway"] = gateway.Add + controllerAddFuncs["service"] = service.Add + controllerAddFuncs["nodepool"] = nodepool.Add + controllerAddFuncs["podbinding"] = podbinding.Add + controllerAddFuncs["poolcoordinatorcert"] = poolcoordinatorcert.Add + controllerAddFuncs["servicetopologyendpoints"] = servicetopologyendpoints.Add + controllerAddFuncs["servicetopologyendpointslice"] = servicetopologyendpointslice.Add + controllerAddFuncs["staticpod"] = staticpod.Add + controllerAddFuncs["yurtappset"] = yurtappset.Add + controllerAddFuncs["yurtappdaemon"] = yurtappdaemon.Add } // If you want to add additional RBAC, enter it here !!! @kadisi diff --git a/pkg/webhook/add_v1alpha1_yurtappdaemon.go b/pkg/webhook/add_v1alpha1_yurtappdaemon.go index 48545562750..40f3236406d 100644 --- a/pkg/webhook/add_v1alpha1_yurtappdaemon.go +++ b/pkg/webhook/add_v1alpha1_yurtappdaemon.go @@ -21,5 +21,5 @@ import ( ) func init() { - addWebhook(&v1alpha1.YurtAppDaemonHandler{}) + addWebhook("yurtappdaemon", &v1alpha1.YurtAppDaemonHandler{}) }