Skip to content

Commit

Permalink
Upgrade kind, kind images and add testing for Kubernetes 1.25 (#2060)
Browse files Browse the repository at this point in the history
* Upgrade kind, kind images and add testing for Kubernetes 1.25

Signed-off-by: Israel Blancas <[email protected]>

* UFix merging issue

Signed-off-by: Israel Blancas <[email protected]>

* Make the E2E tests compatible with batchV1/Cronjobs API

Signed-off-by: Israel Blancas <[email protected]>

* Upgrade the Kafka Operator version used for the E2E Tests from 0.23.0 to 0.30.0

Signed-off-by: Israel Blancas <[email protected]>

* Upgrade istio from 0.11.2 to 0.15.0

Signed-off-by: Israel Blancas <[email protected]>

* Add changes requested in CR

Signed-off-by: Israel Blancas <[email protected]>

* Fix linting

Signed-off-by: Israel Blancas <[email protected]>

Signed-off-by: Israel Blancas <[email protected]>
  • Loading branch information
iblancasa authored Sep 16, 2022
1 parent 6c0dbe0 commit 8903e35
Show file tree
Hide file tree
Showing 30 changed files with 107 additions and 61 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/e2e-elasticsearch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
matrix:
kube-version:
- "1.19"
- "1.24"
- "1.25"
name: Run Elasticsearch E2E tests
steps:
- name: "Check out code into the Go module directory"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/e2e-examples.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
matrix:
kube-version:
- "1.19"
- "1.24"
- "1.25"
name: Run examples E2E tests
steps:
- name: "Check out code into the Go module directory"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/e2e-generate.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
matrix:
kube-version:
- "1.19"
- "1.24"
- "1.25"
name: Run generate E2E tests
steps:
- name: "Check out code into the Go module directory"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/e2e-miscellaneous.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
matrix:
kube-version:
- "1.19"
- "1.24"
- "1.25"
name: Run miscellaneous E2E tests
steps:
- name: "Check out code into the Go module directory"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/e2e-sidecar.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
matrix:
kube-version:
- "1.19"
- "1.24"
- "1.25"
name: Run sidecar E2E tests
steps:
- name: "Check out code into the Go module directory"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/e2e-streaming.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
matrix:
kube-version:
- "1.19"
- "1.24"
- "1.25"
name: Run streaming E2E tests
steps:
- name: "Check out code into the Go module directory"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/e2e-ui.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
matrix:
kube-version:
- "1.19"
- "1.24"
- "1.25"
name: UI E2E tests
steps:
- name: "Check out code into the Go module directory"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/e2e-upgrade.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
matrix:
kube-version:
- "1.19"
- "1.24"
- "1.25"
name: Run upgrade E2E tests
steps:
- name: "Check out code into the Go module directory"
Expand Down
5 changes: 3 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,9 @@ export JAEGER_VERSION ?= "$(shell grep jaeger= versions.txt | awk -F= '{print $$
# Kafka and Kafka Operator variables
STORAGE_NAMESPACE ?= "${shell kubectl get sa default -o jsonpath='{.metadata.namespace}' || oc project -q}"
KAFKA_NAMESPACE ?= "kafka"
KAFKA_EXAMPLE ?= "https://raw.githubusercontent.com/strimzi/strimzi-kafka-operator/0.23.0/examples/kafka/kafka-persistent-single.yaml"
KAFKA_YAML ?= "https://github.com/strimzi/strimzi-kafka-operator/releases/download/0.23.0/strimzi-cluster-operator-0.23.0.yaml"
KAFKA_VERSION ?= 0.30.0
KAFKA_EXAMPLE ?= "https://raw.githubusercontent.com/strimzi/strimzi-kafka-operator/${KAFKA_VERSION}/examples/kafka/kafka-persistent-single.yaml"
KAFKA_YAML ?= "https://github.com/strimzi/strimzi-kafka-operator/releases/download/${KAFKA_VERSION}/strimzi-cluster-operator-${KAFKA_VERSION}.yaml"
# Prometheus Operator variables
PROMETHEUS_OPERATOR_TAG ?= v0.39.0
PROMETHEUS_BUNDLE ?= https://raw.githubusercontent.com/prometheus-operator/prometheus-operator/${PROMETHEUS_OPERATOR_TAG}/bundle.yaml
Expand Down
4 changes: 2 additions & 2 deletions apis/v1/groupversion_info.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Package v1 contains API Schema definitions for the jaegertracing.io v1 API group
//+kubebuilder:object:generate=true
//+groupName=jaegertracing.io
// +kubebuilder:object:generate=true
// +groupName=jaegertracing.io
package v1

import (
Expand Down
4 changes: 2 additions & 2 deletions apis/v1/jaeger_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,8 @@ type JaegerStatus struct {
}

// Jaeger is the Schema for the jaegers API
//+kubebuilder:object:root=true
//+kubebuilder:subresource:status
// +kubebuilder:object:root=true
// +kubebuilder:subresource:status
// +operator-sdk:gen-csv:customresourcedefinitions.displayName="Jaeger"
// +operator-sdk:csv:customresourcedefinitions:resources={{CronJob,v1beta1},{Pod,v1},{Deployment,apps/v1}, {Ingress,networking/v1},{DaemonSets,apps/v1},{StatefulSets,apps/v1},{ConfigMaps,v1},{Service,v1}}
// +kubebuilder:subresource:status
Expand Down
2 changes: 1 addition & 1 deletion hack/install/install-istio.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash
VERSION="1.11.2"
VERSION="1.15.0"

echo "Installing istioctl"

Expand Down
2 changes: 1 addition & 1 deletion hack/install/install-kind.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash
VERSION="0.14.0"
VERSION="0.15.0"

echo "Installing kind"

Expand Down
2 changes: 1 addition & 1 deletion kind-1.19.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
- role: control-plane
image: kindest/node:v1.19.16@sha256:d9c819e8668de8d5030708e484a9fdff44d95ec4675d136ef0a0a584e587f65c
image: kindest/node:v1.19.16@sha256:707469aac7e6805e52c3bde2a8a8050ce2b15decff60db6c5077ba9975d28b98
kubeadmConfigPatches:
- |
kind: InitConfiguration
Expand Down
2 changes: 1 addition & 1 deletion kind-1.20.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
- role: control-plane
image: kindest/node:v1.20.15@sha256:6f2d011dffe182bad80b85f6c00e8ca9d86b5b8922cdf433d53575c4c5212248
image: kindest/node:v1.20.15@sha256:d67de8f84143adebe80a07672f370365ec7d23f93dc86866f0e29fa29ce026fe
kubeadmConfigPatches:
- |
kind: InitConfiguration
Expand Down
2 changes: 1 addition & 1 deletion kind-1.21.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
- role: control-plane
image: kindest/node:v1.21.12@sha256:f316b33dd88f8196379f38feb80545ef3ed44d9197dca1bfd48bcb1583210207
image: kindest/node:v1.21.14@sha256:f9b4d3d1112f24a7254d2ee296f177f628f9b4c1b32f0006567af11b91c1f301
kubeadmConfigPatches:
- |
kind: InitConfiguration
Expand Down
2 changes: 1 addition & 1 deletion kind-1.22.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
- role: control-plane
image: kindest/node:v1.22.9@sha256:8135260b959dfe320206eb36b3aeda9cffcb262f4b44cda6b33f7bb73f453105
image: kindest/node:v1.22.13@sha256:4904eda4d6e64b402169797805b8ec01f50133960ad6c19af45173a27eadf959
kubeadmConfigPatches:
- |
kind: InitConfiguration
Expand Down
2 changes: 1 addition & 1 deletion kind-1.23.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
- role: control-plane
image: kindest/node:v1.23.6@sha256:b1fa224cc6c7ff32455e0b1fd9cbfd3d3bc87ecaa8fcb06961ed1afb3db0f9ae
image: kindest/node:v1.23.10@sha256:f047448af6a656fae7bc909e2fab360c18c487ef3edc93f06d78cdfd864b2d12
kubeadmConfigPatches:
- |
kind: InitConfiguration
Expand Down
2 changes: 1 addition & 1 deletion kind-1.24.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
- role: control-plane
image: kindest/node:v1.24.0@sha256:0866296e693efe1fed79d5e6c7af8df71fc73ae45e3679af05342239cdc5bc8e
image: kindest/node:v1.24.4@sha256:adfaebada924a26c2c9308edd53c6e33b3d4e453782c0063dc0028bdebaddf98
kubeadmConfigPatches:
- |
kind: InitConfiguration
Expand Down
18 changes: 18 additions & 0 deletions kind-1.25.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
- role: control-plane
image: kindest/node:v1.25.0@sha256:428aaa17ec82ccde0131cb2d1ca6547d13cf5fdabcc0bbecf749baa935387cbf
kubeadmConfigPatches:
- |
kind: InitConfiguration
nodeRegistration:
kubeletExtraArgs:
node-labels: "ingress-ready=true"
extraPortMappings:
- containerPort: 80
hostPort: 80
protocol: TCP
- containerPort: 443
hostPort: 443
protocol: TCP
4 changes: 2 additions & 2 deletions pkg/kafka/v1beta2/groupversion_info.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Package v1beta2 contains API Schema definitions for the kafka v1beta2 API group
//+kubebuilder:skip
//+kubebuilder:object:generate=true
// +kubebuilder:skip
// +kubebuilder:object:generate=true
package v1beta2

import (
Expand Down
3 changes: 1 addition & 2 deletions pkg/storage/elasticsearch_secrets.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package storage

import (
"fmt"
"io/ioutil"
"os"
"os/exec"
"path"
Expand Down Expand Up @@ -193,7 +192,7 @@ func getFileContents(path string) []byte {
if path == "" {
return nil
}
contents, err := ioutil.ReadFile(filepath.Clean(path))
contents, err := os.ReadFile(filepath.Clean(path))
if err != nil {
return nil
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package storage

import (
"fmt"
"io/ioutil"
"os"
"path"
"reflect"
Expand Down Expand Up @@ -46,11 +45,11 @@ func TestCreateESSecrets(t *testing.T) {
[]string{sec[0].Name, sec[1].Name, sec[2].Name, sec[3].Name})
for _, s := range sec {
if s.Name == jaegerSecret.instanceName(j) {
ca, err := ioutil.ReadFile(fmt.Sprintf("%s/%s/ca.crt", tmpWorkingDir, j.Name))
ca, err := os.ReadFile(fmt.Sprintf("%s/%s/ca.crt", tmpWorkingDir, j.Name))
assert.NoError(t, err)
key, err := ioutil.ReadFile(fmt.Sprintf("%s/%s/user.jaeger.key", tmpWorkingDir, j.Name))
key, err := os.ReadFile(fmt.Sprintf("%s/%s/user.jaeger.key", tmpWorkingDir, j.Name))
assert.NoError(t, err)
cert, err := ioutil.ReadFile(fmt.Sprintf("%s/%s/user.jaeger.crt", tmpWorkingDir, j.Name))
cert, err := os.ReadFile(fmt.Sprintf("%s/%s/user.jaeger.crt", tmpWorkingDir, j.Name))
assert.NoError(t, err)
assert.Equal(t, map[string][]byte{"ca": ca, "key": key, "cert": cert}, s.Data)
}
Expand All @@ -74,7 +73,7 @@ func TestGetWorkingFileDirContent(t *testing.T) {
defer os.RemoveAll(dir)
err := os.MkdirAll(dir, os.ModePerm)
assert.NoError(t, err)
err = ioutil.WriteFile(dir+"/foobar", []byte("foo"), 0o644)
err = os.WriteFile(dir+"/foobar", []byte("foo"), 0o644)
assert.NoError(t, err)
b := getDirFileContents(dir, "foobar")
assert.Equal(t, "foo", string(b))
Expand Down Expand Up @@ -106,7 +105,7 @@ func TestExtractSecretsToFile(t *testing.T) {
secret{name: "sec", keyFileNameMap: map[string]string{"ca": "ca.crt"}},
)
assert.NoError(t, err)
ca, err := ioutil.ReadFile(caFile)
ca, err := os.ReadFile(caFile)
assert.NoError(t, err)
assert.Equal(t, []byte(content), ca)
}
Expand All @@ -125,7 +124,7 @@ func TestExtractSecretsToFile_FileExists(t *testing.T) {
content := "115dasrez"
err := os.MkdirAll(tmpWorkingDir+"/bar/houdy", os.ModePerm)
assert.NoError(t, err)
err = ioutil.WriteFile(tmpWorkingDir+"/bar/houdy/ca.crt", []byte(content), os.ModePerm)
err = os.WriteFile(tmpWorkingDir+"/bar/houdy/ca.crt", []byte(content), os.ModePerm)
assert.NoError(t, err)

j := v1.NewJaeger(types.NamespacedName{Name: "houdy"})
Expand All @@ -136,7 +135,7 @@ func TestExtractSecretsToFile_FileExists(t *testing.T) {
secret{name: "sec", keyFileNameMap: map[string]string{"ca": "ca.crt"}},
)
assert.NoError(t, err)
ca, err := ioutil.ReadFile(tmpWorkingDir + "/bar/houdy/ca.crt")
ca, err := os.ReadFile(tmpWorkingDir + "/bar/houdy/ca.crt")
assert.NoError(t, err)
assert.Equal(t, []byte(content), ca)
}
Expand Down
3 changes: 1 addition & 2 deletions pkg/util/k8s_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package util

import (
"fmt"
"io/ioutil"
"os"
"strings"

Expand Down Expand Up @@ -46,7 +45,7 @@ func GetOperatorNamespace() (string, error) {
if isRunModeLocal() {
return "", ErrRunLocal
}
nsBytes, err := ioutil.ReadFile("/var/run/secrets/kubernetes.io/serviceaccount/namespace")
nsBytes, err := os.ReadFile("/var/run/secrets/kubernetes.io/serviceaccount/namespace")
if err != nil {
if os.IsNotExist(err) {
return "", ErrNoNamespace
Expand Down
7 changes: 4 additions & 3 deletions tests/assert-jobs/utils/elasticsearch/elasticsearch.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ import (
"crypto/x509"
"encoding/json"
"fmt"
"io/ioutil"
"io"
"net/http"
"os"
"path"
"path/filepath"

Expand Down Expand Up @@ -48,7 +49,7 @@ func (connection *EsConnection) LoadCertificate(secretPath string) error {
return fmt.Errorf("something failed while loading the x509 key pair: %s", err)
}

caCert, err := ioutil.ReadFile(filepath.Clean(caFile))
caCert, err := os.ReadFile(filepath.Clean(caFile))
if err != nil {
return fmt.Errorf("something failed while reading the CA file: %s", err)
}
Expand Down Expand Up @@ -241,5 +242,5 @@ func executeEsRequest(es EsConnection, httpMethod, api string, body []byte) ([]b

defer resp.Body.Close()

return ioutil.ReadAll(resp.Body)
return io.ReadAll(resp.Body)
}
4 changes: 2 additions & 2 deletions tests/assert-jobs/utils/secrets/secrets.go
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
package secrets

import (
"io/ioutil"
"os"
"path/filepath"

"github.com/sirupsen/logrus"
)

// GetToken reads the token from the given path and returns it
func GetToken(path string) string {
content, err := ioutil.ReadFile(filepath.Clean(path))
content, err := os.ReadFile(filepath.Clean(path))
if err != nil {
logrus.Errorln("Something failed during reading the token:", err)
return ""
Expand Down
4 changes: 2 additions & 2 deletions tests/assert-jobs/utils/testhttp.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package utils
import (
"crypto/tls"
"fmt"
"io/ioutil"
"io"
"net/http"
"strings"
"time"
Expand Down Expand Up @@ -69,7 +69,7 @@ func TestGetHTTP(url string, params *TestParams, testFn func(response *http.Resp
return false, nil
}

body, err := ioutil.ReadAll(res.Body)
body, err := io.ReadAll(res.Body)
if len(body) == 0 {
failed = true
err = fmt.Errorf("empty body response")
Expand Down
Loading

0 comments on commit 8903e35

Please sign in to comment.