Skip to content

Commit

Permalink
Merge pull request #48 from slok/v115
Browse files Browse the repository at this point in the history
Update Kubernetes 1.15
  • Loading branch information
slok authored Feb 16, 2020
2 parents 494d395 + 2c295cf commit be0a295
Show file tree
Hide file tree
Showing 8 changed files with 85 additions and 44 deletions.
6 changes: 3 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ env:
global:
- GO111MODULE=on
- KIND_VERSION=v0.7.0
- KUBERNETES_VERSION=1.14.10
- KUBERNETES_VERSION=1.15.7
# - NGROK_SSH_PRIVATE_KEY_B64

matrix:
include:
#- env: KUBERNETES_VERSION=1.12.10
#- env: KUBERNETES_VERSION=1.13.12
- env: KUBERNETES_VERSION=1.14.10
#- env: KUBERNETES_VERSION=1.15.7
#- env: KUBERNETES_VERSION=1.14.10
- env: KUBERNETES_VERSION=1.15.7
#- env: KUBERNETES_VERSION=1.16.4
#- env: KUBERNETES_VERSION=1.17.0
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@

## [Unreleased]

### Changed
- Update to Kubernetes v1.15.

## [0.5.0] - 2020-02-16
### Changed
- Update to Kubernetes v1.14.
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ MOCKS_CMD := ./hack/scripts/mockgen.sh
DOCKER_RUN_CMD := docker run -v ${PWD}:$(DOCKER_GO_SERVICE_PATH) --rm -it $(SERVICE_NAME)
DOCKER_DOCS_RUN_CMD := docker run -v ${PWD}/docs:/docs --rm -it -p 1313:1313 $(SERVICE_NAME)-docs
DEPS_CMD := GO111MODULE=on go mod tidy && GO111MODULE=on go mod vendor
K8S_VERSION := "1.14.10"
K8S_VERSION := "1.15.10"
SET_K8S_DEPS_CMD := GO111MODULE=on go mod edit \
-require=k8s.io/apimachinery@kubernetes-${K8S_VERSION} \
-require=k8s.io/api@kubernetes-${K8S_VERSION} \
Expand Down
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ require (
golang.org/x/text v0.3.2 // indirect
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
k8s.io/api v0.0.0-20191004102349-159aefb8556b
k8s.io/apimachinery v0.0.0-20191004074956-c5d2f014d689
k8s.io/client-go v11.0.1-0.20191029005444-8e4128053008+incompatible
k8s.io/api v0.15.10
k8s.io/apimachinery v0.15.11-beta.0
k8s.io/client-go v0.15.10
k8s.io/klog v1.0.0 // indirect
k8s.io/utils v0.0.0-20200124190032-861946025e34 // indirect
sigs.k8s.io/yaml v1.2.0 // indirect
Expand Down
72 changes: 53 additions & 19 deletions go.sum

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion hack/scripts/run-integration.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ set -euo pipefail
CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
TUNNEL_INFO_PATH="/tmp/$(openssl rand -hex 12)-ngrok-tcp-tunnel"
LOCAL_PORT=8080
KUBERNETES_VERSION=v${KUBERNETES_VERSION:-1.14.10}
KUBERNETES_VERSION=v${KUBERNETES_VERSION:-1.15.7}
K3S=${K3S:-false}
PREVIOUS_KUBECTL_CONTEXT=$(kubectl config current-context) || PREVIOUS_KUBECTL_CONTEXT=""

Expand Down
20 changes: 11 additions & 9 deletions test/integration/webhook/mutating_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ package webhook_test

import (
"context"
"fmt"
"net/http"
"testing"
"time"

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
Expand All @@ -26,7 +28,7 @@ func getMutatingWebhookConfig(t *testing.T, cfg helperconfig.TestEnvConfig, rule
ObjectMeta: metav1.ObjectMeta{
Name: "integration-test-webhook",
},
Webhooks: []arv1beta1.Webhook{
Webhooks: []arv1beta1.MutatingWebhook{
{
Name: "test.slok.dev",
ClientConfig: arv1beta1.WebhookClientConfig{
Expand Down Expand Up @@ -88,7 +90,7 @@ func TestMutatingWebhook(t *testing.T) {
// Try creating a pod.
p := &corev1.Pod{
ObjectMeta: metav1.ObjectMeta{
Name: "test",
Name: fmt.Sprintf("test-%d", time.Now().UnixNano()),
Namespace: "default",
Labels: map[string]string{
"nickname": "Dark-knight",
Expand All @@ -104,9 +106,9 @@ func TestMutatingWebhook(t *testing.T) {
},
},
}
_, err := cli.CoreV1().Pods("default").Create(p)
_, err := cli.CoreV1().Pods(p.Namespace).Create(p)
require.NoError(t, err)
defer cli.CoreV1().Pods("default").Delete(p.Name, &metav1.DeleteOptions{})
defer cli.CoreV1().Pods(p.Namespace).Delete(p.Name, &metav1.DeleteOptions{})

// Check expectations.
expLabels := map[string]string{
Expand All @@ -115,7 +117,7 @@ func TestMutatingWebhook(t *testing.T) {
"nickname": "Batman",
"city": "Gotham",
}
pod, err := cli.CoreV1().Pods("default").Get("test", metav1.GetOptions{})
pod, err := cli.CoreV1().Pods(p.Namespace).Get(p.Name, metav1.GetOptions{})
if assert.NoError(t, err) {
assert.Equal(t, expLabels, pod.Labels)
}
Expand Down Expand Up @@ -154,7 +156,7 @@ func TestMutatingWebhook(t *testing.T) {
// Create a pod.
p := &corev1.Pod{
ObjectMeta: metav1.ObjectMeta{
Name: "test2",
Name: fmt.Sprintf("test-%d", time.Now().UnixNano()),
Namespace: "default",
},
Spec: corev1.PodSpec{
Expand All @@ -172,9 +174,9 @@ func TestMutatingWebhook(t *testing.T) {
},
},
}
_, err := cli.CoreV1().Pods("default").Create(p)
_, err := cli.CoreV1().Pods(p.Namespace).Create(p)
require.NoError(t, err)
defer cli.CoreV1().Pods("default").Delete(p.Name, &metav1.DeleteOptions{})
defer cli.CoreV1().Pods(p.Namespace).Delete(p.Name, &metav1.DeleteOptions{})

// Check expectations.
expContainers := []corev1.Container{
Expand All @@ -190,7 +192,7 @@ func TestMutatingWebhook(t *testing.T) {
},
},
}
pod, err := cli.CoreV1().Pods("default").Get("test2", metav1.GetOptions{})
pod, err := cli.CoreV1().Pods(p.Namespace).Get(p.Name, metav1.GetOptions{})
if assert.NoError(t, err) {
// Sanitize default settings on containers before checking expectations.
for i, container := range pod.Spec.Containers {
Expand Down
18 changes: 10 additions & 8 deletions test/integration/webhook/validating_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ package webhook_test

import (
"context"
"fmt"
"net/http"
"testing"
"time"

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
Expand All @@ -27,7 +29,7 @@ func getValidatingWebhookConfig(t *testing.T, cfg helperconfig.TestEnvConfig, ru
ObjectMeta: metav1.ObjectMeta{
Name: "integration-test-webhook",
},
Webhooks: []arv1beta1.Webhook{
Webhooks: []arv1beta1.ValidatingWebhook{
{
Name: "test.slok.dev",
ClientConfig: arv1beta1.WebhookClientConfig{
Expand Down Expand Up @@ -75,14 +77,14 @@ func TestValidatingWebhook(t *testing.T) {
// Crate a pod and check expectations.
p := &corev1.Pod{
ObjectMeta: metav1.ObjectMeta{
Name: "test",
Name: fmt.Sprintf("test-%d", time.Now().UnixNano()),
Namespace: "default",
},
Spec: corev1.PodSpec{
Containers: []corev1.Container{corev1.Container{Name: "test", Image: "wrong"}},
},
}
_, err := cli.CoreV1().Pods("default").Create(p)
_, err := cli.CoreV1().Pods(p.Namespace).Create(p)
if assert.Error(t, err) {
sErr, ok := err.(*apierrors.StatusError)
if assert.True(t, ok) {
Expand All @@ -91,7 +93,7 @@ func TestValidatingWebhook(t *testing.T) {
}
} else {
// Creation should err, if we are here then we need to clean.
cli.CoreV1().Pods("default").Delete(p.Name, &metav1.DeleteOptions{})
cli.CoreV1().Pods(p.Namespace).Delete(p.Name, &metav1.DeleteOptions{})
}
},
},
Expand All @@ -113,19 +115,19 @@ func TestValidatingWebhook(t *testing.T) {
// Crate a pod.
p := &corev1.Pod{
ObjectMeta: metav1.ObjectMeta{
Name: "test2",
Name: fmt.Sprintf("test-%d", time.Now().UnixNano()),
Namespace: "default",
},
Spec: corev1.PodSpec{
Containers: []corev1.Container{corev1.Container{Name: "test", Image: "wrong"}},
},
}
_, err := cli.CoreV1().Pods("default").Create(p)
_, err := cli.CoreV1().Pods(p.Namespace).Create(p)
require.NoError(t, err)
defer cli.CoreV1().Pods("default").Delete(p.Name, &metav1.DeleteOptions{})
defer cli.CoreV1().Pods(p.Namespace).Delete(p.Name, &metav1.DeleteOptions{})

// Check expectations.
_, err = cli.CoreV1().Pods("default").Get("test2", metav1.GetOptions{})
_, err = cli.CoreV1().Pods(p.Namespace).Get(p.Name, metav1.GetOptions{})
assert.NoError(t, err, "pod should be present")
},
},
Expand Down

0 comments on commit be0a295

Please sign in to comment.