Skip to content

Commit

Permalink
Update admission API version (#54)
Browse files Browse the repository at this point in the history
Co-authored-by: Yurii Matsiuk <ymatsiuk@users.noreply.github.com>
  • Loading branch information
ymatsiuk and ymatsiuk committed Jun 7, 2021
1 parent 902e9e3 commit 87dc057
Show file tree
Hide file tree
Showing 8 changed files with 531 additions and 216 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Build the manager binary
FROM golang:1.13 as builder
FROM golang:1.16 as builder

WORKDIR /workspace
# Copy the Go Modules manifests
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ ifeq (, $(shell which controller-gen))
CONTROLLER_GEN_TMP_DIR=$$(mktemp -d) ;\
cd $$CONTROLLER_GEN_TMP_DIR ;\
go mod init tmp ;\
go get sigs.k8s.io/controller-tools/cmd/controller-gen@v0.2.4 ;\
go get sigs.k8s.io/controller-tools/cmd/controller-gen@v0.5.0 ;\
rm -rf $$CONTROLLER_GEN_TMP_DIR ;\
}
CONTROLLER_GEN=$(GOBIN)/controller-gen
Expand Down
6 changes: 4 additions & 2 deletions deploy/dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ rules:
resources: ["secrets"]
verbs: ["*"]
---
apiVersion: rbac.authorization.k8s.io/v1beta1
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: telegraf-operator
Expand All @@ -37,7 +37,7 @@ subjects:
name: telegraf-operator
namespace: telegraf-operator
---
apiVersion: admissionregistration.k8s.io/v1beta1
apiVersion: admissionregistration.k8s.io/v1
kind: MutatingWebhookConfiguration
metadata:
name: telegraf-operator
Expand All @@ -50,6 +50,8 @@ webhooks:
# namespaceSelector:
# matchLabels:
# controller: telegraf-operator
admissionReviewVersions: ["v1"]
sideEffects: None
clientConfig:
service:
name: telegraf-operator
Expand Down
14 changes: 7 additions & 7 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
module github.com/influxdata/telegraf-operator

go 1.13
go 1.16

require (
github.com/go-logr/logr v0.1.0
github.com/go-logr/logr v0.3.0
github.com/influxdata/toml v0.0.0-20180607005434-2a2e3012f7cf
github.com/naoina/go-stringutil v0.1.0 // indirect
k8s.io/api v0.0.0-20190918155943-95b840bb6a1f
k8s.io/apimachinery v0.0.0-20190913080033-27d36303b655
k8s.io/apiserver v0.0.0-20190918160949-bfa5e2e684ad
k8s.io/client-go v0.0.0-20190918160344-1fbdaa4c8d90
sigs.k8s.io/controller-runtime v0.4.0
k8s.io/api v0.20.2
k8s.io/apimachinery v0.20.2
k8s.io/apiserver v0.20.1
k8s.io/client-go v0.20.2
sigs.k8s.io/controller-runtime v0.8.3
)
714 changes: 514 additions & 200 deletions go.sum

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
"net/http"

"github.com/go-logr/logr"
admv1 "k8s.io/api/admission/v1beta1"
admv1 "k8s.io/api/admission/v1"
corev1 "k8s.io/api/core/v1"
"k8s.io/apiserver/pkg/storage/names"

Expand All @@ -32,7 +32,7 @@ import (
"sigs.k8s.io/controller-runtime/pkg/webhook/admission"
)

// +kubebuilder:webhook:path=/mutate-v1-pod,mutating=true,failurePolicy=fail,groups="",resources=pods,verbs=create;update,versions=v1,name=mpod.kb.io
// +kubebuilder:webhook:path=/mutate-v1-pod,mutating=true,failurePolicy=fail,groups="",resources=pods,verbs=create;update,versions=v1,name=mpod.kb.io,sideEffects=None,admissionReviewVersions=v1

// podInjector inject telegraf Pods
type podInjector struct {
Expand Down
2 changes: 1 addition & 1 deletion handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"sort"
"testing"

admv1 "k8s.io/api/admission/v1beta1"
admv1 "k8s.io/api/admission/v1"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
Expand Down
3 changes: 1 addition & 2 deletions sidecar_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -303,8 +303,7 @@ metadata:
name: telegraf-config-myname
namespace: mynamespace
stringData:
telegraf.conf: "\n[[inputs.prometheus]]\n urls = [\"http://127.0.0.1:6060/metrics\"]\n
\ \n\n"
telegraf.conf: "\n[[inputs.prometheus]]\n urls = [\"http://127.0.0.1:6060/metrics\"]\n \n\n"
type: Opaque`,
},
},
Expand Down

0 comments on commit 87dc057

Please sign in to comment.