Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,12 @@ spec:
description: Time before the deployment is requeued in seconds
minimum: 1
type: integer
fallbackToListOrder:
default: true
description: |-
FallbackToListOrder preserves service list order for services
without explicit dependsOn. Defaults to true.
type: boolean
nodeSets:
description: NodeSets is the list of NodeSets deployed
items:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,14 @@ spec:
x-kubernetes-map-type: atomic
type: object
type: array
dependsOn:
description: |-
DependsOn is a list of EDPMServiceType or CR name values that must
complete before this service runs. If empty, the service depends on
the preceding entry in the NodeSet service list.
items:
type: string
type: array
deployOnAllNodeSets:
description: |-
DeployOnAllNodeSets - should the service be deploy across all nodesets
Expand Down
7 changes: 7 additions & 0 deletions api/dataplane/v1beta1/openstackdataplanedeployment_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,13 @@ type OpenStackDataPlaneDeploymentSpec struct {
// variables to inject into the Ansible Execution Environment pod.
// If not specified, defaults to "openstack-aee-default-env".
AnsibleEEEnvConfigMapName string `json:"ansibleEEEnvConfigMapName,omitempty"`

// FallbackToListOrder preserves service list order for services
// without explicit dependsOn. Defaults to true.
// +kubebuilder:validation:Optional
// +kubebuilder:default=true
// +operator-sdk:csv:customresourcedefinitions:type=spec,xDescriptors={"urn:alm:descriptor:com.tectonic.ui:booleanSwitch"}
FallbackToListOrder *bool `json:"fallbackToListOrder"`
}

// AnsibleExecutionSummary captures the final ansible-runner execution result
Expand Down
6 changes: 6 additions & 0 deletions api/dataplane/v1beta1/openstackdataplaneservice_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,12 @@ type OpenStackDataPlaneServiceSpec struct {
// to manage the service. If not set, will default to the
// OpenStackDataPlaneService name.
EDPMServiceType string `json:"edpmServiceType,omitempty" yaml:"edpmServiceType,omitempty"`

// DependsOn is a list of EDPMServiceType or CR name values that must
// complete before this service runs. If empty, the service depends on
// the preceding entry in the NodeSet service list.
// +kubebuilder:validation:Optional
DependsOn []string `json:"dependsOn,omitempty" yaml:"dependsOn,omitempty"`
}

// OpenStackDataPlaneServiceStatus defines the observed state of OpenStackDataPlaneService
Expand Down
10 changes: 10 additions & 0 deletions api/dataplane/v1beta1/zz_generated.deepcopy.go

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

14 changes: 14 additions & 0 deletions bindata/crds/crds.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19035,6 +19035,12 @@ spec:
description: Time before the deployment is requeued in seconds
minimum: 1
type: integer
fallbackToListOrder:
default: true
description: |-
FallbackToListOrder preserves service list order for services
without explicit dependsOn. Defaults to true.
type: boolean
nodeSets:
description: NodeSets is the list of NodeSets deployed
items:
Expand Down Expand Up @@ -21399,6 +21405,14 @@ spec:
x-kubernetes-map-type: atomic
type: object
type: array
dependsOn:
description: |-
DependsOn is a list of EDPMServiceType or CR name values that must
complete before this service runs. If empty, the service depends on
the preceding entry in the NodeSet service list.
items:
type: string
type: array
deployOnAllNodeSets:
description: |-
DeployOnAllNodeSets - should the service be deploy across all nodesets
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,12 @@ spec:
description: Time before the deployment is requeued in seconds
minimum: 1
type: integer
fallbackToListOrder:
default: true
description: |-
FallbackToListOrder preserves service list order for services
without explicit dependsOn. Defaults to true.
type: boolean
nodeSets:
description: NodeSets is the list of NodeSets deployed
items:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,14 @@ spec:
x-kubernetes-map-type: atomic
type: object
type: array
dependsOn:
description: |-
DependsOn is a list of EDPMServiceType or CR name values that must
complete before this service runs. If empty, the service depends on
the preceding entry in the NodeSet service list.
items:
type: string
type: array
deployOnAllNodeSets:
description: |-
DeployOnAllNodeSets - should the service be deploy across all nodesets
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,6 @@ spec:
playbook: osp.edpm.bootstrap
edpmServiceType: bootstrap
caCerts: combined-ca-bundle
dependsOn:
- redhat
- download-cache
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@ metadata:
spec:
playbook: osp.edpm.configure_network
edpmServiceType: configure-network
dependsOn:
- bootstrap
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@ metadata:
spec:
playbook: osp.edpm.configure_os
edpmServiceType: configure-os
dependsOn:
- install-os
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@ metadata:
spec:
playbook: osp.edpm.download_cache
edpmServiceType: download-cache
dependsOn:
- redhat
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ metadata:
name: frr
spec:
playbook: osp.edpm.frr
dependsOn:
- run-os
containerImageFields:
- EdpmFrrImage
edpmServiceType: frr
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@ spec:
playbook: osp.edpm.install_certs
addCertMounts: True
edpmServiceType: install-certs
dependsOn:
- bootstrap
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@ metadata:
spec:
playbook: osp.edpm.install_os
edpmServiceType: install-os
dependsOn:
- bootstrap
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ metadata:
name: libvirt
spec:
playbook: osp.edpm.libvirt
dependsOn:
- run-os
- install-certs
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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ kind: OpenStackDataPlaneService
metadata:
name: logging
spec:
dependsOn:
- run-os
dataSources:
- secretRef:
name: logging-compute-config-data
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ metadata:
name: neutron-dhcp
spec:
playbook: osp.edpm.neutron_dhcp
dependsOn:
- run-os
dataSources:
- secretRef:
name: neutron-dhcp-agent-neutron-config
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ metadata:
name: neutron-metadata
spec:
playbook: osp.edpm.neutron_metadata
dependsOn:
- ovn
dataSources:
- secretRef:
name: neutron-ovn-metadata-agent-neutron-config
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ metadata:
name: neutron-ovn
spec:
playbook: osp.edpm.neutron_ovn
dependsOn:
- ovn
dataSources:
- secretRef:
name: neutron-ovn-agent-neutron-config
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ metadata:
name: neutron-sriov
spec:
playbook: osp.edpm.neutron_sriov
dependsOn:
- run-os
dataSources:
- secretRef:
name: neutron-sriov-agent-neutron-config
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@ kind: OpenStackDataPlaneService
metadata:
name: nova
spec:
dependsOn:
- libvirt
- ssh-known-hosts
- neutron-ovn
- neutron-sriov
- neutron-dhcp
- neutron-metadata
dataSources:
- secretRef:
name: nova-cell1-compute-config
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@ metadata:
spec:
playbook: osp.edpm.reboot
edpmServiceType: reboot-os
dependsOn:
- run-os
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ metadata:
name: ovn
spec:
playbook: osp.edpm.ovn
dependsOn:
- run-os
- configure-network
- install-certs
dataSources:
- configMapRef:
name: ovncontroller-config
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ metadata:
name: ovn-bgp-agent
spec:
playbook: osp.edpm.ovn_bgp_agent
dependsOn:
- ovn
dataSources:
- secretRef:
name: neutron-ovn-agent-neutron-config
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,5 @@ spec:
- EdpmLogrotateCrondImage
- EdpmIscsidImage
edpmServiceType: run-os
dependsOn:
- configure-os
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,6 @@ spec:
playbook: osp.edpm.ssh_known_hosts
deployOnAllNodeSets: true
edpmServiceType: ssh-known-hosts
dependsOn:
- install-os
- configure-network
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ metadata:
name: swift
spec:
playbook: osp.edpm.swift
dependsOn:
- run-os
dataSources:
- secretRef:
name: swift-conf
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ kind: OpenStackDataPlaneService
metadata:
name: telemetry
spec:
dependsOn:
- nova
dataSources:
- secretRef:
name: ceilometer-compute-config-data
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ kind: OpenStackDataPlaneService
metadata:
name: telemetry-power-monitoring
spec:
dependsOn:
- nova
dataSources:
- secretRef:
name: ceilometer-ipmi-config-data
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@ metadata:
spec:
playbook: osp.edpm.validate_network
edpmServiceType: validate-network
dependsOn:
- configure-network
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,12 @@ package dataplane

import (
"context"
"errors"
"fmt"
"time"

"github.com/go-playground/validator/v10"
"github.com/iancoleman/strcase"
batchv1 "k8s.io/api/batch/v1"
corev1 "k8s.io/api/core/v1"
k8s_errors "k8s.io/apimachinery/pkg/api/errors"
Expand Down Expand Up @@ -250,12 +252,47 @@ func (r *OpenStackDataPlaneDeploymentReconciler) Reconcile(ctx context.Context,
shouldRequeue := false
haveError := false
deploymentErrMsg := ""
var nodesetServiceMap map[string][]string
var nodesetServiceMap map[string][][]string
backoffLimitReached := false

fallbackToListOrder := true
if instance.Spec.FallbackToListOrder != nil {
fallbackToListOrder = *instance.Spec.FallbackToListOrder
}

if nodesetServiceMap, err = deployment.DedupeServices(ctx, helper, nodeSets.Items,
instance.Spec.ServicesOverride); err != nil {
instance.Spec.ServicesOverride, fallbackToListOrder); err != nil {
util.LogErrorForObject(helper, err, "OpenStackDeployment error for deployment", instance)
var missingServiceErr *deployment.MissingServiceError
if errors.As(err, &missingServiceErr) {
nsConditions := instance.Status.NodeSetConditions[missingServiceErr.NodeSet]
nodeSetServiceErrorMessage := fmt.Sprintf(
dataplanev1.NodeSetServiceDeploymentErrorMessage,
missingServiceErr.Service) + " error %s"
nsConditions.MarkFalse(
dataplanev1.NodeSetDeploymentReadyCondition,
condition.ErrorReason,
condition.SeverityError,
nodeSetServiceErrorMessage,
err.Error())
serviceCondition := condition.Type(fmt.Sprintf(
"Service%sDeploymentReady",
strcase.ToCamel(missingServiceErr.Service)))
nsConditions.MarkFalse(
serviceCondition,
condition.ErrorReason,
condition.SeverityError,
nodeSetServiceErrorMessage,
err.Error())
instance.Status.NodeSetConditions[missingServiceErr.NodeSet] = nsConditions
instance.Status.Conditions.MarkFalse(
condition.DeploymentReadyCondition,
condition.ErrorReason,
condition.SeverityWarning,
condition.DeploymentReadyErrorMessage,
fmt.Sprintf("nodeSet: %s error: %s", missingServiceErr.NodeSet, err.Error()))
return ctrl.Result{}, err
}
instance.Status.Conditions.MarkFalse(
condition.DeploymentReadyCondition,
condition.ErrorReason,
Expand Down Expand Up @@ -309,11 +346,9 @@ func (r *OpenStackDataPlaneDeploymentReconciler) Reconcile(ctx context.Context,
Version: version,
}

// When ServicesOverride is set on the OpenStackDataPlaneDeployment,
// deploy those services for each OpenStackDataPlaneNodeSet. Otherwise,
// deploy with the OpenStackDataPlaneNodeSet's Services.
var deployResult *ctrl.Result
deployResult, err = deployer.Deploy(nodesetServiceMap[nodeSet.Name])
deployResult, err = deployer.Deploy(
nodesetServiceMap[nodeSet.Name])

nsConditions := instance.Status.NodeSetConditions[nodeSet.Name]
nsConditions.Set(nsConditions.Mirror(dataplanev1.NodeSetDeploymentReadyCondition))
Expand Down
Loading
Loading