Skip to content

Commit

Permalink
move webhooks to internal
Browse files Browse the repository at this point in the history
  • Loading branch information
kaitoii11 committed Nov 22, 2021
1 parent 0e1e42b commit 55fc3e5
Show file tree
Hide file tree
Showing 8 changed files with 60 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ generate-manifests-core: $(CONTROLLER_GEN) $(KUSTOMIZE)
$(CONTROLLER_GEN) \
paths=./api/... \
paths=./controllers/... \
paths=./webhooks/... \
paths=./internal/webhooks/... \
paths=./$(EXP_DIR)/api/... \
paths=./$(EXP_DIR)/controllers/... \
paths=./$(EXP_DIR)/addons/api/... \
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
18 changes: 18 additions & 0 deletions internal/webhooks/doc.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/*
Copyright 2021 The Kubernetes 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 webhooks contains external webhook implementations for some of our API types.
package webhooks
File renamed without changes.
41 changes: 41 additions & 0 deletions webhooks/alias.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*
Copyright 2021 The Kubernetes 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 webhooks

import (
clusterwebhooks "sigs.k8s.io/cluster-api/webhooks/internal/webhooks"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/client"
)

// Cluster implements a validating and defaulting webhook for Cluster.
type Cluster struct {
Client client.Reader
}

// SetupWebhookWithManager sets up Cluster webhooks.
func (webhook *Cluster) SetupWebhookWithManager(mgr ctrl.Manager) error {
return (&clusterwebhooks.Cluster{}).SetupWebhookWithManager(mgr)
}

// ClusterClass implements a validation and defaulting webhook for ClusterClass.
type ClusterClass struct{}

// SetupWebhookWithManager sets up ClusterClass webhooks.
func (webhook *ClusterClass) SetupWebhookWithManager(mgr ctrl.Manager) error {
return (&clusterwebhooks.ClusterClass{}).SetupWebhookWithManager(mgr)
}

0 comments on commit 55fc3e5

Please sign in to comment.