Skip to content

Commit efb7e86

Browse files
authored
Merge pull request #7365 from fabriziopandini/simplify-make-targets
🌱 Simplify Makefile targets
2 parents 36bedd6 + 1564438 commit efb7e86

File tree

9 files changed

+72
-230
lines changed

9 files changed

+72
-230
lines changed

Makefile

Lines changed: 55 additions & 79 deletions
Large diffs are not rendered by default.

cloudbuild-nightly.yaml

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,6 @@ steps:
1414
- DOCKER_BUILDKIT=1
1515
args:
1616
- release-staging-nightly
17-
- name: 'gcr.io/k8s-staging-test-infra/gcb-docker-gcloud:v20221007-ad65926f6b'
18-
entrypoint: make
19-
env:
20-
- DOCKER_CLI_EXPERIMENTAL=enabled
21-
- TAG=$_GIT_TAG
22-
- PULL_BASE_REF=$_PULL_BASE_REF
23-
- DOCKER_BUILDKIT=1
24-
args:
25-
- release-capd-staging-nightly
2617
substitutions:
2718
# _GIT_TAG will be filled with a git-based tag for the image, of the form vYYYYMMDD-hash, and
2819
# can be used as a substitution

cloudbuild.yaml

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,6 @@ steps:
1414
- DOCKER_BUILDKIT=1
1515
args:
1616
- release-staging
17-
- name: 'gcr.io/k8s-staging-test-infra/gcb-docker-gcloud:v20221007-ad65926f6b'
18-
entrypoint: make
19-
env:
20-
- DOCKER_CLI_EXPERIMENTAL=enabled
21-
- TAG=$_GIT_TAG
22-
- PULL_BASE_REF=$_PULL_BASE_REF
23-
- DOCKER_BUILDKIT=1
24-
args:
25-
- release-capd-staging
2617
substitutions:
2718
# _GIT_TAG will be filled with a git-based tag for the image, of the form vYYYYMMDD-hash, and
2819
# can be used as a substitution

docs/book/src/clusterctl/developers.md

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,18 +33,12 @@ If you want to create a local artifact, follow these instructions:
3333

3434
### Build artifacts locally
3535

36-
In order to build artifacts for the CAPI core provider, the kubeadm bootstrap provider and the kubeadm control plane provider:
36+
In order to build artifacts for the CAPI core provider, the kubeadm bootstrap provider, the kubeadm control plane provider and the docker infrastructure provider:
3737

3838
```bash
3939
make docker-build REGISTRY=gcr.io/k8s-staging-cluster-api PULL_POLICY=IfNotPresent
4040
```
4141

42-
In order to build docker provider artifacts
43-
44-
```bash
45-
make docker-capd-build REGISTRY=gcr.io/k8s-staging-cluster-api PULL_POLICY=IfNotPresent
46-
```
47-
4842
### Create a clusterctl-settings.json file
4943

5044
Next, create a `clusterctl-settings.json` file and place it in your local copy

docs/book/src/developer/guide.md

Lines changed: 5 additions & 100 deletions
Original file line numberDiff line numberDiff line change
@@ -107,114 +107,19 @@ Many of the Cluster API engineers use it for quick iteration. Please see our [Ti
107107

108108
## Option 2: The Old-fashioned way
109109

110-
### Building everything
111-
112-
You'll need to build two docker images, one for Cluster API itself and one for the Docker provider (CAPD).
113-
114110
```bash
111+
# Build all the images
115112
make docker-build
116-
make docker-capd-build
117-
```
118113

119-
### Push both images
120-
121-
```bash
114+
# Push images
122115
make docker-push
123-
```
124-
```bash
125-
docker push gcr.io/cluster-api-242700/cluster-api-controller-amd64:dev
126-
The push refers to repository [gcr.io/cluster-api-242700/cluster-api-controller-amd64]
127-
90a39583ad5f: Layer already exists
128-
932da5156413: Layer already exists
129-
dev: digest: sha256:263262cfbabd3d1add68172a5a1d141f6481a2bc443672ce80778dc122ee6234 size: 739
130-
```
131-
```bash
132-
$ make docker-capd-push
133-
```
134-
```bash
135-
docker push gcr.io/cluster-api-242700/capd-manager-amd64:dev
136-
The push refers to repository [gcr.io/cluster-api-242700/capd-manager-amd64]
137-
```
138-
139-
Make a note of the URLs and the digests. You'll need them for the next step. In this case, they're...
140-
141-
`gcr.io/cluster-api-242700/capd-manager-amd64@sha256:35670a049372ae063dad910c267a4450758a139c4deb248c04c3198865589ab2`
142116

143-
and
144-
145-
`gcr.io/cluster-api-242700/cluster-api-controller-amd64@sha256:263262cfbabd3d1add68172a5a1d141f6481a2bc443672ce80778dc122ee6234`
146-
147-
### Edit the manifests
148-
149-
```bash
150-
$EDITOR config/default/manager_image_patch.yaml
151-
$EDITOR test/infrastructure/docker/config/default/manager_image_patch.yaml
152-
```
153-
154-
In both cases, change the `- image:` url to the digest URL mentioned above:
155-
156-
```yaml
157-
apiVersion: apps/v1
158-
kind: Deployment
159-
metadata:
160-
name: controller-manager
161-
namespace: system
162-
spec:
163-
template:
164-
spec:
165-
containers:
166-
- image: gcr.io/cluster-api-242700/capd-manager-amd64@sha256:35670a049372ae063dad910c267a4450758a139c4deb248c04c3198865589ab2`
167-
name: manager
168-
```
169-
170-
### Apply the manifests
171-
```bash
117+
# Apply the manifests
172118
kustomize build config/default | ./hack/tools/bin/envsubst | kubectl apply -f -
173-
```
174-
```bash
175-
namespace/capi-system configured
176-
customresourcedefinition.apiextensions.k8s.io/clusters.cluster.x-k8s.io configured
177-
customresourcedefinition.apiextensions.k8s.io/kubeadmconfigs.bootstrap.cluster.x-k8s.io configured
178-
customresourcedefinition.apiextensions.k8s.io/kubeadmconfigtemplates.bootstrap.cluster.x-k8s.io configured
179-
customresourcedefinition.apiextensions.k8s.io/machinedeployments.cluster.x-k8s.io configured
180-
customresourcedefinition.apiextensions.k8s.io/machines.cluster.x-k8s.io configured
181-
customresourcedefinition.apiextensions.k8s.io/machinesets.cluster.x-k8s.io configured
182-
role.rbac.authorization.k8s.io/capi-leader-election-role configured
183-
clusterrole.rbac.authorization.k8s.io/capi-manager-role configured
184-
rolebinding.rbac.authorization.k8s.io/capi-leader-election-rolebinding configured
185-
clusterrolebinding.rbac.authorization.k8s.io/capi-manager-rolebinding configured
186-
deployment.apps/capi-controller-manager created
187-
```
188-
```bash
119+
kustomize build bootstrap/kubeadm/config | ./hack/tools/bin/envsubst | kubectl apply -f -
120+
kustomize build controlplane/kubeadm/config | ./hack/tools/bin/envsubst | kubectl apply -f -
189121
kustomize build test/infrastructure/docker/config/default | ./hack/tools/bin/envsubst | kubectl apply -f -
190122
```
191-
```bash
192-
namespace/capd-system configured
193-
customresourcedefinition.apiextensions.k8s.io/dockerclusters.infrastructure.cluster.x-k8s.io configured
194-
customresourcedefinition.apiextensions.k8s.io/dockermachines.infrastructure.cluster.x-k8s.io configured
195-
customresourcedefinition.apiextensions.k8s.io/dockermachinetemplates.infrastructure.cluster.x-k8s.io configured
196-
role.rbac.authorization.k8s.io/capd-leader-election-role configured
197-
clusterrole.rbac.authorization.k8s.io/capd-manager-role configured
198-
clusterrole.rbac.authorization.k8s.io/capd-proxy-role configured
199-
rolebinding.rbac.authorization.k8s.io/capd-leader-election-rolebinding configured
200-
clusterrolebinding.rbac.authorization.k8s.io/capd-manager-rolebinding configured
201-
clusterrolebinding.rbac.authorization.k8s.io/capd-proxy-rolebinding configured
202-
service/capd-controller-manager-metrics-service created
203-
deployment.apps/capd-controller-manager created
204-
```
205-
206-
### Check the status of the clusters
207-
208-
```bash
209-
kubectl get po -n capd-system
210-
```
211-
```bash
212-
NAME READY STATUS RESTARTS AGE
213-
capd-controller-manager-7568c55d65-ndpts 2/2 Running 0 71s
214-
kubectl get po -n capi-system
215-
NAME READY STATUS RESTARTS AGE
216-
capi-controller-manager-bf9c6468c-d6msj 1/1 Running 0 2m9s
217-
```
218123

219124
## Testing
220125

docs/book/src/reference/jobs.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ GitHub Presubmit Workflows:
4646
### Postsubmits
4747

4848
Prow Postsubmits:
49-
* [post-cluster-api-push-images] Google Cloud Build: `make release-staging`, `make release-capd-staging`
49+
* [post-cluster-api-push-images] Google Cloud Build: `make release-staging`
5050

5151
### Periodics
5252

@@ -75,7 +75,7 @@ Prow Periodics:
7575
* GINKGO_FOCUS: `[K8s-Upgrade]`
7676
* [periodic-cluster-api-e2e-workload-upgrade-1-25-latest-main] `./scripts/ci-e2e.sh` FROM: `stable-1.25` TO: `ci/latest-1.26`
7777
* GINKGO_FOCUS: `[K8s-Upgrade]`
78-
* [cluster-api-push-images-nightly] Google Cloud Build: `make release-staging-nightly`, `make release-capd-staging-nightly`
78+
* [cluster-api-push-images-nightly] Google Cloud Build: `make release-staging-nightly`
7979

8080
## Test-infra configuration
8181

scripts/ci-e2e-lib.sh

Lines changed: 7 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -14,39 +14,24 @@
1414
# See the License for the specific language governing permissions and
1515
# limitations under the License.
1616

17-
# capi:buildDockerImages builds all the CAPI (and CAPD) docker images, if not already present locally.
17+
# capi:buildDockerImages builds all the required docker images, if not already present locally.
1818
capi:buildDockerImages () {
1919
# Configure provider images generation;
20-
# please ensure the generated image name matches image names used in the E2E_CONF_FILE
20+
# please ensure the generated image name matches image names used in the E2E_CONF_FILE;
21+
# also the same settings must be set in Makefile, docker-build-e2e target.
2122
ARCH="$(go env GOARCH)"
2223
export REGISTRY=gcr.io/k8s-staging-cluster-api
2324
export TAG=dev
2425
export ARCH
25-
export PULL_POLICY=IfNotPresent
2626

27-
## Build all Cluster API provider images, if missing
27+
## Build all required docker image, if missing.
28+
## Note: we check only for one image to exist, and assume that if one is missing all are missing.
2829
if [[ "$(docker images -q "$REGISTRY/cluster-api-controller-$ARCH:$TAG" 2> /dev/null)" == "" ]]; then
29-
echo "+ Building CAPI images"
30-
make docker-build
30+
echo "+ Building CAPI images and CAPD image"
31+
make docker-build-e2e
3132
else
3233
echo "+ CAPI images already present in the system, skipping make"
3334
fi
34-
35-
## Build CAPD provider images, if missing
36-
if [[ "$(docker images -q "$REGISTRY/capd-manager-$ARCH:$TAG" 2> /dev/null)" == "" ]]; then
37-
echo "+ Building CAPD images"
38-
make docker-capd-build
39-
else
40-
echo "+ CAPD images already present in the system, skipping make"
41-
fi
42-
43-
## Build test extension images, if missing
44-
if [[ "$(docker images -q "$REGISTRY/test-extension-$ARCH:$TAG" 2> /dev/null)" == "" ]]; then
45-
echo "+ Building test-extension image"
46-
make docker-build-test-extension
47-
else
48-
echo "+ test-extension image already present in the system, skipping make"
49-
fi
5035
}
5136

5237
# k8s::prepareKindestImages checks all the e2e test variables representing a Kubernetes version,

scripts/ci-test.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ make test-junit
2929

3030
echo -e "\n*** Testing Cluster API Provider Docker ***\n"
3131
# Docker provider
32-
make test-capd-junit
32+
make test-docker-infrastructure-junit
3333

3434
echo -e "\n*** Testing Cluster API Runtime SDK test extension ***\n"
3535
# Test Extension

test/infrastructure/docker/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ For a complete overview, please refer to the documentation available [here](http
1717
## Testing
1818

1919
In order to test your local changes, go to the top level directory of this project, `cluster-api/` and run
20-
`make test-capd` to run the unit tests.
20+
`make test-docker-infrastructure` to run the unit tests.
2121

2222
**Note:** `make test-e2e` runs the CAPI E2E tests that are based on CAPD (CAPD does not have a separated e2e suite).
2323

0 commit comments

Comments
 (0)