Skip to content

Commit c93883e

Browse files
authored
build: Remove the need for docker.io creds env vars (#380)
1 parent debc636 commit c93883e

File tree

4 files changed

+16
-27
lines changed

4 files changed

+16
-27
lines changed

hack/kind/create-cluster.sh

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
set -euo pipefail
77
IFS=$'\n\t'
88

9-
SCRIPT_NAME="$(basename "$0")"
9+
SCRIPT_NAME="$(basename "${0}")"
1010
readonly SCRIPT_NAME
1111

1212
function print_usage {
@@ -22,11 +22,11 @@ EOF
2222
}
2323

2424
function assert_not_empty {
25-
local -r arg_name="$1"
26-
local -r arg_value="$2"
25+
local -r arg_name="${1}"
26+
local -r arg_value="${2}"
2727

28-
if [[ -z $arg_value ]]; then
29-
echo "The value for '$arg_name' cannot be empty"
28+
if [[ -z ${arg_value} ]]; then
29+
echo "The value for '${arg_name}' cannot be empty"
3030
print_usage
3131
exit 1
3232
fi
@@ -41,7 +41,7 @@ function run_cmd() {
4141
# read options
4242
while [[ $# -gt 0 ]]; do
4343
local key="$1"
44-
case "$key" in
44+
case "${key}" in
4545
--cluster-name)
4646
cluster_name="$2"
4747
shift
@@ -67,21 +67,21 @@ function run_cmd() {
6767
done
6868

6969
# validate parameters
70-
assert_not_empty "--cluster-name" "$cluster_name"
71-
assert_not_empty "--output-dir" "$output_dir"
72-
assert_not_empty "--base-config" "$base_config"
73-
assert_not_empty "--kindest-image" "$kindest_image"
70+
assert_not_empty "--cluster-name" "${cluster_name}"
71+
assert_not_empty "--output-dir" "${output_dir}"
72+
assert_not_empty "--base-config" "${base_config}"
73+
assert_not_empty "--kindest-image" "${kindest_image}"
7474

75-
local cluster_config="$output_dir/kind-config.yaml"
75+
local cluster_config="${output_dir}/kind-config.yaml"
7676

7777
# make sure output directory exist
78-
mkdir -p "$output_dir"
78+
mkdir -p "${output_dir}"
7979

8080
# create/override base config
8181
export KINDEST_IMAGE="${kindest_image}"
82-
envsubst -no-unset <"$base_config" >"$cluster_config"
82+
envsubst -i "${base_config}" -o "${cluster_config}"
8383

84-
kind create cluster --name "$cluster_name" --config "$cluster_config"
84+
kind create cluster --name "${cluster_name}" --config "${cluster_config}"
8585
}
8686

8787
run_cmd "$@"

hack/kind/kind-base-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ apiVersion: kind.x-k8s.io/v1alpha4
66
containerdConfigPatches:
77
- |-
88
[plugins."io.containerd.grpc.v1.cri".registry.configs."registry-1.docker.io".auth]
9-
username = "${DOCKER_HUB_USERNAME}"
10-
password = "${DOCKER_HUB_PASSWORD}"
9+
username = "${DOCKER_HUB_USERNAME:-}"
10+
password = "${DOCKER_HUB_PASSWORD:-}"
1111
- |-
1212
[plugins."io.containerd.grpc.v1.cri".registry.mirrors."docker.io"]
1313
endpoint = ["${DOCKER_HUB_MIRROR:-https://registry-1.docker.io}"]

make/all.mk

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ include $(INCLUDE_DIR)repo.mk
1010
include $(INCLUDE_DIR)pre-commit.mk
1111
include $(INCLUDE_DIR)go.mk
1212
include $(INCLUDE_DIR)goreleaser.mk
13-
include $(INCLUDE_DIR)docker.mk
1413
include $(INCLUDE_DIR)tag.mk
1514
include $(INCLUDE_DIR)addons.mk
1615
include $(INCLUDE_DIR)kind.mk

make/docker.mk

Lines changed: 0 additions & 10 deletions
This file was deleted.

0 commit comments

Comments
 (0)