Skip to content

Commit

Permalink
Promote binary runtime for all
Browse files Browse the repository at this point in the history
  • Loading branch information
wzshiming committed Apr 8, 2024
1 parent ea50aeb commit 5f581a5
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 23 deletions.
16 changes: 0 additions & 16 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -176,22 +176,6 @@ jobs:
run: |
brew install coreutils bash
# No binary is provided by default for control plane components outside of Linux
# https://kwok.sigs.k8s.io/docs/user/kwokctl-platform-specific-binaries/
- name: Setup Kubernetes Binary
if: ${{ matrix.kwokctl-runtime == 'binary' && matrix.os != 'ubuntu-latest' }}
shell: bash
env:
KUBE_VERSION: v1.29.0
run: |
mkdir -p "${GITHUB_WORKSPACE//\\//}/workdir"
cat << EOF >"${GITHUB_WORKSPACE//\\//}/workdir/kwok.yaml"
kind: KwokctlConfiguration
apiVersion: config.kwok.x-k8s.io/v1alpha1
options:
kubeBinaryPrefix: "https://github.com/kwok-ci/k8s/releases/download/${KUBE_VERSION}-kwok.0-$(go env GOOS)-$(go env GOARCH)"
EOF
# TODO: workaround for https://github.com/actions/runner-images/issues/7753 (caused by https://bugs.launchpad.net/ubuntu/+source/libpod/+bug/2024394).
# Remove this when this issue is fixed and available in the ubuntu runner image
- name: Setup Podman for Ubuntu
Expand Down
18 changes: 14 additions & 4 deletions pkg/config/vars.go
Original file line number Diff line number Diff line change
Expand Up @@ -202,9 +202,11 @@ func setKwokctlConfigurationDefaults(config *configv1alpha1.KwokctlConfiguration
conf.Runtimes = append(conf.Runtimes,
consts.RuntimeTypePodman,
consts.RuntimeTypeNerdctl,
consts.RuntimeTypeBinary,
)
}
conf.Runtimes = append(conf.Runtimes,
consts.RuntimeTypeBinary,
)
}
if conf.Runtime == "" && len(conf.Runtimes) == 1 {
conf.Runtime = conf.Runtimes[0]
Expand Down Expand Up @@ -275,13 +277,21 @@ func setKwokctlKubernetesConfig(conf *configv1alpha1.KwokctlConfigurationOptions

conf.KubeAuditPolicy = envs.GetEnvWithPrefix("KUBE_AUDIT_POLICY", conf.KubeAuditPolicy)

if conf.KubeBinaryPrefix == "" {
conf.KubeBinaryPrefix = consts.KubeBinaryPrefix + "/" + conf.KubeVersion + "/bin/" + GOOS + "/" + GOARCH
// kubectl is provided to be used directly by default.
kubeBinaryPrefix := conf.KubeBinaryPrefix

if kubeBinaryPrefix == "" {
kubeBinaryPrefix = consts.KubeBinaryPrefix + "/" + conf.KubeVersion + "/bin/" + GOOS + "/" + GOARCH
if GOOS == linux {
conf.KubeBinaryPrefix = kubeBinaryPrefix
} else {
conf.KubeBinaryPrefix = consts.KubeBinaryUnofficialPrefix + "/" + conf.KubeVersion + "-kwok.0-" + GOOS + "-" + GOARCH
}
}
conf.KubeBinaryPrefix = envs.GetEnvWithPrefix("KUBE_BINARY_PREFIX", conf.KubeBinaryPrefix)

if conf.KubectlBinary == "" {
conf.KubectlBinary = conf.KubeBinaryPrefix + "/kubectl" + conf.BinSuffix
conf.KubectlBinary = kubeBinaryPrefix + "/kubectl" + conf.BinSuffix
}
conf.KubectlBinary = envs.GetEnvWithPrefix("KUBECTL_BINARY", conf.KubectlBinary)

Expand Down
7 changes: 4 additions & 3 deletions pkg/consts/consts.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,10 @@ var (

// KubeVersion is the version of Kubernetes.
// It will be overwritten during the `make build` process.
KubeVersion = "1.29.0"
KubeBinaryPrefix = "https://dl.k8s.io/release"
KubeImagePrefix = "registry.k8s.io"
KubeVersion = "1.29.0"
KubeBinaryPrefix = "https://dl.k8s.io/release"
KubeBinaryUnofficialPrefix = "https://github.com/kwok-ci/k8s/releases/download"
KubeImagePrefix = "registry.k8s.io"

EtcdBinaryPrefix = "https://github.com/etcd-io/etcd/releases/download"

Expand Down

0 comments on commit 5f581a5

Please sign in to comment.