diff --git a/api/v1beta1/openstackconfiggenerator_types.go b/api/v1beta1/openstackconfiggenerator_types.go index ed43976d..bc128845 100644 --- a/api/v1beta1/openstackconfiggenerator_types.go +++ b/api/v1beta1/openstackconfiggenerator_types.go @@ -58,7 +58,7 @@ type OpenStackConfigGeneratorSpec struct { // - Production OSP environments MUST have fencing enabled. // - Requires the fence-agents-kubevirt package to be installed in the virtual machines for the roles running pacemaker. EnableFencing bool `json:"enableFencing"` - // TripleoRoleOverride - map of TripleO role name to temporary role override to support a multi-rhel environment + // TripleoRoleOverride - map of TripleO role name to temporary role override to support a multi-rhel environment (valid for 17.1 only) TripleoRoleOverride map[string]TripleoRoleOverrideSpec `json:"tripleoRoleOverride,omitempty"` } diff --git a/config/crd/bases/osp-director.openstack.org_openstackconfiggenerators.yaml b/config/crd/bases/osp-director.openstack.org_openstackconfiggenerators.yaml index 29a0c2a4..9c628cd8 100644 --- a/config/crd/bases/osp-director.openstack.org_openstackconfiggenerators.yaml +++ b/config/crd/bases/osp-director.openstack.org_openstackconfiggenerators.yaml @@ -125,6 +125,28 @@ spec: description: Optional. the name of the config map containing custom Heat template tarball which will be extracted prior to config generation type: string + tripleoRoleOverride: + additionalProperties: + description: TripleoRoleOverrideSpec overrides the Tripleo role + for specific hosts (multi-rhel suppport) + properties: + hostIndexMap: + additionalProperties: + type: boolean + description: HostIndexMap - host indices from current role to + override (defaults to false) + type: object + roleName: + description: RoleOverride - TripleO role name to apply + type: string + required: + - hostIndexMap + - roleName + type: object + description: TripleoRoleOverride - map of TripleO role name to temporary + role override to support a multi-rhel environment (valid for 17.1 + only) + type: object required: - enableFencing - gitSecret diff --git a/config/crd/bases/osp-director.openstack.org_openstackdeploys.yaml b/config/crd/bases/osp-director.openstack.org_openstackdeploys.yaml index 1e200c1e..165a981e 100644 --- a/config/crd/bases/osp-director.openstack.org_openstackdeploys.yaml +++ b/config/crd/bases/osp-director.openstack.org_openstackdeploys.yaml @@ -52,8 +52,10 @@ spec: description: Ansible inventory limit type: string playbook: - description: Playbook to run from config-download - type: string + description: Playbooks to run from config-download + items: + type: string + type: array skipDeployIdentifier: default: false description: Skip setting a unique deploy identifier @@ -85,7 +87,9 @@ spec: enum: - deploy - update + - upgrade - externalUpdate + - externalUpgrade type: string skipNNCPValidation: default: false diff --git a/pkg/openstackconfiggenerator/configmap.go b/pkg/openstackconfiggenerator/configmap.go index 22054387..5365de55 100644 --- a/pkg/openstackconfiggenerator/configmap.go +++ b/pkg/openstackconfiggenerator/configmap.go @@ -221,6 +221,7 @@ func CreateConfigMapParams( ctx, r, instance, + OSPVersion, osNetList, osMACList, networksMap, @@ -375,6 +376,7 @@ func createRolesMap( ctx context.Context, r common.ReconcilerCommon, instance *ospdirectorv1beta1.OpenStackConfigGenerator, + ospVersion shared.OSPVersion, osNetList *ospdirectorv1beta1.OpenStackNetList, osMACList *ospdirectorv1beta1.OpenStackMACAddressList, networksMap map[string]*networkType, @@ -382,11 +384,16 @@ func createRolesMap( rolesMap map[string]*RoleType, ) error { + roleOverridePermitted := ospVersion == shared.OSPVersion(shared.TemplateVersion17_1) + if instance.Spec.TripleoRoleOverride != nil && !roleOverridePermitted { + r.GetLogger().Info("TripleoRoleOverride is only valid for 17.1, ignoring", "OSPVersion", ospVersion) + } + for _, osnet := range osNetList.Items { for roleName, roleReservation := range osnet.Spec.RoleReservations { var roleOveride ospdirectorv1beta1.TripleoRoleOverrideSpec roleOverrideFound := false - if instance.Spec.TripleoRoleOverride != nil { + if instance.Spec.TripleoRoleOverride != nil && roleOverridePermitted { roleOveride, roleOverrideFound = instance.Spec.TripleoRoleOverride[roleName] }