Skip to content

Commit

Permalink
Rebase with upstream (#9)
Browse files Browse the repository at this point in the history
* removed kong ingress documentation

* switch to an active mirror

* cluster: drop DisableLocalStorageCapacityIsolation

it was used to workaround a kubelet crash issue with rootless
providers.

The Kubelet seems to work fine now with localStorageCapacityIsolation
enabled in a user namespace so drop the special handling.  After this
change, ephemeral storage can be used in a rootless cluster.

Closes: kubernetes-sigs#3359

Signed-off-by: Giuseppe Scrivano <[email protected]>

* e2e-k8s.sh: support --ginkgo.label-filter

The label filter query is more expressive (logical operations) and readable (no
regexp unless absolutely required). Such a query can be combined with focus +
skip, but in practice a single label filter can replace both of those and is
easier to understand.

Kubernetes has supported ginkgo v2 and thus --label-filter since v1.25.0. This
makes it safe to pass that command line flag unconditionally when invoking the
E2E suite.

* Clean up GitHub Action definitions

This defines a local action for the common actions performed by most of
our workflows. This reduces duplication between them to make sure they
are consistent, and also make the workflow definitions more concise to
just the operations that are unique to the particular testing
activities.

Signed-off-by: Sean McGinnis <[email protected]>

---------

Signed-off-by: Giuseppe Scrivano <[email protected]>
Signed-off-by: Sean McGinnis <[email protected]>
Co-authored-by: Kundan Kumar <[email protected]>
Co-authored-by: Benjamin Elder <[email protected]>
Co-authored-by: Giuseppe Scrivano <[email protected]>
Co-authored-by: Patrick Ohly <[email protected]>
Co-authored-by: Sean McGinnis <[email protected]>
  • Loading branch information
6 people authored Jun 13, 2024
1 parent d0bbb5e commit 5198005
Show file tree
Hide file tree
Showing 9 changed files with 52 additions and 145 deletions.
34 changes: 34 additions & 0 deletions .github/actions/setup-env/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: "Setup environment"
description: "Performs common setup operations."
runs:
using: "composite"
steps:
- name: Get go version
id: golangversion
run: |
echo "go_version=$(cat .go-version)" >> "$GITHUB_OUTPUT"
shell: bash

- name: Set up Go
id: go
uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1
with:
go-version: ${{ steps.golangversion.outputs.go_version }}
check-latest: true

- name: Install kind
run: sudo make install INSTALL_DIR=/usr/local/bin
shell: bash

- name: Install kubectl
run: |
curl -LO https://dl.k8s.io/release/$(curl -sL https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl
chmod +x ./kubectl
sudo mv ./kubectl /usr/local/bin/kubectl
shell: bash

- name: Enable ipv4 and ipv6 forwarding
run: |
sudo sysctl -w net.ipv6.conf.all.forwarding=1
sudo sysctl -w net.ipv4.ip_forward=1
shell: bash
26 changes: 1 addition & 25 deletions .github/workflows/docker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,31 +28,7 @@ jobs:
- name: Check out code into the Go module directory
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6

- name: Get go version
id: golangversion
run: |
echo "go_version=$(cat .go-version)" >> "$GITHUB_OUTPUT"
- name: Set up Go
id: go
uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1
with:
go-version: ${{ steps.golangversion.outputs.go_version }}
check-latest: true

- name: Install kind
run: sudo make install INSTALL_DIR=/usr/local/bin

- name: Install kubectl
run: |
curl -LO https://dl.k8s.io/release/$(curl -sL https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl
chmod +x ./kubectl
sudo mv ./kubectl /usr/local/bin/kubectl
- name: Enable ipv4 and ipv6 forwarding
run: |
sudo sysctl -w net.ipv6.conf.all.forwarding=1
sudo sysctl -w net.ipv4.ip_forward=1
- uses: ./.github/actions/setup-env

- name: Create single node cluster
if: ${{ matrix.deployment == 'singleNode' }}
Expand Down
28 changes: 1 addition & 27 deletions .github/workflows/nerdctl.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,34 +31,8 @@ jobs:
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
with:
fetch-depth: 0

- name: Get go version
id: golangversion
run: |
echo "go_version=$(cat .go-version)" >> "$GITHUB_OUTPUT"
- name: Set up Go
id: go
uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1
with:
go-version: ${{ steps.golangversion.outputs.go_version }}
check-latest: true

- name: Install kind
run: sudo make install INSTALL_DIR=/usr/local/bin

- name: Install kubectl
run: |
curl -LO https://dl.k8s.io/release/$(curl -sL https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl
chmod +x ./kubectl
sudo mv ./kubectl /usr/local/bin/kubectl
- name: Enable ipv4 and ipv6 forwarding
run: |
sudo sysctl -w net.ipv6.conf.all.forwarding=1
sudo sysctl -w net.ipv4.ip_forward=1
- uses: ./.github/actions/setup-env

- name: Install nerdctl
run: |
Expand Down
28 changes: 1 addition & 27 deletions .github/workflows/podman.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,34 +31,8 @@ jobs:
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
with:
fetch-depth: 0

- name: Get go version
id: golangversion
run: |
echo "go_version=$(cat .go-version)" >> "$GITHUB_OUTPUT"
- name: Set up Go
id: go
uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1
with:
go-version: ${{ steps.golangversion.outputs.go_version }}
check-latest: true

- name: Install kind
run: sudo make install INSTALL_DIR=/usr/local/bin

- name: Install kubectl
run: |
curl -LO https://dl.k8s.io/release/$(curl -sL https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl
chmod +x ./kubectl
sudo mv ./kubectl /usr/local/bin/kubectl
- name: Enable ipv4 and ipv6 forwarding
run: |
sudo sysctl -w net.ipv6.conf.all.forwarding=1
sudo sysctl -w net.ipv4.ip_forward=1
- uses: ./.github/actions/setup-env

- name: Setup podman
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/vm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ permissions:
jobs:
vm:
# Fedora is different from Ubuntu in LSM (SELinux), filesystem (btrfs), kernel version, etc.
name: "VM (Fedora)"
name: "CGroupv2 (Fedora)"
runs-on: ubuntu-22.04
timeout-minutes: 30
strategy:
Expand Down
2 changes: 1 addition & 1 deletion hack/ci/Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Vagrant.configure("2") do |config|
# so we specify the URL explicitly.
# Mirrors can be found at here: https://admin.fedoraproject.org/mirrormanager/mirrors/Fedora/37/x86_64
config.vm.box = "dummy"
config.vm.box_url = "https://iad.mirror.rackspace.com/fedora/releases/37/Cloud/x86_64/images/Fedora-Cloud-Base-Vagrant-37-1.7.x86_64.vagrant-virtualbox.box"
config.vm.box_url = "https://mirror.math.princeton.edu/pub/fedora-archive/fedora/linux/releases/37/Cloud/x86_64/images/Fedora-Cloud-Base-Vagrant-37-1.7.x86_64.vagrant-virtualbox.box"
# assume some ram is needed for the host environment but very little CPU
memory = 10240
cpus = 3
Expand Down
16 changes: 13 additions & 3 deletions hack/ci/e2e-k8s.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ set -o errexit -o nounset -o xtrace
# Settings:
# SKIP: ginkgo skip regex
# FOCUS: ginkgo focus regex
# LABEL_FILTER: ginkgo label query for selecting tests (see "Spec Labels" in https://onsi.github.io/ginkgo/#filtering-specs)
#
# The default is to focus on conformance tests. Serial tests get skipped when
# parallel testing is enabled. Using LABEL_FILTER instead of combining SKIP and
# FOCUS is recommended (more expressive, easier to read than regexp).
#
# GA_ONLY: true - limit to GA APIs/features as much as possible
# false - (default) APIs and features left at defaults
# FEATURE_GATES:
Expand Down Expand Up @@ -237,9 +243,13 @@ run_tests() {
printf '%s' "${fixed_coredns}" | kubectl apply -f -
fi

# ginkgo regexes
# ginkgo regexes and label filter
SKIP="${SKIP:-}"
FOCUS="${FOCUS:-"\\[Conformance\\]"}"
FOCUS="${FOCUS:-}"
LABEL_FILTER="${LABEL_FILTER:-}"
if [ -z "${FOCUS}" ] && [ -z "${LABEL_FILTER}" ]; then
FOCUS="\\[Conformance\\]"
fi
# if we set PARALLEL=true, skip serial tests set --ginkgo-parallel
if [ "${PARALLEL:-false}" = "true" ]; then
export GINKGO_PARALLEL=y
Expand All @@ -262,7 +272,7 @@ run_tests() {
# interrupt
./hack/ginkgo-e2e.sh \
'--provider=skeleton' "--num-nodes=${NUM_NODES}" \
"--ginkgo.focus=${FOCUS}" "--ginkgo.skip=${SKIP}" \
"--ginkgo.focus=${FOCUS}" "--ginkgo.skip=${SKIP}" "--ginkgo.label-filter=${LABEL_FILTER}" \
"--report-dir=${ARTIFACTS}" '--disable-log-dump=true' &
GINKGO_PID=$!
wait "$GINKGO_PID"
Expand Down
15 changes: 0 additions & 15 deletions pkg/cluster/internal/kubeadm/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,6 @@ type ConfigData struct {
// RootlessProvider is true if kind is running with rootless mode
RootlessProvider bool

// DisableLocalStorageCapacityIsolation is typically set true based on RootlessProvider
// based on the Kubernetes version, if true kubelet localStorageCapacityIsolation is set false
DisableLocalStorageCapacityIsolation bool

// DerivedConfigData contains fields computed from the other fields for use
// in the config templates and should only be populated by calling Derive()
DerivedConfigData
Expand Down Expand Up @@ -453,7 +449,6 @@ evictionHard:
{{ range $index, $gate := .SortedFeatureGates }}
"{{ (StructuralData $gate.Name) }}": {{ $gate.Value }}
{{end}}{{end}}
{{if .DisableLocalStorageCapacityIsolation}}localStorageCapacityIsolation: false{{end}}
{{if ne .KubeProxyMode "none"}}
---
apiVersion: kubeproxy.config.k8s.io/v1alpha1
Expand Down Expand Up @@ -505,16 +500,6 @@ func Config(data ConfigData) (config string, err error) {
return "", errors.Errorf("version %q is not compatible with rootless provider (hint: kind v0.11.x may work with this version)", ver)
}
data.FeatureGates["KubeletInUserNamespace"] = true

// For avoiding err="failed to get rootfs info: failed to get device for dir \"/var/lib/kubelet\": could not find device with major: 0, minor: 41 in cached partitions map"
// https://github.com/kubernetes-sigs/kind/issues/2524
if ver.LessThan(version.MustParseSemantic("v1.25.0-alpha.3.440+0064010cddfa00")) {
// this feature gate was removed in v1.25 and replaced by an opt-out to disable
data.FeatureGates["LocalStorageCapacityIsolation"] = false
} else {
// added in v1.25 https://github.com/kubernetes/kubernetes/pull/111513
data.DisableLocalStorageCapacityIsolation = true
}
}

// assume the latest API version, then fallback if the k8s version is too low
Expand Down
46 changes: 0 additions & 46 deletions site/content/docs/user/ingress.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,52 +83,6 @@ Note, the example in [Using Ingress](#using-ingress) will not work with Contour

Additional information about Contour can be found at: [projectcontour.io](https://projectcontour.io)

### Ingress Kong

Deploy [Kong Ingress Controller (KIC)](https://docs.konghq.com/kubernetes-ingress-controller/2.1.x/concepts/design/).

{{< codeFromInline lang="bash" >}}
kubectl apply -f https://raw.githubusercontent.com/Kong/kubernetes-ingress-controller/master/deploy/single/all-in-one-dbless.yaml
{{< /codeFromInline >}}

Apply kind specific patches to forward the `hostPorts` to the ingress controller, set taint tolerations, and schedule it to the custom labeled node.

```json
{{% readFile "static/examples/ingress/kong/deployment.patch.json" %}}
```

Apply it by running:

{{< codeFromInline lang="bash" >}}
kubectl patch deployment -n kong proxy-kong -p '{{< minify file="static/examples/ingress/kong/deployment.patch.json" >}}'
{{< /codeFromInline >}}

Apply kind specific patch to change service type to `NodePort`:

```json
{{% readFile "static/examples/ingress/kong/service.patch.json" %}}
```

Apply it by running:

{{< codeFromInline lang="bash" >}}
kubectl patch service -n kong kong-proxy -p '{{< minify file="static/examples/ingress/kong/service.patch.json" >}}'
{{< /codeFromInline >}}

KIC can be used to configure ingress now.

You can try the example in [Using Ingress](#using-ingress) at this moment,
but KIC will not automatically handle `Ingress` object defined there.
`Ingress` resources must include `ingressClassName: kong` under `spec` of `Ingress` for being controlled by Kong Ingress Controller (it will be ignored otherwise).
So once the example has been loaded, you can add this annotation with:

{{< codeFromInline lang="bash" >}}
kubectl patch ingress example-ingress -p '{"spec":{"ingressClassName":"kong"}}'
{{< /codeFromInline >}}

Refer [Using Ingress](#using-ingress) for primary example usage.


### Ingress NGINX

{{< codeFromInline lang="bash" >}}
Expand Down

0 comments on commit 5198005

Please sign in to comment.