Skip to content

Commit

Permalink
Add latest k8s versions in testing (#26729) (#26768)
Browse files Browse the repository at this point in the history
(cherry picked from commit 1654489)

Co-authored-by: Chris Mark <[email protected]>
  • Loading branch information
mergify[bot] and ChrsMark authored Jul 8, 2021
1 parent 7e41784 commit b79145e
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 8 deletions.
20 changes: 19 additions & 1 deletion .ci/scripts/kind-setup.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,23 @@
#!/usr/bin/env bash
set -exuo pipefail

kind create cluster --image kindest/node:${K8S_VERSION}
kind create cluster --image kindest/node:${K8S_VERSION} --config - <<EOF
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
- role: control-plane
kubeadmConfigPatches:
- |
kind: ClusterConfiguration
scheduler:
extraArgs:
bind-address: "0.0.0.0"
port: "10251"
secure-port: "10259"
controllerManager:
extraArgs:
bind-address: "0.0.0.0"
port: "10252"
secure-port: "10257"
EOF
kubectl cluster-info
2 changes: 1 addition & 1 deletion Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ def k8sTest(Map args = [:]) {
versions.each{ v ->
withNode(labels: args.label, forceWorkspace: true){
stage("${args.context} ${v}"){
withEnv(["K8S_VERSION=${v}", "KIND_VERSION=v0.7.0", "KUBECONFIG=${env.WORKSPACE}/kubecfg"]){
withEnv(["K8S_VERSION=${v}", "KIND_VERSION=v0.11.1", "KUBECONFIG=${env.WORKSPACE}/kubecfg"]){
withGithubNotify(context: "${args.context} ${v}") {
withBeatsEnv(archive: false, withModule: false) {
retryWithSleep(retries: 2, seconds: 5, backoff: true){ sh(label: "Install kind", script: ".ci/scripts/install-kind.sh") }
Expand Down
2 changes: 1 addition & 1 deletion deploy/kubernetes/Jenkinsfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ stages:
make check-no-changes;
stage: lint
k8sTest:
k8sTest: "v1.18.2,v1.17.2,v1.16.4,v1.15.7,v1.14.10"
k8sTest: "v1.21.1,v1.20.7,v1.19.11,v1.18.19,v1.17.17,v1.14.10"
stage: mandatory
3 changes: 2 additions & 1 deletion metricbeat/docs/modules/kubernetes.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,8 @@ roleRef:
[float]
=== Compatibility

The Kubernetes module is tested with Kubernetes 1.13.x, 1.14.x, 1.15.x, 1.16.x, 1.17.x, and 1.18.x
The Kubernetes module is tested with the following versions of Kubernetes:
1.14.x, 1.17.x, 1.18.x, 1.19.x, 1.20.x, 1.21.x

[float]
=== Dashboard
Expand Down
3 changes: 2 additions & 1 deletion metricbeat/module/kubernetes/_meta/docs.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,8 @@ roleRef:
[float]
=== Compatibility

The Kubernetes module is tested with Kubernetes 1.13.x, 1.14.x, 1.15.x, 1.16.x, 1.17.x, and 1.18.x
The Kubernetes module is tested with the following versions of Kubernetes:
1.14.x, 1.17.x, 1.18.x, 1.19.x, 1.20.x, 1.21.x

[float]
=== Dashboard
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import (
)

func TestFetchMetricset(t *testing.T) {
config := test.GetAPIServerConfig(t, "controllermanager")
config := test.GetControllerManagerConfig(t, "controllermanager")
metricSet := mbtest.NewFetcher(t, config)
events, errs := metricSet.FetchEvents()
if len(errs) > 0 {
Expand Down
15 changes: 13 additions & 2 deletions metricbeat/module/kubernetes/test/integration.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,11 @@ func GetKubeProxyConfig(t *testing.T, metricSetName string) map[string]interface
"module": "kubernetes",
"metricsets": []string{metricSetName},
"host": "${NODE_NAME}",
"hosts": []string{"localhost:10252"},
"hosts": []string{"localhost:10249"},
}
}

// GetSchedulerConfig function returns configuration for talking to kube-proxy.
// GetSchedulerConfig function returns configuration for talking to kube-scheduler.
func GetSchedulerConfig(t *testing.T, metricSetName string) map[string]interface{} {
t.Helper()
return map[string]interface{}{
Expand All @@ -85,3 +85,14 @@ func GetSchedulerConfig(t *testing.T, metricSetName string) map[string]interface
"hosts": []string{"localhost:10251"},
}
}

// GetControllerManagerConfig function returns configuration for talking to kube-controller-manager.
func GetControllerManagerConfig(t *testing.T, metricSetName string) map[string]interface{} {
t.Helper()
return map[string]interface{}{
"module": "kubernetes",
"metricsets": []string{metricSetName},
"host": "${NODE_NAME}",
"hosts": []string{"localhost:10252"},
}
}

0 comments on commit b79145e

Please sign in to comment.