Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: Remove the need for docker.io creds env vars #380

Merged
merged 1 commit into from
Feb 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 14 additions & 14 deletions hack/kind/create-cluster.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
set -euo pipefail
IFS=$'\n\t'

SCRIPT_NAME="$(basename "$0")"
SCRIPT_NAME="$(basename "${0}")"
readonly SCRIPT_NAME

function print_usage {
Expand All @@ -22,11 +22,11 @@ EOF
}

function assert_not_empty {
local -r arg_name="$1"
local -r arg_value="$2"
local -r arg_name="${1}"
local -r arg_value="${2}"

if [[ -z $arg_value ]]; then
echo "The value for '$arg_name' cannot be empty"
if [[ -z ${arg_value} ]]; then
echo "The value for '${arg_name}' cannot be empty"
print_usage
exit 1
fi
Expand All @@ -41,7 +41,7 @@ function run_cmd() {
# read options
while [[ $# -gt 0 ]]; do
local key="$1"
case "$key" in
case "${key}" in
--cluster-name)
cluster_name="$2"
shift
Expand All @@ -67,21 +67,21 @@ function run_cmd() {
done

# validate parameters
assert_not_empty "--cluster-name" "$cluster_name"
assert_not_empty "--output-dir" "$output_dir"
assert_not_empty "--base-config" "$base_config"
assert_not_empty "--kindest-image" "$kindest_image"
assert_not_empty "--cluster-name" "${cluster_name}"
assert_not_empty "--output-dir" "${output_dir}"
assert_not_empty "--base-config" "${base_config}"
assert_not_empty "--kindest-image" "${kindest_image}"

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

# make sure output directory exist
mkdir -p "$output_dir"
mkdir -p "${output_dir}"

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

kind create cluster --name "$cluster_name" --config "$cluster_config"
kind create cluster --name "${cluster_name}" --config "${cluster_config}"
}

run_cmd "$@"
4 changes: 2 additions & 2 deletions hack/kind/kind-base-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ apiVersion: kind.x-k8s.io/v1alpha4
containerdConfigPatches:
- |-
[plugins."io.containerd.grpc.v1.cri".registry.configs."registry-1.docker.io".auth]
username = "${DOCKER_HUB_USERNAME}"
password = "${DOCKER_HUB_PASSWORD}"
username = "${DOCKER_HUB_USERNAME:-}"
password = "${DOCKER_HUB_PASSWORD:-}"
- |-
[plugins."io.containerd.grpc.v1.cri".registry.mirrors."docker.io"]
endpoint = ["${DOCKER_HUB_MIRROR:-https://registry-1.docker.io}"]
Expand Down
1 change: 0 additions & 1 deletion make/all.mk
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ include $(INCLUDE_DIR)repo.mk
include $(INCLUDE_DIR)pre-commit.mk
include $(INCLUDE_DIR)go.mk
include $(INCLUDE_DIR)goreleaser.mk
include $(INCLUDE_DIR)docker.mk
include $(INCLUDE_DIR)tag.mk
include $(INCLUDE_DIR)addons.mk
include $(INCLUDE_DIR)kind.mk
Expand Down
10 changes: 0 additions & 10 deletions make/docker.mk

This file was deleted.

Loading