Skip to content

Commit 0cd0898

Browse files
author
Brendan Shephard
committed
Require EDPMServiceType
This change switches EDPMServiceType from optional to required. Since the EDPMServiceType of custom services needs to match that of an existing service, we also remove the defaulting mechanism in the webhook. Signed-off-by: Brendan Shephard <bshephar@redhat.com>
1 parent 5637f8d commit 0cd0898

35 files changed

Lines changed: 43 additions & 15 deletions

File tree

apis/dataplane/v1beta1/openstackdataplaneservice_types.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ type OpenStackDataPlaneServiceSpec struct {
111111
// corresponds to the ansible role name (without the "edpm_" prefix) used
112112
// to manage the service. If not set, will default to the
113113
// OpenStackDataPlaneService name.
114+
// +kubebuilder:validation:Required
114115
EDPMServiceType string `json:"edpmServiceType,omitempty" yaml:"edpmServiceType,omitempty"`
115116
}
116117

apis/dataplane/v1beta1/openstackdataplaneservice_webhook.go

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,17 +44,9 @@ var _ webhook.Defaulter = &OpenStackDataPlaneService{}
4444
func (r *OpenStackDataPlaneService) Default() {
4545

4646
openstackdataplaneservicelog.Info("default", "name", r.Name)
47-
r.Spec.Default(r.Name)
4847
r.DefaultLabels()
4948
}
5049

51-
// Default - set defaults for this OpenStackDataPlaneService
52-
func (spec *OpenStackDataPlaneServiceSpec) Default(name string) {
53-
if spec.EDPMServiceType == "" {
54-
spec.EDPMServiceType = name
55-
}
56-
}
57-
5850
// TODO(user): change verbs to "verbs=create;update;delete" if you want to enable deletion validation.
5951
// +kubebuilder:webhook:path=/validate-dataplane-openstack-org-v1beta1-openstackdataplaneservice,mutating=false,failurePolicy=fail,sideEffects=None,groups=dataplane.openstack.org,resources=openstackdataplaneservices,verbs=create;update,versions=v1beta1,name=vopenstackdataplaneservice.kb.io,admissionReviewVersions=v1
6052

config/services/dataplane_v1beta1_openstackdataplaneservice_bootstrap.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ metadata:
44
name: bootstrap
55
spec:
66
playbook: osp.edpm.bootstrap
7+
edpmServiceType: bootstrap

config/services/dataplane_v1beta1_openstackdataplaneservice_ceph_client.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ metadata:
44
name: ceph-client
55
spec:
66
playbook: osp.edpm.ceph_client
7+
edpmServiceType: ceph-client

config/services/dataplane_v1beta1_openstackdataplaneservice_ceph_hci_pre.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ metadata:
44
name: ceph-hci-pre
55
spec:
66
playbook: osp.edpm.ceph_hci_pre
7+
edpmServiceType: ceph-hci-pre

config/services/dataplane_v1beta1_openstackdataplaneservice_configure_network.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ metadata:
44
name: configure-network
55
spec:
66
playbook: osp.edpm.configure_network
7+
edpmServiceType: configure-network

config/services/dataplane_v1beta1_openstackdataplaneservice_configure_os.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ metadata:
44
name: configure-os
55
spec:
66
playbook: osp.edpm.configure_os
7+
edpmServiceType: configure-os

config/services/dataplane_v1beta1_openstackdataplaneservice_configure_ovs_dpdk.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ metadata:
44
name: configure-ovs-dpdk
55
spec:
66
playbook: osp.edpm.configure_ovs_dpdk
7+
edpmServiceType: configure-ovs-dpdk

config/services/dataplane_v1beta1_openstackdataplaneservice_ddp_package_option.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ metadata:
44
name: ddp-package-option
55
spec:
66
playbook: osp.edpm.select_kernel_ddp_package
7+
edpmServiceType: ddp-package-option

config/services/dataplane_v1beta1_openstackdataplaneservice_derive_pci_devicespec.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ metadata:
44
name: derive-pci-devicespec
55
spec:
66
playbook: osp.edpm.sriov_derive_device_spec
7+
edpmServiceType: derive-pci-devicespec

0 commit comments

Comments
 (0)