Skip to content

Commit

Permalink
Feat(NODE-1353): Consolidate rootfs utils #10
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewbattat committed May 24, 2024
1 parent 4dfeaeb commit c38afe5
Show file tree
Hide file tree
Showing 44 changed files with 174 additions and 140 deletions.
2 changes: 1 addition & 1 deletion ic-os/rootfs/boundary-guestos.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,8 @@ rootfs_files = {
Label("networking/generate-network-config/boundary-guestos/generate-network-config.service"): "/etc/systemd/system/generate-network-config.service",
Label("early-boot/save-machine-id/save-machine-id.sh"): "/opt/ic/bin/save-machine-id.sh",
Label("early-boot/save-machine-id/save-machine-id.service"): "/etc/systemd/system/save-machine-id.service",
Label("upgrade/install-upgrade.sh"): "/opt/ic/bin/install-upgrade.sh",
Label("misc/metrics.sh"): "/opt/ic/bin/metrics.sh",
Label("misc/install-upgrade.sh"): "/opt/ic/bin/install-upgrade.sh",
Label("early-boot/relabel-machine-id/relabel-machine-id.sh"): "/opt/ic/bin/relabel-machine-id.sh",
Label("early-boot/relabel-machine-id/relabel-machine-id.service"): "/etc/systemd/system/relabel-machine-id.service",
Label("early-boot/setup-hostname/setup-hostname.sh"): "/opt/ic/bin/setup-hostname.sh",
Expand Down
183 changes: 99 additions & 84 deletions ic-os/rootfs/guestos.bzl

Large diffs are not rendered by default.

79 changes: 45 additions & 34 deletions ic-os/rootfs/hostos.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -3,31 +3,7 @@ Enumerate every rootfs file dependency for HostOS
"""

rootfs_files = {
Label("hostos/etc/sudoers"): "/etc/sudoers",
Label("hostos/etc/tmpfiles.d/ic-node.conf"): "/etc/tmpfiles.d/ic-node.conf",
Label("hostos/etc/udev/rules.d/20-ipmi.rules"): "/etc/udev/rules.d/20-ipmi.rules",

# consolidated files:
Label("misc/metrics.sh"): "/opt/ic/bin/metrics.sh",
Label("misc/install-upgrade.sh"): "/opt/ic/bin/install-upgrade.sh",
Label("misc/fetch-property/hostos/fetch-property.sh"): "/opt/ic/bin/fetch-property.sh",
Label("ssh/setup-ssh-keys/setup-ssh-keys.sh"): "/opt/ic/bin/setup-ssh-keys.sh",
Label("ssh/setup-ssh-keys/setup-ssh-keys.service"): "/etc/systemd/system/setup-ssh-keys.service",
Label("ssh/setup-ssh-account-keys/hostos/setup-ssh-account-keys.sh"): "/opt/ic/bin/setup-ssh-account-keys.sh",
Label("ssh/setup-ssh-account-keys/hostos/setup-ssh-account-keys.service"): "/etc/systemd/system/setup-ssh-account-keys.service",
Label("ssh/deploy-updated-ssh-account-keys/deploy-updated-ssh-account-keys.sh"): "/opt/ic/bin/deploy-updated-ssh-account-keys.sh",
Label("ssh/deploy-updated-ssh-account-keys/deploy-updated-ssh-account-keys.service"): "/etc/systemd/system/deploy-updated-ssh-account-keys.service",
Label("early-boot/relabel-machine-id/relabel-machine-id.sh"): "/opt/ic/bin/relabel-machine-id.sh",
Label("early-boot/relabel-machine-id/relabel-machine-id.service"): "/etc/systemd/system/relabel-machine-id.service",
Label("early-boot/setup-hostname/hostos/setup-hostname.sh"): "/opt/ic/bin/setup-hostname.sh",
Label("early-boot/setup-hostname/hostos/setup-hostname.service"): "/etc/systemd/system/setup-hostname.service",
Label("early-boot/setup-hostname/hostname-empty"): "/etc/hostname",
Label("early-boot/save-machine-id/save-machine-id.sh"): "/opt/ic/bin/save-machine-id.sh",
Label("early-boot/save-machine-id/save-machine-id.service"): "/etc/systemd/system/save-machine-id.service",
Label("monitoring/systemd-user/[email protected]"): "/etc/systemd/system/[email protected]",
Label("upgrade/manageboot/hostos/manageboot.sh"): "/opt/ic/bin/manageboot.sh",
Label("upgrade/systemd-generators/hostos/mount-generator"): "/etc/systemd/system-generators/mount-generator",
Label("upgrade/systemd-generators/systemd-gpt-auto-generator"): "/etc/systemd/system-generators/systemd-gpt-auto-generator",
# hostos-scripts
Label("hostos-scripts/generate-guestos-config/generate-guestos-config.sh"): "/opt/ic/bin/generate-guestos-config.sh",
Label("hostos-scripts/generate-guestos-config/generate-guestos-config.service"): "/etc/systemd/system/generate-guestos-config.service",
Label("hostos-scripts/guestos/guestos.service"): "/etc/systemd/system/guestos.service",
Expand All @@ -50,20 +26,33 @@ rootfs_files = {
Label("hostos-scripts/monitoring/monitor-power.sh"): "/opt/ic/bin/monitor-power.sh",
Label("hostos-scripts/monitoring/monitor-power.service"): "/etc/systemd/system/monitor-power.service",
Label("hostos-scripts/monitoring/monitor-power.timer"): "/etc/systemd/system/monitor-power.timer",
Label("hostos-scripts/vsock/vsock-agent.service"): "/etc/systemd/system/vsock-agent.service",
Label("hostos-scripts/vsock/10-vhost-vsock.rules"): "/etc/udev/rules.d/10-vhost-vsock.rules",
Label("networking/generate-network-config/hostos/generate-network-config.service"): "/etc/systemd/system/generate-network-config.service",
Label("networking/fallback.conf"): "/etc/systemd/resolved.conf.d/fallback.conf",
Label("networking/resolv.conf"): "/etc/resolv.conf",
Label("networking/network-tweaks.conf"): "/etc/sysctl.d/network-tweaks.conf",
Label("networking/nftables/nftables-hostos.conf"): "/etc/nftables.conf",
Label("networking/hosts"): "/etc/hosts",

# early-boot
Label("early-boot/relabel-machine-id/relabel-machine-id.sh"): "/opt/ic/bin/relabel-machine-id.sh",
Label("early-boot/relabel-machine-id/relabel-machine-id.service"): "/etc/systemd/system/relabel-machine-id.service",
Label("early-boot/setup-hostname/hostos/setup-hostname.sh"): "/opt/ic/bin/setup-hostname.sh",
Label("early-boot/setup-hostname/hostos/setup-hostname.service"): "/etc/systemd/system/setup-hostname.service",
Label("early-boot/setup-hostname/hostname-empty"): "/etc/hostname",
Label("early-boot/save-machine-id/save-machine-id.sh"): "/opt/ic/bin/save-machine-id.sh",
Label("early-boot/save-machine-id/save-machine-id.service"): "/etc/systemd/system/save-machine-id.service",
Label("early-boot/fstab/fstab-hostos"): "/etc/fstab",
Label("early-boot/locale"): "/etc/default/locale",
Label("misc/chrony/chrony.conf"): "/etc/chrony/chrony.conf",
Label("early-boot/initramfs-tools/hostos/initramfs.conf"): "/etc/initramfs-tools/initramfs.conf",
Label("early-boot/initramfs-tools/hostos/modules"): "/etc/initramfs-tools/modules",
Label("early-boot/initramfs-tools/hostos/set-machine-id/set-machine-id"): "/etc/initramfs-tools/scripts/init-bottom/set-machine-id/set-machine-id",

# misc
Label("misc/metrics.sh"): "/opt/ic/bin/metrics.sh",
Label("misc/fetch-property/hostos/fetch-property.sh"): "/opt/ic/bin/fetch-property.sh",
Label("misc/vsock/vsock-agent.service"): "/etc/systemd/system/vsock-agent.service",
Label("misc/vsock/10-vhost-vsock.rules"): "/etc/udev/rules.d/10-vhost-vsock.rules",
Label("misc/chrony/chrony.conf"): "/etc/chrony/chrony.conf",
Label("misc/hostos/sudoers"): "/etc/sudoers",
Label("misc/hostos/ic-node.conf"): "/etc/tmpfiles.d/ic-node.conf",
Label("misc/hostos/20-ipmi.rules"): "/etc/udev/rules.d/20-ipmi.rules",

# monitoring
Label("monitoring/systemd-user/[email protected]"): "/etc/systemd/system/[email protected]",
Label("monitoring/node_exporter/node_exporter.crt"): "/etc/node_exporter/node_exporter.crt",
Label("monitoring/node_exporter/node_exporter.key"): "/etc/node_exporter/node_exporter.key",
Label("monitoring/node_exporter/web.yml"): "/etc/node_exporter/web.yml",
Expand All @@ -73,4 +62,26 @@ rootfs_files = {
Label("monitoring/node_exporter/setup-node_exporter-keys/setup-node_exporter-keys.service"): "/etc/systemd/system/setup-node_exporter-keys.service",
Label("monitoring/metrics-proxy/hostos/metrics-proxy.yaml"): "/etc/metrics-proxy.yaml",
Label("monitoring/metrics-proxy/metrics-proxy.service"): "/etc/systemd/system/metrics-proxy.service",

# networking
Label("networking/generate-network-config/hostos/generate-network-config.service"): "/etc/systemd/system/generate-network-config.service",
Label("networking/fallback.conf"): "/etc/systemd/resolved.conf.d/fallback.conf",
Label("networking/resolv.conf"): "/etc/resolv.conf",
Label("networking/network-tweaks.conf"): "/etc/sysctl.d/network-tweaks.conf",
Label("networking/nftables/nftables-hostos.conf"): "/etc/nftables.conf",
Label("networking/hosts"): "/etc/hosts",

# ssh
Label("ssh/setup-ssh-keys/setup-ssh-keys.sh"): "/opt/ic/bin/setup-ssh-keys.sh",
Label("ssh/setup-ssh-keys/setup-ssh-keys.service"): "/etc/systemd/system/setup-ssh-keys.service",
Label("ssh/setup-ssh-account-keys/hostos/setup-ssh-account-keys.sh"): "/opt/ic/bin/setup-ssh-account-keys.sh",
Label("ssh/setup-ssh-account-keys/hostos/setup-ssh-account-keys.service"): "/etc/systemd/system/setup-ssh-account-keys.service",
Label("ssh/deploy-updated-ssh-account-keys/deploy-updated-ssh-account-keys.sh"): "/opt/ic/bin/deploy-updated-ssh-account-keys.sh",
Label("ssh/deploy-updated-ssh-account-keys/deploy-updated-ssh-account-keys.service"): "/etc/systemd/system/deploy-updated-ssh-account-keys.service",

# upgrade
Label("upgrade/manageboot/hostos/manageboot.sh"): "/opt/ic/bin/manageboot.sh",
Label("upgrade/systemd-generators/hostos/mount-generator"): "/etc/systemd/system-generators/mount-generator",
Label("upgrade/systemd-generators/systemd-gpt-auto-generator"): "/etc/systemd/system-generators/systemd-gpt-auto-generator",
Label("upgrade/install-upgrade.sh"): "/opt/ic/bin/install-upgrade.sh",
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
50 changes: 29 additions & 21 deletions ic-os/rootfs/setupos.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,7 @@ Enumerate every rootfs file dependency for SetupOS
"""

rootfs_files = {
# prep files:
Label("setupos/prep/fscontext-fixes/fscontext-fixes.fc"): "/prep/fscontext-fixes/fscontext-fixes.fc",
Label("setupos/prep/fscontext-fixes/fscontext-fixes.if"): "/prep/fscontext-fixes/fscontext-fixes.if",
Label("setupos/prep/fscontext-fixes/fscontext-fixes.te"): "/prep/fscontext-fixes/fscontext-fixes.te",
Label("setupos/prep/misc-fixes/misc-fixes.if"): "/prep/misc-fixes/misc-fixes.if",
Label("setupos/prep/misc-fixes/misc-fixes.te"): "/prep/misc-fixes/misc-fixes.te",
Label("setupos/prep/prep.sh"): "/prep/prep.sh",
Label("setupos/prep/systemd-fixes/systemd-fixes.if"): "/prep/systemd-fixes/systemd-fixes.if",
Label("setupos/prep/systemd-fixes/systemd-fixes.te"): "/prep/systemd-fixes/systemd-fixes.te",

# consolidated files:
Label("misc/fetch-property/setupos/fetch-property.sh"): "/opt/ic/bin/fetch-property.sh",
Label("upgrade/systemd-generators/systemd-gpt-auto-generator"): "/etc/systemd/system-generators/systemd-gpt-auto-generator",
Label("misc/serial-getty@/setupos/[email protected]"): "/etc/systemd/system/[email protected]",
Label("early-boot/setup-hostname/hostname-setupos"): "/etc/hostname",
Label("networking/generate-network-config/setupos/generate-network-config.service"): "/etc/systemd/system/generate-network-config.service",
Label("networking/fallback.conf"): "/etc/systemd/resolved.conf.d/fallback.conf",
Label("networking/resolv.conf"): "/etc/resolv.conf",
Label("networking/hosts"): "/etc/hosts",
Label("early-boot/fstab/fstab-setupos"): "/etc/fstab",
Label("early-boot/locale"): "/etc/default/locale",
# setupos-scripts
Label("setupos-scripts/check-setupos-age.sh"): "/opt/ic/bin/check-setupos-age.sh",
Label("setupos-scripts/config.sh"): "/opt/ic/bin/config.sh",
Label("setupos-scripts/devices.sh"): "/opt/ic/bin/devices.sh",
Expand All @@ -37,5 +17,33 @@ rootfs_files = {
Label("setupos-scripts/setupos.sh"): "/opt/ic/bin/setupos.sh",
Label("setupos-scripts/config.service"): "/etc/systemd/system/config.service",
Label("setupos-scripts/setupos.service"): "/etc/systemd/system/setupos.service",

# early-boot
Label("early-boot/setup-hostname/hostname-setupos"): "/etc/hostname",
Label("early-boot/fstab/fstab-setupos"): "/etc/fstab",
Label("early-boot/locale"): "/etc/default/locale",
Label("early-boot/initramfs-tools/setupos/initramfs.conf"): "/etc/initramfs-tools/initramfs.conf",

# misc
Label("misc/fetch-property/setupos/fetch-property.sh"): "/opt/ic/bin/fetch-property.sh",
Label("misc/serial-getty@/setupos/[email protected]"): "/etc/systemd/system/[email protected]",

# networking
Label("networking/generate-network-config/setupos/generate-network-config.service"): "/etc/systemd/system/generate-network-config.service",
Label("networking/fallback.conf"): "/etc/systemd/resolved.conf.d/fallback.conf",
Label("networking/resolv.conf"): "/etc/resolv.conf",
Label("networking/hosts"): "/etc/hosts",

# prep
Label("prep/setupos/fscontext-fixes/fscontext-fixes.fc"): "/prep/fscontext-fixes/fscontext-fixes.fc",
Label("prep/setupos/fscontext-fixes/fscontext-fixes.if"): "/prep/fscontext-fixes/fscontext-fixes.if",
Label("prep/setupos/fscontext-fixes/fscontext-fixes.te"): "/prep/fscontext-fixes/fscontext-fixes.te",
Label("prep/setupos/misc-fixes/misc-fixes.if"): "/prep/misc-fixes/misc-fixes.if",
Label("prep/setupos/misc-fixes/misc-fixes.te"): "/prep/misc-fixes/misc-fixes.te",
Label("prep/setupos/prep.sh"): "/prep/prep.sh",
Label("prep/setupos/systemd-fixes/systemd-fixes.if"): "/prep/systemd-fixes/systemd-fixes.if",
Label("prep/setupos/systemd-fixes/systemd-fixes.te"): "/prep/systemd-fixes/systemd-fixes.te",

# upgrade
Label("upgrade/systemd-generators/systemd-gpt-auto-generator"): "/etc/systemd/system-generators/systemd-gpt-auto-generator",
}
File renamed without changes.

0 comments on commit c38afe5

Please sign in to comment.