diff --git a/data/data/baremetal/masters/main.tf b/data/data/baremetal/masters/main.tf index 7450373b1ed..23be77dc00e 100644 --- a/data/data/baremetal/masters/main.tf +++ b/data/data/baremetal/masters/main.tf @@ -37,6 +37,7 @@ resource "ironic_node_v1" "openshift-master-host" { power_interface = var.masters[count.index]["power_interface"] raid_interface = var.masters[count.index]["raid_interface"] vendor_interface = var.masters[count.index]["vendor_interface"] + deploy_interface = var.masters[count.index]["deploy_interface"] } resource "ironic_deployment" "openshift-master-deployment" { @@ -48,6 +49,7 @@ resource "ironic_deployment" "openshift-master-deployment" { instance_info = var.instance_infos[count.index] user_data = var.ignition_master + deploy_steps = var.deploy_steps[count.index] } data "ironic_introspection" "openshift-master-introspection" { diff --git a/data/data/baremetal/variables-baremetal.tf b/data/data/baremetal/variables-baremetal.tf index b62ae3bc655..f07a5ea7e9e 100644 --- a/data/data/baremetal/variables-baremetal.tf +++ b/data/data/baremetal/variables-baremetal.tf @@ -57,3 +57,8 @@ variable "instance_infos" { type = list(map(string)) description = "Instance information for masters" } + +variable "deploy_steps" { + type = list(string) + description = "The contents of custom deploy steps for the node in JSON format" +} diff --git a/data/data/bootstrap/baremetal/files/usr/local/bin/startironic.sh.template b/data/data/bootstrap/baremetal/files/usr/local/bin/startironic.sh.template index 96947f32ad9..2b6557e9476 100755 --- a/data/data/bootstrap/baremetal/files/usr/local/bin/startironic.sh.template +++ b/data/data/bootstrap/baremetal/files/usr/local/bin/startironic.sh.template @@ -4,11 +4,13 @@ set -ex . /usr/local/bin/release-image.sh IRONIC_IMAGE=$(image_for ironic) -IPA_DOWNLOADER_IMAGE=$(image_for ironic-ipa-downloader) COREOS_DOWNLOADER_IMAGE=$(image_for ironic-machine-os-downloader || image_for ironic-rhcos-downloader) +IRONIC_AGENT_IMAGE=$(image_for ironic-agent) +CUSTOMIZATION_IMAGE=$(image_for image-customization-controller) -# This image is templated in via the installer pkg/asset/ignition/bootstrap/bootstrap.go +# This image is templated in via the installer pkg/asset/ignition/bootstrap/common.go RHCOS_BOOT_IMAGE_URL="{{.BootImage}}" +RHCOS_LIVE_IMAGE_URL="{{.PlatformData.BareMetal.ClusterOSImage}}" # This DHCP range is used by dnsmasq to serve DHCP to the cluster. If empty # dnsmasq will only serve TFTP, and DHCP will be disabled. @@ -19,7 +21,7 @@ IRONIC_RAMDISK_SSH_KEY="{{.SSHKey}}" # First we stop any previously started containers, because ExecStop only runs when the ExecStart process # e.g this script is still running, but we exit if *any* of the containers exits unexpectedly -for name in ironic-api ironic-conductor ironic-inspector ironic-ramdisk-logs dnsmasq httpd mariadb ipa-downloader coreos-downloader; do +for name in ironic-api ironic-conductor ironic-inspector ironic-ramdisk-logs dnsmasq httpd mariadb coreos-downloader image-customization; do podman ps | grep -w "$name$" && podman kill $name podman ps --all | grep -w "$name$" && podman rm $name -f done @@ -114,12 +116,7 @@ podman run -d --net host --name coreos-downloader \ --restart on-failure \ --env CACHEURL=${CACHEURL} \ --env IP_OPTIONS=${IP_OPTIONS} \ - -v $IRONIC_SHARED_VOLUME:/shared:z ${COREOS_DOWNLOADER_IMAGE} /usr/local/bin/get-resource.sh $RHCOS_BOOT_IMAGE_URL - -podman run -d --net host --name ipa-downloader \ - --restart on-failure \ - --env CACHEURL=${CACHEURL} \ - -v $IRONIC_SHARED_VOLUME:/shared:z ${IPA_DOWNLOADER_IMAGE} /usr/local/bin/get-resource.sh + -v $IRONIC_SHARED_VOLUME:/shared:z ${COREOS_DOWNLOADER_IMAGE} /usr/local/bin/get-live-images.sh $RHCOS_BOOT_IMAGE_URL # Add firewall rules to ensure the IPA ramdisk can reach httpd, Ironic and the Inspector API on the host for port in 80 5050 6385 ; do @@ -152,11 +149,47 @@ $IPTABLES -t raw -A DHCP_IRONIC -j DROP {{end}} # Wait for images to be downloaded/ready -podman wait -i 1000ms ipa-downloader podman wait -i 1000ms coreos-downloader -while ! curl --fail http://localhost/images/rhcos-ootpa-latest.qcow2.md5sum ; do sleep 1; done -while ! curl --fail --head http://localhost/images/ironic-python-agent.initramfs ; do sleep 1; done -while ! curl --fail --head http://localhost/images/ironic-python-agent.kernel ; do sleep 1; done + +export KUBECONFIG=/opt/openshift/auth/kubeconfig-loopback + +mkdir -p /tmp/nmstate + +{{range .PlatformData.BareMetal.Hosts}} + until oc get -n openshift-machine-api baremetalhost {{.Name}}; do + echo Waiting for Host {{.Name}} to appear... + sleep 10 + done + secret_name=$(oc get -n openshift-machine-api baremetalhost {{.Name}} -o jsonpath="{.spec.preprovisioningNetworkDataName}") + if [ -n "${secret_name}" ]; then + until oc get -n openshift-machine-api secret "${secret_name}"; do + echo Waiting for Secret "${secret_name}" to appear... + sleep 10 + done + oc get -n openshift-machine-api secret ${secret_name} -o jsonpath="{.data.nmstate}" | base64 -d > /tmp/nmstate/{{.Name}}.yaml + else + touch /tmp/nmstate/{{.Name}}.yaml + fi +{{end}} + + +# Embed agent ignition into the rhcos live iso +sudo podman run -d -p 8084:8084 --privileged --name image-customization \ + --env DEPLOY_ISO="/shared/html/images/ironic-python-agent.iso" \ + --env IRONIC_BASE_URL="http://{{.PlatformData.BareMetal.APIVIP}}" \ + --env IRONIC_AGENT_IMAGE="" \ + --env IRONIC_AGENT_PULL_SECRET="" \ + --env IRONIC_RAMDISK_SSH_KEY="$IRONIC_RAMDISK_SSH_KEY" \ + --env IRONIC_AGENT_IMAGE="$IRONIC_AGENT_IMAGE" \ + --env IRONIC_AGENT_PULL_SECRET="{{.PlatformData.BareMetal.PullSecretBase64}}" \ + --env DEPLOY_INITRD="/shared/html/images/ironic-python-agent.initramfs" \ + --env PROVISIONING_INTERFACE=$PROVISIONING_NIC \ + --env REGISTRIES_CONF_PATH=/tmp/containers/registries.conf \ + --entrypoint '["/image-customization-server", "--nmstate-dir=/tmp/nmstate/", "--images-publish-addr=http://0.0.0.0:8084"]' \ + -v /tmp/nmstate/:/tmp/nmstate/ \ + -v $IRONIC_SHARED_VOLUME:/shared:z \ + -v /etc/containers:/tmp/containers:z \ + ${CUSTOMIZATION_IMAGE} sudo podman run -d --net host --privileged --name ironic-conductor \ --restart on-failure \ @@ -165,6 +198,7 @@ sudo podman run -d --net host --privileged --name ironic-conductor \ --env PROVISIONING_INTERFACE=$PROVISIONING_NIC \ --env OS_CONDUCTOR__HEARTBEAT_TIMEOUT=120 \ --env HTTP_BASIC_HTPASSWD=${IRONIC_HTPASSWD} \ + --env IRONIC_KERNEL_PARAMS="${IRONIC_KERNEL_PARAMS}" \ --entrypoint /bin/runironic-conductor \ -v $AUTH_DIR:/auth:ro \ -v $IRONIC_SHARED_VOLUME:/shared:z ${IRONIC_IMAGE} @@ -216,7 +250,7 @@ while true; do done echo "Stopping provisioning services..." - podman stop ironic-api ironic-conductor ironic-inspector ironic-ramdisk-logs $dnsmasq_container_name httpd mariadb + podman stop ironic-api ironic-conductor ironic-inspector ironic-ramdisk-logs $dnsmasq_container_name httpd mariadb image-customization exit 0 fi diff --git a/data/data/manifests/openshift/baremetal-provisioning-config.yaml.template b/data/data/manifests/openshift/baremetal-provisioning-config.yaml.template index a58361568ee..c6e52d1c4c7 100644 --- a/data/data/manifests/openshift/baremetal-provisioning-config.yaml.template +++ b/data/data/manifests/openshift/baremetal-provisioning-config.yaml.template @@ -10,3 +10,8 @@ spec: provisioningDHCPRange: "{{.Baremetal.ProvisioningDHCPRange}}" provisioningOSDownloadURL: "{{.ProvisioningOSDownloadURL}}" watchAllNamespaces: false + preProvisioningOSDownloadURLs: + initramfsURL: "{{.InitramfsURL}}" + isoURL: "{{.IsoURL}}" + kernelURL: "{{.KernelURL}}" + rootfsURL: "{{.RootfsURL}}" diff --git a/go.mod b/go.mod index 9630a61ec85..6499bac104c 100644 --- a/go.mod +++ b/go.mod @@ -48,14 +48,14 @@ require ( github.com/metal3-io/baremetal-operator v0.0.0-20211201170610-92ffa60c683d github.com/metal3-io/baremetal-operator/apis v0.0.0 github.com/metal3-io/baremetal-operator/pkg/hardwareutils v0.0.0 - github.com/metal3-io/cluster-api-provider-baremetal v0.0.0 github.com/mitchellh/cli v1.1.1 - github.com/openshift-metal3/terraform-provider-ironic v0.2.6 + github.com/openshift-metal3/terraform-provider-ironic v0.2.7 github.com/openshift/api v0.0.0-20211119153416-313e51eab8c8 github.com/openshift/client-go v0.0.0-20211025111749-96ca2abfc56c github.com/openshift/cloud-credential-operator v0.0.0-20200316201045-d10080b52c9e github.com/openshift/cluster-api-provider-alibaba v0.0.0-20211123142315-d16daa4e6349 - github.com/openshift/cluster-api-provider-gcp v0.0.1-0.20201203141909-4dc702fd57a5 + github.com/openshift/cluster-api-provider-baremetal v0.0.0-20210924143856-c2d3ece4da38 + github.com/openshift/cluster-api-provider-gcp v0.0.1-0.20210615203611-a02074e8d5bb github.com/openshift/cluster-api-provider-ibmcloud v0.0.0-20211008100740-4d7907adbd6b github.com/openshift/cluster-api-provider-libvirt v0.2.1-0.20191219173431-2336783d4603 github.com/openshift/cluster-api-provider-ovirt v0.1.1-0.20211111151530-06177b773958 @@ -85,7 +85,7 @@ require ( github.com/vmware/govmomi v0.24.0 github.com/zclconf/go-cty v1.6.1 golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2 - golang.org/x/lint v0.0.0-20200302205851-738671d3881b + golang.org/x/lint v0.0.0-20210508222113-6edffad5e616 golang.org/x/oauth2 v0.0.0-20200902213428-5d25da1a8d43 golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c google.golang.org/api v0.44.0 @@ -381,7 +381,6 @@ replace ( github.com/metal3-io/baremetal-operator => github.com/openshift/baremetal-operator v0.0.0-20211201170610-92ffa60c683d // Use OpenShift fork github.com/metal3-io/baremetal-operator/apis => github.com/openshift/baremetal-operator/apis v0.0.0-20211201170610-92ffa60c683d // Use OpenShift fork github.com/metal3-io/baremetal-operator/pkg/hardwareutils => github.com/openshift/baremetal-operator/pkg/hardwareutils v0.0.0-20211201170610-92ffa60c683d // Use OpenShift fork - github.com/metal3-io/cluster-api-provider-baremetal => github.com/openshift/cluster-api-provider-baremetal v0.0.0-20190821174549-a2a477909c1d // Pin OpenShift fork github.com/openshift/client-go => github.com/openshift/client-go v0.0.0-20200929181438-91d71ef2122c // Pin client-go github.com/openshift/machine-config-operator => github.com/openshift/machine-config-operator v0.0.1-0.20201009041932-4fe8559913b8 // Pin MCO so it doesn't get downgraded github.com/spf13/afero => github.com/spf13/afero v1.2.2 diff --git a/go.sum b/go.sum index 1ab448aeaf0..5012aaf5d7f 100644 --- a/go.sum +++ b/go.sum @@ -24,7 +24,6 @@ cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohl cloud.google.com/go/storage v1.7.0/go.mod h1:jGMIBwF+L/tL6WN/W5InNgYYu4HP0DvGB6rQ1mufWfs= cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= cloud.google.com/go/storage v1.9.0/go.mod h1:m+/etGaqZbylxaNT876QGXqEHp4PR2Rq5GMqICWb9bU= -cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= cloud.google.com/go/storage v1.11.0 h1:bSLyzhbGjLMYxCratCDRSSH7+xRGpNApTBmowDUFGLk= cloud.google.com/go/storage v1.11.0/go.mod h1:/PAbprKS+5msVYogBmczjWalDXnQ9mr64yEq9YnyPeo= code.cloudfoundry.org/gofileutils v0.0.0-20170111115228-4d0c80011a0f/go.mod h1:sk5LnIjB/nIEU7yP5sDQExVm62wu0pBh3yrElngUisI= @@ -895,10 +894,8 @@ github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/ github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= github.com/google/martian v2.1.1-0.20190517191504-25dcb96d9e51+incompatible h1:xmapqc1AyLoB+ddYT6r04bD9lIjlOqGaREovi0SzFaE= github.com/google/martian v2.1.1-0.20190517191504-25dcb96d9e51+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= -github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= github.com/google/pprof v0.0.0-20181127221834-b4f47329b966/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= github.com/google/pprof v0.0.0-20200430221834-fc25d7d30c6d/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= github.com/google/renameio v1.0.0 h1:xhp2CnJmgQmpJU4RY8chagahUq5mbPPAbiSQstKpVMA= github.com/google/renameio v1.0.0/go.mod h1:t/HQoYBZSsWSNK35C6CO/TpPLDVWvxOHboWUAweKUpk= @@ -926,9 +923,9 @@ github.com/gookit/color v1.2.5/go.mod h1:AhIE+pS6D4Ql0SQWbBeXPHw7gY0/sjHoA4s/n1K github.com/gookit/color v1.2.9/go.mod h1:AhIE+pS6D4Ql0SQWbBeXPHw7gY0/sjHoA4s/n1KB7xg= github.com/gophercloud/gophercloud v0.17.0 h1:BgVw0saxyeHWH5us/SQe1ltp0GRnytjmOLXDA8pO77E= github.com/gophercloud/gophercloud v0.17.0/go.mod h1:wRtmUelyIIv3CSSDI47aUwbs075O6i+LY+pXsKCBsb4= -github.com/gophercloud/utils v0.0.0-20190313033024-0bcc8e728cb5/go.mod h1:SZ9FTKibIotDtCrxAU/evccoyu1yhKST6hgBvwTB5Eg= github.com/gophercloud/utils v0.0.0-20191129022341-463e26ffa30d/go.mod h1:SZ9FTKibIotDtCrxAU/evccoyu1yhKST6hgBvwTB5Eg= github.com/gophercloud/utils v0.0.0-20210202040619-eca783186fc4/go.mod h1:wx8HMD8oQD0Ryhz6+6ykq75PJ79iPyEqYHfwZ4l7OsA= +github.com/gophercloud/utils v0.0.0-20210530213738-7c693d7efe47/go.mod h1:wx8HMD8oQD0Ryhz6+6ykq75PJ79iPyEqYHfwZ4l7OsA= github.com/gophercloud/utils v0.0.0-20210720165645-8a3ad2ad9e70 h1:9UYK3/bQIZ9EfYPLaKbN23nxpKWodtKs69JZmpaNU+I= github.com/gophercloud/utils v0.0.0-20210720165645-8a3ad2ad9e70/go.mod h1:wx8HMD8oQD0Ryhz6+6ykq75PJ79iPyEqYHfwZ4l7OsA= github.com/gopherjs/gopherjs v0.0.0-20180628210949-0892b62f0d9f/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= @@ -1491,8 +1488,8 @@ github.com/opencontainers/runc v0.1.1/go.mod h1:qT5XzbpPznkRYVz/mWwUaVBUv2rmF59P github.com/opencontainers/runc v1.0.0-rc90/go.mod h1:qT5XzbpPznkRYVz/mWwUaVBUv2rmF59PVA73FjuZG0U= github.com/opencontainers/runtime-spec v0.1.2-0.20190507144316-5b71a03e2700/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0= github.com/opencontainers/selinux v1.5.2/go.mod h1:yTcKuYAh6R95iDpefGLQaPaRwJFwyzAJufJyiTt7s0g= -github.com/openshift-metal3/terraform-provider-ironic v0.2.6 h1:R48DOxq2z6NpFkRs/OHzbkWA8aLZMIXljMK2aq1VvbM= -github.com/openshift-metal3/terraform-provider-ironic v0.2.6/go.mod h1:ux2W6gsCIYsY/fX5N0V0ZgwFEBNN7P8g6RlH6ACi97k= +github.com/openshift-metal3/terraform-provider-ironic v0.2.7 h1:h2XrpcdN7ivdpZKocQPxemI5/eJpaCy2xTpO/9NWfc8= +github.com/openshift-metal3/terraform-provider-ironic v0.2.7/go.mod h1:r0k8OSQ0VsL2xrVhojdgfQET6/Z7/AY5exHWG5pWE1E= github.com/openshift/api v0.0.0-20200326160804-ecb9283fe820/go.mod h1:RKMJ5CBnljLfnej+BJ/xnOWc3kZDvJUaIAEq2oKSPtE= github.com/openshift/api v0.0.0-20200424083944-0422dc17083e/go.mod h1:VnbEzX8SAaRj7Yfl836NykdQIlbEjfL6/CD+AaJQg5Q= github.com/openshift/api v0.0.0-20200827090112-c05698d102cf/go.mod h1:M3xexPhgM8DISzzRpuFUy+jfPjQPIcs9yqEYj17mXV8= @@ -1505,6 +1502,7 @@ github.com/openshift/api v0.0.0-20210331193751-3acddb19d360/go.mod h1:dZ4kytOo3s github.com/openshift/api v0.0.0-20210412212256-79bd8cfbbd59/go.mod h1:dZ4kytOo3svxJHNYd0J55hwe/6IQG5gAUHUE0F3Jkio= github.com/openshift/api v0.0.0-20210416115537-a60c0dc032fd/go.mod h1:dZ4kytOo3svxJHNYd0J55hwe/6IQG5gAUHUE0F3Jkio= github.com/openshift/api v0.0.0-20210730095913-85e1d547cdee/go.mod h1:ntkQrC1Z6AxxkhDlVpDVjkD+pzdwVUalWyfH40rSyyM= +github.com/openshift/api v0.0.0-20210816181336-8ff39b776da3/go.mod h1:x81TFA31x1OMT9SYWukQqJ/KbmeveRN6fo+XeGRK8g0= github.com/openshift/api v0.0.0-20211025104849-a11323ccb6ea/go.mod h1:RsQCVJu4qhUawxxDP7pGlwU3IA4F01wYm3qKEu29Su8= github.com/openshift/api v0.0.0-20211108165917-be1be0e89115/go.mod h1:RsQCVJu4qhUawxxDP7pGlwU3IA4F01wYm3qKEu29Su8= github.com/openshift/api v0.0.0-20211119153416-313e51eab8c8 h1:FBV3/2ac0uE3MGExSzx/TqJKWNpNjHrpxRBIbmxI654= @@ -1533,15 +1531,15 @@ github.com/openshift/cluster-api-provider-alibaba v0.0.0-20211123142315-d16daa4e github.com/openshift/cluster-api-provider-aws v0.2.1-0.20210121023454-5ffc5f422a80 h1:fFHoy/1QCLUcfo/NceEM8jGY2Tafl1BmyLa7tReN328= github.com/openshift/cluster-api-provider-aws v0.2.1-0.20210121023454-5ffc5f422a80/go.mod h1:JV7aXj/LZ8B4MwIQdhGxpTO2PCG8+7UKFd6FaOZCSzA= github.com/openshift/cluster-api-provider-azure v0.1.0-alpha.3.0.20210626224711-5d94c794092f/go.mod h1:GR+ocB8I+Z7JTSBdO+DMu/diBfH66lRlRpnc1KWysUM= -github.com/openshift/cluster-api-provider-baremetal v0.0.0-20190821174549-a2a477909c1d h1:6+XwaVvSMPHm3nFdZW3g+iXiOHpf0Y2ajY5/Zr66Dt0= -github.com/openshift/cluster-api-provider-baremetal v0.0.0-20190821174549-a2a477909c1d/go.mod h1:S+wtA0Rm2FZ5ccC9zNQXUWUDesR6Jsdn5eb6HjAR+Gs= +github.com/openshift/cluster-api-provider-baremetal v0.0.0-20210924143856-c2d3ece4da38 h1:Q6VimHTiOuMXtSstyXMa3/GC7Pdx8CphdKEmiB7tQHQ= +github.com/openshift/cluster-api-provider-baremetal v0.0.0-20210924143856-c2d3ece4da38/go.mod h1:TyotVVwHJhqcDfX/0MkCjLOh7y6+RshdurRIboZ0/Hk= github.com/openshift/cluster-api-provider-gcp v0.0.1-0.20200701112720-3a7d727c9a10/go.mod h1:wgkZrOlcIMWTzo8khB4Js2PoDJDlIUUdzCBm7BuDdqw= github.com/openshift/cluster-api-provider-gcp v0.0.1-0.20200713133651-5c8a640669ac/go.mod h1:XVYX9JE339nKbDDa/W481XD+1GTeqeaBm8bDPr7WE7I= github.com/openshift/cluster-api-provider-gcp v0.0.1-0.20200901173901-9056dbc8c9b9/go.mod h1:rcwAydGZX+z4l91wtOdbq+fqDwuo6iu0YuFik3UUc+8= github.com/openshift/cluster-api-provider-gcp v0.0.1-0.20201002065957-9854f7420570/go.mod h1:7NRECVE26rvP1/fs1CbhfY5gsgnnFQNhb9txTFzWmUw= github.com/openshift/cluster-api-provider-gcp v0.0.1-0.20201201000827-1117a4fc438c/go.mod h1:21N0wWjiTQypZ7WosEYhcGJHr9JoDR1RBFztE0NvdYM= -github.com/openshift/cluster-api-provider-gcp v0.0.1-0.20201203141909-4dc702fd57a5 h1:75U75i/GfStAartlsP/F9v3Gv3MwzuLwqdLTjP1vPeE= -github.com/openshift/cluster-api-provider-gcp v0.0.1-0.20201203141909-4dc702fd57a5/go.mod h1:/XjFaKnqBc8K/jcRXHO7tau39CmzNinqmpxYaQGRvnE= +github.com/openshift/cluster-api-provider-gcp v0.0.1-0.20210615203611-a02074e8d5bb h1:vFMc7likijMQ1u4yhrjv2JDaK6wrXwC+iP3CaHHG6sE= +github.com/openshift/cluster-api-provider-gcp v0.0.1-0.20210615203611-a02074e8d5bb/go.mod h1:KLZ9LTM+EPEny4VXWNbBkJndhfKakmlqafeOfC0jxXA= github.com/openshift/cluster-api-provider-ibmcloud v0.0.0-20211008100740-4d7907adbd6b h1:atciNID+jTAqvQT0t/hAE+KVFLCxv2asXGih2py2dpg= github.com/openshift/cluster-api-provider-ibmcloud v0.0.0-20211008100740-4d7907adbd6b/go.mod h1:xkkPB22FMQyrv3G0HLobylRsosJP4Voi8Yojg5WEYrs= github.com/openshift/cluster-api-provider-libvirt v0.2.1-0.20191219173431-2336783d4603 h1:MC6BSZYxFPoqqKj9PdlGjHGVKcMsvn6Kv1NiVzQErZ8= @@ -1569,6 +1567,7 @@ github.com/openshift/machine-api-operator v0.2.1-0.20200926044412-b7d860f8074c/g github.com/openshift/machine-api-operator v0.2.1-0.20201002104344-6abfb5440597/go.mod h1:+oAfoCl+TUd2TM79/6NdqLpFUHIJpmqkKdmiHe2O7mw= github.com/openshift/machine-api-operator v0.2.1-0.20210104142355-8e6ae0acdfcf/go.mod h1:U5eAHChde1XvtQy3s1Zcr7ll4X7heb0SzYpaiAwxmQc= github.com/openshift/machine-api-operator v0.2.1-0.20210504014029-a132ec00f7dd/go.mod h1:DFZBMPtC2TYZH5NE9+2JQIpbZAnruqc9F26QmbOm9pw= +github.com/openshift/machine-api-operator v0.2.1-0.20210820103535-d50698c302f5/go.mod h1:ko7xmso6c25h9UL6Ai0I5l+6OgyVf+ebinAYXnwlGNg= github.com/openshift/machine-api-operator v0.2.1-0.20211102083422-ee77ca7b9fd1/go.mod h1:8kWuB/zhnlBsNOyD1yz0epINZX5IodG3Z4iDwQrYKx0= github.com/openshift/machine-api-operator v0.2.1-0.20211111133920-c8bba3e64310/go.mod h1:8kWuB/zhnlBsNOyD1yz0epINZX5IodG3Z4iDwQrYKx0= github.com/openshift/machine-config-operator v0.0.1-0.20201009041932-4fe8559913b8 h1:C4gCipkWTDp0B9jb0wZdLgB+HWC7EzVVwQOeNaKnTRA= @@ -2001,7 +2000,6 @@ go.opencensus.io v0.20.2/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= -go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.5 h1:dntmOdLpSpHlVqbW5Eay97DelsZHe+55D+xC6i0dDS0= go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk= go.opentelemetry.io/contrib v0.20.0/go.mod h1:G/EtFaa6qaN7+LxqfIAT3GiZa7Wv5DTBUzl5H4LY0Kc= @@ -2100,8 +2098,9 @@ golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHl golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f/go.mod h1:5qLYkcX4OjUUV8bRuDixDT3tpyyb+LUpUlRWLxfhWrs= golang.org/x/lint v0.0.0-20200130185559-910be7a94367/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= -golang.org/x/lint v0.0.0-20200302205851-738671d3881b h1:Wh+f8QHJXR411sJR8/vRBTZ7YapZaRvUcLFFJhusH0k= golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= +golang.org/x/lint v0.0.0-20210508222113-6edffad5e616 h1:VLliZ0d+/avPrXXH+OakdXhpJuEoBZuwh1m2j7U6Iug= +golang.org/x/lint v0.0.0-20210508222113-6edffad5e616/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= @@ -2394,7 +2393,6 @@ golang.org/x/tools v0.0.0-20200601175630-2caf76543d99/go.mod h1:EkVYQZoAsY45+roY golang.org/x/tools v0.0.0-20200610160956-3e83d1e96d0e/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20200616133436-c1934b75d054/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20200616195046-dc31b401abb5/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200618134242-20370b0cb4b2/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20200625211823-6506e20df31f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20200626171337-aa94e735be7f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= @@ -2611,6 +2609,7 @@ k8s.io/code-generator v0.21.0-beta.1/go.mod h1:IpCUojpiKp25KNB3/UbEeElznqpQUMvhA k8s.io/code-generator v0.21.0-rc.0/go.mod h1:hUlps5+9QaTrKx+jiM4rmq7YmH8wPOIko64uZCHDh6Q= k8s.io/code-generator v0.21.0/go.mod h1:hUlps5+9QaTrKx+jiM4rmq7YmH8wPOIko64uZCHDh6Q= k8s.io/code-generator v0.22.0-rc.0/go.mod h1:eV77Y09IopzeXOJzndrDyCI88UBok2h6WxAlBwpxa+o= +k8s.io/code-generator v0.22.0/go.mod h1:eV77Y09IopzeXOJzndrDyCI88UBok2h6WxAlBwpxa+o= k8s.io/code-generator v0.22.1/go.mod h1:eV77Y09IopzeXOJzndrDyCI88UBok2h6WxAlBwpxa+o= k8s.io/code-generator v0.22.2/go.mod h1:eV77Y09IopzeXOJzndrDyCI88UBok2h6WxAlBwpxa+o= k8s.io/component-base v0.18.0-beta.2/go.mod h1:HVk5FpRnyzQ/MjBr9//e/yEBjTVa2qjGXCTuUzcD7ks= diff --git a/pkg/asset/ignition/bootstrap/baremetal/template.go b/pkg/asset/ignition/bootstrap/baremetal/template.go index fe8a07fbb66..de9f831c327 100644 --- a/pkg/asset/ignition/bootstrap/baremetal/template.go +++ b/pkg/asset/ignition/bootstrap/baremetal/template.go @@ -1,6 +1,7 @@ package baremetal import ( + "encoding/base64" "fmt" "net" "strings" @@ -46,12 +47,26 @@ type TemplateData struct { // BaremetalIntrospectionEndpointOverride contains the url for the baremetal introspection endpoint BaremetalIntrospectionEndpointOverride string + + // ClusterOSImage contains 4 URLs to download RHCOS live iso, kernel, rootfs and initramfs + ClusterOSImage string + + // API VIP for use by ironic during bootstrap. + APIVIP string + + // Hosts is the information needed to create the objects in Ironic. + Hosts []*baremetal.Host + + // Pull secret for Ironic agent. + PullSecretBase64 string } // GetTemplateData returns platform-specific data for bootstrap templates. -func GetTemplateData(config *baremetal.Platform, networks []types.MachineNetworkEntry, ironicUsername, ironicPassword string) *TemplateData { +func GetTemplateData(config *baremetal.Platform, networks []types.MachineNetworkEntry, ironicUsername, ironicPassword string, pullSecret string) *TemplateData { var templateData TemplateData + templateData.Hosts = config.Hosts + templateData.ProvisioningIP = config.BootstrapProvisioningIP templateData.BaremetalEndpointOverride = fmt.Sprintf("http://%s/v1", net.JoinHostPort(config.APIVIP, "6385")) templateData.BaremetalIntrospectionEndpointOverride = fmt.Sprintf("http://%s/v1", net.JoinHostPort(config.APIVIP, "5050")) @@ -97,6 +112,9 @@ func GetTemplateData(config *baremetal.Platform, networks []types.MachineNetwork templateData.IronicUsername = ironicUsername templateData.IronicPassword = ironicPassword + templateData.ClusterOSImage = config.ClusterOSImage + templateData.APIVIP = config.APIVIP + templateData.PullSecretBase64 = base64.StdEncoding.EncodeToString([]byte(pullSecret)) return &templateData } diff --git a/pkg/asset/ignition/bootstrap/baremetal/template_test.go b/pkg/asset/ignition/bootstrap/baremetal/template_test.go index 72912ed4e9d..571318d234a 100644 --- a/pkg/asset/ignition/bootstrap/baremetal/template_test.go +++ b/pkg/asset/ignition/bootstrap/baremetal/template_test.go @@ -1,6 +1,7 @@ package baremetal import ( + "encoding/base64" "github.com/openshift/installer/pkg/ipnet" "github.com/openshift/installer/pkg/types/baremetal" "github.com/stretchr/testify/assert" @@ -33,7 +34,7 @@ func TestTemplatingIPv4(t *testing.T) { }, } - result := GetTemplateData(&bareMetalConfig, nil, "bootstrap-ironic-user", "passw0rd") + result := GetTemplateData(&bareMetalConfig, nil, "bootstrap-ironic-user", "passw0rd", "pullsecret") assert.Equal(t, result.ProvisioningDHCPRange, "172.22.0.10,172.22.0.100,24") assert.Equal(t, result.ProvisioningCIDR, 24) @@ -42,6 +43,7 @@ func TestTemplatingIPv4(t *testing.T) { assert.Equal(t, result.ProvisioningDHCPAllowList, "c0:ff:ee:ca:fe:00 c0:ff:ee:ca:fe:01 c0:ff:ee:ca:fe:02") assert.Equal(t, result.IronicUsername, "bootstrap-ironic-user") assert.Equal(t, result.IronicPassword, "passw0rd") + assert.Equal(t, result.PullSecretBase64, base64.StdEncoding.EncodeToString([]byte("pullsecret"))) } func TestTemplatingManagedIPv6(t *testing.T) { @@ -52,7 +54,7 @@ func TestTemplatingManagedIPv6(t *testing.T) { ProvisioningNetwork: baremetal.ManagedProvisioningNetwork, } - result := GetTemplateData(&bareMetalConfig, nil, "bootstrap-ironic-user", "passw0rd") + result := GetTemplateData(&bareMetalConfig, nil, "bootstrap-ironic-user", "passw0rd", "pullsecret") assert.Equal(t, result.ProvisioningDHCPRange, "fd2e:6f44:5dd8:b856::1,fd2e:6f44:5dd8::ff,80") assert.Equal(t, result.ProvisioningCIDR, 80) @@ -69,7 +71,7 @@ func TestTemplatingUnmanagedIPv6(t *testing.T) { ProvisioningNetwork: baremetal.UnmanagedProvisioningNetwork, } - result := GetTemplateData(&bareMetalConfig, nil, "bootstrap-ironic-user", "passw0rd") + result := GetTemplateData(&bareMetalConfig, nil, "bootstrap-ironic-user", "passw0rd", "pullsecret") assert.Equal(t, result.ProvisioningDHCPRange, "") assert.Equal(t, result.ProvisioningCIDR, 64) diff --git a/pkg/asset/ignition/bootstrap/common.go b/pkg/asset/ignition/bootstrap/common.go index ad26e4388ef..98a2a7f3c41 100644 --- a/pkg/asset/ignition/bootstrap/common.go +++ b/pkg/asset/ignition/bootstrap/common.go @@ -259,7 +259,7 @@ func (a *Common) getTemplateData(dependencies asset.Parents, bootstrapInPlace bo switch installConfig.Config.Platform.Name() { case baremetaltypes.Name: - platformData.BareMetal = baremetal.GetTemplateData(installConfig.Config.Platform.BareMetal, installConfig.Config.MachineNetwork, ironicCreds.Username, ironicCreds.Password) + platformData.BareMetal = baremetal.GetTemplateData(installConfig.Config.Platform.BareMetal, installConfig.Config.MachineNetwork, ironicCreds.Username, ironicCreds.Password, installConfig.Config.PullSecret) case vspheretypes.Name: platformData.VSphere = vsphere.GetTemplateData(installConfig.Config.Platform.VSphere) } diff --git a/pkg/asset/machines/baremetal/machines.go b/pkg/asset/machines/baremetal/machines.go index 943bcc34416..53b0e015113 100644 --- a/pkg/asset/machines/baremetal/machines.go +++ b/pkg/asset/machines/baremetal/machines.go @@ -3,13 +3,9 @@ package baremetal import ( "fmt" - "net" - "net/url" - "path" - "strings" - baremetalprovider "github.com/metal3-io/cluster-api-provider-baremetal/pkg/apis/baremetal/v1alpha1" machineapi "github.com/openshift/api/machine/v1beta1" + baremetalprovider "github.com/openshift/cluster-api-provider-baremetal/pkg/apis/baremetal/v1alpha1" "github.com/pkg/errors" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -20,7 +16,7 @@ import ( ) // Machines returns a list of machines for a machinepool. -func Machines(clusterID string, config *types.InstallConfig, pool *types.MachinePool, osImage, role, userDataSecret string) ([]machineapi.Machine, error) { +func Machines(clusterID string, config *types.InstallConfig, pool *types.MachinePool, role, userDataSecret string) ([]machineapi.Machine, error) { if configPlatform := config.Platform.Name(); configPlatform != baremetal.Name { return nil, fmt.Errorf("non bare metal configuration: %q", configPlatform) } @@ -33,7 +29,7 @@ func Machines(clusterID string, config *types.InstallConfig, pool *types.Machine if pool.Replicas != nil { total = *pool.Replicas } - provider, err := provider(platform, osImage, userDataSecret) + provider, err := provider(platform, userDataSecret) if err != nil { return nil, errors.Wrap(err, "failed to create provider") } @@ -66,42 +62,14 @@ func Machines(clusterID string, config *types.InstallConfig, pool *types.Machine return machines, nil } -func provider(platform *baremetal.Platform, osImage string, userDataSecret string) (*baremetalprovider.BareMetalMachineProviderSpec, error) { - // The machine-os-downloader container launched by the baremetal-operator downloads the image, - // compresses it to speed up deployments and makes it available on platform.ClusterProvisioningIP, via http - // osImage looks like: - // https://releases-art-rhcos.svc.ci.openshift.org/art/storage/releases/rhcos-4.2/42.80.20190725.1/rhcos-42.80.20190725.1-openstack.qcow2?sha256sum=123 - // And the cached URL looks like: - // http://172.22.0.3:6180/images/rhcos-42.80.20190725.1-openstack.qcow2/cached-rhcos-42.80.20190725.1-openstack.qcow2 - // See https://github.com/openshift/ironic-rhcos-downloader for more details - // The image is now formatted with a query string containing the sha256sum, we strip that here - // and it will be consumed for validation in ironic-machine-os-downloader - imageURL, err := url.Parse(osImage) - if err != nil { - return nil, errors.Wrap(err, "invalid osImage URL format") - } - imageURL.RawQuery = "" - imageURL.Fragment = "" - // We strip any .gz/.xz suffix because ironic-machine-os-downloader unzips the image - // ref https://github.com/openshift/ironic-rhcos-downloader/pull/12 - imageFilename := path.Base(strings.TrimSuffix(imageURL.String(), ".gz")) - imageFilename = strings.TrimSuffix(imageFilename, ".xz") - cachedImageFilename := "cached-" + imageFilename - - cacheImageIP := platform.ClusterProvisioningIP - if platform.ProvisioningNetwork == baremetal.DisabledProvisioningNetwork && platform.ClusterProvisioningIP == "" { - cacheImageIP = platform.APIVIP - } - cacheImageURL := fmt.Sprintf("http://%s/images/%s/%s", net.JoinHostPort(cacheImageIP, "6181"), imageFilename, cachedImageFilename) - cacheChecksumURL := fmt.Sprintf("%s.md5sum", cacheImageURL) +func provider(platform *baremetal.Platform, userDataSecret string) (*baremetalprovider.BareMetalMachineProviderSpec, error) { config := &baremetalprovider.BareMetalMachineProviderSpec{ TypeMeta: metav1.TypeMeta{ APIVersion: "baremetal.cluster.k8s.io/v1alpha1", Kind: "BareMetalMachineProviderSpec", }, - Image: baremetalprovider.Image{ - URL: cacheImageURL, - Checksum: cacheChecksumURL, + CustomDeploy: baremetalprovider.CustomDeploy{ + Method: "install_coreos", }, UserData: &corev1.SecretReference{Name: userDataSecret}, } diff --git a/pkg/asset/machines/baremetal/machinesets.go b/pkg/asset/machines/baremetal/machinesets.go index 343b7737d94..f047b502264 100644 --- a/pkg/asset/machines/baremetal/machinesets.go +++ b/pkg/asset/machines/baremetal/machinesets.go @@ -32,7 +32,7 @@ func MachineSets(clusterID string, config *types.InstallConfig, pool *types.Mach total = *pool.Replicas } - provider, err := provider(platform, osImage, userDataSecret) + provider, err := provider(platform, userDataSecret) if err != nil { return nil, errors.Wrap(err, "failed to create provider") } diff --git a/pkg/asset/machines/master.go b/pkg/asset/machines/master.go index 46530adcd68..a239e3a42b3 100644 --- a/pkg/asset/machines/master.go +++ b/pkg/asset/machines/master.go @@ -9,11 +9,11 @@ import ( "github.com/ghodss/yaml" baremetalhost "github.com/metal3-io/baremetal-operator/apis/metal3.io/v1alpha1" - baremetalapi "github.com/metal3-io/cluster-api-provider-baremetal/pkg/apis" - baremetalprovider "github.com/metal3-io/cluster-api-provider-baremetal/pkg/apis/baremetal/v1alpha1" machineapi "github.com/openshift/api/machine/v1beta1" alibabacloudapi "github.com/openshift/cluster-api-provider-alibaba/pkg/apis" alibabacloudprovider "github.com/openshift/cluster-api-provider-alibaba/pkg/apis/alibabacloudprovider/v1beta1" + baremetalapi "github.com/openshift/cluster-api-provider-baremetal/pkg/apis" + baremetalprovider "github.com/openshift/cluster-api-provider-baremetal/pkg/apis/baremetal/v1alpha1" gcpapi "github.com/openshift/cluster-api-provider-gcp/pkg/apis" gcpprovider "github.com/openshift/cluster-api-provider-gcp/pkg/apis/gcpprovider/v1beta1" ibmcloudapi "github.com/openshift/cluster-api-provider-ibmcloud/pkg/apis" @@ -359,7 +359,7 @@ func (m *Master) Generate(dependencies asset.Parents) error { mpool.Set(pool.Platform.BareMetal) pool.Platform.BareMetal = &mpool - machines, err = baremetal.Machines(clusterID.InfraID, ic, &pool, string(*rhcosImage), "master", "master-user-data") + machines, err = baremetal.Machines(clusterID.InfraID, ic, &pool, "master", "master-user-data") if err != nil { return errors.Wrap(err, "failed to create master machine objects") } diff --git a/pkg/asset/machines/worker.go b/pkg/asset/machines/worker.go index b3c9bfc3174..4d6f2c4961d 100644 --- a/pkg/asset/machines/worker.go +++ b/pkg/asset/machines/worker.go @@ -8,11 +8,11 @@ import ( "strings" "github.com/ghodss/yaml" - baremetalapi "github.com/metal3-io/cluster-api-provider-baremetal/pkg/apis" - baremetalprovider "github.com/metal3-io/cluster-api-provider-baremetal/pkg/apis/baremetal/v1alpha1" machineapi "github.com/openshift/api/machine/v1beta1" alibabacloudapi "github.com/openshift/cluster-api-provider-alibaba/pkg/apis" alibabacloudprovider "github.com/openshift/cluster-api-provider-alibaba/pkg/apis/alibabacloudprovider/v1beta1" + baremetalapi "github.com/openshift/cluster-api-provider-baremetal/pkg/apis" + baremetalprovider "github.com/openshift/cluster-api-provider-baremetal/pkg/apis/baremetal/v1alpha1" gcpapi "github.com/openshift/cluster-api-provider-gcp/pkg/apis" gcpprovider "github.com/openshift/cluster-api-provider-gcp/pkg/apis/gcpprovider/v1beta1" ibmcloudapi "github.com/openshift/cluster-api-provider-ibmcloud/pkg/apis" @@ -383,7 +383,7 @@ func (w *Worker) Generate(dependencies asset.Parents) error { mpool.Set(ic.Platform.BareMetal.DefaultMachinePlatform) mpool.Set(pool.Platform.BareMetal) pool.Platform.BareMetal = &mpool - sets, err := baremetal.MachineSets(clusterID.InfraID, ic, &pool, string(*rhcosImage), "worker", "worker-user-data") + sets, err := baremetal.MachineSets(clusterID.InfraID, ic, &pool, "", "worker", "worker-user-data") if err != nil { return errors.Wrap(err, "failed to create worker machine objects") } diff --git a/pkg/asset/manifests/openshift.go b/pkg/asset/manifests/openshift.go index 0bfb3b107e5..1843e953cc5 100644 --- a/pkg/asset/manifests/openshift.go +++ b/pkg/asset/manifests/openshift.go @@ -242,13 +242,26 @@ func (o *Openshift) Generate(dependencies asset.Parents) error { } assetData["99_role-cloud-creds-secret-reader.yaml"] = applyTemplateData(roleCloudCredsSecretReader.Files()[0].Data, templateData) case baremetaltypes.Name: + osURL := string(*rhcosImage) bmTemplateData := baremetalTemplateData{ - Baremetal: installConfig.Config.Platform.BareMetal, - ProvisioningOSDownloadURL: string(*rhcosImage), + Baremetal: installConfig.Config.Platform.BareMetal, + } + URIs := strings.Split(osURL, ",") + for _, uri := range URIs { + if strings.Contains(uri, "iso") { + bmTemplateData.IsoURL = uri + } else if strings.Contains(uri, "rootfs") { + bmTemplateData.RootfsURL = uri + } else if strings.Contains(uri, "initramfs") { + bmTemplateData.InitramfsURL = uri + } else if strings.Contains(uri, "kernel") { + bmTemplateData.KernelURL = uri + } else if strings.Contains(uri, ".qcow2") { + bmTemplateData.ProvisioningOSDownloadURL = uri + } } assetData["99_baremetal-provisioning-config.yaml"] = applyTemplateData(baremetalConfig.Files()[0].Data, bmTemplateData) } - if platform == azuretypes.Name && installConfig.Config.Azure.IsARO() { // config is used to created compatible secret to trigger azure cloud // controller config merge behaviour diff --git a/pkg/asset/manifests/template.go b/pkg/asset/manifests/template.go index 4e93d3b00d8..572bb131b08 100644 --- a/pkg/asset/manifests/template.go +++ b/pkg/asset/manifests/template.go @@ -84,6 +84,10 @@ type bootkubeTemplateData struct { type baremetalTemplateData struct { Baremetal *baremetal.Platform ProvisioningOSDownloadURL string + IsoURL string + KernelURL string + InitramfsURL string + RootfsURL string } type openshiftTemplateData struct { diff --git a/pkg/asset/rhcos/image.go b/pkg/asset/rhcos/image.go index aacfa683c14..fa5446bbca0 100644 --- a/pkg/asset/rhcos/image.go +++ b/pkg/asset/rhcos/image.go @@ -141,13 +141,30 @@ func osImage(config *types.InstallConfig) (string, error) { return oi, nil } - // Note that baremetal IPI currently uses the OpenStack image - // because this contains the necessary ironic config drive - // ignition support, which isn't enabled in the UPI BM images - if a, ok := streamArch.Artifacts["openstack"]; ok { - return rhcos.FindArtifactURL(a) + // Note that baremetal IPI currently uses the RHCOS live-iso image. + // We will need to pass 4 URLs one for virtual media and 3 for PXE + // booting. We will concatenate the URLs with a separator for easier extraction. + // Note: We cannot use rhcos.FindArtifactURL for the "metal" artifact. + // The iso image is optional, so we will continue looking for others. + iso := streamArch.Artifacts["metal"].Formats["iso"].Disk.Location + + kernel := streamArch.Artifacts["metal"].Formats["pxe"].Kernel.Location + if kernel == "" { + return "", fmt.Errorf("%s: No live-kernel build found", st.FormatPrefix(archName)) } - return "", fmt.Errorf("%s: No openstack build found", st.FormatPrefix(archName)) + + initramfs := streamArch.Artifacts["metal"].Formats["pxe"].Initramfs.Location + if initramfs == "" { + return "", fmt.Errorf("%s: No live-initramfs build found", st.FormatPrefix(archName)) + } + + rootfs := streamArch.Artifacts["metal"].Formats["pxe"].Rootfs.Location + if rootfs == "" { + return "", fmt.Errorf("%s: No live-rootfs build found", st.FormatPrefix(archName)) + } + + urls := iso + "," + kernel + "," + initramfs + "," + rootfs + return urls, nil case vsphere.Name: // Check for image URL override if config.Platform.VSphere.ClusterOSImage != "" { diff --git a/pkg/tfvars/baremetal/baremetal.go b/pkg/tfvars/baremetal/baremetal.go index 68289112583..3715af9ff9c 100644 --- a/pkg/tfvars/baremetal/baremetal.go +++ b/pkg/tfvars/baremetal/baremetal.go @@ -5,9 +5,6 @@ import ( "encoding/json" "fmt" "net" - "net/url" - "path" - "strings" "github.com/metal3-io/baremetal-operator/pkg/hardware" "github.com/metal3-io/baremetal-operator/pkg/hardwareutils/bmc" @@ -26,6 +23,8 @@ type config struct { IronicUsername string `json:"ironic_username"` IronicPassword string `json:"ironic_password"` + DeploySteps []string `json:"deploy_steps"` + // Data required for control plane deployment - several maps per host, because of terraform's limitations Masters []map[string]interface{} `json:"masters"` RootDevices []map[string]interface{} `json:"root_devices"` @@ -52,6 +51,7 @@ func TFVars(numControlPlaneReplicas int64, libvirtURI, apiVIP, imageCacheIP, boo } var masters, rootDevices, properties, driverInfos, instanceInfos []map[string]interface{} + var deploySteps []string // Select the first N hosts as masters, excluding the workers for _, host := range platformHosts { @@ -85,7 +85,8 @@ func TFVars(numControlPlaneReplicas int64, libvirtURI, apiVIP, imageCacheIP, boo } driverInfo := accessDetails.DriverInfo(credentials) driverInfo["deploy_kernel"] = fmt.Sprintf("http://%s/images/ironic-python-agent.kernel", net.JoinHostPort(imageCacheIP, "80")) - driverInfo["deploy_ramdisk"] = fmt.Sprintf("http://%s/images/ironic-python-agent.initramfs", net.JoinHostPort(imageCacheIP, "80")) + driverInfo["deploy_ramdisk"] = fmt.Sprintf("http://%s/%s.initramfs", net.JoinHostPort(imageCacheIP, "8084"), host.Name) + driverInfo["deploy_iso"] = fmt.Sprintf("http://%s/%s.iso", net.JoinHostPort(imageCacheIP, "8084"), host.Name) // Host Details hostMap := map[string]interface{}{ @@ -97,6 +98,7 @@ func TFVars(numControlPlaneReplicas int64, libvirtURI, apiVIP, imageCacheIP, boo "power_interface": accessDetails.PowerInterface(), "raid_interface": accessDetails.RAIDInterface(), "vendor_interface": accessDetails.VendorInterface(), + "deploy_interface": "custom-agent", } // Explicitly set the boot mode to the default "uefi" in case @@ -135,41 +137,25 @@ func TFVars(numControlPlaneReplicas int64, libvirtURI, apiVIP, imageCacheIP, boo rootDevice["name"] = profile.RootDeviceHints.DeviceName } - // Instance Info - // The machine-os-downloader container downloads the image, compresses it to speed up deployments - // and then makes it available on bootstrapProvisioningIP via http - // The image is now formatted with a query string containing the sha256sum, we strip that here - // and it will be consumed for validation in https://github.com/openshift/ironic-rhcos-downloader - imageURL, err := url.Parse(image) - if err != nil { - return nil, err - } - imageURL.RawQuery = "" - imageURL.Fragment = "" - // We strip any .gz/.xz suffix because ironic-machine-os-downloader unzips the image - // ref https://github.com/openshift/ironic-rhcos-downloader/pull/12 - imageFilename := path.Base(strings.TrimSuffix(imageURL.String(), ".gz")) - imageFilename = strings.TrimSuffix(imageFilename, ".xz") - cachedImageFilename := "cached-" + imageFilename - cacheImageURL := fmt.Sprintf("http://%s/images/%s/%s", net.JoinHostPort(imageCacheIP, "80"), imageFilename, cachedImageFilename) - cacheChecksumURL := fmt.Sprintf("%s.md5sum", cacheImageURL) - instanceInfo := map[string]interface{}{ - "image_source": cacheImageURL, - "image_checksum": cacheChecksumURL, - } - // This is the only place where we need to set instance_info capabilities, // if we need to add another capabilitie we need merge the values // and ensure they are in the `key1:value1,key2:value2` format + instanceInfo := make(map[string]interface{}) if host.BootMode == baremetal.UEFISecureBoot { instanceInfo["capabilities"] = "secure_boot:true" } masters = append(masters, hostMap) + // deploy_steps is set when a custom deployment is desired. We will use ironic's custom deployment + // interface to use live ISO based installer. Currently this value is static but may be configurable + // in the future. + hostDeploySteps := `[{"interface": "deploy", "step": "install_coreos", "priority": 80, "args": {}}]` + properties = append(properties, propertiesMap) driverInfos = append(driverInfos, driverInfo) rootDevices = append(rootDevices, rootDevice) instanceInfos = append(instanceInfos, instanceInfo) + deploySteps = append(deploySteps, hostDeploySteps) } var bridges []map[string]string @@ -202,6 +188,7 @@ func TFVars(numControlPlaneReplicas int64, libvirtURI, apiVIP, imageCacheIP, boo DriverInfos: driverInfos, RootDevices: rootDevices, InstanceInfos: instanceInfos, + DeploySteps: deploySteps, } return json.MarshalIndent(cfg, "", " ") diff --git a/pkg/types/baremetal/validation/platform.go b/pkg/types/baremetal/validation/platform.go index 8ae91ad6261..c4b894c44b9 100644 --- a/pkg/types/baremetal/validation/platform.go +++ b/pkg/types/baremetal/validation/platform.go @@ -110,25 +110,28 @@ func validateNoOverlapMachineCIDR(target *net.IPNet, n *types.Networking) error return nil } -func validateOSImageURI(uri string) error { - // Check for valid URI and sha256 checksum part of the URL - parsedURL, err := url.ParseRequestURI(uri) - if err != nil { - return fmt.Errorf("the URI provided: %s is invalid", uri) - } - if parsedURL.Scheme == "http" || parsedURL.Scheme == "https" { - var sha256Checksum string - if sha256Checksums, ok := parsedURL.Query()["sha256"]; ok { - sha256Checksum = sha256Checksums[0] - } - if sha256Checksum == "" { - return fmt.Errorf("the sha256 parameter in the %s URI is missing", uri) +func validateOSImageURI(uris string) error { + URIs := strings.Split(uris, ",") + for _, uri := range URIs { + // Check for valid URI and sha256 checksum part of the URL + parsedURL, err := url.ParseRequestURI(uri) + if err != nil { + return fmt.Errorf("the URI provided: %s is invalid", uri) } - if len(sha256Checksum) != 64 { - return fmt.Errorf("the sha256 parameter in the %s URI is invalid", uri) + if parsedURL.Scheme == "http" || parsedURL.Scheme == "https" { + var sha256Checksum string + if sha256Checksums, ok := parsedURL.Query()["sha256"]; ok { + sha256Checksum = sha256Checksums[0] + } + if sha256Checksum == "" { + return fmt.Errorf("the sha256 parameter in the %s URI is missing", uri) + } + if len(sha256Checksum) != 64 { + return fmt.Errorf("the sha256 parameter in the %s URI is invalid", uri) + } + } else { + return fmt.Errorf("the URI provided: %s must begin with http/https", uri) } - } else { - return fmt.Errorf("the URI provided: %s must begin with http/https", uri) } return nil } diff --git a/pkg/types/baremetal/validation/platform_test.go b/pkg/types/baremetal/validation/platform_test.go index fbb4d2c93d3..a6adeb85c4d 100644 --- a/pkg/types/baremetal/validation/platform_test.go +++ b/pkg/types/baremetal/validation/platform_test.go @@ -380,6 +380,15 @@ func TestValidateProvisioning(t *testing.T) { BootstrapOSImage(imagesServer.URL + "/images/qemu.x86_64.qcow2.gz?sha256=3b5a882c2af3e19d515b961855d144f293cab30190c2bdedd661af31a1fc4e2f"). ClusterOSImage(imagesServer.URL + "/images/metal.x86_64.qcow2.gz?sha256=340dfa4d92450f2eee852ed1e2d02e3138cc68d824827ef9cf0a40a7ea2f93da").build(), }, + { + name: "valid_with_live_image_os_image_overrides", + platform: platform(). + BootstrapOSImage(imagesServer.URL + "/images/qemu.x86_64.qcow2.gz?sha256=3b5a882c2af3e19d515b961855d144f293cab30190c2bdedd661af31a1fc4e2f"). + ClusterOSImage(imagesServer.URL + "/images/metal-live.iso?sha256=340dfa4d92450f2eee852ed1e2d02e3138cc68d824827ef9cf0a40a7ea2f93da" + "," + + imagesServer.URL + "/images/metal-live-kernel?sha256=340dfa4d92450f2eee852ed1e2d02e3138cc68d824827ef9cf0a40a7ea2f93da" + "," + + imagesServer.URL + "/images/metal-live-rootfs.img?sha256=340dfa4d92450f2eee852ed1e2d02e3138cc68d824827ef9cf0a40a7ea2f93da" + "," + + imagesServer.URL + "/images/metal-live-initramfs.img?sha256=340dfa4d92450f2eee852ed1e2d02e3138cc68d824827ef9cf0a40a7ea2f93da").build(), + }, { name: "invalid_bootstraposimage", platform: platform(). diff --git a/vendor/github.com/openshift-metal3/terraform-provider-ironic/ironic/resource_ironic_deployment.go b/vendor/github.com/openshift-metal3/terraform-provider-ironic/ironic/resource_ironic_deployment.go index 8cc92d22906..aa8793c1599 100644 --- a/vendor/github.com/openshift-metal3/terraform-provider-ironic/ironic/resource_ironic_deployment.go +++ b/vendor/github.com/openshift-metal3/terraform-provider-ironic/ironic/resource_ironic_deployment.go @@ -4,6 +4,7 @@ import ( "crypto/tls" "crypto/x509" "encoding/base64" + "encoding/json" "fmt" "io/ioutil" "log" @@ -40,6 +41,11 @@ func resourceDeployment() *schema.Resource { Required: true, ForceNew: true, }, + "deploy_steps": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, "user_data": { Type: schema.TypeString, Optional: true, @@ -92,12 +98,12 @@ func resourceDeploymentCreate(d *schema.ResourceData, meta interface{}) error { // Reload the resource before returning defer func() { _ = resourceDeploymentRead(d, meta) }() + nodeUUID := d.Get("node_uuid").(string) // Set instance info instanceInfo := d.Get("instance_info").(map[string]interface{}) if instanceInfo != nil { instanceInfoCapabilities, found := instanceInfo["capabilities"] capabilities := make(map[string]string) - nodeUUID := d.Get("node_uuid").(string) if found { for _, e := range strings.Split(instanceInfoCapabilities.(string), ",") { parts := strings.Split(e, ":") @@ -134,7 +140,17 @@ func resourceDeploymentCreate(d *schema.ResourceData, meta interface{}) error { } } - d.SetId(d.Get("node_uuid").(string)) + d.SetId(nodeUUID) + + // deploy_steps is a json string + dSteps := d.Get("deploy_steps").(string) + var deploySteps []nodes.DeployStep + if len(dSteps) > 0 { + deploySteps, err = buildDeploySteps(dSteps) + if err != nil { + return fmt.Errorf("could not fetch deploy steps: %s", err) + } + } userData := d.Get("user_data").(string) userDataURL := d.Get("user_data_url").(string) @@ -159,7 +175,7 @@ func resourceDeploymentCreate(d *schema.ResourceData, meta interface{}) error { } // Deploy the node - drive Ironic state machine until node is 'active' - return ChangeProvisionStateToTarget(client, d.Id(), "active", &configDrive) + return ChangeProvisionStateToTarget(client, nodeUUID, "active", &configDrive, deploySteps) } // fetchFullIgnition gets full igntion from the URL and cert passed to it and returns userdata as a string @@ -212,6 +228,18 @@ func fetchFullIgnition(userDataURL string, userDataCaCert string, userDataHeader return "", nil } +// buildDeploySteps handles customized deploy steps +func buildDeploySteps(steps string) ([]nodes.DeployStep, error) { + var deploySteps []nodes.DeployStep + err := json.Unmarshal([]byte(steps), &deploySteps) + if err != nil { + log.Printf("could not unmarshal deploy_steps.\n") + return nil, err + } + + return deploySteps, nil +} + // buildConfigDrive handles building a config drive appropriate for the Ironic version we are using. Newer versions // support sending the user data directly, otherwise we need to build an ISO image func buildConfigDrive(apiVersion, userData string, networkData, metaData map[string]interface{}) (interface{}, error) { @@ -273,5 +301,5 @@ func resourceDeploymentDelete(d *schema.ResourceData, meta interface{}) error { return err } - return ChangeProvisionStateToTarget(client, d.Id(), "deleted", nil) + return ChangeProvisionStateToTarget(client, d.Id(), "deleted", nil, nil) } diff --git a/vendor/github.com/openshift-metal3/terraform-provider-ironic/ironic/resource_ironic_node_v1.go b/vendor/github.com/openshift-metal3/terraform-provider-ironic/ironic/resource_ironic_node_v1.go index 503e79a9ace..7823f5ec133 100644 --- a/vendor/github.com/openshift-metal3/terraform-provider-ironic/ironic/resource_ironic_node_v1.go +++ b/vendor/github.com/openshift-metal3/terraform-provider-ironic/ironic/resource_ironic_node_v1.go @@ -230,28 +230,28 @@ func resourceNodeV1Create(d *schema.ResourceData, meta interface{}) error { // Make node manageable if d.Get("manage").(bool) || d.Get("clean").(bool) || d.Get("inspect").(bool) { - if err := ChangeProvisionStateToTarget(client, d.Id(), "manage", nil); err != nil { + if err := ChangeProvisionStateToTarget(client, d.Id(), "manage", nil, nil); err != nil { return fmt.Errorf("could not manage: %s", err) } } // Clean node if d.Get("clean").(bool) { - if err := ChangeProvisionStateToTarget(client, d.Id(), "clean", nil); err != nil { + if err := ChangeProvisionStateToTarget(client, d.Id(), "clean", nil, nil); err != nil { return fmt.Errorf("could not clean: %s", err) } } // Inspect node if d.Get("inspect").(bool) { - if err := ChangeProvisionStateToTarget(client, d.Id(), "inspect", nil); err != nil { + if err := ChangeProvisionStateToTarget(client, d.Id(), "inspect", nil, nil); err != nil { return fmt.Errorf("could not inspect: %s", err) } } // Make node available if d.Get("available").(bool) { - if err := ChangeProvisionStateToTarget(client, d.Id(), "provide", nil); err != nil { + if err := ChangeProvisionStateToTarget(client, d.Id(), "provide", nil, nil); err != nil { return fmt.Errorf("could not make node available: %s", err) } } @@ -422,7 +422,7 @@ func resourceNodeV1Update(d *schema.ResourceData, meta interface{}) error { if (d.HasChange("manage") && d.Get("manage").(bool)) || (d.HasChange("clean") && d.Get("clean").(bool)) || (d.HasChange("inspect") && d.Get("inspect").(bool)) { - if err := ChangeProvisionStateToTarget(client, d.Id(), "manage", nil); err != nil { + if err := ChangeProvisionStateToTarget(client, d.Id(), "manage", nil, nil); err != nil { return fmt.Errorf("could not manage: %s", err) } } @@ -436,21 +436,21 @@ func resourceNodeV1Update(d *schema.ResourceData, meta interface{}) error { // Clean node if d.HasChange("clean") && d.Get("clean").(bool) { - if err := ChangeProvisionStateToTarget(client, d.Id(), "clean", nil); err != nil { + if err := ChangeProvisionStateToTarget(client, d.Id(), "clean", nil, nil); err != nil { return fmt.Errorf("could not clean: %s", err) } } // Inspect node if d.HasChange("inspect") && d.Get("inspect").(bool) { - if err := ChangeProvisionStateToTarget(client, d.Id(), "inspect", nil); err != nil { + if err := ChangeProvisionStateToTarget(client, d.Id(), "inspect", nil, nil); err != nil { return fmt.Errorf("could not inspect: %s", err) } } // Make node available if d.HasChange("available") && d.Get("available").(bool) { - if err := ChangeProvisionStateToTarget(client, d.Id(), "provide", nil); err != nil { + if err := ChangeProvisionStateToTarget(client, d.Id(), "provide", nil, nil); err != nil { return fmt.Errorf("could not make node available: %s", err) } } @@ -481,7 +481,7 @@ func resourceNodeV1Delete(d *schema.ResourceData, meta interface{}) error { return err } - if err := ChangeProvisionStateToTarget(client, d.Id(), "deleted", nil); err != nil { + if err := ChangeProvisionStateToTarget(client, d.Id(), "deleted", nil, nil); err != nil { return err } diff --git a/vendor/github.com/openshift-metal3/terraform-provider-ironic/ironic/workflow.go b/vendor/github.com/openshift-metal3/terraform-provider-ironic/ironic/workflow.go index a22d7930047..6a44fb48c0f 100644 --- a/vendor/github.com/openshift-metal3/terraform-provider-ironic/ironic/workflow.go +++ b/vendor/github.com/openshift-metal3/terraform-provider-ironic/ironic/workflow.go @@ -18,11 +18,12 @@ type provisionStateWorkflow struct { wait time.Duration configDrive interface{} + deploySteps []nodes.DeployStep } // ChangeProvisionStateToTarget drives Ironic's state machine through the process to reach our desired end state. This requires multiple // possibly long-running steps. If required, we'll build a config drive ISO for deployment. -func ChangeProvisionStateToTarget(client *gophercloud.ServiceClient, uuid string, target nodes.TargetProvisionState, configDrive interface{}) error { +func ChangeProvisionStateToTarget(client *gophercloud.ServiceClient, uuid string, target nodes.TargetProvisionState, configDrive interface{}, deploySteps []nodes.DeployStep) error { // Run the provisionStateWorkflow - this could take a while wf := provisionStateWorkflow{ target: target, @@ -30,6 +31,7 @@ func ChangeProvisionStateToTarget(client *gophercloud.ServiceClient, uuid string wait: 5 * time.Second, uuid: uuid, configDrive: configDrive, + deploySteps: deploySteps, } return wf.run() @@ -111,8 +113,7 @@ func (workflow *provisionStateWorkflow) toClean() (bool, error) { return true, err } if workflow.node.ProvisionState != string(nodes.Manageable) { - err = ChangeProvisionStateToTarget(workflow.client, workflow.uuid, nodes.TargetManage, nil) - if err != nil { + if err := ChangeProvisionStateToTarget(workflow.client, workflow.uuid, nodes.TargetManage, nil, nil); err != nil { return true, err } } @@ -151,7 +152,7 @@ func (workflow *provisionStateWorkflow) toInspect() (bool, error) { return true, err } if workflow.node.ProvisionState != string(nodes.Manageable) { - if err := ChangeProvisionStateToTarget(workflow.client, workflow.uuid, nodes.TargetManage, nil); err != nil { + if err := ChangeProvisionStateToTarget(workflow.client, workflow.uuid, nodes.TargetManage, nil, nil); err != nil { return true, err } } @@ -278,6 +279,10 @@ func (workflow *provisionStateWorkflow) buildProvisionStateOpts(target nodes.Tar // If we're deploying, then build a config drive to send to Ironic if target == "active" { opts.ConfigDrive = workflow.configDrive + + if workflow.deploySteps != nil { + opts.DeploySteps = workflow.deploySteps + } } if target == "clean" { opts.CleanSteps = []nodes.CleanStep{} diff --git a/vendor/github.com/metal3-io/cluster-api-provider-baremetal/LICENSE b/vendor/github.com/openshift/cluster-api-provider-baremetal/LICENSE similarity index 100% rename from vendor/github.com/metal3-io/cluster-api-provider-baremetal/LICENSE rename to vendor/github.com/openshift/cluster-api-provider-baremetal/LICENSE diff --git a/vendor/github.com/metal3-io/cluster-api-provider-baremetal/pkg/apis/addtoscheme_baremetal_v1alpha1.go b/vendor/github.com/openshift/cluster-api-provider-baremetal/pkg/apis/addtoscheme_baremetal_v1alpha1.go similarity index 92% rename from vendor/github.com/metal3-io/cluster-api-provider-baremetal/pkg/apis/addtoscheme_baremetal_v1alpha1.go rename to vendor/github.com/openshift/cluster-api-provider-baremetal/pkg/apis/addtoscheme_baremetal_v1alpha1.go index 5fbf89d0129..0c0aa6a8021 100644 --- a/vendor/github.com/metal3-io/cluster-api-provider-baremetal/pkg/apis/addtoscheme_baremetal_v1alpha1.go +++ b/vendor/github.com/openshift/cluster-api-provider-baremetal/pkg/apis/addtoscheme_baremetal_v1alpha1.go @@ -17,7 +17,7 @@ limitations under the License. package apis import ( - "github.com/metal3-io/cluster-api-provider-baremetal/pkg/apis/baremetal/v1alpha1" + "github.com/openshift/cluster-api-provider-baremetal/pkg/apis/baremetal/v1alpha1" ) func init() { diff --git a/vendor/github.com/metal3-io/cluster-api-provider-baremetal/pkg/apis/apis.go b/vendor/github.com/openshift/cluster-api-provider-baremetal/pkg/apis/apis.go similarity index 86% rename from vendor/github.com/metal3-io/cluster-api-provider-baremetal/pkg/apis/apis.go rename to vendor/github.com/openshift/cluster-api-provider-baremetal/pkg/apis/apis.go index 956c65ce5aa..b97c5c1660a 100644 --- a/vendor/github.com/metal3-io/cluster-api-provider-baremetal/pkg/apis/apis.go +++ b/vendor/github.com/openshift/cluster-api-provider-baremetal/pkg/apis/apis.go @@ -15,7 +15,7 @@ limitations under the License. */ // Generate deepcopy for apis -//go:generate go run ../../vendor/k8s.io/code-generator/cmd/deepcopy-gen/main.go -O zz_generated.deepcopy -i ./... -h ../../hack/boilerplate.go.txt +//go:generate go run ../../vendor/sigs.k8s.io/controller-tools/cmd/controller-gen paths=./... object:headerFile=../../hack/boilerplate.go.txt // Package apis contains Kubernetes API groups. package apis diff --git a/vendor/github.com/metal3-io/cluster-api-provider-baremetal/pkg/apis/baremetal/v1alpha1/baremetalmachineproviderspec_types.go b/vendor/github.com/openshift/cluster-api-provider-baremetal/pkg/apis/baremetal/v1alpha1/baremetalmachineproviderspec_types.go similarity index 86% rename from vendor/github.com/metal3-io/cluster-api-provider-baremetal/pkg/apis/baremetal/v1alpha1/baremetalmachineproviderspec_types.go rename to vendor/github.com/openshift/cluster-api-provider-baremetal/pkg/apis/baremetal/v1alpha1/baremetalmachineproviderspec_types.go index c54ce442910..31f5f973191 100644 --- a/vendor/github.com/metal3-io/cluster-api-provider-baremetal/pkg/apis/baremetal/v1alpha1/baremetalmachineproviderspec_types.go +++ b/vendor/github.com/openshift/cluster-api-provider-baremetal/pkg/apis/baremetal/v1alpha1/baremetalmachineproviderspec_types.go @@ -29,13 +29,15 @@ import ( // BareMetalMachineProviderSpec holds data that the actuator needs to provision // and manage a Machine. -// +k8s:openapi-gen=true type BareMetalMachineProviderSpec struct { metav1.TypeMeta `json:",inline"` metav1.ObjectMeta `json:"metadata,omitempty"` // Image is the image to be provisioned. - Image Image `json:"image"` + Image Image `json:"image,omitempty"` + + // Custom Deploy Procedure + CustomDeploy CustomDeploy `json:"customDeploy,omitempty"` // UserData references the Secret that holds user data needed by the bare metal // operator. The Namespace is optional; it will default to the Machine's @@ -74,14 +76,22 @@ type Image struct { Checksum string `json:"checksum"` } +// Custom deploy is a description of a customized deploy process. +type CustomDeploy struct { + // Custom deploy method name. + // This name is specific to the deploy ramdisk used. If you don't have + // a custom deploy ramdisk, you shouldn't use CustomDeploy. + Method string `json:"method"` +} + // IsValid returns an error if the object is not valid, otherwise nil. The // string representation of the error is suitable for human consumption. func (s *BareMetalMachineProviderSpec) IsValid() error { missing := []string{} - if s.Image.URL == "" { + if s.CustomDeploy.Method == "" && s.Image.URL == "" { missing = append(missing, "Image.URL") } - if s.Image.Checksum == "" { + if s.CustomDeploy.Method == "" && s.Image.Checksum == "" { missing = append(missing, "Image.Checksum") } if len(missing) > 0 { diff --git a/vendor/github.com/metal3-io/cluster-api-provider-baremetal/pkg/apis/baremetal/v1alpha1/baremetalmachineproviderstatus_types.go b/vendor/github.com/openshift/cluster-api-provider-baremetal/pkg/apis/baremetal/v1alpha1/baremetalmachineproviderstatus_types.go similarity index 98% rename from vendor/github.com/metal3-io/cluster-api-provider-baremetal/pkg/apis/baremetal/v1alpha1/baremetalmachineproviderstatus_types.go rename to vendor/github.com/openshift/cluster-api-provider-baremetal/pkg/apis/baremetal/v1alpha1/baremetalmachineproviderstatus_types.go index 122ba5f7b55..d1e6e296425 100644 --- a/vendor/github.com/metal3-io/cluster-api-provider-baremetal/pkg/apis/baremetal/v1alpha1/baremetalmachineproviderstatus_types.go +++ b/vendor/github.com/openshift/cluster-api-provider-baremetal/pkg/apis/baremetal/v1alpha1/baremetalmachineproviderstatus_types.go @@ -24,7 +24,6 @@ import ( // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object // BareMetalMachineProviderStatus is the Schema for the baremetalmachineproviderstatuses API -// +k8s:openapi-gen=true type BareMetalMachineProviderStatus struct { metav1.TypeMeta `json:",inline"` metav1.ObjectMeta `json:"metadata,omitempty"` diff --git a/vendor/github.com/metal3-io/cluster-api-provider-baremetal/pkg/apis/baremetal/v1alpha1/doc.go b/vendor/github.com/openshift/cluster-api-provider-baremetal/pkg/apis/baremetal/v1alpha1/doc.go similarity index 92% rename from vendor/github.com/metal3-io/cluster-api-provider-baremetal/pkg/apis/baremetal/v1alpha1/doc.go rename to vendor/github.com/openshift/cluster-api-provider-baremetal/pkg/apis/baremetal/v1alpha1/doc.go index e88a2570dfc..f8b60a79aca 100644 --- a/vendor/github.com/metal3-io/cluster-api-provider-baremetal/pkg/apis/baremetal/v1alpha1/doc.go +++ b/vendor/github.com/openshift/cluster-api-provider-baremetal/pkg/apis/baremetal/v1alpha1/doc.go @@ -17,7 +17,7 @@ limitations under the License. // Package v1alpha1 contains API Schema definitions for the baremetal v1alpha1 API group // +k8s:openapi-gen=true // +k8s:deepcopy-gen=package,register -// +k8s:conversion-gen=github.com/metal3-io/cluster-api-provider-baremetal/pkg/apis/baremetal +// +k8s:conversion-gen=github.com/openshift/cluster-api-provider-baremetal/pkg/apis/baremetal // +k8s:defaulter-gen=TypeMeta // +groupName=baremetal.cluster.k8s.io package v1alpha1 diff --git a/vendor/github.com/metal3-io/cluster-api-provider-baremetal/pkg/apis/baremetal/v1alpha1/register.go b/vendor/github.com/openshift/cluster-api-provider-baremetal/pkg/apis/baremetal/v1alpha1/register.go similarity index 96% rename from vendor/github.com/metal3-io/cluster-api-provider-baremetal/pkg/apis/baremetal/v1alpha1/register.go rename to vendor/github.com/openshift/cluster-api-provider-baremetal/pkg/apis/baremetal/v1alpha1/register.go index ffbae771a94..0d02a758131 100644 --- a/vendor/github.com/metal3-io/cluster-api-provider-baremetal/pkg/apis/baremetal/v1alpha1/register.go +++ b/vendor/github.com/openshift/cluster-api-provider-baremetal/pkg/apis/baremetal/v1alpha1/register.go @@ -19,7 +19,7 @@ limitations under the License. // Package v1alpha1 contains API Schema definitions for the baremetal v1alpha1 API group // +k8s:openapi-gen=true // +k8s:deepcopy-gen=package,register -// +k8s:conversion-gen=github.com/metal3-io/cluster-api-provider-baremetal/pkg/apis/baremetal +// +k8s:conversion-gen=github.com/openshift/cluster-api-provider-baremetal/pkg/apis/baremetal // +k8s:defaulter-gen=TypeMeta // +groupName=baremetal.cluster.k8s.io package v1alpha1 diff --git a/vendor/github.com/metal3-io/cluster-api-provider-baremetal/pkg/apis/baremetal/v1alpha1/zz_generated.deepcopy.go b/vendor/github.com/openshift/cluster-api-provider-baremetal/pkg/apis/baremetal/v1alpha1/zz_generated.deepcopy.go similarity index 91% rename from vendor/github.com/metal3-io/cluster-api-provider-baremetal/pkg/apis/baremetal/v1alpha1/zz_generated.deepcopy.go rename to vendor/github.com/openshift/cluster-api-provider-baremetal/pkg/apis/baremetal/v1alpha1/zz_generated.deepcopy.go index 81d9c6a3e4d..55210b24659 100644 --- a/vendor/github.com/metal3-io/cluster-api-provider-baremetal/pkg/apis/baremetal/v1alpha1/zz_generated.deepcopy.go +++ b/vendor/github.com/openshift/cluster-api-provider-baremetal/pkg/apis/baremetal/v1alpha1/zz_generated.deepcopy.go @@ -15,12 +15,13 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ -// Code generated by main. DO NOT EDIT. + +// Code generated by controller-gen. DO NOT EDIT. package v1alpha1 import ( - v1 "k8s.io/api/core/v1" + "k8s.io/api/core/v1" runtime "k8s.io/apimachinery/pkg/runtime" ) @@ -30,13 +31,13 @@ func (in *BareMetalMachineProviderSpec) DeepCopyInto(out *BareMetalMachineProvid out.TypeMeta = in.TypeMeta in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) out.Image = in.Image + out.CustomDeploy = in.CustomDeploy if in.UserData != nil { in, out := &in.UserData, &out.UserData *out = new(v1.SecretReference) **out = **in } in.HostSelector.DeepCopyInto(&out.HostSelector) - return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BareMetalMachineProviderSpec. @@ -61,7 +62,7 @@ func (in *BareMetalMachineProviderSpec) DeepCopyObject() runtime.Object { func (in *BareMetalMachineProviderSpecList) DeepCopyInto(out *BareMetalMachineProviderSpecList) { *out = *in out.TypeMeta = in.TypeMeta - out.ListMeta = in.ListMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) if in.Items != nil { in, out := &in.Items, &out.Items *out = make([]BareMetalMachineProviderSpec, len(*in)) @@ -69,7 +70,6 @@ func (in *BareMetalMachineProviderSpecList) DeepCopyInto(out *BareMetalMachinePr (*in)[i].DeepCopyInto(&(*out)[i]) } } - return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BareMetalMachineProviderSpecList. @@ -95,7 +95,6 @@ func (in *BareMetalMachineProviderStatus) DeepCopyInto(out *BareMetalMachineProv *out = *in out.TypeMeta = in.TypeMeta in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BareMetalMachineProviderStatus. @@ -120,7 +119,7 @@ func (in *BareMetalMachineProviderStatus) DeepCopyObject() runtime.Object { func (in *BareMetalMachineProviderStatusList) DeepCopyInto(out *BareMetalMachineProviderStatusList) { *out = *in out.TypeMeta = in.TypeMeta - out.ListMeta = in.ListMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) if in.Items != nil { in, out := &in.Items, &out.Items *out = make([]BareMetalMachineProviderStatus, len(*in)) @@ -128,7 +127,6 @@ func (in *BareMetalMachineProviderStatusList) DeepCopyInto(out *BareMetalMachine (*in)[i].DeepCopyInto(&(*out)[i]) } } - return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BareMetalMachineProviderStatusList. @@ -149,6 +147,21 @@ func (in *BareMetalMachineProviderStatusList) DeepCopyObject() runtime.Object { return nil } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CustomDeploy) DeepCopyInto(out *CustomDeploy) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CustomDeploy. +func (in *CustomDeploy) DeepCopy() *CustomDeploy { + if in == nil { + return nil + } + out := new(CustomDeploy) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *HostSelector) DeepCopyInto(out *HostSelector) { *out = *in @@ -166,7 +179,6 @@ func (in *HostSelector) DeepCopyInto(out *HostSelector) { (*in)[i].DeepCopyInto(&(*out)[i]) } } - return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HostSelector. @@ -187,7 +199,6 @@ func (in *HostSelectorRequirement) DeepCopyInto(out *HostSelectorRequirement) { *out = make([]string, len(*in)) copy(*out, *in) } - return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HostSelectorRequirement. @@ -203,7 +214,6 @@ func (in *HostSelectorRequirement) DeepCopy() *HostSelectorRequirement { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Image) DeepCopyInto(out *Image) { *out = *in - return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Image. diff --git a/vendor/golang.org/x/lint/README.md b/vendor/golang.org/x/lint/README.md index 4968b13aef7..989b1dc2380 100644 --- a/vendor/golang.org/x/lint/README.md +++ b/vendor/golang.org/x/lint/README.md @@ -1,5 +1,10 @@ +**NOTE:** Golint is [deprecated and frozen](https://github.com/golang/go/issues/38968). +There's no drop-in replacement for it, but tools such as [Staticcheck](https://staticcheck.io/) +and `go vet` should be used instead. + Golint is a linter for Go source code. +[![Go Reference](https://pkg.go.dev/badge/golang.org/x/lint.svg)](https://pkg.go.dev/golang.org/x/lint) [![Build Status](https://travis-ci.org/golang/lint.svg?branch=master)](https://travis-ci.org/golang/lint) ## Installation diff --git a/vendor/modules.txt b/vendor/modules.txt index 2d16de1708b..4812fbce6aa 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -1609,10 +1609,6 @@ github.com/metal3-io/baremetal-operator/apis/metal3.io/v1alpha1 # github.com/metal3-io/baremetal-operator/pkg/hardwareutils v0.0.0 => github.com/openshift/baremetal-operator/pkg/hardwareutils v0.0.0-20211201170610-92ffa60c683d ## explicit; go 1.16 github.com/metal3-io/baremetal-operator/pkg/hardwareutils/bmc -# github.com/metal3-io/cluster-api-provider-baremetal v0.0.0 => github.com/openshift/cluster-api-provider-baremetal v0.0.0-20190821174549-a2a477909c1d -## explicit -github.com/metal3-io/cluster-api-provider-baremetal/pkg/apis -github.com/metal3-io/cluster-api-provider-baremetal/pkg/apis/baremetal/v1alpha1 # github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b ## explicit github.com/mgutz/ansi @@ -1693,7 +1689,7 @@ github.com/opencontainers/go-digest ## explicit github.com/opencontainers/image-spec/specs-go github.com/opencontainers/image-spec/specs-go/v1 -# github.com/openshift-metal3/terraform-provider-ironic v0.2.6 +# github.com/openshift-metal3/terraform-provider-ironic v0.2.7 ## explicit; go 1.13 github.com/openshift-metal3/terraform-provider-ironic/ironic # github.com/openshift/api v0.0.0-20211119153416-313e51eab8c8 @@ -1724,7 +1720,11 @@ github.com/openshift/cluster-api/pkg/apis/machine/v1beta1 ## explicit; go 1.16 github.com/openshift/cluster-api-provider-alibaba/pkg/apis github.com/openshift/cluster-api-provider-alibaba/pkg/apis/alibabacloudprovider/v1beta1 -# github.com/openshift/cluster-api-provider-gcp v0.0.1-0.20201203141909-4dc702fd57a5 +# github.com/openshift/cluster-api-provider-baremetal v0.0.0-20210924143856-c2d3ece4da38 +## explicit; go 1.16 +github.com/openshift/cluster-api-provider-baremetal/pkg/apis +github.com/openshift/cluster-api-provider-baremetal/pkg/apis/baremetal/v1alpha1 +# github.com/openshift/cluster-api-provider-gcp v0.0.1-0.20210615203611-a02074e8d5bb ## explicit; go 1.15 github.com/openshift/cluster-api-provider-gcp/pkg/apis github.com/openshift/cluster-api-provider-gcp/pkg/apis/gcpprovider/v1beta1 @@ -2445,7 +2445,7 @@ golang.org/x/crypto/ssh/agent golang.org/x/crypto/ssh/internal/bcrypt_pbkdf golang.org/x/crypto/ssh/knownhosts golang.org/x/crypto/ssh/terminal -# golang.org/x/lint v0.0.0-20200302205851-738671d3881b +# golang.org/x/lint v0.0.0-20210508222113-6edffad5e616 ## explicit; go 1.11 golang.org/x/lint golang.org/x/lint/golint @@ -3304,7 +3304,6 @@ sigs.k8s.io/yaml # github.com/metal3-io/baremetal-operator => github.com/openshift/baremetal-operator v0.0.0-20211201170610-92ffa60c683d # github.com/metal3-io/baremetal-operator/apis => github.com/openshift/baremetal-operator/apis v0.0.0-20211201170610-92ffa60c683d # github.com/metal3-io/baremetal-operator/pkg/hardwareutils => github.com/openshift/baremetal-operator/pkg/hardwareutils v0.0.0-20211201170610-92ffa60c683d -# github.com/metal3-io/cluster-api-provider-baremetal => github.com/openshift/cluster-api-provider-baremetal v0.0.0-20190821174549-a2a477909c1d # github.com/openshift/client-go => github.com/openshift/client-go v0.0.0-20200929181438-91d71ef2122c # github.com/openshift/machine-config-operator => github.com/openshift/machine-config-operator v0.0.1-0.20201009041932-4fe8559913b8 # github.com/spf13/afero => github.com/spf13/afero v1.2.2