Skip to content

Commit

Permalink
chore: bump k8s packages to 1.17.8 (#42)
Browse files Browse the repository at this point in the history
  • Loading branch information
colunira authored Jul 14, 2020
1 parent 3a778e9 commit efaeddc
Show file tree
Hide file tree
Showing 8 changed files with 487 additions and 489 deletions.
15 changes: 8 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,24 +14,25 @@ test: generate fmt vet manifests

# Start KIND pseudo-cluster
kind-start:
GO111MODULE=on go get "sigs.k8s.io/[email protected]" && kind create cluster
KUBECONFIG=$(shell kind get kubeconfig-path --name="kind")
GO111MODULE=on go get "sigs.k8s.io/[email protected]" && kind create cluster

# Stop KIND pseudo-cluster
kind-stop:
GO111MODULE=on go get "sigs.k8s.io/kind@v0.4.0" && kind delete cluster
GO111MODULE=on go get "sigs.k8s.io/kind@v0.7.0" && kind delete cluster

# Deploy on KIND
# Ensures the controller image is built, deploys the image to KIND cluster along with necessary configuration
kind-deploy: manager manifests docker-build-notest kind-start
kubectl config set-context kind-kind
kind load docker-image controller:latest
KUBECONFIG=$(KUBECONFIG) kubectl apply -f config/crd/bases
kustomize build config/default | KUBECONFIG=$(KUBECONFIG) kubectl apply -f -
kubectl apply -f config/crd/bases
kustomize build config/default | kubectl apply -f -

# private
kind-test: kind-deploy
kubectl config set-context kind-kind
go get github.com/onsi/ginkgo/ginkgo
KUBECONFIG=$(KUBECONFIG) ginkgo -v ./tests/integration/...
ginkgo -v ./tests/integration/...

# Run integration tests on local KIND cluster
test-integration:
Expand Down Expand Up @@ -86,7 +87,7 @@ docker-push:
# download controller-gen if necessary
controller-gen:
ifeq (, $(shell which controller-gen))
go get sigs.k8s.io/controller-tools/cmd/[email protected].0-beta.2
go get sigs.k8s.io/controller-tools/cmd/[email protected].9
CONTROLLER_GEN=$(shell which controller-gen)
else
CONTROLLER_GEN=$(shell which controller-gen)
Expand Down
2 changes: 1 addition & 1 deletion api/v1alpha1/rule_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ type Upstream struct {
// URL defines the target URL for incoming requests
// +kubebuilder:validation:MinLength=3
// +kubebuilder:validation:MaxLength=256
// +kubebuilder:validation:Pattern=^(?:https?:\/\/)?(?:[^@\/\n]+@)?(?:www\.)?([^:\/\n]+)
// +kubebuilder:validation:Pattern=`^(?:https?:\/\/)?(?:[^@\/\n]+@)?(?:www\.)?([^:\/\n]+)`
URL string `json:"url"`
// StripPath replaces the provided path prefix when forwarding the requested URL to the upstream URL.
// +optional
Expand Down
4 changes: 2 additions & 2 deletions api/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

383 changes: 22 additions & 361 deletions config/crd/bases/oathkeeper.ory.sh_rules.yaml

Large diffs are not rendered by default.

30 changes: 15 additions & 15 deletions config/rbac/role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,34 +7,34 @@ metadata:
name: manager-role
rules:
- apiGroups:
- oathkeeper.ory.sh
- ""
resources:
- rules
- configmaps
verbs:
- create
- delete
- get
- list
- watch
- create
- update
- patch
- delete
- update
- watch
- apiGroups:
- oathkeeper.ory.sh
resources:
- rules/status
- rules
verbs:
- create
- delete
- get
- update
- list
- patch
- update
- watch
- apiGroups:
- ""
- oathkeeper.ory.sh
resources:
- configmaps
- rules/status
verbs:
- get
- list
- watch
- create
- update
- patch
- delete
- update
20 changes: 8 additions & 12 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,12 @@ require (
github.com/bitly/go-simplejson v0.5.0
github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869 // indirect
github.com/go-logr/logr v0.1.0
github.com/onsi/ginkgo v1.10.3
github.com/onsi/gomega v1.5.0
github.com/stretchr/testify v1.3.0
golang.org/x/net v0.0.0-20190620200207-3b0461eec859 // indirect
golang.org/x/sys v0.0.0-20190429190828-d89cdac9e872 // indirect
golang.org/x/text v0.3.2 // indirect
gopkg.in/yaml.v2 v2.2.2 // indirect
k8s.io/api v0.0.0-20190409021203-6e4e0e4f393b
k8s.io/apimachinery v0.0.0-20190404173353-6a84e37a896d
k8s.io/client-go v11.0.1-0.20190409021438-1a26190bd76a+incompatible
sigs.k8s.io/controller-runtime v0.2.0-beta.2
sigs.k8s.io/kind v0.4.0 // indirect
github.com/onsi/ginkgo v1.14.0
github.com/onsi/gomega v1.10.1
github.com/stretchr/testify v1.4.0
k8s.io/api v0.17.8
k8s.io/apimachinery v0.17.8
k8s.io/client-go v0.17.8
sigs.k8s.io/controller-runtime v0.5.8
sigs.k8s.io/kind v0.7.0 // indirect
)
485 changes: 410 additions & 75 deletions go.sum

Large diffs are not rendered by default.

37 changes: 21 additions & 16 deletions tests/integration/rules_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package integration
import (
"errors"
"fmt"
"k8s.io/client-go/rest"
"os"
"time"

Expand Down Expand Up @@ -169,14 +170,7 @@ func expectRuleCount(rulesArray *json.Json, cnt int) {
}

func getK8sDynamicClientOrDie() dynamic.Interface {
var kubeconfig = os.Getenv("KUBECONFIG")

// use the current context in kubeconfig
config, err := clientcmd.BuildConfigFromFlags("", kubeconfig)
if err != nil {
fmt.Printf("\nError building K8s config: %s\n", err.Error())
os.Exit(1)
}
config := getKubeConfigOrDie()

// create the client
client, err := dynamic.NewForConfig(config)
Expand All @@ -189,14 +183,7 @@ func getK8sDynamicClientOrDie() dynamic.Interface {
}

func getK8sClientOrDie() *kubernetes.Clientset {
var kubeconfig = os.Getenv("KUBECONFIG")

// use the current context in kubeconfig
config, err := clientcmd.BuildConfigFromFlags("", kubeconfig)
if err != nil {
fmt.Printf("\nError building K8s config: %s\n", err.Error())
os.Exit(1)
}
config := getKubeConfigOrDie()

// create the clientset
clientset, err := kubernetes.NewForConfig(config)
Expand All @@ -208,6 +195,24 @@ func getK8sClientOrDie() *kubernetes.Clientset {
return clientset
}

func getKubeConfigOrDie() *rest.Config {
if _, err := os.Stat(clientcmd.RecommendedHomeFile); os.IsNotExist(err) {
cfg, err := rest.InClusterConfig()
if err != nil {
fmt.Printf("Cannot create in-cluster config: %v", err)
panic(err)
}
return cfg
}

cfg, err := clientcmd.BuildConfigFromFlags("", clientcmd.RecommendedHomeFile)
if err != nil {
fmt.Printf("Cannot read kubeconfig: %s", err)
panic(err)
}
return cfg
}

func toNamespace(name string) *corev1.Namespace {
return &corev1.Namespace{
ObjectMeta: metav1.ObjectMeta{
Expand Down

0 comments on commit efaeddc

Please sign in to comment.