Skip to content

Commit bb45ad9

Browse files
committed
Move webhooks into pkg/webhooks
Moves webhooks from api to pkg/webhooks making only mechanical code changes except for the removal of the defaulting webhooks, because they weren't used. This results in there now being no mutating webhook configured. NOTE(stephenfin): There were a lot of conflicts here. These were mostly mitigated by faking the addition of v1alpha8, which moved the webhooks to the 'api/v1alpha8' package (commit 750b84d), followed by the subsequent rename of this package to v1beta1 (commit e9fb53c), for the webhook files and tests. This still resulted in some merge conflicts due the v1alpha8 changes such as 564b6bd and 4368c4f (which we obviously don't want to include here) but it made the backport much simpler. Signed-off-by: Stephen Finucane <stephenfin@redhat.com> (cherry picked from commit 750b84d)
1 parent 0cd0798 commit bb45ad9

23 files changed

+740
-775
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ generate-go: $(MOCKGEN)
267267
.PHONY: generate-manifests
268268
generate-manifests: $(CONTROLLER_GEN) ## Generate manifests e.g. CRD, RBAC etc.
269269
$(CONTROLLER_GEN) \
270-
paths=./api/... \
270+
paths=./pkg/webhooks/... \
271271
crd:crdVersions=v1 \
272272
output:crd:dir=$(CRD_ROOT) \
273273
output:webhook:dir=$(WEBHOOK_ROOT) \

api/v1alpha5/conversion.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,9 @@ import (
2020
"strings"
2121

2222
conversion "k8s.io/apimachinery/pkg/conversion"
23+
infrav1 "sigs.k8s.io/cluster-api-provider-openstack/api/v1alpha7"
2324
utilconversion "sigs.k8s.io/cluster-api/util/conversion"
2425
ctrlconversion "sigs.k8s.io/controller-runtime/pkg/conversion"
25-
26-
infrav1 "sigs.k8s.io/cluster-api-provider-openstack/api/v1alpha7"
2726
)
2827

2928
var _ ctrlconversion.Convertible = &OpenStackCluster{}

api/v1alpha5/conversion_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,8 @@ import (
2222
"github.com/onsi/gomega"
2323
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2424
runtime "k8s.io/apimachinery/pkg/runtime"
25-
ctrlconversion "sigs.k8s.io/controller-runtime/pkg/conversion"
26-
2725
infrav1 "sigs.k8s.io/cluster-api-provider-openstack/api/v1alpha7"
26+
ctrlconversion "sigs.k8s.io/controller-runtime/pkg/conversion"
2827
)
2928

3029
func TestConvertFrom(t *testing.T) {

api/v1alpha6/conversion.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,9 @@ import (
2121
"strings"
2222

2323
apiconversion "k8s.io/apimachinery/pkg/conversion"
24-
ctrlconversion "sigs.k8s.io/controller-runtime/pkg/conversion"
25-
2624
infrav1 "sigs.k8s.io/cluster-api-provider-openstack/api/v1alpha7"
2725
"sigs.k8s.io/cluster-api-provider-openstack/pkg/utils/conversion"
26+
ctrlconversion "sigs.k8s.io/controller-runtime/pkg/conversion"
2827
)
2928

3029
const trueString = "true"

api/v1alpha6/conversion_test.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,10 @@ import (
2626
runtime "k8s.io/apimachinery/pkg/runtime"
2727
runtimeserializer "k8s.io/apimachinery/pkg/runtime/serializer"
2828
"k8s.io/utils/pointer"
29-
utilconversion "sigs.k8s.io/cluster-api/util/conversion"
30-
"sigs.k8s.io/controller-runtime/pkg/conversion"
31-
3229
infrav1 "sigs.k8s.io/cluster-api-provider-openstack/api/v1alpha7"
3330
testhelpers "sigs.k8s.io/cluster-api-provider-openstack/test/helpers"
31+
utilconversion "sigs.k8s.io/cluster-api/util/conversion"
32+
"sigs.k8s.io/controller-runtime/pkg/conversion"
3433
)
3534

3635
// Setting this to false to avoid running tests in parallel. Only for use in development.

api/v1alpha7/identity_types.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@ limitations under the License.
1616

1717
package v1alpha7
1818

19-
const defaultIdentityRefKind = "Secret"
20-
2119
// OpenStackIdentityReference is a reference to an infrastructure
2220
// provider identity to be used to provision cluster resources.
2321
type OpenStackIdentityReference struct {

api/v1alpha7/openstackcluster_webhook.go

Lines changed: 0 additions & 153 deletions
This file was deleted.

api/v1alpha7/openstackclusterlist_webhook.go

Lines changed: 0 additions & 32 deletions
This file was deleted.

api/v1alpha7/openstackclustertemplate_webhook.go

Lines changed: 0 additions & 85 deletions
This file was deleted.

0 commit comments

Comments
 (0)