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

Fix fcos crio #11716

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 4 additions & 15 deletions docs/operating_systems/fcos.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Fedora CoreOS

Tested with stable version 37.20230322.3.0
Tested with stable version 40.20241019.3.0

Because package installation with `rpm-ostree` requires a reboot, playbook may fail while bootstrap.
Restart playbook again.
Expand Down Expand Up @@ -30,7 +30,7 @@ files:
### Prepare
Prepare ignition and serve via http (a.e. python -m http.server )
Create ignition file
```json
{
Expand All @@ -51,19 +51,8 @@ Prepare ignition and serve via http (a.e. python -m http.server )
}
}
```
and [produce an Ignition Config](https://docs.fedoraproject.org/en-US/fedora-coreos/producing-ign/)

### create guest

```ShellSeasion
machine_name=myfcos1
ignition_url=http://mywebserver/fcos.ign
fcos_version=34.20210611.3.0
kernel=https://builds.coreos.fedoraproject.org/prod/streams/stable/builds/${fcos_version}/x86_64/fedora-coreos-${fcos_version}-live-kernel-x86_64
initrd=https://builds.coreos.fedoraproject.org/prod/streams/stable/builds/${fcos_version}/x86_64/fedora-coreos-${fcos_version}-live-initramfs.x86_64.img
rootfs=https://builds.coreos.fedoraproject.org/prod/streams/stable/builds/${fcos_version}/x86_64/fedora-coreos-${fcos_version}-live-rootfs.x86_64.img
kernel_args="console=ttyS0 coreos.live.rootfs_url=${rootfs} coreos.inst.install_dev=/dev/sda coreos.inst.stream=stable coreos.inst.ignition_url=${ignition_url}"
sudo virt-install --name ${machine_name} --ram 4048 --graphics=none --vcpus 2 --disk size=20 \
--network bridge=virbr0 \
--install kernel=${kernel},initrd=${initrd},kernel_args_overwrite=yes,kernel_args="${kernel_args}"
```
see [Provisioning Fedora CoreOS on libvirt](https://docs.fedoraproject.org/en-US/fedora-coreos/provisioning-libvirt/)
42 changes: 37 additions & 5 deletions roles/container-engine/cri-o/tasks/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,40 @@
set_fact:
is_ostree: "{{ ostree.stat.exists }}"

- name: Cri-o | get ostree version
shell: "set -o pipefail && rpm-ostree --version | awk -F\\' '/Version/{print $2}'"
args:
executable: /bin/bash
register: ostree_version
- name: Cri-o | ostree | add yum repo
copy:
content: |
[cri-o]
name=CRI-O
baseurl=https://pkgs.k8s.io/addons:/cri-o:/stable:/{{ kube_major_version }}/rpm/
enabled=1
gpgcheck=1
gpgkey=https://pkgs.k8s.io/addons:/cri-o:/stable:/{{ kube_major_version }}/rpm/repodata/repomd.xml.key
dest: /etc/yum.repos.d/cri-o.repo
when: is_ostree

- name: Cri-o | ostree | install via rpm-ostree
community.general.rpm_ostree_pkg:
name: cri-o
state: present
when: is_ostree
register: rpm_ostree_pkg

- name: Cri-o | ostree | install via rpm-ostree
reboot:
reboot_timeout: 240
when:
- is_ostree
- rpm_ostree_pkg.changed

- name: Cri-o | ostree | add link to installed crio binary
file:
src: '/usr/bin/crio'
dest: '{{ bin_dir }}/crio'
state: link
when:
- is_ostree

- name: Cri-o | Download cri-o
include_tasks: "../../../download/tasks/download_file.yml"
vars:
Expand Down Expand Up @@ -88,13 +115,15 @@
with_items:
- "{{ crio_bin_files }}"
notify: Restart crio
when: not is_ostree

- name: Cri-o | create directory for libexec
file:
path: "{{ crio_libexec_dir }}"
state: directory
owner: root
mode: "0755"
when: not is_ostree

- name: Cri-o | copy libexec
copy:
Expand All @@ -105,6 +134,7 @@
with_items:
- "{{ crio_libexec_files }}"
notify: Restart crio
when: not is_ostree

- name: Cri-o | copy service file
copy:
Expand All @@ -113,6 +143,7 @@
mode: "0755"
remote_src: true
notify: Restart crio
when: not is_ostree

- name: Cri-o | configure crio to use kube reserved cgroups
ansible.builtin.copy:
Expand All @@ -134,6 +165,7 @@
regexp: "/usr/local/bin/crio"
replace: "{{ bin_dir }}/crio"
notify: Restart crio
when: not is_ostree

- name: Cri-o | copy default policy
copy:
Expand Down