Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

osp_public_subnet never defined for OSP sandbox users #3487

Open
wilson-walrus opened this issue Mar 3, 2021 · 1 comment
Open

osp_public_subnet never defined for OSP sandbox users #3487

wilson-walrus opened this issue Mar 3, 2021 · 1 comment
Assignees

Comments

@wilson-walrus
Copy link
Collaborator

Describe the bug

Originally from this pull:
ee748d2

I believe this is causing an issue when deploying to sandbox environments because osp_public_subnet is undefined.

TASK [infra-osp-template-generate : Generate Heat template] ***********************************************************************************************************************************
task path: /Users/Cibeles/repos/agd-training/ansible/roles-infra/infra-osp-template-generate/tasks/generate_osp_template.yml:11
Wednesday 03 March 2021  16:06:09 +0100 (0:00:00.081)       0:00:19.004 *******
<127.0.0.1> ESTABLISH LOCAL CONNECTION FOR USER: Cibeles
<127.0.0.1> EXEC /bin/sh -c 'echo ~Cibeles && sleep 0'
<127.0.0.1> EXEC /bin/sh -c '( umask 77 && mkdir -p " echo /Users/Cibeles/.ansible/tmp "&& mkdir " echo /Users/Cibeles/.ansible/tmp/ansible-tmp-1614783969.5583801-57648-171710359000791 " && echo ansible-tmp-1614783969.5583801-57648-171710359000791=" echo /Users/Cibeles/.ansible/tmp/ansible-tmp-1614783969.5583801-57648-171710359000791 " ) && sleep 0'
<127.0.0.1> EXEC /bin/sh -c 'rm -f -r /Users/Cibeles/.ansible/tmp/ansible-tmp-1614783969.5583801-57648-171710359000791/ > /dev/null 2>&1 && sleep 0'
fatal: [localhost]: FAILED! => {
    "changed": false,
    "msg": "AnsibleUndefinedVariable: 'osp_public_subnet' is `undefined"`

I've found that osp_public_subnet is being defined when conditions are met in ansible/roles-infra/infra-osp-project-create/tasks/main.yml

Lines: 20 - 40

- when: >-
    osp_project_create | bool
    or osp_project_id is not defined
    or osp_create_sandbox | bool
......
  block:
  - name: Get public subnet to use
    shell: |
      openstack ip availability show external -f json | jq -r '.subnet_ip_availability | min_by(.used_ips) | .subnet_id'
    register: r_floating_subnet
  - name: Set fact for public subnet
    set_fact:
      osp_public_subnet: "{{ r_floating_subnet.stdout }}"

From the above when we are deploying on sandbox environments the osp_public_subnet variable will never be automatically defined due to the conditionals.

Is there a work around for sandboxes that I am missing?

I was thinking of hard coding that value as an environment variable but it seems in the environment I cannot pull it in the same way.

openstack ip availability show external -f json --os-cloud=amaya
No NetworkIPAvailability found for f14eb667-03b3-4d97-a2e0-f4a54abe4174

To Reproduce
Steps to reproduce the behavior, ex:

  1. Deploy a OSP sandbox environment
  2. Attempt to deploy any config to that environment
  3. See error

Expected behavior
We should be able to deploy onto sandboxes.

Verions (please complete the following information):

  • Fedora 32
  • AAD version (git log --pretty=oneline -2)
└─ $ ▶ git log --pretty=oneline -2
3252dd63d03b0eec6dee6f4d01066fba8b223c70 (HEAD -> 69-hackfest-config, tag: shared_ocp46_cluster_access-prod-0.1, tag: shared-ocp46-cluster-access-prod-0.1, origin/development, origin/HEAD, development) update-ocp4-workload-ccnrd Upgrade OCP 4.7 features (#3483)
783ba826e8e96d9cf54d48ae4598bab87cd5befd (tag: ocs4-external-implementation-prod-0.1, tag: ocp-workshop-47-rhpds-test-0.1) enabled satellite clean up (#3482)
  • Ansible (ansible --version) 2.9.15
  • cloud provider CLI (aws-cli, azure, ..) OSP

Additional context
This is an issue for our agnosticD training efforts as we are providing sandboxes to students. They will need to be able to deploy.

@thomas-crowe
Copy link
Contributor

'osp_public_subnet' can not be hard coded, it specifically comes from the command "openstack ip availability show external -f json | jq -r '.subnet_ip_availability | min_by(.used_ips) | .subnet_id'" and is used to identify subnets which have sufficient ip addresses available to avoid a particular bug within OVN that manifests when a floating ip is assigned from a different subnet (on the external network) than the router's external interface.

Typically that command is only available to administrators, however we opened it up to admins or owners, that is possibly why your command failed. What were your openstack credentials set to when you manually executed the command? When sandbox accounts are generated, the user provided to the learner's should have owner privileges within that project.

I will order a sandbox and re-create the issue to troubleshoot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants