name: "Set up k8s"
description: "Downloads and installs k8s tools"
inputs:
  arch:
    description: "Architecture"
    required: true
  kubectl-version:
    description: "kubectl version to install"
    required: false
    default: "1.33.4"
  kustomize-version:
    description: "kustomize version to install"
    required: false
    default: "5.7.1"
runs:
  using: "composite"
  steps:
    - name: "Install k8s tools"
      shell: "bash"
      run: |
        set -x
        mkdir -p /opt/k8s/bin /opt/k8s/etc /opt/k8s/src

        wget -O /opt/k8s/src/kubectl "https://nexus.bthlabs.pl/repository/ops-tools/k8s/kubectl-${{ inputs.kubectl-version }}-linux-${{ inputs.arch }}"
        chmod a+x /opt/k8s/src/kubectl
        mv /opt/k8s/src/kubectl /opt/k8s/bin

        wget -O /opt/k8s/src/kustomize "https://nexus.bthlabs.pl/repository/ops-tools/k8s/kustomize-${{ inputs.kustomize-version }}-linux-${{ inputs.arch }}"
        chmod a+x /opt/k8s/src/kustomize
        mv /opt/k8s/src/kustomize /opt/k8s/bin

        rm -rf /opt/k8s/src/
