Skip to content

Commit 35805c8

Browse files
committed
Remove duplicate inventory check logic
This change removes the duplicate inventory mount check. Duplicate mounts in general wont be allowed by Kubernetes when we create the batchv1.Job. But this check is only handling duplicate inventories which is not necessary. Signed-off-by: Brendan Shephard <[email protected]>
1 parent 0030652 commit 35805c8

File tree

1 file changed

+0
-30
lines changed

1 file changed

+0
-30
lines changed

pkg/dataplane/util/ansibleee.go

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import (
44
"encoding/json"
55
"fmt"
66
"sort"
7-
"strings"
87

98
"github.com/openstack-k8s-operators/lib-common/modules/storage"
109
yaml "gopkg.in/yaml.v3"
@@ -37,9 +36,6 @@ type EEJob struct {
3736
// ServiceAccountName allows to specify what ServiceAccountName do we want the ansible execution run with. Without specifying,
3837
// it will run with default serviceaccount
3938
ServiceAccountName string `json:"serviceAccountName,omitempty"`
40-
// Inventory is the primary inventory that the ansible playbook will use to launch the job.
41-
// Further inventories may be provided as ExtraMount in the `/runner/inventory/` path.
42-
Inventory string `json:"inventory,omitempty"`
4339
// Args are the command plus the playbook executed by the image. If args is passed, Playbook is ignored.
4440
Args []string `json:"args,omitempty"`
4541
// NetworkAttachments is a list of NetworkAttachment resource names to expose the services to the given network
@@ -152,32 +148,6 @@ func (a *EEJob) JobForOpenStackAnsibleEE(h *helper.Helper) (*batchv1.Job, error)
152148
if len(a.ServiceAccountName) > 0 {
153149
job.Spec.Template.Spec.ServiceAccountName = a.ServiceAccountName
154150
}
155-
// Set primary inventory if specified as string
156-
existingInventoryMounts := ""
157-
if len(a.Inventory) > 0 {
158-
setRunnerEnvVar(h, "RUNNER_INVENTORY", a.Inventory, "inventory", job, hashes)
159-
existingInventoryMounts = CustomInventory
160-
}
161-
// Report additional inventory paths mounted as volumes
162-
// AnsibleEE will later attempt to use them all together with the primary
163-
// If any of the additional inventories uses location of the primary inventory
164-
// provided by the dataplane operator raise an error.
165-
if len(a.ExtraMounts) > 0 {
166-
for _, inventory := range a.ExtraMounts {
167-
for _, mount := range inventory.Mounts {
168-
// Report when we mount other inventories as that alters ansible execution
169-
if strings.HasPrefix(mount.MountPath, "/runner/inventory/") {
170-
h.GetLogger().Info(fmt.Sprintf("additional inventory %s mounted", mount.Name))
171-
if searchIndex := strings.Index(existingInventoryMounts, mount.MountPath); searchIndex != -1 {
172-
return nil, fmt.Errorf(
173-
"inventory mount %s overrides existing inventory location",
174-
mount.Name)
175-
}
176-
existingInventoryMounts = existingInventoryMounts + fmt.Sprintf(",%s", mount.MountPath)
177-
}
178-
}
179-
}
180-
}
181151

182152
if len(a.Role) > 0 {
183153
setRunnerEnvVar(h, "RUNNER_ROLE", a.Role, "role", job, hashes)

0 commit comments

Comments
 (0)