Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update K8s version to 0.20.2 #74

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions build/tools.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*
Copyright 2020 The SuperEdge Authors.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

// +build tools

// This package imports things required by build scripts, to force `go mod` to see them as dependencies
package build

import (
_ "k8s.io/code-generator"
)
30 changes: 8 additions & 22 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,32 +1,18 @@
module tkestack.io/tapp

go 1.12
go 1.15

require (
github.com/evanphx/json-patch v4.5.0+incompatible // indirect
github.com/gogo/protobuf v1.3.1 // indirect
github.com/golang/groupcache v0.0.0-20191027212112-611e8accdfc9 // indirect
github.com/googleapis/gnostic v0.3.1 // indirect
github.com/davecgh/go-spew v1.1.1
github.com/hashicorp/golang-lru v0.5.3 // indirect
github.com/imdario/mergo v0.3.8 // indirect
github.com/json-iterator/go v1.1.8 // indirect
github.com/mitchellh/gox v1.0.1 // indirect
github.com/modern-go/reflect2 v1.0.1 // indirect
github.com/onsi/ginkgo v1.10.3 // indirect
github.com/onsi/gomega v1.7.1 // indirect
github.com/pkg/errors v0.8.1 // indirect
github.com/spf13/pflag v1.0.5
golang.org/x/crypto v0.0.0-20191206172530-e9b2fee46413 // indirect
golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6 // indirect
golang.org/x/time v0.0.0-20191024005414-555d28b269f0 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
k8s.io/api v0.0.0-20191004102349-159aefb8556b
k8s.io/apiextensions-apiserver v0.0.0-20191212015246-8fe0c124fb40
k8s.io/apimachinery v0.0.0-20191004074956-c5d2f014d689
k8s.io/client-go v11.0.1-0.20191029005444-8e4128053008+incompatible
k8s.io/component-base v0.0.0-20191212015026-7bd5511f1bb2
k8s.io/api v0.20.2
k8s.io/apiextensions-apiserver v0.20.2
k8s.io/apimachinery v0.20.2
k8s.io/client-go v0.20.2
k8s.io/code-generator v0.20.2
k8s.io/component-base v0.20.2
k8s.io/klog v1.0.0
k8s.io/kube-openapi v0.0.0-20191107075043-30be4d16710a // indirect
k8s.io/kubernetes v1.14.10
k8s.io/utils v0.0.0-20191114200735-6ca3b61696b6 // indirect
)
645 changes: 587 additions & 58 deletions go.sum

Large diffs are not rendered by default.

15 changes: 15 additions & 0 deletions hack/boilerplate.go.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/*
Copyright The Kubernetes Authors.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
3 changes: 2 additions & 1 deletion hack/update-codegen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ CODEGEN_PKG=${CODEGEN_PKG:-$(cd ${SCRIPT_ROOT}; ls -d -1 ./vendor/k8s.io/code-ge
${CODEGEN_PKG}/generate-groups.sh "deepcopy,client,informer,lister" \
tkestack.io/tapp/pkg/client tkestack.io/tapp/pkg/apis \
tappcontroller:v1 \
--output-base "$(dirname ${BASH_SOURCE})/../../../.."
--output-base "$(dirname ${BASH_SOURCE})/../../.." \
--go-header-file ${SCRIPT_ROOT}/hack/boilerplate.go.txt

# To use your own boilerplate text append:
# --go-header-file ${SCRIPT_ROOT}/hack/custom-boilerplate.go.txt
4 changes: 2 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ import (
"k8s.io/client-go/tools/leaderelection"
"k8s.io/client-go/tools/leaderelection/resourcelock"
componentbaseconfig "k8s.io/component-base/config"
"k8s.io/component-base/config/options"
"k8s.io/component-base/logs"
"k8s.io/klog"
"k8s.io/kubernetes/pkg/client/leaderelectionconfig"
)

var (
Expand Down Expand Up @@ -207,5 +207,5 @@ func addFlags(fs *pflag.FlagSet) {
fs.StringVar(&tlsKeyFile, "tlsKeyFile", "/etc/certs/tls.key", "File containing the x509 private key to for HTTPS.")
fs.StringVar(&namespace, "namespace", "kube-system", "Namespace to deploy tapp controller")

leaderelectionconfig.BindFlags(&leaderElection, fs)
options.BindLeaderElectionFlags(&leaderElection, fs)
}
9 changes: 5 additions & 4 deletions pkg/admission/admission.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
package admission

import (
"context"
"encoding/json"
"fmt"
"io/ioutil"
Expand Down Expand Up @@ -59,7 +60,7 @@ func Register(clientset *kubernetes.Clientset, namespace string, caFile string)
ObjectMeta: metav1.ObjectMeta{
Name: validatingWebhookConfiguration,
},
Webhooks: []admissionregistrationv1beta1.Webhook{
Webhooks: []admissionregistrationv1beta1.ValidatingWebhook{
{
Name: fmt.Sprintf("tapp-controller.%s.svc", namespace),
Rules: []admissionregistrationv1beta1.RuleWithOperations{{
Expand All @@ -85,17 +86,17 @@ func Register(clientset *kubernetes.Clientset, namespace string, caFile string)
}

client := clientset.AdmissionregistrationV1beta1().ValidatingWebhookConfigurations()
if present, err := client.Get(validatingWebhookConfiguration, metav1.GetOptions{}); err == nil {
if present, err := client.Get(context.TODO(), validatingWebhookConfiguration, metav1.GetOptions{}); err == nil {
if !reflect.DeepEqual(present.Webhooks, webhookConfig.Webhooks) {
klog.V(1).Infof("Update validationWebhookConfiguration from %+v to %+v", present, webhookConfig)
webhookConfig.ResourceVersion = present.ResourceVersion
if _, err := client.Update(webhookConfig); err != nil {
if _, err := client.Update(context.TODO(), webhookConfig, metav1.UpdateOptions{}); err != nil {
klog.Errorf("Failed to update validationWebhookConfiguration: %v", err)
return false, nil
}
}
} else {
if _, err := client.Create(webhookConfig); err != nil {
if _, err := client.Create(context.TODO(), webhookConfig, metav1.CreateOptions{}); err != nil {
klog.Errorf("Failed to create validatingWebhookConfiguration: %v", err)
return false, nil
}
Expand Down
30 changes: 28 additions & 2 deletions pkg/apis/tappcontroller/v1/zz_generated.deepcopy.go

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

10 changes: 8 additions & 2 deletions pkg/client/clientset/versioned/clientset.go

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

1 change: 0 additions & 1 deletion pkg/client/clientset/versioned/doc.go

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

14 changes: 9 additions & 5 deletions pkg/client/clientset/versioned/fake/clientset_generated.go

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

1 change: 0 additions & 1 deletion pkg/client/clientset/versioned/fake/doc.go

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

5 changes: 2 additions & 3 deletions pkg/client/clientset/versioned/fake/register.go

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

1 change: 0 additions & 1 deletion pkg/client/clientset/versioned/scheme/doc.go

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

3 changes: 1 addition & 2 deletions pkg/client/clientset/versioned/scheme/register.go

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

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

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

Loading