Skip to content

Commit

Permalink
Drop DataPlaneService ConfigMaps and Secrets
Browse files Browse the repository at this point in the history
- Drops the ConfigMaps and Secrets fields from OpenStackDataPlaneService.
- Updates all services under config/services to use the
  OpenStackDataPlaneService.Spec.DataSources field instead.
- Update docs for the switch to DataSources.

Signed-off-by: Fabricio Aguiar <[email protected]>
  • Loading branch information
fao89 committed Jun 14, 2024
1 parent 54e92e4 commit 78cd024
Show file tree
Hide file tree
Showing 19 changed files with 51 additions and 135 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,6 @@ spec:
type: string
certsFrom:
type: string
configMaps:
items:
type: string
type: array
containerImageFields:
items:
type: string
Expand Down Expand Up @@ -79,10 +75,6 @@ spec:
type: string
playbookContents:
type: string
secrets:
items:
type: string
type: array
tlsCerts:
additionalProperties:
properties:
Expand Down
8 changes: 0 additions & 8 deletions apis/dataplane/v1beta1/openstackdataplaneservice_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,6 @@ type OpenstackDataPlaneServiceCert struct {

// OpenStackDataPlaneServiceSpec defines the desired state of OpenStackDataPlaneService
type OpenStackDataPlaneServiceSpec struct {
// ConfigMaps list of ConfigMap names to mount as ExtraMounts for the OpenStackAnsibleEE
// +kubebuilder:validation:Optional
ConfigMaps []string `json:"configMaps,omitempty" yaml:"configMaps,omitempty"`

// Secrets list of Secret names to mount as ExtraMounts for the OpenStackAnsibleEE
// +kubebuilder:validation:Optional
Secrets []string `json:"secrets,omitempty"`

// DataSources list of DataSource objects to mount as ExtraMounts for the
// OpenStackAnsibleEE
DataSources []DataSource `json:"dataSources,omitempty" yaml:"dataSources,omitempty"`
Expand Down
10 changes: 0 additions & 10 deletions apis/dataplane/v1beta1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,6 @@ spec:
type: string
certsFrom:
type: string
configMaps:
items:
type: string
type: array
containerImageFields:
items:
type: string
Expand Down Expand Up @@ -79,10 +75,6 @@ spec:
type: string
playbookContents:
type: string
secrets:
items:
type: string
type: array
tlsCerts:
additionalProperties:
properties:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@ metadata:
name: libvirt
spec:
playbook: osp.edpm.libvirt
secrets:
dataSources:
# NOTE: this Secret needs to be created before deploying the data plane.
# It should contain the libvirt sasl auth password using the key LibvirtPassword
- libvirt-secret
- secretRef:
name: libvirt-secret
tlsCerts:
default:
contents:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ kind: OpenStackDataPlaneService
metadata:
name: logging
spec:
secrets:
- logging-compute-config-data
dataSources:
- secretRef:
name: logging-compute-config-data
playbook: osp.edpm.telemetry_logging
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ metadata:
name: neutron-dhcp
spec:
playbook: osp.edpm.neutron_dhcp
secrets:
- neutron-dhcp-agent-neutron-config
dataSources:
- secretRef:
name: neutron-dhcp-agent-neutron-config
caCerts: combined-ca-bundle
containerImageFields:
- EdpmNeutronDhcpAgentImage
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@ metadata:
name: neutron-metadata
spec:
playbook: osp.edpm.neutron_metadata
secrets:
- neutron-ovn-metadata-agent-neutron-config
- nova-metadata-neutron-config
dataSources:
- secretRef:
name: neutron-ovn-metadata-agent-neutron-config
- secretRef:
name: nova-metadata-neutron-config
tlsCerts:
default:
contents:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ metadata:
name: neutron-ovn
spec:
playbook: osp.edpm.neutron_ovn
secrets:
- neutron-ovn-agent-neutron-config
dataSources:
- secretRef:
name: neutron-ovn-agent-neutron-config
tlsCerts:
default:
contents:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ metadata:
name: neutron-sriov
spec:
playbook: osp.edpm.neutron_sriov
secrets:
- neutron-sriov-agent-neutron-config
dataSources:
- secretRef:
name: neutron-sriov-agent-neutron-config
caCerts: combined-ca-bundle
containerImageFields:
- EdpmNeutronSriovAgentImage
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ metadata:
name: ovn
spec:
playbook: osp.edpm.ovn
configMaps:
- ovncontroller-config
dataSources:
- configMapRef:
name: ovncontroller-config
tlsCerts:
default:
contents:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ metadata:
name: ovn-bgp-agent
spec:
playbook: osp.edpm.ovn_bgp_agent
secrets:
- neutron-ovn-agent-neutron-config
dataSources:
- secretRef:
name: neutron-ovn-agent-neutron-config
tlsCerts:
default:
contents:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ metadata:
name: swift
spec:
playbook: osp.edpm.swift
secrets:
- swift-conf
configMaps:
- swift-storage-config-data
- swift-ring-files
dataSources:
- secretRef:
name: swift-conf
- configMapRef:
name: swift-storage-config-data
- configMapRef:
name: swift-ring-files
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ kind: OpenStackDataPlaneService
metadata:
name: telemetry
spec:
secrets:
- ceilometer-compute-config-data
dataSources:
- secretRef:
name: ceilometer-compute-config-data
playbook: osp.edpm.telemetry
tlsCerts:
default:
Expand Down
22 changes: 6 additions & 16 deletions docs/assemblies/custom_resources.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -15397,7 +15397,7 @@ AutoscalingSection defines the desired state of the autoscaling service
| enabled
| Enabled - Whether OpenStack autoscaling service should be deployed and managed
| bool
| *bool
| true
|===
Expand All @@ -15413,7 +15413,7 @@ AutoscalingSectionCore defines the desired state of the autoscaling service
| enabled
| Enabled - Whether OpenStack autoscaling service should be deployed and managed
| bool
| *bool
| true
|===
Expand All @@ -15429,7 +15429,7 @@ CeilometerSection defines the desired state of the ceilometer service
| enabled
| Enabled - Whether OpenStack Ceilometer service should be deployed and managed
| bool
| *bool
| true
|===
Expand All @@ -15445,7 +15445,7 @@ CeilometerSectionCore defines the desired state of the ceilometer service
| enabled
| Enabled - Whether OpenStack Ceilometer service should be deployed and managed
| bool
| *bool
| true
|===
Expand All @@ -15461,7 +15461,7 @@ LoggingSection defines the desired state of the logging service
| enabled
| Enabled - Whether OpenStack logging service should be deployed and managed
| bool
| *bool
| true
|===
Expand All @@ -15477,7 +15477,7 @@ MetricStorageSection defines the desired state of the MetricStorage
| enabled
| Enabled - Whether a MetricStorage should be deployed and managed
| bool
| *bool
| true
|===
Expand Down Expand Up @@ -17006,16 +17006,6 @@ OpenStackDataPlaneServiceSpec defines the desired state of OpenStackDataPlaneSer
|===
| Field | Description | Scheme | Required
| configMaps
| ConfigMaps list of ConfigMap names to mount as ExtraMounts for the OpenStackAnsibleEE
| []string
| false
| secrets
| Secrets list of Secret names to mount as ExtraMounts for the OpenStackAnsibleEE
| []string
| false
| dataSources
| DataSources list of DataSource objects to mount as ExtraMounts for the OpenStackAnsibleEE
| []<<datasource,DataSource>>
Expand Down
19 changes: 0 additions & 19 deletions pkg/dataplane/deployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,6 @@ func (d *Deployer) addCertMounts(
func (d *Deployer) addServiceExtraMounts(
service dataplanev1.OpenStackDataPlaneService,
) (*dataplanev1.AnsibleEESpec, error) {
client := d.Helper.GetClient()
baseMountPath := path.Join(ConfigPaths, service.Name)

var configMaps []*corev1.ConfigMap
Expand All @@ -388,24 +387,6 @@ func (d *Deployer) addServiceExtraMounts(
}
}

for _, cmName := range service.Spec.ConfigMaps {
cm := &corev1.ConfigMap{}
err := client.Get(d.Ctx, types.NamespacedName{Name: cmName, Namespace: service.Namespace}, cm)
if err != nil {
return d.AeeSpec, err
}
configMaps = append(configMaps, cm)
}

for _, secretName := range service.Spec.Secrets {
sec := &corev1.Secret{}
err := client.Get(d.Ctx, types.NamespacedName{Name: secretName, Namespace: service.Namespace}, sec)
if err != nil {
return d.AeeSpec, err
}
secrets = append(secrets, sec)
}

for _, cm := range configMaps {

volMounts := storage.VolMounts{}
Expand Down
34 changes: 0 additions & 34 deletions pkg/dataplane/hashes.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,40 +70,6 @@ func GetDeploymentHashesForService(
}
}

for _, cmName := range service.Spec.ConfigMaps {
namespacedName := types.NamespacedName{
Name: cmName,
Namespace: namespace,
}
cm := &corev1.ConfigMap{}
err := helper.GetClient().Get(context.Background(), namespacedName, cm)
if err != nil {
helper.GetLogger().Error(err, "Unable to retrieve ConfigMap %v")
return err
}
configMapHashes[cmName], err = configmap.Hash(cm)
if err != nil {
helper.GetLogger().Error(err, "Unable to hash ConfigMap %v")
}

}
for _, secretName := range service.Spec.Secrets {
namespacedName := types.NamespacedName{
Name: secretName,
Namespace: namespace,
}
sec := &corev1.Secret{}
err := helper.GetClient().Get(ctx, namespacedName, sec)
if err != nil {
helper.GetLogger().Error(err, "Unable to retrieve Secret %v")
return err
}
secretHashes[secretName], err = secret.Hash(sec)
if err != nil {
helper.GetLogger().Error(err, "Unable to hash Secret %v")
}
}

if service.Spec.TLSCerts != nil {
for certKey := range service.Spec.TLSCerts {
var secrets *corev1.SecretList
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,8 @@ var _ = Describe("OpenstackDataplaneService Test", func() {

It("spec fields are set up", func() {
service := GetService(dataplaneServiceName)
Expect(service.Spec.Secrets).To(BeEmpty())
Expect(service.Spec.DataSources).To(BeEmpty())
Expect(service.Spec.Playbook).To(BeEmpty())
Expect(service.Spec.ConfigMaps).To(BeEmpty())
Expect(service.Spec.DeployOnAllNodeSets).To(BeFalse())
})
})
Expand All @@ -57,9 +56,8 @@ var _ = Describe("OpenstackDataplaneService Test", func() {

It("spec fields are set up", func() {
service := GetService(dataplaneServiceName)
Expect(service.Spec.Secrets).To(BeEmpty())
Expect(service.Spec.DataSources).To(BeEmpty())
Expect(service.Spec.Playbook).To(BeEmpty())
Expect(service.Spec.ConfigMaps).To(BeEmpty())
Expect(service.Spec.DeployOnAllNodeSets).To(BeTrue())
})
})
Expand Down
11 changes: 7 additions & 4 deletions tests/kuttl/tests/dataplane-service-config/00-create.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,13 @@ spec:
- name: Sleep
command: sleep infinity
delegate_to: localhost
configMaps:
- kuttl-service-cm-0
- kuttl-service-cm-1
- kuttl-service-cm-2
dataSources:
- configMapRef:
name: kuttl-service-cm-0
- configMapRef:
name: kuttl-service-cm-1
- configMapRef:
name: kuttl-service-cm-2
---
apiVersion: dataplane.openstack.org/v1beta1
kind: OpenStackDataPlaneNodeSet
Expand Down

0 comments on commit 78cd024

Please sign in to comment.