Skip to content

Commit

Permalink
Ignore TripleoRoleOverride if version is not 17.1
Browse files Browse the repository at this point in the history
  • Loading branch information
olliewalsh committed Sep 12, 2023
1 parent 9c1d66c commit 5d04853
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 4 deletions.
2 changes: 1 addition & 1 deletion api/v1beta1/openstackconfiggenerator_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -85,7 +87,9 @@ spec:
enum:
- deploy
- update
- upgrade
- externalUpdate
- externalUpgrade
type: string
skipNNCPValidation:
default: false
Expand Down
9 changes: 8 additions & 1 deletion pkg/openstackconfiggenerator/configmap.go
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ func CreateConfigMapParams(
ctx,
r,
instance,
OSPVersion,
osNetList,
osMACList,
networksMap,
Expand Down Expand Up @@ -375,18 +376,24 @@ func createRolesMap(
ctx context.Context,
r common.ReconcilerCommon,
instance *ospdirectorv1beta1.OpenStackConfigGenerator,
ospVersion shared.OSPVersion,
osNetList *ospdirectorv1beta1.OpenStackNetList,
osMACList *ospdirectorv1beta1.OpenStackMACAddressList,
networksMap map[string]*networkType,
networkMappingList map[string]string,
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]
}

Expand Down

0 comments on commit 5d04853

Please sign in to comment.