Skip to content

Commit 0b73b39

Browse files
committed
UPSTREAM: <carry>: Add manifest generator tool
1 parent 2f03b8c commit 0b73b39

File tree

8 files changed

+536
-8
lines changed

8 files changed

+536
-8
lines changed

openshift/Dockerfile.openshift

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,16 @@ WORKDIR /build
44
COPY . .
55
RUN GO111MODULE=on CGO_ENABLED=0 GOOS=${GOOS} GOPROXY=${GOPROXY} go build \
66
-ldflags="-w -s -X 'main.version=${VERSION}'" \
7-
-o=cluster-api-provider-azure-controller-manager \
7+
-o=manager \
88
main.go
99

1010
FROM registry.ci.openshift.org/ocp/4.18:base-rhel9
1111

1212
LABEL description="Cluster API Provider Azure Controller Manager"
1313

14-
COPY --from=builder /build/cluster-api-provider-azure-controller-manager /bin/cluster-api-provider-azure-controller-manager
14+
COPY --from=builder /build/manager /bin/manager
15+
COPY --from=builder /build/openshift/manifests /manifests
1516

16-
ENTRYPOINT [ "/bin/cluster-api-provider-azure-controller-manager" ]
17+
ENTRYPOINT [ "/bin/manager" ]
1718

1819
LABEL io.openshift.release.operator true

openshift/Makefile

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,25 @@
1-
include ../Makefile
1+
BIN_DIR := bin
2+
TOOLS_DIR := tools
23

3-
RELEASE_DIR := openshift
4-
GO_INSTALL = ../scripts/go_install.sh
4+
$(RELEASE_DIR):
5+
mkdir -p $(RELEASE_DIR)/
6+
7+
KUSTOMIZE := tools/bin/kustomize
8+
MANIFESTS_GEN := go run ./vendor/github.com/openshift/cluster-capi-operator/manifests-gen/
9+
10+
$(KUSTOMIZE):
11+
./tools/ensure-kustomize.sh
12+
13+
.PHONY: check-env
14+
check-env:
15+
ifndef PROVIDER_VERSION
16+
$(error PROVIDER_VERSION is undefined)
17+
endif
518

619
.PHONY: ocp-manifests
7-
ocp-manifests: $(KUSTOMIZE) ## Builds openshift specific manifests
8-
$(KUSTOMIZE) build ../config/default > infrastructure-components.yaml
20+
ocp-manifests: $(RELEASE_DIR) $(KUSTOMIZE) check-env ## Builds openshift specific manifests
21+
# Build core-components.
22+
$(KUSTOMIZE) build > infrastructure-components.yaml
23+
# Generate provider manifests.
24+
# TODO: load the provider-version dynamically at rebase time when this is invoked by the Rebase Bot during one of its lifecycle hooks.
25+
cd tools && $(MANIFESTS_GEN) --provider-name "azure" --provider-type "InfrastructureProvider" --provider-version "${PROVIDER_VERSION}" --base-path "../../" --manifests-path "../manifests"

openshift/kustomization.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
apiVersion: kustomize.config.k8s.io/v1beta1
2+
kind: Kustomization
3+
4+
resources:
5+
- ../config/default

openshift/manifests/.gitkeep

Whitespace-only changes.

openshift/tools/ensure-kustomize.sh

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
#!/usr/bin/env bash
2+
3+
# Copyright 2019 The Kubernetes Authors.
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
17+
set -o errexit
18+
set -o nounset
19+
set -o pipefail
20+
21+
ROOT=$(dirname "$0")
22+
BIN_ROOT="${ROOT}/bin"
23+
24+
kustomize_version=4.5.2
25+
26+
goarch=amd64
27+
goos="unknown"
28+
if [[ "${OSTYPE}" == "linux"* ]]; then
29+
goos="linux"
30+
elif [[ "${OSTYPE}" == "darwin"* ]]; then
31+
goos="darwin"
32+
fi
33+
34+
if [[ "$goos" == "unknown" ]]; then
35+
echo "OS '$OSTYPE' not supported. Aborting." >&2
36+
exit 1
37+
fi
38+
39+
# Ensure the kustomize tool exists and is a viable version, or installs it
40+
verify_kustomize_version() {
41+
if ! [ -x "$(command -v "${BIN_ROOT}/kustomize")" ]; then
42+
echo "fetching kustomize@${kustomize_version}"
43+
if ! [ -d "${BIN_ROOT}" ]; then
44+
mkdir -p "${BIN_ROOT}"
45+
fi
46+
archive_name="kustomize-v${kustomize_version}.tar.gz"
47+
curl -sLo "${BIN_ROOT}/${archive_name}" https://github.com/kubernetes-sigs/kustomize/releases/download/kustomize%2Fv${kustomize_version}/kustomize_v${kustomize_version}_${goos}_${goarch}.tar.gz
48+
tar -zvxf "${BIN_ROOT}/${archive_name}" -C "${BIN_ROOT}/"
49+
chmod +x "${BIN_ROOT}/kustomize"
50+
rm "${BIN_ROOT}/${archive_name}"
51+
fi
52+
}
53+
54+
verify_kustomize_version

openshift/tools/go.mod

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
module tools
2+
3+
go 1.22.0
4+
5+
toolchain go1.22.7
6+
7+
require github.com/openshift/cluster-capi-operator/manifests-gen v0.0.0-20241031122839-87f4fd28a59e
8+
9+
require (
10+
github.com/MakeNowJust/heredoc v1.0.0 // indirect
11+
github.com/ProtonMail/go-crypto v0.0.0-20230217124315-7d5c6f04bbb8 // indirect
12+
github.com/adrg/xdg v0.5.0 // indirect
13+
github.com/beorn7/perks v1.0.1 // indirect
14+
github.com/blang/semver/v4 v4.0.0 // indirect
15+
github.com/cert-manager/cert-manager v1.14.5 // indirect
16+
github.com/cespare/xxhash/v2 v2.2.0 // indirect
17+
github.com/cloudflare/circl v1.3.7 // indirect
18+
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
19+
github.com/distribution/reference v0.6.0 // indirect
20+
github.com/drone/envsubst/v2 v2.0.0-20210730161058-179042472c46 // indirect
21+
github.com/emicklei/go-restful/v3 v3.12.1 // indirect
22+
github.com/evanphx/json-patch v5.7.0+incompatible // indirect
23+
github.com/evanphx/json-patch/v5 v5.9.0 // indirect
24+
github.com/fsnotify/fsnotify v1.7.0 // indirect
25+
github.com/go-errors/errors v1.4.2 // indirect
26+
github.com/go-logr/logr v1.4.2 // indirect
27+
github.com/go-openapi/jsonpointer v0.20.2 // indirect
28+
github.com/go-openapi/jsonreference v0.20.4 // indirect
29+
github.com/go-openapi/swag v0.22.7 // indirect
30+
github.com/gobuffalo/flect v1.0.2 // indirect
31+
github.com/gogo/protobuf v1.3.2 // indirect
32+
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
33+
github.com/golang/protobuf v1.5.4 // indirect
34+
github.com/google/gnostic-models v0.6.8 // indirect
35+
github.com/google/go-cmp v0.6.0 // indirect
36+
github.com/google/go-github/v53 v53.2.0 // indirect
37+
github.com/google/go-querystring v1.1.0 // indirect
38+
github.com/google/gofuzz v1.2.0 // indirect
39+
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect
40+
github.com/google/uuid v1.6.0 // indirect
41+
github.com/hashicorp/hcl v1.0.1-vault-5 // indirect
42+
github.com/imdario/mergo v0.3.16 // indirect
43+
github.com/josharian/intern v1.0.0 // indirect
44+
github.com/json-iterator/go v1.1.12 // indirect
45+
github.com/klauspost/compress v1.17.8 // indirect
46+
github.com/magiconair/properties v1.8.7 // indirect
47+
github.com/mailru/easyjson v0.7.7 // indirect
48+
github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0 // indirect
49+
github.com/mitchellh/mapstructure v1.5.0 // indirect
50+
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
51+
github.com/modern-go/reflect2 v1.0.2 // indirect
52+
github.com/monochromegane/go-gitignore v0.0.0-20200626010858-205db1a8cc00 // indirect
53+
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
54+
github.com/opencontainers/go-digest v1.0.0 // indirect
55+
github.com/pelletier/go-toml/v2 v2.2.2 // indirect
56+
github.com/pkg/errors v0.9.1 // indirect
57+
github.com/prometheus/client_golang v1.18.0 // indirect
58+
github.com/prometheus/client_model v0.6.0 // indirect
59+
github.com/prometheus/common v0.45.0 // indirect
60+
github.com/prometheus/procfs v0.12.0 // indirect
61+
github.com/sagikazarmark/locafero v0.4.0 // indirect
62+
github.com/sagikazarmark/slog-shim v0.1.0 // indirect
63+
github.com/sourcegraph/conc v0.3.0 // indirect
64+
github.com/spf13/afero v1.11.0 // indirect
65+
github.com/spf13/cast v1.6.0 // indirect
66+
github.com/spf13/pflag v1.0.5 // indirect
67+
github.com/spf13/viper v1.19.0 // indirect
68+
github.com/subosito/gotenv v1.6.0 // indirect
69+
github.com/xlab/treeprint v1.2.0 // indirect
70+
go.starlark.net v0.0.0-20230525235612-a134d8f9ddca // indirect
71+
go.uber.org/multierr v1.11.0 // indirect
72+
golang.org/x/crypto v0.25.0 // indirect
73+
golang.org/x/exp v0.0.0-20231226003508-02704c960a9b // indirect
74+
golang.org/x/net v0.27.0 // indirect
75+
golang.org/x/oauth2 v0.21.0 // indirect
76+
golang.org/x/sys v0.22.0 // indirect
77+
golang.org/x/term v0.22.0 // indirect
78+
golang.org/x/text v0.16.0 // indirect
79+
golang.org/x/time v0.5.0 // indirect
80+
gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect
81+
google.golang.org/protobuf v1.34.1 // indirect
82+
gopkg.in/inf.v0 v0.9.1 // indirect
83+
gopkg.in/ini.v1 v1.67.0 // indirect
84+
gopkg.in/yaml.v2 v2.4.0 // indirect
85+
gopkg.in/yaml.v3 v3.0.1 // indirect
86+
k8s.io/api v0.30.5 // indirect
87+
k8s.io/apiextensions-apiserver v0.30.5 // indirect
88+
k8s.io/apimachinery v0.30.5 // indirect
89+
k8s.io/client-go v0.30.5 // indirect
90+
k8s.io/cluster-bootstrap v0.30.3 // indirect
91+
k8s.io/component-base v0.30.5 // indirect
92+
k8s.io/klog/v2 v2.120.1 // indirect
93+
k8s.io/kube-openapi v0.0.0-20240228011516-70dd3763d340 // indirect
94+
k8s.io/utils v0.0.0-20240102154912-e7106e64919e // indirect
95+
sigs.k8s.io/cluster-api v1.8.4 // indirect
96+
sigs.k8s.io/controller-runtime v0.18.5 // indirect
97+
sigs.k8s.io/gateway-api v1.0.0 // indirect
98+
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
99+
sigs.k8s.io/kustomize/api v0.13.5-0.20230601165947-6ce0bf390ce3 // indirect
100+
sigs.k8s.io/kustomize/kyaml v0.14.3-0.20230601165947-6ce0bf390ce3 // indirect
101+
sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect
102+
sigs.k8s.io/yaml v1.4.0 // indirect
103+
)

0 commit comments

Comments
 (0)