Created
December 13, 2019 21:32
-
-
Save cgwalters/5741d640f4c2af811f47c043de392c32 to your computer and use it in GitHub Desktop.
Overriding content in an old RHCOS AMI for testing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
First, given a build like: https://releases-art-rhcos.svc.ci.openshift.org/art/storage/releases/rhcos-4.3/43.81.201911081536.0/x86_64/meta.json | |
Download the qemu image: | |
``` | |
$ curl -L https://releases-art-rhcos.svc.ci.openshift.org/art/storage/releases/rhcos-4.3/43.81.201911081536.0/x86_64/rhcos-43.81.201911081536.0-qemu.x86_64.qcow2.gz | gunzip > rhcos-43.81.201911081536.0-qemu.x86_64.qcow2 | |
``` | |
Download new RPM or other content you want, in this case let's assume it's a new hyperkube we want to drop in `/usr/bin`: | |
`$ curl -L http://example/openshift-hyperkube-4.3.0-201912131246.git.0.09a9468.el8.x86_64.rpm | rpm2cpio | cpio -div` | |
Run libguestfs: | |
``` | |
$ guestfish -a rhcos-43.81.201911081536.0-qemu.x86_64.qcow2 | |
``` | |
Inside libguestfs: | |
``` | |
# run | |
# mount /dev/sda4 / | |
# copy-in ./usr/bin/hyperkube /ostree/deploy/rhcos/deploy/<checksum>/usr/bin | |
# selinux-relabel /ostree/deploy/rhcos/deploy/<checksum>/etc/selinux/targeted/contexts/files/file_contexts /ostree/deploy/rhcos/deploy/<checksum>/usr/bin/hyperkube | |
# sync | |
# exit | |
``` | |
Bless it as an AWS image via coreos-assembler: | |
``` | |
$ /usr/lib/coreos-assembler/gf-oemid rhcos-43.81.201911081536.0-qemu.x86_64.qcow2 aws | |
``` | |
Upload it. | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Then change launch/snapshop permissions
aws ec2 modify-image-attribute --image-id <ami_id> --launch-permission '{"Add":[{"Group":"all"}]}'
aws ec2 modify-snapshot-attribute --snapshot-id <snapshot_id> --create-volume-permission '{"Add":[{"Group":"all"}]}'