Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
K
Kubespray
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Model registry
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Mirror
Kubespray
Commits
47f67818
Unverified
Commit
47f67818
authored
6 months ago
by
Max Gautier
Browse files
Options
Downloads
Patches
Plain Diff
CI: (packet-ci) simplify role layout
parent
236a7486
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
tests/cloud_playbooks/roles/packet-ci/tasks/create-vms.yml
+0
-49
0 additions, 49 deletions
tests/cloud_playbooks/roles/packet-ci/tasks/create-vms.yml
tests/cloud_playbooks/roles/packet-ci/tasks/main.yml
+50
-4
50 additions, 4 deletions
tests/cloud_playbooks/roles/packet-ci/tasks/main.yml
with
50 additions
and
53 deletions
tests/cloud_playbooks/roles/packet-ci/tasks/create-vms.yml
deleted
100644 → 0
+
0
−
49
View file @
236a7486
---
-
name
:
Start vms for CI job
vars
:
# Workaround for compatibility when testing upgrades with old == before e9d406ed088d4291ef1d9018c170a4deed2bf928
# TODO: drop after 2.27.0
legacy_groups
:
"
{{
(['kube_control_plane',
'kube_node',
'calico_rr']
|
intersect(item)
|
length
>
0)
|
ternary(['k8s_cluster'],
[])
}}"
tvars
:
kubespray_groups
:
"
{{
item
+
legacy_groups
}}"
kubernetes.core.k8s
:
definition
:
"
{{
lookup('template',
'vm.yml.j2',
template_vars=tvars)
}}"
loop
:
"
{{
scenarios[mode
|
d('default')]
}}"
-
name
:
Wait for vms to have IP addresses
kubernetes.core.k8s_info
:
api_version
:
kubevirt.io/v1
kind
:
VirtualMachineInstance
label_selectors
:
-
"
ci_job_id={{
ci_job_id
}}"
namespace
:
"
{{
pod_namespace
}}"
register
:
vmis
until
:
vmis.resources
| map(attribute='status.interfaces.0')
| rejectattr('ipAddress', 'defined') == []
retries
:
30
delay
:
10
-
name
:
Massage VirtualMachineInstance data into an Ansible inventory structure
vars
:
ips
:
"
{{
vmis.resources
|
map(attribute='status.interfaces.0.ipAddress')
}}"
names
:
"
{{
vmis.resources
|
map(attribute='metadata.name')
}}"
_groups
:
"
{{
vmis.resources
|
map(attribute='metadata.annotations.ansible_groups')
|
map('split',
',')
}}"
hosts
:
"
{{
ips
|
zip(_groups,
names)
|
map('zip',
['ansible_host',
'ansible_groups',
'k8s_vmi_name'])
|
map('map',
'reverse')
|
map('community.general.dict')
}}"
loop
:
"
{{
hosts
|
map(attribute='ansible_groups')
|
flatten
|
unique
}}"
set_fact
:
ci_inventory
:
"
{{
ci_inventory|d({})
|
combine({
item:
{
'hosts':
hosts
|
selectattr('ansible_groups',
'contains',
item)
|
rekey_on_member('k8s_vmi_name')
}
})
}}"
-
name
:
Create inventory for CI tests
copy
:
content
:
"
{{
ci_inventory
|
to_yaml
}}"
dest
:
"
{{
inventory_path
}}/ci_inventory.yml"
mode
:
"
0644"
This diff is collapsed.
Click to expand it.
tests/cloud_playbooks/roles/packet-ci/tasks/main.yml
+
50
−
4
View file @
47f67818
---
---
-
name
:
Include custom vars for ci job
-
name
:
"
Include
custom
vars
for
ci
job:
{{
ci_job_name
}}"
include_vars
:
"
../files/{{
ci_job_name
}}.yml"
include_vars
:
"
../files/{{
ci_job_name
}}.yml"
-
name
:
Create VMs
import_tasks
:
create-vms.yml
-
name
:
Start vms for CI job
vars
:
# Workaround for compatibility when testing upgrades with old == before e9d406ed088d4291ef1d9018c170a4deed2bf928
# TODO: drop after 2.27.0
legacy_groups
:
"
{{
(['kube_control_plane',
'kube_node',
'calico_rr']
|
intersect(item)
|
length
>
0)
|
ternary(['k8s_cluster'],
[])
}}"
tvars
:
kubespray_groups
:
"
{{
item
+
legacy_groups
}}"
kubernetes.core.k8s
:
definition
:
"
{{
lookup('template',
'vm.yml.j2',
template_vars=tvars)
}}"
loop
:
"
{{
scenarios[mode
|
d('default')]
}}"
-
name
:
Wait for vms to have IP addresses
kubernetes.core.k8s_info
:
api_version
:
kubevirt.io/v1
kind
:
VirtualMachineInstance
label_selectors
:
-
"
ci_job_id={{
ci_job_id
}}"
namespace
:
"
{{
pod_namespace
}}"
register
:
vmis
until
:
vmis.resources
| map(attribute='status.interfaces.0')
| rejectattr('ipAddress', 'defined') == []
retries
:
30
delay
:
10
-
name
:
Massage VirtualMachineInstance data into an Ansible inventory structure
vars
:
ips
:
"
{{
vmis.resources
|
map(attribute='status.interfaces.0.ipAddress')
}}"
names
:
"
{{
vmis.resources
|
map(attribute='metadata.name')
}}"
_groups
:
"
{{
vmis.resources
|
map(attribute='metadata.annotations.ansible_groups')
|
map('split',
',')
}}"
hosts
:
"
{{
ips
|
zip(_groups,
names)
|
map('zip',
['ansible_host',
'ansible_groups',
'k8s_vmi_name'])
|
map('map',
'reverse')
|
map('community.general.dict')
}}"
loop
:
"
{{
hosts
|
map(attribute='ansible_groups')
|
flatten
|
unique
}}"
set_fact
:
ci_inventory
:
"
{{
ci_inventory|d({})
|
combine({
item:
{
'hosts':
hosts
|
selectattr('ansible_groups',
'contains',
item)
|
rekey_on_member('k8s_vmi_name')
}
})
}}"
-
name
:
Create inventory for CI tests
copy
:
content
:
"
{{
ci_inventory
|
to_yaml
}}"
dest
:
"
{{
inventory_path
}}/ci_inventory.yml"
mode
:
"
0644"
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment