Skip to content

Commit

Permalink
Update to use knative 0.15
Browse files Browse the repository at this point in the history
The update to knative is to pick up genreconciler and in turn requires us to
update our pipelines dependency to v0.13.2. I had to update the hack/ scripts,
remove some old pinned dependencies, and drop some deprecated functions and
flags. To get the webhook cert generation to work again, I had to replace
`sharedmain.MainWithContext` with `sharedmain.WebhookMainWihtConfig`.

Needed for #635 and fixes #627

Signed-off-by: Dibyo Mukherjee <dibyo@google.com>
  • Loading branch information
dibyom authored and tekton-robot committed Jul 8, 2020
1 parent b386548 commit 7fc96c7
Show file tree
Hide file tree
Showing 782 changed files with 56,578 additions and 17,728 deletions.
3 changes: 2 additions & 1 deletion cmd/webhook/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,8 @@ func main() {
SecretName: secretName,
})

sharedmain.MainWithContext(ctx, "webhook",
sharedmain.WebhookMainWithConfig(ctx, "webhook",
sharedmain.ParseAndGetConfigOrDie(),
certificates.NewController,
NewDefaultingAdmissionController,
NewValidationAdmissionController,
Expand Down
34 changes: 11 additions & 23 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ module github.com/tektoncd/triggers
go 1.14

require (
contrib.go.opencensus.io/exporter/ocagent v0.6.0 // indirect
contrib.go.opencensus.io/exporter/stackdriver v0.12.9 // indirect
github.com/GoogleCloudPlatform/cloud-builders/gcs-fetcher v0.0.0-20191203181535-308b93ad1f39
github.com/gobuffalo/envy v1.9.0 // indirect
github.com/golang/protobuf v1.4.1
Expand All @@ -13,45 +11,35 @@ require (
github.com/google/go-github/v31 v31.0.0
github.com/gorilla/mux v1.7.3
github.com/grpc-ecosystem/grpc-gateway v1.13.0 // indirect
github.com/openzipkin/zipkin-go v0.2.2 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/prometheus/client_model v0.2.0 // indirect
github.com/spf13/cobra v0.0.5
github.com/tektoncd/pipeline v0.11.3
github.com/spf13/cobra v0.0.6
github.com/tektoncd/pipeline v0.13.2
github.com/tektoncd/plumbing v0.0.0-20200430135134-e53521e1d887
github.com/tidwall/gjson v1.3.5 // indirect
github.com/tidwall/sjson v1.0.4
go.uber.org/zap v1.13.0
golang.org/x/crypto v0.0.0-20200220183623-bac4c82f6975 // indirect
go.uber.org/zap v1.15.0
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543
google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013
google.golang.org/protobuf v1.25.0
gopkg.in/yaml.v2 v2.2.8
gopkg.in/yaml.v2 v2.3.0
k8s.io/api v0.18.2
k8s.io/apimachinery v0.18.2
k8s.io/client-go v1.5.1
k8s.io/code-generator v0.17.1
k8s.io/client-go v11.0.1-0.20190805182717-6502b5e7b1b5+incompatible
k8s.io/code-generator v0.18.0
k8s.io/klog v1.0.0
k8s.io/kube-openapi v0.0.0-20200121204235-bf4fb3bd569c
k8s.io/kube-openapi v0.0.0-20200410145947-bcb3869e6f29
k8s.io/utils v0.0.0-20200324210504-a9aa75ae1b89 // indirect
knative.dev/caching v0.0.0-20200228235451-13d271455c74
knative.dev/pkg v0.0.0-20200207155214-fef852970f43
knative.dev/caching v0.0.0-20200521155757-e78d17bc250e
knative.dev/pkg v0.0.0-20200625173728-dfb81cf04a7c
sigs.k8s.io/yaml v1.2.0
)

// Knative deps (release-0.12)
replace (
contrib.go.opencensus.io/exporter/stackdriver => contrib.go.opencensus.io/exporter/stackdriver v0.12.9-0.20191108183826-59d068f8d8ff
knative.dev/caching => knative.dev/caching v0.0.0-20200116200605-67bca2c83dfa
knative.dev/pkg => knative.dev/pkg v0.0.0-20200113182502-b8dc5fbc6d2f
knative.dev/pkg/vendor/github.com/spf13/pflag => github.com/spf13/pflag v1.0.5
)
// Knative deps (release-0.15)
replace contrib.go.opencensus.io/exporter/stackdriver => contrib.go.opencensus.io/exporter/stackdriver v0.12.9-0.20191108183826-59d068f8d8ff

// Pin k8s deps to 1.16.5
replace (
k8s.io/api => k8s.io/api v0.16.5
k8s.io/apimachinery => k8s.io/apimachinery v0.16.5
k8s.io/client-go => k8s.io/client-go v0.16.5
k8s.io/code-generator => k8s.io/code-generator v0.16.5
k8s.io/gengo => k8s.io/gengo v0.0.0-20190327210449-e17681d19d3a
)
798 changes: 732 additions & 66 deletions go.sum

Large diffs are not rendered by default.

10 changes: 6 additions & 4 deletions hack/generate-groups.sh
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ shift 4
go install k8s.io/code-generator/cmd/{defaulter-gen,client-gen,lister-gen,informer-gen,deepcopy-gen}
)

PREFIX=${GOBIN:-${GOPATH}/bin}

function codegen::join() { local IFS="$1"; shift; echo "$*"; }

# enumerate group versions
Expand All @@ -66,22 +68,22 @@ done

if [ "${GENS}" = "all" ] || grep -qw "deepcopy" <<<"${GENS}"; then
echo "Generating deepcopy funcs for ${GROUPS_WITH_VERSIONS}"
"deepcopy-gen" --input-dirs "$(codegen::join , "${FQ_APIS[@]}")" -O zz_generated.deepcopy --bounding-dirs "${APIS_PKG}" "$@"
"${PREFIX}/deepcopy-gen" --input-dirs "$(codegen::join , "${FQ_APIS[@]}")" -O zz_generated.deepcopy --bounding-dirs "${APIS_PKG}" "$@"
fi

if [ "${GENS}" = "all" ] || grep -qw "client" <<<"${GENS}"; then
echo "Generating clientset for ${GROUPS_WITH_VERSIONS} at ${OUTPUT_PKG}/${CLIENTSET_PKG_NAME:-clientset}"
"client-gen" --clientset-name "${CLIENTSET_NAME_VERSIONED:-versioned}" --input-base "" --input "$(codegen::join , "${FQ_APIS[@]}")" --output-package "${OUTPUT_PKG}/${CLIENTSET_PKG_NAME:-clientset}" "$@"
"${PREFIX}/client-gen" --clientset-name "${CLIENTSET_NAME_VERSIONED:-versioned}" --input-base "" --input "$(codegen::join , "${FQ_APIS[@]}")" --output-package "${OUTPUT_PKG}/${CLIENTSET_PKG_NAME:-clientset}" "$@"
fi

if [ "${GENS}" = "all" ] || grep -qw "lister" <<<"${GENS}"; then
echo "Generating listers for ${GROUPS_WITH_VERSIONS} at ${OUTPUT_PKG}/listers"
"lister-gen" --input-dirs "$(codegen::join , "${FQ_APIS[@]}")" --output-package "${OUTPUT_PKG}/listers" "$@"
"${PREFIX}/lister-gen" --input-dirs "$(codegen::join , "${FQ_APIS[@]}")" --output-package "${OUTPUT_PKG}/listers" "$@"
fi

if [ "${GENS}" = "all" ] || grep -qw "informer" <<<"${GENS}"; then
echo "Generating informers for ${GROUPS_WITH_VERSIONS} at ${OUTPUT_PKG}/informers"
"informer-gen" \
"${PREFIX}/informer-gen" \
--input-dirs "$(codegen::join , "${FQ_APIS[@]}")" \
--versioned-clientset-package "${OUTPUT_PKG}/${CLIENTSET_PKG_NAME:-clientset}/${CLIENTSET_NAME_VERSIONED:-versioned}" \
--listers-package "${OUTPUT_PKG}/listers" \
Expand Down
9 changes: 8 additions & 1 deletion hack/generate-knative.sh
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ shift 4
go install knative.dev/pkg/codegen/cmd/injection-gen
)

PREFIX=${GOBIN:-${GOPATH}/bin}

function codegen::join() { local IFS="$1"; shift; echo "$*"; }

# enumerate group versions
Expand Down Expand Up @@ -77,15 +79,20 @@ if grep -qw "injection" <<<"${GENS}"; then
EXTERNAL_INFORMER_PKG="${CLIENT_PKG}/informers/externalversions"
fi

if [[ -z "${LISTERS_PKG:-}" ]]; then
LISTERS_PKG="${CLIENT_PKG}/listers"
fi

echo "Generating injection for ${GROUPS_WITH_VERSIONS} at ${OUTPUT_PKG}"

# Clear old injection
rm -rf ${OUTPUT_PKG}

injection-gen \
${PREFIX}/injection-gen \
--input-dirs $(codegen::join , "${FQ_APIS[@]}") \
--versioned-clientset-package ${VERSIONED_CLIENTSET_PKG} \
--external-versions-informers-package ${EXTERNAL_INFORMER_PKG} \
--listers-package ${LISTERS_PKG} \
--output-package ${OUTPUT_PKG} \
"$@"
fi
9 changes: 4 additions & 5 deletions hack/update-codegen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,10 @@ set -o pipefail

source $(git rev-parse --show-toplevel)/vendor/github.com/tektoncd/plumbing/scripts/library.sh

CODEGEN_PKG=${CODEGEN_PKG:-$(cd ${REPO_ROOT_DIR}; ls -d -1 ./vendor/k8s.io/code-generator 2>/dev/null || echo ../../../k8s.io/code-generator)}
KNATIVE_CODEGEN_PKG=${KNATIVE_CODEGEN_PKG:-$(cd ${REPO_ROOT_DIR}; ls -d -1 ./vendor/knative.dev/pkg/codegen 2>/dev/null || echo ../pkg)}

go install ${CODEGEN_PKG}/cmd/{defaulter-gen,client-gen,lister-gen,informer-gen,deepcopy-gen}
go install ${KNATIVE_CODEGEN_PKG}/cmd/injection-gen
PREFIX=${GOBIN:-${GOPATH}/bin}

OLDGOFLAGS="${GOFLAGS:-}"
GOFLAGS="-mod=vendor"
# generate the code with:
# --output-base because this script should also be able to run inside the vendor dir of
# k8s.io/kubernetes. The output-base is needed for the generators to output into the vendor dir
Expand All @@ -40,6 +38,7 @@ bash ${REPO_ROOT_DIR}/hack/generate-knative.sh "injection" \
github.com/tektoncd/triggers/pkg/client github.com/tektoncd/triggers/pkg/apis \
"triggers:v1alpha1" \
--go-header-file ${REPO_ROOT_DIR}/hack/boilerplate/boilerplate.go.txt
GOFLAGS="${OLDGOFLAGS}"

# Make sure our dependencies are up-to-date
${REPO_ROOT_DIR}/hack/update-deps.sh
5 changes: 1 addition & 4 deletions hack/update-deps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,13 @@ source $(git rev-parse --show-toplevel)/vendor/github.com/tektoncd/plumbing/scri

cd ${REPO_ROOT_DIR}

VERSION="master"
VERSION="release-0.15"

# The list of dependencies that we track at HEAD and periodically
# float forward in this repository.
FLOATING_DEPS=(
"knative.dev/pkg@${VERSION}"
"knative.dev/caching@${VERSION}"
"knative.dev/serving@${VERSION}"
"knative.dev/eventing@${VERSION}"
"knative.dev/eventing-contrib@${VERSION}"
)

# Parse flags to determine any we should pass to dep.
Expand Down
2 changes: 1 addition & 1 deletion pkg/client/injection/client/client.go

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

6 changes: 3 additions & 3 deletions pkg/client/injection/client/fake/fake.go

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

2 changes: 1 addition & 1 deletion pkg/client/injection/informers/factory/factory.go

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

2 changes: 1 addition & 1 deletion pkg/client/injection/informers/factory/fake/fake.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.

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.

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.

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.

4 changes: 2 additions & 2 deletions pkg/reconciler/v1alpha1/eventlistener/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,12 @@ func NewController(ctx context.Context, cmw configmap.Watcher) *controller.Impl
})

deploymentInformer.Informer().AddEventHandler(cache.FilteringResourceEventHandler{
FilterFunc: controller.Filter(v1alpha1.SchemeGroupVersion.WithKind("EventListener")),
FilterFunc: controller.FilterControllerGVK(v1alpha1.SchemeGroupVersion.WithKind("EventListener")),
Handler: controller.HandleAll(impl.EnqueueControllerOf),
})

serviceInformer.Informer().AddEventHandler(cache.FilteringResourceEventHandler{
FilterFunc: controller.Filter(v1alpha1.SchemeGroupVersion.WithKind("EventListener")),
FilterFunc: controller.FilterControllerGVK(v1alpha1.SchemeGroupVersion.WithKind("EventListener")),
Handler: controller.HandleAll(impl.EnqueueControllerOf),
})

Expand Down
5 changes: 1 addition & 4 deletions test/init_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,7 @@ func initializeLogsAndMetrics(t *testing.T) {
t.Helper()
initMetrics.Do(func() {
flag.Parse()
if err := flag.Set("alsologtostderr", "true"); err != nil {
t.Fatalf("Failed to set 'alsologtostderr' flag to 'true': %s", err)
}
logging.InitializeLogger(knativetest.Flags.LogVerbose)
logging.InitializeLogger()
})
}

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
Copyright (c) 2017 Uber Technologies, Inc.
The MIT License

Copyright (c) 2014 Benedikt Lang <github at benediktlang.de>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand All @@ -17,3 +19,4 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

22 changes: 22 additions & 0 deletions third_party/github.com/cespare/xxhash/v2/LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
Copyright (c) 2016 Caleb Spare

MIT License

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

0 comments on commit 7fc96c7

Please sign in to comment.