diff --git a/apis/dataplane/v1beta1/openstackdataplaneservice_types.go b/apis/dataplane/v1beta1/openstackdataplaneservice_types.go index 068ac805f..bbfdb0baf 100644 --- a/apis/dataplane/v1beta1/openstackdataplaneservice_types.go +++ b/apis/dataplane/v1beta1/openstackdataplaneservice_types.go @@ -160,3 +160,20 @@ func (instance OpenStackDataPlaneService) InitConditions() { // initialize conditions used later as Status=Unknown instance.Status.Conditions.Init(&cl) } + +// DefaultLabel - adding default label to the OpenStackDataPlaneService +func (r *OpenStackDataPlaneService) DefaultLabels() { + labels := map[string]string{ + "app.kubernetes.io/name": "openstackdataplaneservice", + "app.kubernetes.io/instance": r.Name, + "app.kubernetes.io/part-of": "openstack-operator", + } + + if r.Labels == nil { + r.Labels = labels + } else { + for k, v := range labels { + r.Labels[k] = v + } + } +} diff --git a/apis/dataplane/v1beta1/openstackdataplaneservice_webhook.go b/apis/dataplane/v1beta1/openstackdataplaneservice_webhook.go index db65ccc03..7088a12c3 100644 --- a/apis/dataplane/v1beta1/openstackdataplaneservice_webhook.go +++ b/apis/dataplane/v1beta1/openstackdataplaneservice_webhook.go @@ -45,6 +45,7 @@ func (r *OpenStackDataPlaneService) Default() { openstackdataplaneservicelog.Info("default", "name", r.Name) r.Spec.Default(r.Name) + r.DefaultLabels() } // Default - set defaults for this OpenStackDataPlaneService diff --git a/config/services/dataplane_v1beta1_openstackdataplaneservice_bootstrap.yaml b/config/services/dataplane_v1beta1_openstackdataplaneservice_bootstrap.yaml index 90668075e..fc5734c04 100644 --- a/config/services/dataplane_v1beta1_openstackdataplaneservice_bootstrap.yaml +++ b/config/services/dataplane_v1beta1_openstackdataplaneservice_bootstrap.yaml @@ -1,12 +1,6 @@ apiVersion: dataplane.openstack.org/v1beta1 kind: OpenStackDataPlaneService metadata: - labels: - app.kubernetes.io/name: openstackdataplaneservice - app.kubernetes.io/instance: openstackdataplaneservice-bootstrap - app.kubernetes.io/part-of: openstack-operator - app.kubernetes.io/managed-by: kustomize - app.kubernetes.io/created-by: openstack-operator name: bootstrap spec: playbook: osp.edpm.bootstrap diff --git a/config/services/dataplane_v1beta1_openstackdataplaneservice_configure_network.yaml b/config/services/dataplane_v1beta1_openstackdataplaneservice_configure_network.yaml index c045211e3..3b83b5660 100644 --- a/config/services/dataplane_v1beta1_openstackdataplaneservice_configure_network.yaml +++ b/config/services/dataplane_v1beta1_openstackdataplaneservice_configure_network.yaml @@ -1,12 +1,6 @@ apiVersion: dataplane.openstack.org/v1beta1 kind: OpenStackDataPlaneService metadata: - labels: - app.kubernetes.io/name: openstackdataplaneservice - app.kubernetes.io/instance: openstackdataplaneservice-configure-network - app.kubernetes.io/part-of: openstack-operator - app.kubernetes.io/managed-by: kustomize - app.kubernetes.io/created-by: openstack-operator name: configure-network spec: playbook: osp.edpm.configure_network diff --git a/config/services/dataplane_v1beta1_openstackdataplaneservice_configure_ovs_dpdk.yaml b/config/services/dataplane_v1beta1_openstackdataplaneservice_configure_ovs_dpdk.yaml index 946e321d3..07570f477 100644 --- a/config/services/dataplane_v1beta1_openstackdataplaneservice_configure_ovs_dpdk.yaml +++ b/config/services/dataplane_v1beta1_openstackdataplaneservice_configure_ovs_dpdk.yaml @@ -1,12 +1,6 @@ apiVersion: dataplane.openstack.org/v1beta1 kind: OpenStackDataPlaneService metadata: - labels: - app.kubernetes.io/name: openstackdataplaneservice - app.kubernetes.io/instance: openstackdataplaneservice-configure-ovs-dpdk - app.kubernetes.io/part-of: openstack-operator - app.kubernetes.io/managed-by: kustomize - app.kubernetes.io/created-by: openstack-operator name: configure-ovs-dpdk spec: playbook: osp.edpm.configure_ovs_dpdk diff --git a/config/services/dataplane_v1beta1_openstackdataplaneservice_derive_pci_devicespec.yaml b/config/services/dataplane_v1beta1_openstackdataplaneservice_derive_pci_devicespec.yaml index a0fecb89c..9dfc80b79 100644 --- a/config/services/dataplane_v1beta1_openstackdataplaneservice_derive_pci_devicespec.yaml +++ b/config/services/dataplane_v1beta1_openstackdataplaneservice_derive_pci_devicespec.yaml @@ -1,12 +1,6 @@ apiVersion: dataplane.openstack.org/v1beta1 kind: OpenStackDataPlaneService metadata: - labels: - app.kubernetes.io/name: openstackdataplaneservice - app.kubernetes.io/instance: openstackdataplaneservice-derive-pci-devicespec - app.kubernetes.io/part-of: openstack-operator - app.kubernetes.io/managed-by: kustomize - app.kubernetes.io/created-by: openstack-operator name: derive-pci-devicespec spec: playbook: osp.edpm.sriov_derive_device_spec diff --git a/config/services/dataplane_v1beta1_openstackdataplaneservice_download_cache.yaml b/config/services/dataplane_v1beta1_openstackdataplaneservice_download_cache.yaml index f7b399413..a9d429c80 100644 --- a/config/services/dataplane_v1beta1_openstackdataplaneservice_download_cache.yaml +++ b/config/services/dataplane_v1beta1_openstackdataplaneservice_download_cache.yaml @@ -1,12 +1,6 @@ apiVersion: dataplane.openstack.org/v1beta1 kind: OpenStackDataPlaneService metadata: - labels: - app.kubernetes.io/name: openstackdataplaneservice - app.kubernetes.io/instance: openstackdataplaneservice-download-cache - app.kubernetes.io/part-of: openstack-operator - app.kubernetes.io/managed-by: kustomize - app.kubernetes.io/created-by: openstack-operator name: download-cache spec: playbook: osp.edpm.download_cache diff --git a/config/services/dataplane_v1beta1_openstackdataplaneservice_install_certs.yaml b/config/services/dataplane_v1beta1_openstackdataplaneservice_install_certs.yaml index d946f31d8..feeb111b7 100644 --- a/config/services/dataplane_v1beta1_openstackdataplaneservice_install_certs.yaml +++ b/config/services/dataplane_v1beta1_openstackdataplaneservice_install_certs.yaml @@ -1,12 +1,6 @@ apiVersion: dataplane.openstack.org/v1beta1 kind: OpenStackDataPlaneService metadata: - labels: - app.kubernetes.io/name: openstackdataplaneservice - app.kubernetes.io/instance: openstackdataplaneservice-install-certs - app.kubernetes.io/part-of: openstack-operator - app.kubernetes.io/managed-by: kustomize - app.kubernetes.io/created-by: openstack-operator name: install-certs spec: playbook: osp.edpm.install_certs diff --git a/config/services/dataplane_v1beta1_openstackdataplaneservice_validate_network.yaml b/config/services/dataplane_v1beta1_openstackdataplaneservice_validate_network.yaml index 77df9768f..66ae6cc9a 100644 --- a/config/services/dataplane_v1beta1_openstackdataplaneservice_validate_network.yaml +++ b/config/services/dataplane_v1beta1_openstackdataplaneservice_validate_network.yaml @@ -1,12 +1,6 @@ apiVersion: dataplane.openstack.org/v1beta1 kind: OpenStackDataPlaneService metadata: - labels: - app.kubernetes.io/name: openstackdataplaneservice - app.kubernetes.io/instance: openstackdataplaneservice-validate-network - app.kubernetes.io/part-of: openstack-operator - app.kubernetes.io/managed-by: kustomize - app.kubernetes.io/created-by: openstack-operator name: validate-network spec: playbook: osp.edpm.validate_network