├── README.md ├── entrypoint.sh ├── .gitignore ├── LICENSE ├── Dockerfile └── .github └── workflows └── build.yml /README.md: -------------------------------------------------------------------------------- 1 | # kubectl 2 | kubectl tools docker image used in kubeclipper for kubectl console feature. 3 | -------------------------------------------------------------------------------- /entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | if [ "$1" = '' ]; then 6 | while true; do sleep 1000; done 7 | fi 8 | 9 | exec "$@" -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Binaries for programs and plugins 2 | *.exe 3 | *.exe~ 4 | *.dll 5 | *.so 6 | *.dylib 7 | .vscode 8 | .idea 9 | # Test binary, built with `go test -c` 10 | *.test 11 | 12 | # Output of the go coverage tool, specifically when used with LiteIDE 13 | *.out 14 | 15 | # Dependency directories (remove the comment below to include it) 16 | # vendor/ 17 | 18 | .DS_Store 19 | .DS_Store? 20 | .vscode 21 | *.code-workspace 22 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2022 KubeClipper 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM alpine 2 | 3 | ARG KUBECTL_VERSION=v1.23.6 4 | ARG HELM_VERSION=v3.9.4 5 | ARG TARGETOS 6 | ARG TARGETARCH 7 | 8 | # Install General tools. 9 | RUN apk update && apk add \ 10 | bash \ 11 | bash-completion \ 12 | busybox-extras \ 13 | net-tools \ 14 | vim \ 15 | curl \ 16 | wget \ 17 | tcpdump \ 18 | ca-certificates && \ 19 | update-ca-certificates && \ 20 | rm -rf /var/cache/apk/* && \ 21 | # Install kubectl、config completion 22 | curl -LO https://storage.googleapis.com/kubernetes-release/release/${KUBECTL_VERSION}/bin/${TARGETOS}/${TARGETARCH}/kubectl && \ 23 | chmod +x ./kubectl && \ 24 | mv ./kubectl /usr/local/bin/kubectl && \ 25 | echo -e 'source /usr/share/bash-completion/bash_completion\nsource <(kubectl completion bash)' >>~/.bashrc && \ 26 | # Install helm (latest release) \ 27 | curl -SsLO https://get.helm.sh/helm-${HELM_VERSION}-${TARGETOS}-${TARGETARCH}.tar.gz && \ 28 | tar xf helm-${HELM_VERSION}-${TARGETOS}-${TARGETARCH}.tar.gz -C /usr/local/bin && \ 29 | mv /usr/local/bin/${TARGETOS}-${TARGETARCH}/helm /usr/local/bin && \ 30 | rm helm-${HELM_VERSION}-${TARGETOS}-${TARGETARCH}.tar.gz && \ 31 | rm -rf /usr/local/bin/${TARGETOS}-${TARGETARCH} 32 | 33 | 34 | COPY entrypoint.sh /usr/local/bin/entrypoint.sh 35 | 36 | ENTRYPOINT ["entrypoint.sh"] 37 | -------------------------------------------------------------------------------- /.github/workflows/build.yml: -------------------------------------------------------------------------------- 1 | name: build 2 | 3 | on: 4 | push: 5 | branches: 6 | - 'main' 7 | - 'release-*' 8 | tags: 9 | - 'v*' 10 | 11 | jobs: 12 | buildx: 13 | runs-on: ubuntu-latest 14 | steps: 15 | - name: Checkout 16 | uses: actions/checkout@v2 17 | 18 | - name: Prepare 19 | id: prepare 20 | run: | 21 | VERSION=latest 22 | 23 | if [[ $GITHUB_REF == refs/tags/* ]]; then 24 | VERSION=${GITHUB_REF#refs/tags/} 25 | fi 26 | if [ "${{ github.event_name }}" = "schedule" ]; then 27 | VERSION=nightly 28 | fi 29 | echo ::set-output name=version::${VERSION} 30 | 31 | - name: Set up docker buildx 32 | id: buildx 33 | uses: crazy-max/ghaction-docker-buildx@v3 34 | with: 35 | buildx-version: latest 36 | qemu-version: latest 37 | 38 | - name: Available platforms 39 | run: echo ${{ steps.buildx.outputs.platforms }} 40 | 41 | - name: Docker login 42 | env: 43 | DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} 44 | DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} 45 | run: | 46 | echo "${DOCKER_PASSWORD}" | docker login --username "${DOCKER_USERNAME}" --password-stdin 47 | 48 | - name: Run buildx 49 | run: | 50 | docker buildx build --platform linux/amd64,linux/arm64 --push --file ./Dockerfile -t kubeclipper/kubectl:${{ steps.prepare.outputs.version }} . 51 | 52 | --------------------------------------------------------------------------------