forked from openstack-k8s-operators/openstack-operator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
custom-bundle.Dockerfile
126 lines (108 loc) · 5.82 KB
/
custom-bundle.Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
ARG GOLANG_CTX=golang:1.19
ARG INFRA_BUNDLE=quay.io/openstack-k8s-operators/infra-operator-bundle:latest
ARG KEYSTONE_BUNDLE=quay.io/openstack-k8s-operators/keystone-operator-bundle:latest
ARG MARIADB_BUNDLE=quay.io/openstack-k8s-operators/mariadb-operator-bundle:latest
ARG RABBITMQ_BUNDLE=quay.io/openstack-k8s-operators/rabbitmq-cluster-operator-bundle:latest
ARG PLACEMENT_BUNDLE=quay.io/openstack-k8s-operators/placement-operator-bundle:latest
ARG OVN_BUNDLE=quay.io/openstack-k8s-operators/ovn-operator-bundle:latest
ARG OVS_BUNDLE=quay.io/openstack-k8s-operators/ovs-operator-bundle:latest
ARG NEUTRON_BUNDLE=quay.io/openstack-k8s-operators/neutron-operator-bundle:latest
ARG ANSIBLEEE_BUNDLE=quay.io/openstack-k8s-operators/openstack-ansibleee-operator-bundle:latest
ARG DATAPLANE_BUNDLE=quay.io/openstack-k8s-operators/dataplane-operator-bundle:latest
ARG NOVA_BUNDLE=quay.io/openstack-k8s-operators/nova-operator-bundle:latest
ARG IRONIC_BUNDLE=quay.io/openstack-k8s-operators/ironic-operator-bundle:latest
ARG BAREMETAL_BUNDLE=quay.io/openstack-k8s-operators/openstack-baremetal-operator-bundle:latest
# we obtain the needed ENV vars containing defaults from storage operators
ARG OPENSTACK_STORAGE_BUNDLE=quay.io/openstack-k8s-operators/openstack-operator-storage-bundle:latest
ARG HORIZON_BUNDLE=quay.io/openstack-k8s-operators/horizon-operator-bundle:latest
# Build the manager binary
FROM $GOLANG_CTX as builder
WORKDIR /workspace
# Copy the Go Modules manifests
COPY go.mod go.mod
COPY go.sum go.sum
COPY apis/ apis/
# cache deps before building and copying source so that we don't need to re-download as much
# and so that source changes don't invalidate our downloaded layer
RUN go mod download
# Copy the go source
COPY cmd/csv-merger/csv-merger.go csv-merger.go
COPY pkg/ pkg/
# Build
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -o csv-merger csv-merger.go
FROM $INFRA_BUNDLE as infra-bundle
FROM $KEYSTONE_BUNDLE as keystone-bundle
FROM $MARIADB_BUNDLE as mariadb-bundle
FROM $RABBITMQ_BUNDLE as rabbitmq-bundle
FROM $PLACEMENT_BUNDLE as placement-bundle
FROM $OVN_BUNDLE as ovn-bundle
FROM $OVS_BUNDLE as ovs-bundle
FROM $NEUTRON_BUNDLE as neutron-bundle
FROM $ANSIBLEEE_BUNDLE as openstack-ansibleee-bundle
FROM $DATAPLANE_BUNDLE as dataplane-bundle
FROM $NOVA_BUNDLE as nova-bundle
FROM $IRONIC_BUNDLE as ironic-bundle
FROM $BAREMETAL_BUNDLE as baremetal-bundle
FROM $OPENSTACK_STORAGE_BUNDLE as openstack-storage-bundle
FROM $HORIZON_BUNDLE as horizon-bundle
FROM $GOLANG_CTX as merger
WORKDIR /workspace
COPY --from=builder /workspace/csv-merger .
# local operator manifests
COPY bundle/manifests /manifests/
# Custom Manifests
COPY --from=keystone-bundle /manifests/* /manifests/
COPY --from=mariadb-bundle /manifests/* /manifests/
COPY --from=rabbitmq-bundle /manifests/* /manifests/
COPY --from=infra-bundle /manifests/* /manifests/
COPY --from=placement-bundle /manifests/* /manifests/
COPY --from=ovn-bundle /manifests/* /manifests/
COPY --from=ovs-bundle /manifests/* /manifests/
COPY --from=neutron-bundle /manifests/* /manifests/
COPY --from=openstack-ansibleee-bundle /manifests/* /manifests/
COPY --from=dataplane-bundle /manifests/* /manifests/
COPY --from=nova-bundle /manifests/* /manifests/
COPY --from=ironic-bundle /manifests/* /manifests/
COPY --from=baremetal-bundle /manifests/* /manifests/
COPY --from=openstack-storage-bundle /env-vars.yaml /storage-env-vars.yaml
COPY --from=horizon-bundle /manifests/* /manifests/
RUN /workspace/csv-merger \
--import-env-files=/storage-env-vars.yaml \
--mariadb-csv=/manifests/mariadb-operator.clusterserviceversion.yaml \
--rabbitmq-csv=/manifests/cluster-operator.clusterserviceversion.yaml \
--infra-csv=/manifests/infra-operator.clusterserviceversion.yaml \
--keystone-csv=/manifests/keystone-operator.clusterserviceversion.yaml \
--placement-csv=/manifests/placement-operator.clusterserviceversion.yaml \
--ovn-csv=/manifests/ovn-operator.clusterserviceversion.yaml \
--ovs-csv=/manifests/ovs-operator.clusterserviceversion.yaml \
--neutron-csv=/manifests/neutron-operator.clusterserviceversion.yaml \
--ansibleee-csv=/manifests/openstack-ansibleee-operator.clusterserviceversion.yaml \
--dataplane-csv=/manifests/dataplane-operator.clusterserviceversion.yaml \
--nova-csv=/manifests/nova-operator.clusterserviceversion.yaml \
--ironic-csv=/manifests/ironic-operator.clusterserviceversion.yaml \
--baremetal-csv=/manifests/openstack-baremetal-operator.clusterserviceversion.yaml \
--horizon-csv=/manifests/horizon-operator.clusterserviceversion.yaml \
--base-csv=/manifests/openstack-operator.clusterserviceversion.yaml | tee /openstack-operator.clusterserviceversion.yaml.new
# remove all individual operator CSV's
RUN rm /manifests/*clusterserviceversion.yaml
### Put everything together
FROM scratch
# Core bundle labels.
LABEL operators.operatorframework.io.bundle.mediatype.v1=registry+v1
LABEL operators.operatorframework.io.bundle.manifests.v1=manifests/
LABEL operators.operatorframework.io.bundle.metadata.v1=metadata/
LABEL operators.operatorframework.io.bundle.package.v1=openstack-operator
LABEL operators.operatorframework.io.bundle.channels.v1=alpha
LABEL operators.operatorframework.io.metrics.builder=operator-sdk-v1.22.1
LABEL operators.operatorframework.io.metrics.mediatype.v1=metrics+v1
LABEL operators.operatorframework.io.metrics.project_layout=go.kubebuilder.io/v3
# Labels for testing.
LABEL operators.operatorframework.io.test.mediatype.v1=scorecard+v1
LABEL operators.operatorframework.io.test.config.v1=tests/scorecard/
# Copy files to locations specified by labels.
COPY bundle/metadata /metadata/
COPY bundle/tests/scorecard /tests/scorecard/
# copy in manifests from operators
COPY --from=merger /manifests /manifests/
# overwrite with the final merged CSV
COPY --from=merger /openstack-operator.clusterserviceversion.yaml.new /manifests/openstack-operator.clusterserviceversion.yaml