Skip to content

Commit d8a5cdd

Browse files
committed
CORS-3250: images: use pre-built KAS/etcd binaries
We copy pre-built binaries from the `-artifacts` images when we want statically linked binaries and from the regular etcd/hyperkube images for dynamically linked binaries. This is necessary to have capi and capi providers included in the installer images both for CI and for the release payload.
1 parent adb699e commit d8a5cdd

File tree

7 files changed

+54
-5
lines changed

7 files changed

+54
-5
lines changed

images/baremetal/Dockerfile.ci

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,18 @@
11
# This Dockerfile is a used by CI to publish an installer image
22
# It builds an image containing openshift-install.
33

4+
# The binaries in these images are dynamically linked
5+
FROM registry.ci.openshift.org/ocp/4.16:etcd AS etcd
6+
FROM registry.ci.openshift.org/ocp/4.16:hyperkube AS kas
7+
48
FROM registry.ci.openshift.org/ocp/builder:rhel-9-golang-1.21-openshift-4.16 AS builder
59
ARG TAGS="baremetal fipscapable"
610
WORKDIR /go/src/github.com/openshift/installer
711
COPY . .
12+
COPY --from=etcd /usr/bin/etcd /usr/bin/etcd
13+
COPY --from=kas /usr/bin/kube-apiserver /usr/bin/kube-apiserver
14+
RUN mkdir -p cluster-api/bin/$(go env GOOS)_$(go env GOHOSTARCH) && \
15+
mv /usr/bin/etcd /usr/bin/kube-apiserver -t cluster-api/bin/$(go env GOOS)_$(go env GOHOSTARCH)/
816
RUN DEFAULT_ARCH="$(go env GOHOSTARCH)" hack/build.sh
917
RUN DEFAULT_ARCH="$(go env GOHOSTARCH)" hack/build-node-joiner.sh
1018

images/installer-altinfra/Dockerfile.ci

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,21 @@
77
# solutions. Once all providers have alternate implementations, this image will
88
# not be needed.
99

10-
FROM registry.ci.openshift.org/ocp/4.16:etcd AS etcd
11-
FROM registry.ci.openshift.org/ocp/4.16:hyperkube AS kas
10+
# We copy from the -artifacts images because they are statically linked
11+
FROM registry.ci.openshift.org/ocp/4.16:installer-kube-apiserver-artifacts AS kas-artifacts
12+
FROM registry.ci.openshift.org/ocp/4.16:installer-etcd-artifacts AS etcd-artifacts
1213

1314
FROM registry.ci.openshift.org/ocp/builder:rhel-9-golang-1.21-openshift-4.16 AS builder
1415
# FIPS support is offered via the baremetal-installer image
1516
ENV GO_COMPLIANCE_EXCLUDE=".*"
1617
ARG TAGS="altinfra"
1718
ARG OPENSHIFT_INSTALL_CLUSTER_API=""
1819
WORKDIR /go/src/github.com/openshift/installer
19-
COPY --from=etcd /usr/bin/etcd /usr/bin/etcd
20-
COPY --from=kas /usr/bin/kube-apiserver /usr/bin/kube-apiserver
2120
COPY . .
21+
COPY --from=kas-artifacts /usr/share/openshift/ cluster-api/bin/
22+
COPY --from=etcd-artifacts /usr/share/openshift/ cluster-api/bin/
2223
RUN mkdir -p cluster-api/bin/$(go env GOOS)_$(go env GOHOSTARCH) && \
23-
mv /usr/bin/etcd /usr/bin/kube-apiserver -t cluster-api/bin/$(go env GOOS)_$(go env GOHOSTARCH)/
24+
mv cluster-api/bin/$(go env GOOS)/$(go env GOHOSTARCH)/* -t cluster-api/bin/$(go env GOOS)_$(go env GOHOSTARCH)/
2425
RUN DEFAULT_ARCH="$(go env GOHOSTARCH)" hack/build.sh
2526
RUN go run -mod=vendor hack/build-coreos-manifest.go
2627

images/installer-artifacts/Dockerfile.rhel

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
# the installer layered on top of the cluster-native Linux installer image.
33

44
FROM registry.ci.openshift.org/ocp/4.16:installer-terraform-providers AS providers
5+
# We copy from the -artifacts images because they are statically linked
6+
FROM registry.ci.openshift.org/ocp/4.16:installer-kube-apiserver-artifacts AS kas-artifacts
7+
FROM registry.ci.openshift.org/ocp/4.16:installer-etcd-artifacts AS etcd-artifacts
58

69
# FIPS support is offered via the baremetal-installer image
710

@@ -11,6 +14,8 @@ ARG TAGS=""
1114
WORKDIR /go/src/github.com/openshift/installer
1215
COPY . .
1316
COPY --from=providers /go/src/github.com/openshift/installer/terraform/bin/darwin_amd64 terraform/bin/darwin_amd64
17+
COPY --from=kas-artifacts /usr/share/openshift/darwin/amd64 cluster-api/bin/darwin_amd64
18+
COPY --from=etcd-artifacts /usr/share/openshift/darwin/amd64 cluster-api/bin/darwin_amd64
1419
RUN GOOS=darwin GOARCH=amd64 DEFAULT_ARCH="$(go env GOHOSTARCH)" hack/build.sh
1520

1621
FROM registry.ci.openshift.org/ocp/builder:rhel-9-golang-1.21-openshift-4.16 AS macarmbuilder
@@ -19,6 +24,8 @@ ARG TAGS=""
1924
WORKDIR /go/src/github.com/openshift/installer
2025
COPY . .
2126
COPY --from=providers /go/src/github.com/openshift/installer/terraform/bin/darwin_arm64 terraform/bin/darwin_arm64
27+
COPY --from=kas-artifacts /usr/share/openshift/darwin/arm64 cluster-api/bin/darwin_arm64
28+
COPY --from=etcd-artifacts /usr/share/openshift/darwin/arm64 cluster-api/bin/darwin_arm64
2229
RUN GOOS=darwin GOARCH=arm64 DEFAULT_ARCH="$(go env GOHOSTARCH)" hack/build.sh
2330

2431
FROM registry.ci.openshift.org/ocp/builder:rhel-9-golang-1.21-openshift-4.16 AS linuxbuilder
@@ -27,6 +34,8 @@ ARG TAGS=""
2734
WORKDIR /go/src/github.com/openshift/installer
2835
COPY . .
2936
COPY --from=providers /go/src/github.com/openshift/installer/terraform/bin/linux_amd64 terraform/bin/linux_amd64
37+
COPY --from=kas-artifacts /usr/share/openshift/linux/amd64 cluster-api/bin/linux_amd64
38+
COPY --from=etcd-artifacts /usr/share/openshift/linux/amd64 cluster-api/bin/linux_amd64
3039
RUN GOOS=linux GOARCH=amd64 DEFAULT_ARCH="$(go env GOHOSTARCH)" hack/build.sh
3140

3241
FROM registry.ci.openshift.org/ocp/builder:rhel-9-golang-1.21-openshift-4.16 AS linuxarmbuilder
@@ -35,6 +44,8 @@ ARG TAGS=""
3544
WORKDIR /go/src/github.com/openshift/installer
3645
COPY . .
3746
COPY --from=providers /go/src/github.com/openshift/installer/terraform/bin/linux_arm64 terraform/bin/linux_arm64
47+
COPY --from=kas-artifacts /usr/share/openshift/linux/arm64 cluster-api/bin/linux_arm64
48+
COPY --from=etcd-artifacts /usr/share/openshift/linux/arm64 cluster-api/bin/linux_arm64
3849
RUN GOOS=linux GOARCH=arm64 DEFAULT_ARCH="$(go env GOHOSTARCH)" hack/build.sh
3950

4051
FROM registry.ci.openshift.org/ocp/builder:rhel-9-golang-1.21-openshift-4.16 AS builder

images/installer/Dockerfile.ci

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
# It builds an image containing only the openshift-install.
33

44
FROM registry.ci.openshift.org/ocp/4.16:installer-terraform-providers AS providers
5+
# We copy from the -artifacts images because they are statically linked
6+
FROM registry.ci.openshift.org/ocp/4.16:installer-kube-apiserver-artifacts AS kas-artifacts
7+
FROM registry.ci.openshift.org/ocp/4.16:installer-etcd-artifacts AS etcd-artifacts
58

69
FROM registry.ci.openshift.org/ocp/builder:rhel-9-golang-1.21-openshift-4.16 AS builder
710
# FIPS support is offered via the baremetal-installer image
@@ -10,6 +13,10 @@ ARG TAGS=""
1013
WORKDIR /go/src/github.com/openshift/installer
1114
COPY . .
1215
COPY --from=providers /go/src/github.com/openshift/installer/terraform/bin/ terraform/bin/
16+
COPY --from=kas-artifacts /usr/share/openshift/ cluster-api/bin/
17+
COPY --from=etcd-artifacts /usr/share/openshift/ cluster-api/bin/
18+
RUN mkdir -p cluster-api/bin/$(go env GOOS)_$(go env GOHOSTARCH) && \
19+
mv cluster-api/bin/$(go env GOOS)/$(go env GOHOSTARCH)/* -t cluster-api/bin/$(go env GOOS)_$(go env GOHOSTARCH)/
1320
RUN DEFAULT_ARCH="$(go env GOHOSTARCH)" hack/build.sh
1421
RUN go run -mod=vendor hack/build-coreos-manifest.go
1522

images/installer/Dockerfile.upi.ci

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
# It also contains the `upi` directory that contains various terraform and cloud formation templates that are used to create infrastructure resources.
44

55
FROM registry.ci.openshift.org/ocp/4.16:installer-terraform-providers as providers
6+
# We copy from the -artifacts images because they are statically linked
7+
FROM registry.ci.openshift.org/ocp/4.16:installer-kube-apiserver-artifacts AS kas-artifacts
8+
FROM registry.ci.openshift.org/ocp/4.16:installer-etcd-artifacts AS etcd-artifacts
69

710
FROM registry.ci.openshift.org/ocp/builder:rhel-9-golang-1.21-openshift-4.16 AS builder
811
# FIPS support is offered via the baremetal-installer image
@@ -11,6 +14,10 @@ ARG TAGS=""
1114
WORKDIR /go/src/github.com/openshift/installer
1215
COPY . .
1316
COPY --from=providers /go/src/github.com/openshift/installer/terraform/bin/ terraform/bin/
17+
COPY --from=kas-artifacts /usr/share/openshift/ cluster-api/bin/
18+
COPY --from=etcd-artifacts /usr/share/openshift/ cluster-api/bin/
19+
RUN mkdir -p cluster-api/bin/$(go env GOOS)_$(go env GOHOSTARCH) && \
20+
mv cluster-api/bin/$(go env GOOS)/$(go env GOHOSTARCH)/* -t cluster-api/bin/$(go env GOOS)_$(go env GOHOSTARCH)/
1421
RUN DEFAULT_ARCH="$(go env GOHOSTARCH)" hack/build.sh
1522

1623
FROM registry.ci.openshift.org/ocp/4.16:cli as cli

images/libvirt/Dockerfile.ci

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,18 @@
22
# It builds an image containing openshift-install and nss-wrapper for remote deployments, as well as the google cloud-sdk for nested GCE environments and
33
# oc for getting assets from an existing cluster to spin up multi-architecture compute clusters on libvirt.
44

5+
# The binaries in these images are dynamically linked
6+
FROM registry.ci.openshift.org/ocp/4.16:etcd AS etcd
7+
FROM registry.ci.openshift.org/ocp/4.16:hyperkube AS kas
8+
59
FROM registry.ci.openshift.org/ocp/builder:rhel-9-golang-1.21-openshift-4.16 AS builder
610
ARG TAGS="libvirt fipscapable"
711
WORKDIR /go/src/github.com/openshift/installer
812
COPY . .
13+
COPY --from=etcd /usr/bin/etcd /usr/bin/etcd
14+
COPY --from=kas /usr/bin/kube-apiserver /usr/bin/kube-apiserver
15+
RUN mkdir -p cluster-api/bin/$(go env GOOS)_$(go env GOHOSTARCH) && \
16+
mv /usr/bin/etcd /usr/bin/kube-apiserver -t cluster-api/bin/$(go env GOOS)_$(go env GOHOSTARCH)/
917
RUN DEFAULT_ARCH="$(go env GOHOSTARCH)" hack/build.sh
1018

1119
FROM registry.ci.openshift.org/ocp/4.16:cli as cli

images/openstack/Dockerfile.ci

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
# This Dockerfile is used by CI to test using OpenShift Installer against an OpenStack cloud.
22
# It builds an image containing the openshift-install command as well as the openstack cli.
33
FROM registry.ci.openshift.org/ocp/4.16:installer-terraform-providers as providers
4+
# We copy from the -artifacts images because they are statically linked
5+
FROM registry.ci.openshift.org/ocp/4.16:installer-kube-apiserver-artifacts AS kas-artifacts
6+
FROM registry.ci.openshift.org/ocp/4.16:installer-etcd-artifacts AS etcd-artifacts
47

58
FROM registry.ci.openshift.org/ocp/builder:rhel-9-golang-1.21-openshift-4.16 AS builder
69
# FIPS support is offered via the baremetal-installer image
@@ -9,6 +12,10 @@ ARG TAGS=""
912
WORKDIR /go/src/github.com/openshift/installer
1013
COPY . .
1114
COPY --from=providers /go/src/github.com/openshift/installer/terraform/bin/ terraform/bin/
15+
COPY --from=kas-artifacts /usr/share/openshift/ cluster-api/bin/
16+
COPY --from=etcd-artifacts /usr/share/openshift/ cluster-api/bin/
17+
RUN mkdir -p cluster-api/bin/$(go env GOOS)_$(go env GOHOSTARCH) && \
18+
mv cluster-api/bin/$(go env GOOS)/$(go env GOHOSTARCH)/* -t cluster-api/bin/$(go env GOOS)_$(go env GOHOSTARCH)/
1219
RUN DEFAULT_ARCH="$(go env GOHOSTARCH)" hack/build.sh
1320

1421
FROM registry.ci.openshift.org/ocp/4.16:cli AS cli

0 commit comments

Comments
 (0)