Full Code of kind-ci/examples for AI

master df54b8dc5d9f cached
17 files
26.3 KB
7.2k tokens
1 requests
Download .txt
Repository: kind-ci/examples
Branch: master
Commit: df54b8dc5d9f
Files: 17
Total size: 26.3 KB

Directory structure:
gitextract_zgiv1qaa/

├── .circleci/
│   └── config.yml
├── .github/
│   └── workflows/
│       └── kind.yml
├── .gitlab-ci.yml
├── .travis.yml
├── LICENSE
├── README.md
├── azure-pipelines.yml
├── concourse.md
├── drone/
│   ├── .drone.yml
│   ├── README.md
│   ├── install.sh
│   ├── kind-config
│   └── setup.sh
├── gcb.md
├── gitlab/
│   └── kind-config.yaml
├── kind-config.yaml
└── kind-smoketest.sh

================================================
FILE CONTENTS
================================================

================================================
FILE: .circleci/config.yml
================================================
version: 2
jobs:
  build:
    machine:
      enabled: true
    steps:
    - checkout
    - run: ./kind-smoketest.sh


================================================
FILE: .github/workflows/kind.yml
================================================
name: Kind
on: [push, pull_request]
jobs:
  test-unit:
    name: Create a Kind cluster
    runs-on: [ubuntu-latest]
    steps:
    - uses: actions/checkout@v1
    - uses: actions/setup-go@v1
      with:
        go-version: 1.13
    - name: Install latest version of Kind
      run: |
        GO111MODULE=on go get sigs.k8s.io/kind
    - name: Create Kind cluster
      run: |
        PATH=$(go env GOPATH)/bin:$PATH kind create cluster --config kind-config.yaml
    - name: Run some sanity checks
      # kubectl is already installed on the Github Ubuntu worker
      run: |
        kubectl get nodes -o wide
        kubectl get pods --all-namespaces -o wide
        kubectl get services --all-namespaces -o wide


================================================
FILE: .gitlab-ci.yml
================================================
image: docker:stable
variables:
  KUBECTL: v1.17.0
  KIND: v0.8.1
services:
  - docker:dind
stages:
  - test
test:
  stage: test
  script:
    - apk add -U wget
    - wget -O /usr/local/bin/kind https://github.com/kubernetes-sigs/kind/releases/download/${KIND}/kind-linux-amd64
    - chmod +x /usr/local/bin/kind
    - wget -O /usr/local/bin/kubectl https://storage.googleapis.com/kubernetes-release/release/${KUBECTL}/bin/linux/amd64/kubectl
    - chmod +x /usr/local/bin/kubectl
    - kind create cluster --config=./gitlab/kind-config.yaml
    - sed -i -E -e 's/localhost|0\.0\.0\.0/docker/g' "$HOME/.kube/config"
    - kubectl get nodes -o wide
    - kubectl get pods --all-namespaces -o wide
    - kubectl get services --all-namespaces -o wide


================================================
FILE: .travis.yml
================================================
sudo: required
language: go
go:
    - "1.14"

services:
  - docker

install: true

script: 
  - echo "Run your tests here"

before_install:
  # Download and install Kind and kubectl
  - GO111MODULE=on go get sigs.k8s.io/kind
  - kind create cluster --config kind-config.yaml
  - export KUBECONFIG="$(kind get kubeconfig-path --name="kind")"
  - curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl
  - chmod +x ./kubectl
  - ./kubectl get nodes -o wide
  - ./kubectl get pods --all-namespaces -o wide
  - ./kubectl get services --all-namespaces -o wide



================================================
FILE: LICENSE
================================================
                                 Apache License
                           Version 2.0, January 2004
                        http://www.apache.org/licenses/

   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION

   1. Definitions.

      "License" shall mean the terms and conditions for use, reproduction,
      and distribution as defined by Sections 1 through 9 of this document.

      "Licensor" shall mean the copyright owner or entity authorized by
      the copyright owner that is granting the License.

      "Legal Entity" shall mean the union of the acting entity and all
      other entities that control, are controlled by, or are under common
      control with that entity. For the purposes of this definition,
      "control" means (i) the power, direct or indirect, to cause the
      direction or management of such entity, whether by contract or
      otherwise, or (ii) ownership of fifty percent (50%) or more of the
      outstanding shares, or (iii) beneficial ownership of such entity.

      "You" (or "Your") shall mean an individual or Legal Entity
      exercising permissions granted by this License.

      "Source" form shall mean the preferred form for making modifications,
      including but not limited to software source code, documentation
      source, and configuration files.

      "Object" form shall mean any form resulting from mechanical
      transformation or translation of a Source form, including but
      not limited to compiled object code, generated documentation,
      and conversions to other media types.

      "Work" shall mean the work of authorship, whether in Source or
      Object form, made available under the License, as indicated by a
      copyright notice that is included in or attached to the work
      (an example is provided in the Appendix below).

      "Derivative Works" shall mean any work, whether in Source or Object
      form, that is based on (or derived from) the Work and for which the
      editorial revisions, annotations, elaborations, or other modifications
      represent, as a whole, an original work of authorship. For the purposes
      of this License, Derivative Works shall not include works that remain
      separable from, or merely link (or bind by name) to the interfaces of,
      the Work and Derivative Works thereof.

      "Contribution" shall mean any work of authorship, including
      the original version of the Work and any modifications or additions
      to that Work or Derivative Works thereof, that is intentionally
      submitted to Licensor for inclusion in the Work by the copyright owner
      or by an individual or Legal Entity authorized to submit on behalf of
      the copyright owner. For the purposes of this definition, "submitted"
      means any form of electronic, verbal, or written communication sent
      to the Licensor or its representatives, including but not limited to
      communication on electronic mailing lists, source code control systems,
      and issue tracking systems that are managed by, or on behalf of, the
      Licensor for the purpose of discussing and improving the Work, but
      excluding communication that is conspicuously marked or otherwise
      designated in writing by the copyright owner as "Not a Contribution."

      "Contributor" shall mean Licensor and any individual or Legal Entity
      on behalf of whom a Contribution has been received by Licensor and
      subsequently incorporated within the Work.

   2. Grant of Copyright License. Subject to the terms and conditions of
      this License, each Contributor hereby grants to You a perpetual,
      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
      copyright license to reproduce, prepare Derivative Works of,
      publicly display, publicly perform, sublicense, and distribute the
      Work and such Derivative Works in Source or Object form.

   3. Grant of Patent License. Subject to the terms and conditions of
      this License, each Contributor hereby grants to You a perpetual,
      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
      (except as stated in this section) patent license to make, have made,
      use, offer to sell, sell, import, and otherwise transfer the Work,
      where such license applies only to those patent claims licensable
      by such Contributor that are necessarily infringed by their
      Contribution(s) alone or by combination of their Contribution(s)
      with the Work to which such Contribution(s) was submitted. If You
      institute patent litigation against any entity (including a
      cross-claim or counterclaim in a lawsuit) alleging that the Work
      or a Contribution incorporated within the Work constitutes direct
      or contributory patent infringement, then any patent licenses
      granted to You under this License for that Work shall terminate
      as of the date such litigation is filed.

   4. Redistribution. You may reproduce and distribute copies of the
      Work or Derivative Works thereof in any medium, with or without
      modifications, and in Source or Object form, provided that You
      meet the following conditions:

      (a) You must give any other recipients of the Work or
          Derivative Works a copy of this License; and

      (b) You must cause any modified files to carry prominent notices
          stating that You changed the files; and

      (c) You must retain, in the Source form of any Derivative Works
          that You distribute, all copyright, patent, trademark, and
          attribution notices from the Source form of the Work,
          excluding those notices that do not pertain to any part of
          the Derivative Works; and

      (d) If the Work includes a "NOTICE" text file as part of its
          distribution, then any Derivative Works that You distribute must
          include a readable copy of the attribution notices contained
          within such NOTICE file, excluding those notices that do not
          pertain to any part of the Derivative Works, in at least one
          of the following places: within a NOTICE text file distributed
          as part of the Derivative Works; within the Source form or
          documentation, if provided along with the Derivative Works; or,
          within a display generated by the Derivative Works, if and
          wherever such third-party notices normally appear. The contents
          of the NOTICE file are for informational purposes only and
          do not modify the License. You may add Your own attribution
          notices within Derivative Works that You distribute, alongside
          or as an addendum to the NOTICE text from the Work, provided
          that such additional attribution notices cannot be construed
          as modifying the License.

      You may add Your own copyright statement to Your modifications and
      may provide additional or different license terms and conditions
      for use, reproduction, or distribution of Your modifications, or
      for any such Derivative Works as a whole, provided Your use,
      reproduction, and distribution of the Work otherwise complies with
      the conditions stated in this License.

   5. Submission of Contributions. Unless You explicitly state otherwise,
      any Contribution intentionally submitted for inclusion in the Work
      by You to the Licensor shall be under the terms and conditions of
      this License, without any additional terms or conditions.
      Notwithstanding the above, nothing herein shall supersede or modify
      the terms of any separate license agreement you may have executed
      with Licensor regarding such Contributions.

   6. Trademarks. This License does not grant permission to use the trade
      names, trademarks, service marks, or product names of the Licensor,
      except as required for reasonable and customary use in describing the
      origin of the Work and reproducing the content of the NOTICE file.

   7. Disclaimer of Warranty. Unless required by applicable law or
      agreed to in writing, Licensor provides the Work (and each
      Contributor provides its Contributions) on an "AS IS" BASIS,
      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
      implied, including, without limitation, any warranties or conditions
      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
      PARTICULAR PURPOSE. You are solely responsible for determining the
      appropriateness of using or redistributing the Work and assume any
      risks associated with Your exercise of permissions under this License.

   8. Limitation of Liability. In no event and under no legal theory,
      whether in tort (including negligence), contract, or otherwise,
      unless required by applicable law (such as deliberate and grossly
      negligent acts) or agreed to in writing, shall any Contributor be
      liable to You for damages, including any direct, indirect, special,
      incidental, or consequential damages of any character arising as a
      result of this License or out of the use or inability to use the
      Work (including but not limited to damages for loss of goodwill,
      work stoppage, computer failure or malfunction, or any and all
      other commercial damages or losses), even if such Contributor
      has been advised of the possibility of such damages.

   9. Accepting Warranty or Additional Liability. While redistributing
      the Work or Derivative Works thereof, You may choose to offer,
      and charge a fee for, acceptance of support, warranty, indemnity,
      or other liability obligations and/or rights consistent with this
      License. However, in accepting such obligations, You may act only
      on Your own behalf and on Your sole responsibility, not on behalf
      of any other Contributor, and only if You agree to indemnify,
      defend, and hold each Contributor harmless for any liability
      incurred by, or claims asserted against, such Contributor by reason
      of your accepting any such warranty or additional liability.

   END OF TERMS AND CONDITIONS

   APPENDIX: How to apply the Apache License to your work.

      To apply the Apache License to your work, attach the following
      boilerplate notice, with the fields enclosed by brackets "[]"
      replaced with your own identifying information. (Don't include
      the brackets!)  The text should be enclosed in the appropriate
      comment syntax for the file format. We also recommend that a
      file or class name and description of purpose be included on the
      same "printed page" as the copyright notice for easier
      identification within third-party archives.

   Copyright [yyyy] [name of copyright owner]

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.


================================================
FILE: README.md
================================================
# Examples

This repository provides samples and testing for running [sigs.k8s.io/kind](https://sigs.k8s.io/kind) on various CI platforms.

## Supported / Tested CI Platforms


For any platform not yet listed or listed as "Unsure :question:" we are looking for your help!
Please file Pull Requests and / or Issues for missing CI platforms :smile:

| Platform | Known to Work? | Status |
|---|---|--|
| [CircleCI](https://circleci.com/) | [Yes](.circleci) :heavy_check_mark: | [![CircleCI](https://circleci.com/gh/kind-ci/examples.svg?style=svg)](https://circleci.com/gh/kind-ci/examples) |
| [Travis CI](https://travis-ci.com/) | [Yes](.travis.yml) :heavy_check_mark: | [![Travis CI](https://travis-ci.com/kind-ci/examples.svg?branch=master)](https://travis-ci.com/kind-ci/examples/) |
| [Prow](https://github.com/kubernetes/test-infra/tree/master/prow) | [Yes](https://github.com/kubernetes/test-infra/tree/master/config/jobs/kubernetes-sigs/kind) :heavy_check_mark: | [![Prow](https://prow.k8s.io/badge.svg?jobs=ci-kubernetes-kind-e2e-parallel)](https://prow.k8s.io/?job=ci-kubernetes-kind-e2e-parallel) |
| [Concourse](https://concourse-ci.org/) | [Yes](concourse.md) :heavy_check_mark: | [![Concourse k8s](https://hush-house.pivotal.io/api/v1/teams/k8s-c10s/pipelines/kind/badge)](https://hush-house.pivotal.io/teams/k8s-c10s/pipelines/kind?group=all) |
| [Github](https://help.github.com/en/actions/automating-your-workflow-with-github-actions/about-continuous-integration) | [Yes](.github/workflows/kind.yml) :heavy_check_mark: | ![Github](https://github.com/kind-ci/examples/workflows/Kind/badge.svg) |
| [Gitlab](https://about.gitlab.com/product/continuous-integration/) | [Yes](.gitlab-ci.yml) :heavy_check_mark: | ![Gitlab](https://gitlab.com/kind-ci/examples/badges/master/pipeline.svg) |
| [Azure Pipelines](https://azure.microsoft.com/en-us/services/devops/pipelines/) | [Yes](azure-pipelines.yml) :heavy_check_mark: | ![Azure Pipelines](https://dev.azure.com/kind-ci/examples/_apis/build/status/examples?api-version=5.1-preview.1) |
| [Drone](https://drone.io/) | [Yes](./drone) :heavy_check_mark: | None |
| [Google Cloud Build](https://cloud.google.com/cloud-build/) | [Yes](./gcb.md) :heavy_check_mark: | None |
| [BuildKite](https://buildkite.com/) | Unsure :question: | None |
| [CodeShip](https://codeship.com/) | Unsure :question: | None |


================================================
FILE: azure-pipelines.yml
================================================
trigger:
  - master

pool:
  vmImage: 'Ubuntu 18.04'

steps:
- task: GoTool@0
  inputs:
    version: '1.13.7'
    goBin: '$(Agent.HomeDirectory)/bin'

- script: GO111MODULE="on" go get sigs.k8s.io/kind@v0.8.1
  displayName: 'Install kind'

- script: $(GOBIN)/kind create cluster
  displayName: 'Deploying kind cluster'

- script: kubectl cluster-info --context kind-kind
  displayName: 'Show cluster info'


================================================
FILE: concourse.md
================================================
# `kind` on `concourse` with [`kind-on-c`][kind-on-c]

## Quick Intro

To run [kind] in a [concourse] task you can use [kind-on-c]. 
The project aims to provide an easy, nice, and "concourse-native" experience
for concourse pipeline authors by supplying a reusable concourse task
definition and task container.

[kind-on-c] supports primarily two modes:
- pull and run the node images provided by `kind`
- pull the source of kubernetes in a specific revision and create a node image
  on the fly

More information on supported kubernetes versions and features can be found at
[the project's github][kind-on-c] or its [automated test
pipeline][ci] (see also: [pipeline source][ci-src]).

## Example pipeline stub

```yaml
# ...
jobs:
- name: kind
  plan:
  - in_parallel:
    - get: kind-on-c
    - get: kind-release
      params:
        globs:
        - kind-linux-amd64
  - task: run-kind
    privileged: true
    file: kind-on-c/kind.yaml
    params:
      KIND_TESTS: |
        # your actual tests go here!
        kubectl get nodes -o wide
# ...
resources:
- name: kind-release
  type: github-release
  source:
    owner: kubernetes-sigs
    repository: kind
    access_token: <some github token>
    pre_release: true
- name: kind-on-c
  type: git
  source:
    uri: https://github.com/pivotal-k8s/kind-on-c
# ...
```

[kind]: //kind.sigs.k8s.io/
[concourse]: //concourse-ci.org/
[kind-on-c]: //github.com/pivotal-k8s/kind-on-c
[ci]: //hush-house.pivotal.io/teams/k8s-c10s/pipelines/kind
[ci-src]: //github.com/pivotal-k8s/kind-on-c/tree/master/ci/


================================================
FILE: drone/.drone.yml
================================================
---
kind: pipeline
name: test

platform:
  os: linux
  arch: amd64

steps:
  - name: setup
    image: docker:stable
    pull: always
    depends_on: [ clone ]
    environment:
      CLUSTER_HOST: docker
      CLUSTER_NAME: kind-cluster
      KUBECONFIG: /mnt/config/admin.conf
    commands:
      - ./drone/install.sh
      - ./drone/setup.sh
      - kubectl get nodes
    volumes:
      - name: dockersock
        path: /var/run
      - name: kubeconfig
        path: /mnt/config
    when:
      event:
      - push

  - name: test
    image: alpine:3.14
    pull: always
    depends_on: [ setup ]
    environment:
      KUBECONFIG: /mnt/config/admin.conf
    commands:
      - ./drone/install.sh
      - kubectl get nodes
    volumes:
      - name: kubeconfig
        path: /mnt/config
    when:
      event:
      - push

services:
- name: docker
  image: docker:dind
  privileged: true
  volumes:
  - name: dockersock
    path: /var/run

volumes:
- name: dockersock
  temp: {}
- name: kubeconfig
  temp: {}


================================================
FILE: drone/README.md
================================================
# DRONE PIPELINE EXAMPLE

An example drone pipeline using kind to create a kind cluster.

For the sake of simplicity all dependencies will be installed at runtime, but a more complete example can be found in the [fury-kubernetes-monitoring project](https://github.com/sighupio/fury-kubernetes-monitoring/blob/master/.drone.yml) using the image built from [fury-images](https://github.com/sighupio/fury-images/tree/master/kind).

We have chosen to use a docker service, sharing the docker socket with the pipeline step creating the cluster.
If access to the cluster is needed from successive steps, only the kubeconfig file has to be mounted and used as in the example.

## N.B.
- the project's repository has to be flagged as "trusted" from drone reposistory's settings due to the docker service having `privileged: true` set
- the teardown of the cluster will be managed from the docker service, no need to `kind delete cluster` explicitly
- the docker service name (here "docker") has to be added to "/apiServer/certSANs" as can be seen in the "kubeadmConfigPatchesJson6902" in [kind-config](./kind-config)


================================================
FILE: drone/install.sh
================================================
# standard bash error handling
set -o errexit;
set -o pipefail;
set -o nounset;
# debug commands
set -x;

KUBECTL=v1.21.0
KIND=v0.11.0

install(){
  wget -O /usr/local/bin/$1 $2
  chmod +x /usr/local/bin/$1
}

# installing kind
install "kind" "https://github.com/kubernetes-sigs/kind/releases/download/${KIND}/kind-linux-amd64"

#installing kubectl
install "kubectl" "https://storage.googleapis.com/kubernetes-release/release/${KUBECTL}/bin/linux/amd64/kubectl"


================================================
FILE: drone/kind-config
================================================
apiVersion: kind.x-k8s.io/v1alpha4
kind: Cluster
name: test
networking:
  apiServerAddress: "0.0.0.0"

nodes:
# add to the apiServer certSANs the name of the drone service in order to be able to reach the cluster through it
- role: control-plane
  kubeadmConfigPatches:
  - |
    kind: ClusterConfiguration
    apiServer:
      certSANs:
      - "docker"
- role: worker


================================================
FILE: drone/setup.sh
================================================
# standard bash error handling
set -o errexit;
set -o pipefail;
set -o nounset;
# debug commands
set -x;


kind create cluster --name "$CLUSTER_NAME" --config drone/kind-config --wait 1m

#replace localhost or 0.0.0.0 in the kubeconfig file with "docker", in order to be able to reach the cluster through the docker service
sed -i -E -e 's/localhost|0\.0\.0\.0/'"$CLUSTER_HOST"'/g' ${KUBECONFIG}

kubectl wait node --all --for condition=ready


================================================
FILE: gcb.md
================================================
# `kind` on Google Cloud Build

This is very much a **hack**. Don't use this for real, take inspiration from it
at max!

The biggest hacks here are:
- using `awk` to "parse" out the port that exposes the APIServer from an URL in
  a yaml file
- the forwarding of the port from the host into the container where `kind` and
  the actual test is running:
  - inside the container, where `kind` and the actual test runs, we start a
    `socat` process which listens on a tcp port
  - when a connection to that port inside the container is made, we start
    another container in the host's network namespace. That container is able
    to connect to the exposed port on the host. Both `socat` processes are
    connected via their Stdin & Stdout.
  - we've essentially created a tunnel from within the container to the host
    for this one port
  - by default, `kind` exposes the APIServer on localhost (on the host), thus
    the kubeconfig file will hold something like `https://127.0.0.1:XXX/` as
    the server URL. Thus if we use the same port inside the container that
    `kind` has setup on the host, we can just use the same kubeconfig.

## Example `cloudbuild.yml`

The following cloud build config can be used by running

```sh
gcloud builds submit --config cloudbuild.yml --no-source
```

and will:

- download current version of `kubectl`
- compile `kind` from the tip of master
- run `kind` to create a cluster
- start a portforwarder to make the kube-apiserver accessible

There are two things which can be configured via `--substitutions`, none of
which is mandatory:
- `KIND_CONFIG`: a [configuration for kind][kind-config]
- `KIND_TESTS`: whatever should be run after the cluster hast been created,
  `KUBECONFIG` is setup for you

Examples on what the substitutions could look like can be found in the following `cloudbuild.yml`.

[kind-config]: https://kind.sigs.k8s.io/docs/user/quick-start/#configuring-your-kind-cluster

```yaml
steps:
- name: 'gcr.io/cloud-builders/git'
  args:
  - clone
  - https://github.com/kubernetes-sigs/kind
  - src/kind
- name: 'gcr.io/cloud-builders/docker'
  entrypoint: bash
  dir: bin
  args:
  - -c
  - |
    curl -L https://storage.googleapis.com/kubernetes-release/release/`curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt`/bin/linux/amd64/kubectl > kubectl
    chmod 0750 kubectl
- name: golang
  dir: src/kind
  env:
  - CGO_ENABLED=0
  - GO111MODULE=on
  args:
  - go
  - build
  - -o
  - ../../bin/kind
- name: 'gcr.io/cloud-builders/docker'
  entrypoint: bash
  args:
  - -xeuc
  - |
    PATH="$${PATH}:$${PWD}/bin"

    {
      apt-get update -y
      apt-get install -y socat
    } >/dev/null

    kindArgs=( create cluster )

    if [ -n "$_KIND_CONFIG" ]
    then
      echo "$_KIND_CONFIG" > /tmp/kind-config.yml
      kindArgs+=( --config=/tmp/kind-config.yml )
    fi

    kind "$${kindArgs[@]}"

    KUBECONFIG="$$(mktemp)"
    kind get kubeconfig > "$$KUBECONFIG"
    export KUBECONFIG

    startForwarder() {
      local port
      # Gets the apiServerPort from the KUBECONFIG file.
      port="$( awk -F: '/server:/{ print $4 }' "$$KUBECONFIG" )"
      socat \
        TCP-LISTEN:${port},reuseaddr,fork \
        "EXEC:docker run --rm -i --network=host alpine/socat 'STDIO TCP-CONNECT:localhost:${port}'"
    }
    startForwarder &

    bash -xeuc "${_KIND_TESTS}"

substitutions:
  _KIND_TESTS: |
    kubectl get nodes -o wide
  _KIND_CONFIG: |
    kind: Cluster
    apiVersion: kind.x-k8s.io/v1alpha4
    nodes:
    - role: control-plane
    - role: worker
```


================================================
FILE: gitlab/kind-config.yaml
================================================
apiVersion: kind.x-k8s.io/v1alpha4
kind: Cluster
networking:
  apiServerAddress: "0.0.0.0"

# add to the apiServer certSANs the name of the docker (dind) service in order to be able to reach the cluster through it
kubeadmConfigPatchesJSON6902:
  - group: kubeadm.k8s.io
    version: v1beta2
    kind: ClusterConfiguration
    patch: |
      - op: add
        path: /apiServer/certSANs/-
        value: docker
nodes:
  - role: control-plane
  - role: worker


================================================
FILE: kind-config.yaml
================================================
# see: https://kind.sigs.k8s.io/docs/user/configuration/
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
- role: control-plane


================================================
FILE: kind-smoketest.sh
================================================
#!/bin/bash

# standard bash error handling
set -o errexit;
set -o pipefail;
set -o nounset;
# debug commands
set -x;

# working dir to install binaries etc, cleaned up on exit
BIN_DIR="$(mktemp -d)"
# kind binary will be here
KIND="${BIN_DIR}/kind"

CWD="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
KIND_CONFIG="${CWD}/kind-config.yaml"

# cleanup on exit (useful for running locally)
cleanup() {
    "${KIND}" delete cluster || true
    rm -rf "${BIN_DIR}"
}
trap cleanup EXIT

# util to install the latest kind version into ${BIN_DIR}
install_latest_kind() {
    # clone kind into a tempdir within BIN_DIR
    local tmp_dir
    tmp_dir="$(TMPDIR="${BIN_DIR}" mktemp -d "${BIN_DIR}/kind-source.XXXXX")"
    cd "${tmp_dir}" || exit
    git clone https://github.com/kubernetes-sigs/kind && cd ./kind
    make install INSTALL_DIR="${BIN_DIR}"
}

# util to install a released kind version into ${BIN_DIR}
install_kind_release() {
    VERSION="v0.5.1"
    KIND_BINARY_URL="https://github.com/kubernetes-sigs/kind/releases/download/${VERSION}/kind-linux-amd64"
    wget -O "${KIND}" "${KIND_BINARY_URL}"
    chmod +x "${KIND}"
}

main() {
    # get kind
    install_latest_kind
    # create a cluster
    "${KIND}" create cluster --loglevel=debug --config "${KIND_CONFIG}"
    # set KUBECONFIG to point to the cluster
    KUBECONFIG="$("${KIND}" get kubeconfig-path)"
    export KUBECONFIG
    # TODO: invoke your tests here
    # teardown will happen automatically on exit
}

main
Download .txt
gitextract_zgiv1qaa/

├── .circleci/
│   └── config.yml
├── .github/
│   └── workflows/
│       └── kind.yml
├── .gitlab-ci.yml
├── .travis.yml
├── LICENSE
├── README.md
├── azure-pipelines.yml
├── concourse.md
├── drone/
│   ├── .drone.yml
│   ├── README.md
│   ├── install.sh
│   ├── kind-config
│   └── setup.sh
├── gcb.md
├── gitlab/
│   └── kind-config.yaml
├── kind-config.yaml
└── kind-smoketest.sh
Condensed preview — 17 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (29K chars).
[
  {
    "path": ".circleci/config.yml",
    "chars": 116,
    "preview": "version: 2\njobs:\n  build:\n    machine:\n      enabled: true\n    steps:\n    - checkout\n    - run: ./kind-smoketest.sh\n"
  },
  {
    "path": ".github/workflows/kind.yml",
    "chars": 713,
    "preview": "name: Kind\non: [push, pull_request]\njobs:\n  test-unit:\n    name: Create a Kind cluster\n    runs-on: [ubuntu-latest]\n    "
  },
  {
    "path": ".gitlab-ci.yml",
    "chars": 748,
    "preview": "image: docker:stable\nvariables:\n  KUBECTL: v1.17.0\n  KIND: v0.8.1\nservices:\n  - docker:dind\nstages:\n  - test\ntest:\n  sta"
  },
  {
    "path": ".travis.yml",
    "chars": 672,
    "preview": "sudo: required\nlanguage: go\ngo:\n    - \"1.14\"\n\nservices:\n  - docker\n\ninstall: true\n\nscript: \n  - echo \"Run your tests her"
  },
  {
    "path": "LICENSE",
    "chars": 11357,
    "preview": "                                 Apache License\n                           Version 2.0, January 2004\n                   "
  },
  {
    "path": "README.md",
    "chars": 2361,
    "preview": "# Examples\n\nThis repository provides samples and testing for running [sigs.k8s.io/kind](https://sigs.k8s.io/kind) on var"
  },
  {
    "path": "azure-pipelines.yml",
    "chars": 406,
    "preview": "trigger:\n  - master\n\npool:\n  vmImage: 'Ubuntu 18.04'\n\nsteps:\n- task: GoTool@0\n  inputs:\n    version: '1.13.7'\n    goBin:"
  },
  {
    "path": "concourse.md",
    "chars": 1555,
    "preview": "# `kind` on `concourse` with [`kind-on-c`][kind-on-c]\n\n## Quick Intro\n\nTo run [kind] in a [concourse] task you can use ["
  },
  {
    "path": "drone/.drone.yml",
    "chars": 1011,
    "preview": "---\nkind: pipeline\nname: test\n\nplatform:\n  os: linux\n  arch: amd64\n\nsteps:\n  - name: setup\n    image: docker:stable\n    "
  },
  {
    "path": "drone/README.md",
    "chars": 1109,
    "preview": "# DRONE PIPELINE EXAMPLE\n\nAn example drone pipeline using kind to create a kind cluster.\n\nFor the sake of simplicity all"
  },
  {
    "path": "drone/install.sh",
    "chars": 462,
    "preview": "# standard bash error handling\nset -o errexit;\nset -o pipefail;\nset -o nounset;\n# debug commands\nset -x;\n\nKUBECTL=v1.21."
  },
  {
    "path": "drone/kind-config",
    "chars": 370,
    "preview": "apiVersion: kind.x-k8s.io/v1alpha4\nkind: Cluster\nname: test\nnetworking:\n  apiServerAddress: \"0.0.0.0\"\n\nnodes:\n# add to t"
  },
  {
    "path": "drone/setup.sh",
    "chars": 443,
    "preview": "# standard bash error handling\nset -o errexit;\nset -o pipefail;\nset -o nounset;\n# debug commands\nset -x;\n\n\nkind create c"
  },
  {
    "path": "gcb.md",
    "chars": 3561,
    "preview": "# `kind` on Google Cloud Build\n\nThis is very much a **hack**. Don't use this for real, take inspiration from it\nat max!\n"
  },
  {
    "path": "gitlab/kind-config.yaml",
    "chars": 457,
    "preview": "apiVersion: kind.x-k8s.io/v1alpha4\nkind: Cluster\nnetworking:\n  apiServerAddress: \"0.0.0.0\"\n\n# add to the apiServer certS"
  },
  {
    "path": "kind-config.yaml",
    "chars": 135,
    "preview": "# see: https://kind.sigs.k8s.io/docs/user/configuration/\nkind: Cluster\napiVersion: kind.x-k8s.io/v1alpha4\nnodes:\n- role:"
  },
  {
    "path": "kind-smoketest.sh",
    "chars": 1501,
    "preview": "#!/bin/bash\n\n# standard bash error handling\nset -o errexit;\nset -o pipefail;\nset -o nounset;\n# debug commands\nset -x;\n\n#"
  }
]

About this extraction

This page contains the full source code of the kind-ci/examples GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 17 files (26.3 KB), approximately 7.2k tokens. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.

Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.

Copied to clipboard!