mirror of https://github.com/knative/client.git
upgrade to latest dependencies (#1296)
bumping knative.dev/hack 88c69cd...93ad912: > 93ad912 Print java and mvn version (# 65) > 86f9adc Fix default codegen pkg dir (# 67) bumping knative.dev/networking 7a7ad51...796a800: > 796a800 upgrade to latest dependencies (# 403) > b62df94 upgrade to latest dependencies (# 402) > 2696fca Add missing JSON tag to protocol type (# 400) bumping knative.dev/eventing 83a1713...474fb5b: > 474fb5b remove v1alpha1 sources APIs (# 5317) > fc44024 More v1 (# 5316) > e807987 [v1] Add flows yaml desc (# 5315) > 178be6b Remove some vbeta1 IMC configs in tests (# 5314) > d21b7d6 💄 Adding API description (e.g. for k explain) for IMC and generic Channel (# 5307) > 18fb3db CreatePodOrFail retry on "No API token found" (# 5313) > 504cae3 Fixing versions and api groups for subscription validation test (# 5310) > 386cd07 upgrade to latest dependencies (# 5302) > 5dccb29 Tidy up the CRD to remove the v1beta1 (# 5298) > 978778a Increase Subscription validation test coverage (# 5305) > 0d25138 Increase Trigger validation test coverage (# 5306) > a62ed6a 🧹 lifting some apis to more recent level (# 5300) > 6f7c5cf Doing version bumps for some files to v1 (# 5299) bumping knative.dev/pkg 2a0fc65...5a308fa: > 5a308fa upgrade to latest dependencies (# 2105) > cfc1eed Better support for error wrapping with ReconcilerEvents (# 2106) bumping knative.dev/serving 792c8d2...6ed3b03: > 6ed3b03 Update net-kourier nightly (# 11265) > 38c791e upgrade to latest dependencies (# 11271) > c28723a upgrade to latest dependencies (# 11269) > efb7b45 Update net-istio nightly (# 11268) > 1297dbd Update net-certmanager nightly (# 11266) > da0d742 Actually use the rate limited queue (# 11256) > 5692160 Update visibility label comment in config-domain (# 11253) > 88ff33f Update net-istio nightly (# 11247) > b69efda Update net-kourier nightly (# 11255) > 7ce1ba1 Update net-contour nightly (# 11254) > b4dd584 upgrade to latest dependencies (# 11264) > c7326c1 Add myself to support rotation of 04-26 (# 11263) > 28ba542 upgrade to latest dependencies (# 11262) Signed-off-by: Knative Automation <automation@knative.team>
This commit is contained in:
parent
e829ed24a0
commit
dccf3e30fa
10
go.mod
10
go.mod
|
|
@ -21,11 +21,11 @@ require (
|
|||
k8s.io/cli-runtime v0.19.7
|
||||
k8s.io/client-go v0.19.7
|
||||
k8s.io/code-generator v0.19.7
|
||||
knative.dev/eventing v0.22.1-0.20210426130639-83a1713973d5
|
||||
knative.dev/hack v0.0.0-20210426064739-88c69cd1eca7
|
||||
knative.dev/networking v0.0.0-20210426132139-7a7ad5197fe6
|
||||
knative.dev/pkg v0.0.0-20210426101439-2a0fc657a712
|
||||
knative.dev/serving v0.22.1-0.20210426060740-792c8d233f49
|
||||
knative.dev/eventing v0.22.1-0.20210427180853-474fb5b41c3b
|
||||
knative.dev/hack v0.0.0-20210428122153-93ad9129c268
|
||||
knative.dev/networking v0.0.0-20210428014353-796a80097840
|
||||
knative.dev/pkg v0.0.0-20210428023153-5a308fa62139
|
||||
knative.dev/serving v0.22.1-0.20210428070553-6ed3b03f1545
|
||||
sigs.k8s.io/yaml v1.2.0
|
||||
)
|
||||
|
||||
|
|
|
|||
32
go.sum
32
go.sum
|
|
@ -1294,29 +1294,27 @@ k8s.io/legacy-cloud-providers v0.19.7/go.mod h1:dsZk4gH9QIwAtHQ8CK0Ps257xlfgoXE3
|
|||
k8s.io/utils v0.0.0-20200729134348-d5654de09c73/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA=
|
||||
k8s.io/utils v0.0.0-20210111153108-fddb29f9d009 h1:0T5IaWHO3sJTEmCP6mUlBvMukxPKUQWqiI/YuiBNMiQ=
|
||||
k8s.io/utils v0.0.0-20210111153108-fddb29f9d009/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA=
|
||||
knative.dev/caching v0.0.0-20210423055338-088b702d3c98/go.mod h1:kN+wZL/HLh8vrW+lb0+A/zS1Ejmw6eSsVssWPrA2xrw=
|
||||
knative.dev/eventing v0.22.1-0.20210426130639-83a1713973d5 h1:QwjdYdmFl/yeGVux+sVQPq/ysyiBPLp46g62gt6qfJA=
|
||||
knative.dev/eventing v0.22.1-0.20210426130639-83a1713973d5/go.mod h1:/2DIdu7qs+G+MP90+OlGXoOXxwBLeMqcGFZoP6saUts=
|
||||
knative.dev/caching v0.0.0-20210428014353-bbc9e06da791/go.mod h1:sKywEfD70Vcm+FoKFRd57LA10Bc+XDZUnIczbVKg3Qk=
|
||||
knative.dev/eventing v0.22.1-0.20210427180853-474fb5b41c3b h1:5mReYQ7+7UfHOvaexGZBv4dED5C76GWPZhoefToqRlI=
|
||||
knative.dev/eventing v0.22.1-0.20210427180853-474fb5b41c3b/go.mod h1:N6c9wtqdLEiaNNxAK6+WHqdAy/Uhh0/xWfsRGa1sznw=
|
||||
knative.dev/hack v0.0.0-20210325223819-b6ab329907d3 h1:km0Rrh0T9/wA2pivQm1hqSPVwgNgGCHC2WNn3GakZmE=
|
||||
knative.dev/hack v0.0.0-20210325223819-b6ab329907d3/go.mod h1:PHt8x8yX5Z9pPquBEfIj0X66f8iWkWfR0S/sarACJrI=
|
||||
knative.dev/hack v0.0.0-20210423193138-b5f6e2587f6d/go.mod h1:PHt8x8yX5Z9pPquBEfIj0X66f8iWkWfR0S/sarACJrI=
|
||||
knative.dev/hack v0.0.0-20210426064739-88c69cd1eca7 h1:Z5icQ2KNCDSzTcHWMGI3KzdK/BpmgkGYdTX0RRzZul0=
|
||||
knative.dev/hack v0.0.0-20210426064739-88c69cd1eca7/go.mod h1:PHt8x8yX5Z9pPquBEfIj0X66f8iWkWfR0S/sarACJrI=
|
||||
knative.dev/hack/schema v0.0.0-20210325223819-b6ab329907d3/go.mod h1:ffjwmdcrH5vN3mPhO8RrF2KfNnbHeCE2C60A+2cv3U0=
|
||||
knative.dev/networking v0.0.0-20210423055338-2b84569a04be h1:WnRCmtZtAiUG/C9e6a1C5+SOco1NCwdbsOT6B3jpYi4=
|
||||
knative.dev/networking v0.0.0-20210423055338-2b84569a04be/go.mod h1:l1RP6FFeyFWCxl/7PI4oa93OT2pyt6Vj+UhRDtZe0tg=
|
||||
knative.dev/networking v0.0.0-20210426132139-7a7ad5197fe6 h1:nkqvVqoVVsC/FJh5SFUSudOROjiqYsjTO2pv/W0/ZQM=
|
||||
knative.dev/networking v0.0.0-20210426132139-7a7ad5197fe6/go.mod h1:2SC/FY1orrWjGmz8Z8JUEcvucY9zyC6EJdh9J8jE/x8=
|
||||
knative.dev/hack v0.0.0-20210427190353-86f9adc0c8e2/go.mod h1:PHt8x8yX5Z9pPquBEfIj0X66f8iWkWfR0S/sarACJrI=
|
||||
knative.dev/hack v0.0.0-20210428122153-93ad9129c268 h1:lBIj9Epd9UQ55NEaHzAdY/UZbuaegCdGPKVC2+Z68Q0=
|
||||
knative.dev/hack v0.0.0-20210428122153-93ad9129c268/go.mod h1:PHt8x8yX5Z9pPquBEfIj0X66f8iWkWfR0S/sarACJrI=
|
||||
knative.dev/hack/schema v0.0.0-20210426064739-88c69cd1eca7/go.mod h1:ffjwmdcrH5vN3mPhO8RrF2KfNnbHeCE2C60A+2cv3U0=
|
||||
knative.dev/networking v0.0.0-20210428014353-796a80097840 h1:mxH1I/GkzLnFQy9/goXfb39FmEhg4uvJDxpJT+XZ4Vo=
|
||||
knative.dev/networking v0.0.0-20210428014353-796a80097840/go.mod h1:RTmu/DhuB1vrci07WfITTg2Kf+pKSgcDbmypgsOi2ug=
|
||||
knative.dev/pkg v0.0.0-20210420053235-1afd04993622 h1:wSyDPp/LuOLeDCpvUHgKXqb4DfmCEPelsaYzC0Fojm0=
|
||||
knative.dev/pkg v0.0.0-20210420053235-1afd04993622/go.mod h1:UtcSLHy2XIz5blWoPTA40F87zk4O7erxkCwv+7Tsmws=
|
||||
knative.dev/pkg v0.0.0-20210422210038-0c5259d6504d h1:ilIOXb2KfleKeW/JXqcoQK/BKi3D4X8HVmrKYek32Go=
|
||||
knative.dev/pkg v0.0.0-20210422210038-0c5259d6504d/go.mod h1:UtcSLHy2XIz5blWoPTA40F87zk4O7erxkCwv+7Tsmws=
|
||||
knative.dev/pkg v0.0.0-20210423162638-78b8140ed19c/go.mod h1:UtcSLHy2XIz5blWoPTA40F87zk4O7erxkCwv+7Tsmws=
|
||||
knative.dev/pkg v0.0.0-20210426101439-2a0fc657a712 h1:cOCsX7V1QRubJdUqWW/yeD+5Pok6smz0chUq5Vi4Aq4=
|
||||
knative.dev/pkg v0.0.0-20210426101439-2a0fc657a712/go.mod h1:UtcSLHy2XIz5blWoPTA40F87zk4O7erxkCwv+7Tsmws=
|
||||
knative.dev/reconciler-test v0.0.0-20210420215136-4598ca0f0602/go.mod h1:yZihS1XoBt7oxU6Jq+U2hMKmUvfKFEaj3vMqOMBt/tI=
|
||||
knative.dev/serving v0.22.1-0.20210426060740-792c8d233f49 h1:pU6VQGIUFvqiW2iWutb2ILDIJWeGE2y1yAmHqc3b4Zo=
|
||||
knative.dev/serving v0.22.1-0.20210426060740-792c8d233f49/go.mod h1:pRK+nTqebKvaRmeccaTs0Ux0pZ1JOxI0tFa2jFDJQVI=
|
||||
knative.dev/pkg v0.0.0-20210426180040-cfc1eed82870/go.mod h1:UtcSLHy2XIz5blWoPTA40F87zk4O7erxkCwv+7Tsmws=
|
||||
knative.dev/pkg v0.0.0-20210428023153-5a308fa62139 h1:88XRR7sk9SxrFn/TFO1iYeW2uoTg34DrfEoKX5/RqAE=
|
||||
knative.dev/pkg v0.0.0-20210428023153-5a308fa62139/go.mod h1:7Xmwv60SD68lc4mpbKvU1J4WJLfZNNDNpHFA87T7/AM=
|
||||
knative.dev/reconciler-test v0.0.0-20210426151439-cd315b0f06aa/go.mod h1:yZihS1XoBt7oxU6Jq+U2hMKmUvfKFEaj3vMqOMBt/tI=
|
||||
knative.dev/serving v0.22.1-0.20210428070553-6ed3b03f1545 h1:GLEU4XccotS0zxe22YQzZzOJ9rXkQvjoDlZoSaXgLM8=
|
||||
knative.dev/serving v0.22.1-0.20210428070553-6ed3b03f1545/go.mod h1:Uyc88uX9qn7/0TOqbmLLK/mEHOTa1Y7OYAKe60kzSm8=
|
||||
modernc.org/cc v1.0.0/go.mod h1:1Sk4//wdnYJiUIxnW8ddKpaOJCF37yAdqYnkxUpaYxw=
|
||||
modernc.org/golex v1.0.0/go.mod h1:b/QX9oBD/LhixY6NDh+IdGv17hgB+51fET1i2kPSmvk=
|
||||
modernc.org/mathutil v1.0.0/go.mod h1:wU0vUrJsVWBZ4P6e7xtFJEhFSNsfRLJ8H458uRjg03k=
|
||||
|
|
|
|||
|
|
@ -1,162 +0,0 @@
|
|||
/*
|
||||
Copyright 2020 The Knative 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.
|
||||
*/
|
||||
|
||||
package v1alpha1
|
||||
|
||||
import (
|
||||
"context"
|
||||
"reflect"
|
||||
|
||||
"github.com/google/go-cmp/cmp"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
"knative.dev/eventing/pkg/apis/sources/v1alpha2"
|
||||
"knative.dev/pkg/apis"
|
||||
duckv1 "knative.dev/pkg/apis/duck/v1"
|
||||
duckv1beta1 "knative.dev/pkg/apis/duck/v1beta1"
|
||||
)
|
||||
|
||||
// ConvertTo implements apis.Convertible.
|
||||
// Converts source (from v1alpha1.ApiServerSource) into into a higher version.
|
||||
func (source *ApiServerSource) ConvertTo(ctx context.Context, obj apis.Convertible) error {
|
||||
switch sink := obj.(type) {
|
||||
case *v1alpha2.ApiServerSource:
|
||||
// Meta
|
||||
sink.ObjectMeta = source.ObjectMeta
|
||||
|
||||
// Spec
|
||||
|
||||
if len(source.Spec.Resources) > 0 {
|
||||
sink.Spec.Resources = make([]v1alpha2.APIVersionKindSelector, len(source.Spec.Resources))
|
||||
}
|
||||
for i, v := range source.Spec.Resources {
|
||||
sink.Spec.Resources[i] = v1alpha2.APIVersionKindSelector{
|
||||
APIVersion: v.APIVersion,
|
||||
Kind: v.Kind,
|
||||
}
|
||||
|
||||
if !cmp.Equal(v.LabelSelector, metav1.LabelSelector{}) {
|
||||
sink.Spec.Resources[i].LabelSelector = &metav1.LabelSelector{}
|
||||
v.LabelSelector.DeepCopyInto(sink.Spec.Resources[i].LabelSelector)
|
||||
}
|
||||
}
|
||||
|
||||
switch source.Spec.Mode {
|
||||
case RefMode:
|
||||
sink.Spec.EventMode = v1alpha2.ReferenceMode
|
||||
case ResourceMode:
|
||||
sink.Spec.EventMode = v1alpha2.ResourceMode
|
||||
}
|
||||
|
||||
// Optional Spec
|
||||
|
||||
if source.Spec.ResourceOwner != nil {
|
||||
sink.Spec.ResourceOwner = source.Spec.ResourceOwner
|
||||
}
|
||||
|
||||
if source.Spec.Sink != nil {
|
||||
var ref *duckv1.KReference
|
||||
if source.Spec.Sink.Ref != nil {
|
||||
ref = &duckv1.KReference{
|
||||
Kind: source.Spec.Sink.Ref.Kind,
|
||||
Namespace: source.Spec.Sink.Ref.Namespace,
|
||||
Name: source.Spec.Sink.Ref.Name,
|
||||
APIVersion: source.Spec.Sink.Ref.APIVersion,
|
||||
}
|
||||
}
|
||||
sink.Spec.Sink = duckv1.Destination{
|
||||
Ref: ref,
|
||||
URI: source.Spec.Sink.URI,
|
||||
}
|
||||
}
|
||||
|
||||
if source.Spec.CloudEventOverrides != nil {
|
||||
sink.Spec.CloudEventOverrides = source.Spec.CloudEventOverrides.DeepCopy()
|
||||
}
|
||||
|
||||
sink.Spec.ServiceAccountName = source.Spec.ServiceAccountName
|
||||
|
||||
// Status
|
||||
source.Status.SourceStatus.DeepCopyInto(&sink.Status.SourceStatus)
|
||||
return nil
|
||||
default:
|
||||
return apis.ConvertToViaProxy(ctx, source, &v1alpha2.ApiServerSource{}, sink)
|
||||
}
|
||||
}
|
||||
|
||||
// ConvertFrom implements apis.Convertible.
|
||||
// Converts obj from a higher version into v1alpha1.ApiServerSource.
|
||||
func (sink *ApiServerSource) ConvertFrom(ctx context.Context, obj apis.Convertible) error {
|
||||
switch source := obj.(type) {
|
||||
case *v1alpha2.ApiServerSource:
|
||||
// Meta
|
||||
sink.ObjectMeta = source.ObjectMeta
|
||||
|
||||
// Spec
|
||||
|
||||
switch source.Spec.EventMode {
|
||||
case v1alpha2.ReferenceMode:
|
||||
sink.Spec.Mode = RefMode
|
||||
case v1alpha2.ResourceMode:
|
||||
sink.Spec.Mode = ResourceMode
|
||||
}
|
||||
|
||||
sink.Spec.CloudEventOverrides = source.Spec.CloudEventOverrides
|
||||
|
||||
sink.Spec.Sink = &duckv1beta1.Destination{
|
||||
URI: source.Spec.Sink.URI,
|
||||
}
|
||||
if source.Spec.Sink.Ref != nil {
|
||||
sink.Spec.Sink.Ref = &corev1.ObjectReference{
|
||||
Kind: source.Spec.Sink.Ref.Kind,
|
||||
Namespace: source.Spec.Sink.Ref.Namespace,
|
||||
Name: source.Spec.Sink.Ref.Name,
|
||||
APIVersion: source.Spec.Sink.Ref.APIVersion,
|
||||
}
|
||||
}
|
||||
if sink.Spec.Sink != nil && reflect.DeepEqual(*sink.Spec.Sink, duckv1beta1.Destination{}) {
|
||||
sink.Spec.Sink = nil
|
||||
}
|
||||
|
||||
if len(source.Spec.Resources) > 0 {
|
||||
sink.Spec.Resources = make([]ApiServerResource, len(source.Spec.Resources))
|
||||
}
|
||||
for i, v := range source.Spec.Resources {
|
||||
sink.Spec.Resources[i] = ApiServerResource{}
|
||||
sink.Spec.Resources[i].APIVersion = v.APIVersion
|
||||
sink.Spec.Resources[i].Kind = v.Kind
|
||||
if v.LabelSelector != nil {
|
||||
sink.Spec.Resources[i].LabelSelector = *v.LabelSelector
|
||||
}
|
||||
}
|
||||
|
||||
// Spec Optionals
|
||||
|
||||
if source.Spec.ResourceOwner != nil {
|
||||
sink.Spec.ResourceOwner = source.Spec.ResourceOwner
|
||||
}
|
||||
|
||||
sink.Spec.ServiceAccountName = source.Spec.ServiceAccountName
|
||||
|
||||
// Status
|
||||
source.Status.SourceStatus.DeepCopyInto(&sink.Status.SourceStatus)
|
||||
|
||||
return nil
|
||||
default:
|
||||
return apis.ConvertFromViaProxy(ctx, source, &v1alpha2.ApiServerSource{}, sink)
|
||||
}
|
||||
}
|
||||
|
|
@ -1,29 +0,0 @@
|
|||
/*
|
||||
Copyright 2020 The Knative 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.
|
||||
*/
|
||||
|
||||
package v1alpha1
|
||||
|
||||
import (
|
||||
"context"
|
||||
)
|
||||
|
||||
func (s *ApiServerSource) SetDefaults(ctx context.Context) {
|
||||
s.Spec.SetDefaults(ctx)
|
||||
}
|
||||
|
||||
func (ss *ApiServerSourceSpec) SetDefaults(ctx context.Context) {
|
||||
// TODO anything?
|
||||
}
|
||||
|
|
@ -1,146 +0,0 @@
|
|||
/*
|
||||
Copyright 2020 The Knative 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.
|
||||
*/
|
||||
|
||||
package v1alpha1
|
||||
|
||||
import (
|
||||
appsv1 "k8s.io/api/apps/v1"
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
"knative.dev/pkg/apis"
|
||||
)
|
||||
|
||||
const (
|
||||
// ApiServerConditionReady has status True when the ApiServerSource is ready to send events.
|
||||
ApiServerConditionReady = apis.ConditionReady
|
||||
|
||||
// ApiServerConditionSinkProvided has status True when the ApiServerSource has been configured with a sink target.
|
||||
ApiServerConditionSinkProvided apis.ConditionType = "SinkProvided"
|
||||
|
||||
// ApiServerConditionDeployed has status True when the ApiServerSource has had it's deployment created.
|
||||
ApiServerConditionDeployed apis.ConditionType = "Deployed"
|
||||
|
||||
// ApiServerConditionSufficientPermissions has status True when the ApiServerSource has sufficient permissions to access resources.
|
||||
ApiServerConditionSufficientPermissions apis.ConditionType = "SufficientPermissions"
|
||||
)
|
||||
|
||||
var apiserverCondSet = apis.NewLivingConditionSet(
|
||||
ApiServerConditionSinkProvided,
|
||||
ApiServerConditionDeployed,
|
||||
ApiServerConditionSufficientPermissions,
|
||||
)
|
||||
|
||||
// GetGroupVersionKind returns the GroupVersionKind.
|
||||
func (s *ApiServerSource) GetGroupVersionKind() schema.GroupVersionKind {
|
||||
return SchemeGroupVersion.WithKind("ApiServerSource")
|
||||
}
|
||||
|
||||
// GetUntypedSpec returns the spec of the ApiServerSource.
|
||||
func (s *ApiServerSource) GetUntypedSpec() interface{} {
|
||||
return s.Spec
|
||||
}
|
||||
|
||||
// GetCondition returns the condition currently associated with the given type, or nil.
|
||||
func (s *ApiServerSourceStatus) GetCondition(t apis.ConditionType) *apis.Condition {
|
||||
return apiserverCondSet.Manage(s).GetCondition(t)
|
||||
}
|
||||
|
||||
// GetTopLevelCondition returns the top level condition.
|
||||
func (s *ApiServerSourceStatus) GetTopLevelCondition() *apis.Condition {
|
||||
return apiserverCondSet.Manage(s).GetTopLevelCondition()
|
||||
}
|
||||
|
||||
// InitializeConditions sets relevant unset conditions to Unknown state.
|
||||
func (s *ApiServerSourceStatus) InitializeConditions() {
|
||||
apiserverCondSet.Manage(s).InitializeConditions()
|
||||
}
|
||||
|
||||
// MarkSink sets the condition that the source has a sink configured.
|
||||
func (s *ApiServerSourceStatus) MarkSink(uri string) {
|
||||
s.SinkURI = nil
|
||||
if len(uri) > 0 {
|
||||
if u, err := apis.ParseURL(uri); err != nil {
|
||||
apiserverCondSet.Manage(s).MarkFalse(ApiServerConditionSinkProvided, "SinkInvalid", "Failed to parse sink: %v", err)
|
||||
} else {
|
||||
s.SinkURI = u
|
||||
apiserverCondSet.Manage(s).MarkTrue(ApiServerConditionSinkProvided)
|
||||
}
|
||||
|
||||
} else {
|
||||
apiserverCondSet.Manage(s).MarkFalse(ApiServerConditionSinkProvided, "SinkEmpty", "Sink has resolved to empty.")
|
||||
}
|
||||
}
|
||||
|
||||
// MarkSinkWarnDeprecated sets the condition that the source has a sink configured and warns ref is deprecated.
|
||||
func (s *ApiServerSourceStatus) MarkSinkWarnRefDeprecated(uri string) {
|
||||
if u, err := apis.ParseURL(uri); err != nil {
|
||||
s.SinkURI = nil
|
||||
} else {
|
||||
s.SinkURI = u
|
||||
}
|
||||
if len(uri) > 0 {
|
||||
c := apis.Condition{
|
||||
Type: ApiServerConditionSinkProvided,
|
||||
Status: corev1.ConditionTrue,
|
||||
Severity: apis.ConditionSeverityError,
|
||||
Message: "Using deprecated object ref fields when specifying spec.sink. Update to spec.sink.ref. These will be removed in the future.",
|
||||
}
|
||||
apiserverCondSet.Manage(s).SetCondition(c)
|
||||
} else {
|
||||
apiserverCondSet.Manage(s).MarkUnknown(ApiServerConditionSinkProvided, "SinkEmpty", "Sink has resolved to empty.%s", "")
|
||||
}
|
||||
}
|
||||
|
||||
// MarkNoSink sets the condition that the source does not have a sink configured.
|
||||
func (s *ApiServerSourceStatus) MarkNoSink(reason, messageFormat string, messageA ...interface{}) {
|
||||
apiserverCondSet.Manage(s).MarkFalse(ApiServerConditionSinkProvided, reason, messageFormat, messageA...)
|
||||
}
|
||||
|
||||
// PropagateDeploymentAvailability uses the availability of the provided Deployment to determine if
|
||||
// ApiServerConditionDeployed should be marked as true or false.
|
||||
func (s *ApiServerSourceStatus) PropagateDeploymentAvailability(d *appsv1.Deployment) {
|
||||
deploymentAvailableFound := false
|
||||
for _, cond := range d.Status.Conditions {
|
||||
if cond.Type == appsv1.DeploymentAvailable {
|
||||
deploymentAvailableFound = true
|
||||
if cond.Status == corev1.ConditionTrue {
|
||||
apiserverCondSet.Manage(s).MarkTrue(ApiServerConditionDeployed)
|
||||
} else if cond.Status == corev1.ConditionFalse {
|
||||
apiserverCondSet.Manage(s).MarkFalse(ApiServerConditionDeployed, cond.Reason, cond.Message)
|
||||
} else if cond.Status == corev1.ConditionUnknown {
|
||||
apiserverCondSet.Manage(s).MarkUnknown(ApiServerConditionDeployed, cond.Reason, cond.Message)
|
||||
}
|
||||
}
|
||||
}
|
||||
if !deploymentAvailableFound {
|
||||
apiserverCondSet.Manage(s).MarkUnknown(ApiServerConditionDeployed, "DeploymentUnavailable", "The Deployment '%s' is unavailable.", d.Name)
|
||||
}
|
||||
}
|
||||
|
||||
// MarkSufficientPermissions sets the condition that the source has enough permissions to access the resources.
|
||||
func (s *ApiServerSourceStatus) MarkSufficientPermissions() {
|
||||
apiserverCondSet.Manage(s).MarkTrue(ApiServerConditionSufficientPermissions)
|
||||
}
|
||||
|
||||
// MarkNoSufficientPermissions sets the condition that the source does not have enough permissions to access the resources
|
||||
func (s *ApiServerSourceStatus) MarkNoSufficientPermissions(reason, messageFormat string, messageA ...interface{}) {
|
||||
apiserverCondSet.Manage(s).MarkFalse(ApiServerConditionSufficientPermissions, reason, messageFormat, messageA...)
|
||||
}
|
||||
|
||||
// IsReady returns true if the resource is ready overall.
|
||||
func (s *ApiServerSourceStatus) IsReady() bool {
|
||||
return apiserverCondSet.Manage(s).IsHappy()
|
||||
}
|
||||
|
|
@ -1,123 +0,0 @@
|
|||
/*
|
||||
Copyright 2020 The Knative 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.
|
||||
*/
|
||||
|
||||
package v1alpha1
|
||||
|
||||
import (
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"knative.dev/eventing/pkg/apis/sources/v1alpha2"
|
||||
"knative.dev/pkg/apis"
|
||||
duckv1 "knative.dev/pkg/apis/duck/v1"
|
||||
duckv1beta1 "knative.dev/pkg/apis/duck/v1beta1"
|
||||
"knative.dev/pkg/kmeta"
|
||||
)
|
||||
|
||||
// +genclient
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
|
||||
// ApiServerSource is the Schema for the apiserversources API
|
||||
type ApiServerSource struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ObjectMeta `json:"metadata,omitempty"`
|
||||
|
||||
Spec ApiServerSourceSpec `json:"spec,omitempty"`
|
||||
Status ApiServerSourceStatus `json:"status,omitempty"`
|
||||
}
|
||||
|
||||
var (
|
||||
// Check that we can create OwnerReferences to an ApiServerSource.
|
||||
_ kmeta.OwnerRefable = (*ApiServerSource)(nil)
|
||||
|
||||
// Check that ApiServerSource can return its spec untyped.
|
||||
_ apis.HasSpec = (*ApiServerSource)(nil)
|
||||
)
|
||||
|
||||
// ApiServerSourceSpec defines the desired state of ApiServerSource
|
||||
type ApiServerSourceSpec struct {
|
||||
// Resources is the list of resources to watch
|
||||
Resources []ApiServerResource `json:"resources"`
|
||||
|
||||
// ServiceAccountName is the name of the ServiceAccount to use to run this
|
||||
// source.
|
||||
// +optional
|
||||
ServiceAccountName string `json:"serviceAccountName,omitempty"`
|
||||
|
||||
// Sink is a reference to an object that will resolve to a domain name to use as the sink.
|
||||
// +optional
|
||||
Sink *duckv1beta1.Destination `json:"sink,omitempty"`
|
||||
|
||||
// CloudEventOverrides defines overrides to control the output format and
|
||||
// modifications of the event sent to the sink.
|
||||
// +optional
|
||||
CloudEventOverrides *duckv1.CloudEventOverrides `json:"ceOverrides,omitempty"`
|
||||
|
||||
// ResourceOwner is an additional filter to only track resources that are
|
||||
// owned by a specific resource type. If ResourceOwner matches Resources[n]
|
||||
// then Resources[n] is allowed to pass the ResourceOwner filter.
|
||||
// +optional
|
||||
ResourceOwner *v1alpha2.APIVersionKind `json:"owner,omitempty"`
|
||||
|
||||
// Mode is the mode the receive adapter controller runs under: Ref or Resource.
|
||||
// `Ref` sends only the reference to the resource.
|
||||
// `Resource` send the full resource.
|
||||
Mode string `json:"mode,omitempty"`
|
||||
}
|
||||
|
||||
// ApiServerSourceStatus defines the observed state of ApiServerSource
|
||||
type ApiServerSourceStatus struct {
|
||||
// inherits duck/v1 SourceStatus, which currently provides:
|
||||
// * ObservedGeneration - the 'Generation' of the Service that was last
|
||||
// processed by the controller.
|
||||
// * Conditions - the latest available observations of a resource's current
|
||||
// state.
|
||||
// * SinkURI - the current active sink URI that has been configured for the
|
||||
// Source.
|
||||
duckv1.SourceStatus `json:",inline"`
|
||||
}
|
||||
|
||||
// ApiServerResource defines the resource to watch
|
||||
type ApiServerResource struct {
|
||||
// API version of the resource to watch.
|
||||
APIVersion string `json:"apiVersion"`
|
||||
|
||||
// Kind of the resource to watch.
|
||||
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
|
||||
Kind string `json:"kind"`
|
||||
|
||||
// LabelSelector restricts this source to objects with the selected labels
|
||||
// More info: http://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#label-selectors
|
||||
LabelSelector metav1.LabelSelector `json:"labelSelector"`
|
||||
|
||||
// ControllerSelector restricts this source to objects with a controlling owner reference of the specified kind.
|
||||
// Only apiVersion and kind are used. Both are optional.
|
||||
// Deprecated: Per-resource owner refs will no longer be supported in
|
||||
// v1alpha2, please use Spec.Owner as a GKV.
|
||||
ControllerSelector metav1.OwnerReference `json:"controllerSelector"`
|
||||
|
||||
// If true, send an event referencing the object controlling the resource
|
||||
// Deprecated: Per-resource controller flag will no longer be supported in
|
||||
// v1alpha2, please use Spec.Owner as a GKV.
|
||||
Controller bool `json:"controller"`
|
||||
}
|
||||
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
|
||||
// ApiServerSourceList contains a list of ApiServerSource
|
||||
type ApiServerSourceList struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ListMeta `json:"metadata,omitempty"`
|
||||
Items []ApiServerSource `json:"items"`
|
||||
}
|
||||
|
|
@ -1,56 +0,0 @@
|
|||
/*
|
||||
Copyright 2020 The Knative 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.
|
||||
*/
|
||||
|
||||
package v1alpha1
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"knative.dev/pkg/apis"
|
||||
)
|
||||
|
||||
const (
|
||||
// RefMode produces payloads of ObjectReference
|
||||
RefMode = "Ref"
|
||||
// ResourceMode produces payloads of ResourceEvent
|
||||
ResourceMode = "Resource"
|
||||
)
|
||||
|
||||
func (c *ApiServerSource) Validate(ctx context.Context) *apis.FieldError {
|
||||
return c.Spec.Validate(ctx).ViaField("spec")
|
||||
}
|
||||
|
||||
func (cs *ApiServerSourceSpec) Validate(ctx context.Context) *apis.FieldError {
|
||||
var errs *apis.FieldError
|
||||
|
||||
// Validate mode, if can be empty or set as certain value
|
||||
if cs.Mode != "" && cs.Mode != RefMode && cs.Mode != ResourceMode {
|
||||
fe := &apis.FieldError{
|
||||
Message: "Mode is not valid",
|
||||
Paths: []string{"mode"},
|
||||
}
|
||||
errs = errs.Also(fe)
|
||||
}
|
||||
|
||||
// Validate sink
|
||||
if cs.Sink == nil {
|
||||
fe := apis.ErrMissingField("sink")
|
||||
errs = errs.Also(fe)
|
||||
} else if fe := cs.Sink.Validate(ctx); fe != nil {
|
||||
errs = errs.Also(fe.ViaField("sink"))
|
||||
}
|
||||
return errs
|
||||
}
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
/*
|
||||
Copyright 2020 The Knative 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.
|
||||
*/
|
||||
|
||||
// Package v1alpha1 contains API Schema definitions for the sources v1alpha1 API group
|
||||
// +k8s:deepcopy-gen=package
|
||||
// +groupName=sources.knative.dev
|
||||
package v1alpha1
|
||||
|
|
@ -1,55 +0,0 @@
|
|||
/*
|
||||
Copyright 2020 The Knative 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.
|
||||
*/
|
||||
|
||||
package v1alpha1
|
||||
|
||||
import (
|
||||
"knative.dev/eventing/pkg/apis/sources"
|
||||
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
)
|
||||
|
||||
// SchemeGroupVersion is group version used to register these objects
|
||||
var SchemeGroupVersion = schema.GroupVersion{Group: sources.GroupName, Version: "v1alpha1"}
|
||||
|
||||
// Kind takes an unqualified kind and returns back a Group qualified GroupKind
|
||||
func Kind(kind string) schema.GroupKind {
|
||||
return SchemeGroupVersion.WithKind(kind).GroupKind()
|
||||
}
|
||||
|
||||
// Resource takes an unqualified resource and returns a Group qualified GroupResource
|
||||
func Resource(resource string) schema.GroupResource {
|
||||
return SchemeGroupVersion.WithResource(resource).GroupResource()
|
||||
}
|
||||
|
||||
var (
|
||||
SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes)
|
||||
AddToScheme = SchemeBuilder.AddToScheme
|
||||
)
|
||||
|
||||
// Adds the list of known types to Scheme.
|
||||
func addKnownTypes(scheme *runtime.Scheme) error {
|
||||
scheme.AddKnownTypes(SchemeGroupVersion,
|
||||
&ApiServerSource{},
|
||||
&ApiServerSourceList{},
|
||||
&SinkBinding{},
|
||||
&SinkBindingList{},
|
||||
)
|
||||
metav1.AddToGroupVersion(scheme, SchemeGroupVersion)
|
||||
return nil
|
||||
}
|
||||
|
|
@ -1,43 +0,0 @@
|
|||
/*
|
||||
Copyright 2020 The Knative 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.
|
||||
*/
|
||||
|
||||
package v1alpha1
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"knative.dev/pkg/apis"
|
||||
)
|
||||
|
||||
// sinkURIKey is used as the key for associating information
|
||||
// with a context.Context.
|
||||
type sinkURIKey struct{}
|
||||
|
||||
// WithSinkURI notes on the context for binding that the resolved SinkURI
|
||||
// is the provided apis.URL.
|
||||
func WithSinkURI(ctx context.Context, uri *apis.URL) context.Context {
|
||||
return context.WithValue(ctx, sinkURIKey{}, uri)
|
||||
}
|
||||
|
||||
// GetSinkURI accesses the apis.URL for the Sink URI that has been associated
|
||||
// with this context.
|
||||
func GetSinkURI(ctx context.Context) *apis.URL {
|
||||
value := ctx.Value(sinkURIKey{})
|
||||
if value == nil {
|
||||
return nil
|
||||
}
|
||||
return value.(*apis.URL)
|
||||
}
|
||||
|
|
@ -1,55 +0,0 @@
|
|||
/*
|
||||
Copyright 2020 The Knative 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.
|
||||
*/
|
||||
|
||||
package v1alpha1
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"knative.dev/eventing/pkg/apis/sources/v1alpha2"
|
||||
"knative.dev/pkg/apis"
|
||||
)
|
||||
|
||||
// ConvertTo implements apis.Convertible.
|
||||
// Converts source from v1alpha1.SinkBinding into a higher version.
|
||||
func (source *SinkBinding) ConvertTo(ctx context.Context, obj apis.Convertible) error {
|
||||
switch sink := obj.(type) {
|
||||
case *v1alpha2.SinkBinding:
|
||||
sink.ObjectMeta = source.ObjectMeta
|
||||
sink.Spec.SourceSpec = source.Spec.SourceSpec
|
||||
sink.Spec.BindingSpec = source.Spec.BindingSpec
|
||||
sink.Status.SourceStatus = source.Status.SourceStatus
|
||||
return nil
|
||||
default:
|
||||
return apis.ConvertToViaProxy(ctx, source, &v1alpha2.SinkBinding{}, sink)
|
||||
}
|
||||
}
|
||||
|
||||
// ConvertFrom implements apis.Convertible.
|
||||
// Converts obj from a higher version into v1alpha1.SinkBinding.
|
||||
func (sink *SinkBinding) ConvertFrom(ctx context.Context, obj apis.Convertible) error {
|
||||
switch source := obj.(type) {
|
||||
case *v1alpha2.SinkBinding:
|
||||
sink.ObjectMeta = source.ObjectMeta
|
||||
sink.Spec.Subject = source.Spec.Subject
|
||||
sink.Spec.SourceSpec = source.Spec.SourceSpec
|
||||
sink.Spec.BindingSpec = source.Spec.BindingSpec
|
||||
sink.Status.SourceStatus = source.Status.SourceStatus
|
||||
return nil
|
||||
default:
|
||||
return apis.ConvertFromViaProxy(ctx, source, &v1alpha2.SinkBinding{}, sink)
|
||||
}
|
||||
}
|
||||
|
|
@ -1,34 +0,0 @@
|
|||
/*
|
||||
Copyright 2020 The Knative 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.
|
||||
*/
|
||||
|
||||
package v1alpha1
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"knative.dev/pkg/apis"
|
||||
)
|
||||
|
||||
// SetDefaults implements apis.Defaultable
|
||||
func (fb *SinkBinding) SetDefaults(ctx context.Context) {
|
||||
if fb.Spec.Subject.Namespace == "" {
|
||||
// Default the subject's namespace to our namespace.
|
||||
fb.Spec.Subject.Namespace = fb.Namespace
|
||||
}
|
||||
|
||||
withNS := apis.WithinParent(ctx, fb.ObjectMeta)
|
||||
fb.Spec.Sink.SetDefaults(withNS)
|
||||
}
|
||||
|
|
@ -1,152 +0,0 @@
|
|||
/*
|
||||
Copyright 2020 The Knative 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.
|
||||
*/
|
||||
|
||||
package v1alpha1
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
|
||||
"knative.dev/pkg/apis"
|
||||
"knative.dev/pkg/apis/duck"
|
||||
duckv1 "knative.dev/pkg/apis/duck/v1"
|
||||
"knative.dev/pkg/logging"
|
||||
"knative.dev/pkg/tracker"
|
||||
)
|
||||
|
||||
var sbCondSet = apis.NewLivingConditionSet()
|
||||
|
||||
// GetGroupVersionKind returns the GroupVersionKind.
|
||||
func (s *SinkBinding) GetGroupVersionKind() schema.GroupVersionKind {
|
||||
return SchemeGroupVersion.WithKind("SinkBinding")
|
||||
}
|
||||
|
||||
// GetUntypedSpec implements apis.HasSpec
|
||||
func (s *SinkBinding) GetUntypedSpec() interface{} {
|
||||
return s.Spec
|
||||
}
|
||||
|
||||
// GetSubject implements psbinding.Bindable
|
||||
func (sb *SinkBinding) GetSubject() tracker.Reference {
|
||||
return sb.Spec.Subject
|
||||
}
|
||||
|
||||
// GetBindingStatus implements psbinding.Bindable
|
||||
func (sb *SinkBinding) GetBindingStatus() duck.BindableStatus {
|
||||
return &sb.Status
|
||||
}
|
||||
|
||||
// SetObservedGeneration implements psbinding.BindableStatus
|
||||
func (sbs *SinkBindingStatus) SetObservedGeneration(gen int64) {
|
||||
sbs.ObservedGeneration = gen
|
||||
}
|
||||
|
||||
// InitializeConditions populates the SinkBindingStatus's conditions field
|
||||
// with all of its conditions configured to Unknown.
|
||||
func (sbs *SinkBindingStatus) InitializeConditions() {
|
||||
sbCondSet.Manage(sbs).InitializeConditions()
|
||||
}
|
||||
|
||||
// MarkBindingUnavailable marks the SinkBinding's Ready condition to False with
|
||||
// the provided reason and message.
|
||||
func (sbs *SinkBindingStatus) MarkBindingUnavailable(reason, message string) {
|
||||
sbCondSet.Manage(sbs).MarkFalse(SinkBindingConditionReady, reason, message)
|
||||
}
|
||||
|
||||
// MarkBindingAvailable marks the SinkBinding's Ready condition to True.
|
||||
func (sbs *SinkBindingStatus) MarkBindingAvailable() {
|
||||
sbCondSet.Manage(sbs).MarkTrue(SinkBindingConditionReady)
|
||||
}
|
||||
|
||||
// Do implements psbinding.Bindable
|
||||
func (sb *SinkBinding) Do(ctx context.Context, ps *duckv1.WithPod) {
|
||||
// First undo so that we can just unconditionally append below.
|
||||
sb.Undo(ctx, ps)
|
||||
|
||||
uri := GetSinkURI(ctx)
|
||||
if uri == nil {
|
||||
logging.FromContext(ctx).Errorf("No sink URI associated with context for %+v", sb)
|
||||
return
|
||||
}
|
||||
|
||||
var ceOverrides string
|
||||
if sb.Spec.CloudEventOverrides != nil {
|
||||
if co, err := json.Marshal(sb.Spec.SourceSpec.CloudEventOverrides); err != nil {
|
||||
logging.FromContext(ctx).Errorf("Failed to marshal CloudEventOverrides into JSON for %+v, %v", sb, err)
|
||||
} else if len(co) > 0 {
|
||||
ceOverrides = string(co)
|
||||
}
|
||||
}
|
||||
|
||||
spec := ps.Spec.Template.Spec
|
||||
for i := range spec.InitContainers {
|
||||
spec.InitContainers[i].Env = append(spec.InitContainers[i].Env, corev1.EnvVar{
|
||||
Name: "K_SINK",
|
||||
Value: uri.String(),
|
||||
})
|
||||
spec.InitContainers[i].Env = append(spec.InitContainers[i].Env, corev1.EnvVar{
|
||||
Name: "K_CE_OVERRIDES",
|
||||
Value: ceOverrides,
|
||||
})
|
||||
}
|
||||
for i := range spec.Containers {
|
||||
spec.Containers[i].Env = append(spec.Containers[i].Env, corev1.EnvVar{
|
||||
Name: "K_SINK",
|
||||
Value: uri.String(),
|
||||
})
|
||||
spec.Containers[i].Env = append(spec.Containers[i].Env, corev1.EnvVar{
|
||||
Name: "K_CE_OVERRIDES",
|
||||
Value: ceOverrides,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func (sb *SinkBinding) Undo(ctx context.Context, ps *duckv1.WithPod) {
|
||||
spec := ps.Spec.Template.Spec
|
||||
for i, c := range spec.InitContainers {
|
||||
if len(c.Env) == 0 {
|
||||
continue
|
||||
}
|
||||
env := make([]corev1.EnvVar, 0, len(spec.InitContainers[i].Env))
|
||||
for j, ev := range c.Env {
|
||||
switch ev.Name {
|
||||
case "K_SINK", "K_CE_OVERRIDES":
|
||||
continue
|
||||
default:
|
||||
env = append(env, spec.InitContainers[i].Env[j])
|
||||
}
|
||||
}
|
||||
spec.InitContainers[i].Env = env
|
||||
}
|
||||
for i, c := range spec.Containers {
|
||||
if len(c.Env) == 0 {
|
||||
continue
|
||||
}
|
||||
env := make([]corev1.EnvVar, 0, len(spec.Containers[i].Env))
|
||||
for j, ev := range c.Env {
|
||||
switch ev.Name {
|
||||
case "K_SINK", "K_CE_OVERRIDES":
|
||||
continue
|
||||
default:
|
||||
env = append(env, spec.Containers[i].Env[j])
|
||||
}
|
||||
}
|
||||
spec.Containers[i].Env = env
|
||||
}
|
||||
}
|
||||
|
|
@ -1,79 +0,0 @@
|
|||
/*
|
||||
Copyright 2020 The Knative 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.
|
||||
*/
|
||||
|
||||
package v1alpha1
|
||||
|
||||
import (
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"knative.dev/pkg/apis"
|
||||
duckv1 "knative.dev/pkg/apis/duck/v1"
|
||||
duckv1alpha1 "knative.dev/pkg/apis/duck/v1alpha1"
|
||||
"knative.dev/pkg/kmeta"
|
||||
)
|
||||
|
||||
// +genclient
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
// +k8s:defaulter-gen=true
|
||||
|
||||
// SinkBinding describes a Binding that is also a Source.
|
||||
// The `sink` (from the Source duck) is resolved to a URL and
|
||||
// then projected into the `subject` by augmenting the runtime
|
||||
// contract of the referenced containers to have a `K_SINK`
|
||||
// environment variable holding the endpoint to which to send
|
||||
// cloud events.
|
||||
type SinkBinding struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ObjectMeta `json:"metadata,omitempty"`
|
||||
|
||||
Spec SinkBindingSpec `json:"spec"`
|
||||
Status SinkBindingStatus `json:"status"`
|
||||
}
|
||||
|
||||
// Check the interfaces that SinkBinding should be implementing.
|
||||
var (
|
||||
_ runtime.Object = (*SinkBinding)(nil)
|
||||
_ kmeta.OwnerRefable = (*SinkBinding)(nil)
|
||||
_ apis.Validatable = (*SinkBinding)(nil)
|
||||
_ apis.Defaultable = (*SinkBinding)(nil)
|
||||
_ apis.HasSpec = (*SinkBinding)(nil)
|
||||
)
|
||||
|
||||
// SinkBindingSpec holds the desired state of the SinkBinding (from the client).
|
||||
type SinkBindingSpec struct {
|
||||
duckv1.SourceSpec `json:",inline"`
|
||||
duckv1alpha1.BindingSpec `json:",inline"`
|
||||
}
|
||||
|
||||
const (
|
||||
// SinkBindingConditionReady is configured to indicate whether the Binding
|
||||
// has been configured for resources subject to its runtime contract.
|
||||
SinkBindingConditionReady = apis.ConditionReady
|
||||
)
|
||||
|
||||
// SinkBindingStatus communicates the observed state of the SinkBinding (from the controller).
|
||||
type SinkBindingStatus struct {
|
||||
duckv1.SourceStatus `json:",inline"`
|
||||
}
|
||||
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
|
||||
// SinkBindingList contains a list of SinkBinding
|
||||
type SinkBindingList struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ListMeta `json:"metadata,omitempty"`
|
||||
Items []SinkBinding `json:"items"`
|
||||
}
|
||||
|
|
@ -1,38 +0,0 @@
|
|||
/*
|
||||
Copyright 2020 The Knative 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.
|
||||
*/
|
||||
|
||||
package v1alpha1
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"knative.dev/pkg/apis"
|
||||
)
|
||||
|
||||
// Validate implements apis.Validatable
|
||||
func (fb *SinkBinding) Validate(ctx context.Context) *apis.FieldError {
|
||||
err := fb.Spec.Validate(ctx).ViaField("spec")
|
||||
if fb.Spec.Subject.Namespace != "" && fb.Namespace != fb.Spec.Subject.Namespace {
|
||||
err = err.Also(apis.ErrInvalidValue(fb.Spec.Subject.Namespace, "spec.subject.namespace"))
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
// Validate implements apis.Validatable
|
||||
func (fbs *SinkBindingSpec) Validate(ctx context.Context) *apis.FieldError {
|
||||
return fbs.Subject.Validate(ctx).ViaField("subject").Also(
|
||||
fbs.Sink.Validate(ctx).ViaField("sink"))
|
||||
}
|
||||
|
|
@ -1,258 +0,0 @@
|
|||
// +build !ignore_autogenerated
|
||||
|
||||
/*
|
||||
Copyright 2021 The Knative 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.
|
||||
*/
|
||||
|
||||
// Code generated by deepcopy-gen. DO NOT EDIT.
|
||||
|
||||
package v1alpha1
|
||||
|
||||
import (
|
||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||
v1alpha2 "knative.dev/eventing/pkg/apis/sources/v1alpha2"
|
||||
v1 "knative.dev/pkg/apis/duck/v1"
|
||||
v1beta1 "knative.dev/pkg/apis/duck/v1beta1"
|
||||
)
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *ApiServerResource) DeepCopyInto(out *ApiServerResource) {
|
||||
*out = *in
|
||||
in.LabelSelector.DeepCopyInto(&out.LabelSelector)
|
||||
in.ControllerSelector.DeepCopyInto(&out.ControllerSelector)
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ApiServerResource.
|
||||
func (in *ApiServerResource) DeepCopy() *ApiServerResource {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(ApiServerResource)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *ApiServerSource) DeepCopyInto(out *ApiServerSource) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
||||
in.Spec.DeepCopyInto(&out.Spec)
|
||||
in.Status.DeepCopyInto(&out.Status)
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ApiServerSource.
|
||||
func (in *ApiServerSource) DeepCopy() *ApiServerSource {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(ApiServerSource)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *ApiServerSource) DeepCopyObject() runtime.Object {
|
||||
if c := in.DeepCopy(); c != nil {
|
||||
return c
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *ApiServerSourceList) DeepCopyInto(out *ApiServerSourceList) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ListMeta.DeepCopyInto(&out.ListMeta)
|
||||
if in.Items != nil {
|
||||
in, out := &in.Items, &out.Items
|
||||
*out = make([]ApiServerSource, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ApiServerSourceList.
|
||||
func (in *ApiServerSourceList) DeepCopy() *ApiServerSourceList {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(ApiServerSourceList)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *ApiServerSourceList) DeepCopyObject() runtime.Object {
|
||||
if c := in.DeepCopy(); c != nil {
|
||||
return c
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *ApiServerSourceSpec) DeepCopyInto(out *ApiServerSourceSpec) {
|
||||
*out = *in
|
||||
if in.Resources != nil {
|
||||
in, out := &in.Resources, &out.Resources
|
||||
*out = make([]ApiServerResource, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
if in.Sink != nil {
|
||||
in, out := &in.Sink, &out.Sink
|
||||
*out = new(v1beta1.Destination)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
if in.CloudEventOverrides != nil {
|
||||
in, out := &in.CloudEventOverrides, &out.CloudEventOverrides
|
||||
*out = new(v1.CloudEventOverrides)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
if in.ResourceOwner != nil {
|
||||
in, out := &in.ResourceOwner, &out.ResourceOwner
|
||||
*out = new(v1alpha2.APIVersionKind)
|
||||
**out = **in
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ApiServerSourceSpec.
|
||||
func (in *ApiServerSourceSpec) DeepCopy() *ApiServerSourceSpec {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(ApiServerSourceSpec)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *ApiServerSourceStatus) DeepCopyInto(out *ApiServerSourceStatus) {
|
||||
*out = *in
|
||||
in.SourceStatus.DeepCopyInto(&out.SourceStatus)
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ApiServerSourceStatus.
|
||||
func (in *ApiServerSourceStatus) DeepCopy() *ApiServerSourceStatus {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(ApiServerSourceStatus)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *SinkBinding) DeepCopyInto(out *SinkBinding) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
||||
in.Spec.DeepCopyInto(&out.Spec)
|
||||
in.Status.DeepCopyInto(&out.Status)
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SinkBinding.
|
||||
func (in *SinkBinding) DeepCopy() *SinkBinding {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(SinkBinding)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *SinkBinding) DeepCopyObject() runtime.Object {
|
||||
if c := in.DeepCopy(); c != nil {
|
||||
return c
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *SinkBindingList) DeepCopyInto(out *SinkBindingList) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ListMeta.DeepCopyInto(&out.ListMeta)
|
||||
if in.Items != nil {
|
||||
in, out := &in.Items, &out.Items
|
||||
*out = make([]SinkBinding, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SinkBindingList.
|
||||
func (in *SinkBindingList) DeepCopy() *SinkBindingList {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(SinkBindingList)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *SinkBindingList) DeepCopyObject() runtime.Object {
|
||||
if c := in.DeepCopy(); c != nil {
|
||||
return c
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *SinkBindingSpec) DeepCopyInto(out *SinkBindingSpec) {
|
||||
*out = *in
|
||||
in.SourceSpec.DeepCopyInto(&out.SourceSpec)
|
||||
in.BindingSpec.DeepCopyInto(&out.BindingSpec)
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SinkBindingSpec.
|
||||
func (in *SinkBindingSpec) DeepCopy() *SinkBindingSpec {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(SinkBindingSpec)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *SinkBindingStatus) DeepCopyInto(out *SinkBindingStatus) {
|
||||
*out = *in
|
||||
in.SourceStatus.DeepCopyInto(&out.SourceStatus)
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SinkBindingStatus.
|
||||
func (in *SinkBindingStatus) DeepCopy() *SinkBindingStatus {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(SinkBindingStatus)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
|
@ -29,7 +29,6 @@ import (
|
|||
flowsv1 "knative.dev/eventing/pkg/apis/flows/v1"
|
||||
messagingv1 "knative.dev/eventing/pkg/apis/messaging/v1"
|
||||
sourcesv1 "knative.dev/eventing/pkg/apis/sources/v1"
|
||||
sourcesv1alpha1 "knative.dev/eventing/pkg/apis/sources/v1alpha1"
|
||||
sourcesv1alpha2 "knative.dev/eventing/pkg/apis/sources/v1alpha2"
|
||||
sourcesv1beta1 "knative.dev/eventing/pkg/apis/sources/v1beta1"
|
||||
sourcesv1beta2 "knative.dev/eventing/pkg/apis/sources/v1beta2"
|
||||
|
|
@ -43,7 +42,6 @@ var localSchemeBuilder = runtime.SchemeBuilder{
|
|||
eventingv1.AddToScheme,
|
||||
flowsv1.AddToScheme,
|
||||
messagingv1.AddToScheme,
|
||||
sourcesv1alpha1.AddToScheme,
|
||||
sourcesv1alpha2.AddToScheme,
|
||||
sourcesv1beta1.AddToScheme,
|
||||
sourcesv1beta2.AddToScheme,
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ export GOPATH=$(go_mod_gopath_hack)
|
|||
export GOBIN=${GOPATH}/bin # Set GOBIN explicitly as deepcopy-gen is installed by go install.
|
||||
export MODULE_NAME=$(go_mod_module_name)
|
||||
export CODEGEN_PKG=${CODEGEN_PKG:-$(cd ${REPO_ROOT_DIR}; ls -d -1 ./vendor/k8s.io/code-generator 2>/dev/null || echo ../code-generator)}
|
||||
export KNATIVE_CODEGEN_PKG=${KNATIVE_CODEGEN_PKG:-$(cd ${REPO_ROOT_DIR}; ls -d -1 ./vendor/knative.dev/pkg 2>/dev/null || echo ../pkg)}
|
||||
export KNATIVE_CODEGEN_PKG=${KNATIVE_CODEGEN_PKG:-$(cd ${REPO_ROOT_DIR}; ls -d -1 ./vendor/knative.dev/pkg 2>/dev/null || echo "${REPO_ROOT_DIR}")}
|
||||
|
||||
chmod +x ${CODEGEN_PKG}/generate-groups.sh
|
||||
chmod +x ${KNATIVE_CODEGEN_PKG}/hack/generate-knative.sh
|
||||
|
|
|
|||
|
|
@ -296,6 +296,15 @@ function main() {
|
|||
echo ">> docker version"
|
||||
docker version
|
||||
fi
|
||||
if type java > /dev/null; then
|
||||
echo ">> java version"
|
||||
java -version
|
||||
echo "JAVA_HOME: $JAVA_HOME"
|
||||
fi
|
||||
if type mvn > /dev/null; then
|
||||
echo ">> maven version"
|
||||
mvn --version
|
||||
fi
|
||||
fi
|
||||
|
||||
[[ -z $1 ]] && set -- "--all-tests"
|
||||
|
|
|
|||
|
|
@ -103,7 +103,7 @@ type ServerlessServiceSpec struct {
|
|||
|
||||
// The application-layer protocol. Matches `RevisionProtocolType` set on the owning pa/revision.
|
||||
// serving imports networking, so just use string.
|
||||
ProtocolType networking.ProtocolType
|
||||
ProtocolType networking.ProtocolType `json:"protocolType"`
|
||||
|
||||
// NumActivators contains number of Activators that this revision should be
|
||||
// assigned.
|
||||
|
|
|
|||
|
|
@ -508,7 +508,7 @@ func (r *reconcilerImpl) Reconcile(ctx {{.contextContext|raw}}, key string) erro
|
|||
var event *{{.reconcilerReconcilerEvent|raw}}
|
||||
if reconciler.EventAs(reconcileEvent, &event) {
|
||||
logger.Infow("Returned an event", zap.Any("event", reconcileEvent))
|
||||
r.Recorder.Eventf(resource, event.EventType, event.Reason, event.Format, event.Args...)
|
||||
r.Recorder.Event(resource, event.EventType, event.Reason, event.Error())
|
||||
|
||||
// the event was wrapped inside an error, consider the reconciliation as failed
|
||||
if _, isEvent := reconcileEvent.(*reconciler.ReconcilerEvent); !isEvent {
|
||||
|
|
|
|||
|
|
@ -18,23 +18,20 @@ set -o errexit
|
|||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
export GO111MODULE=on
|
||||
source $(dirname $0)/../vendor/knative.dev/hack/codegen-library.sh
|
||||
|
||||
# If we run with -mod=vendor here, then generate-groups.sh looks for vendor files in the wrong place.
|
||||
export GOFLAGS=-mod=
|
||||
|
||||
if [ -z "${GOPATH:-}" ]; then
|
||||
export GOPATH=$(go env GOPATH)
|
||||
fi
|
||||
|
||||
source $(dirname $0)/../vendor/knative.dev/hack/library.sh
|
||||
|
||||
CODEGEN_PKG=${CODEGEN_PKG:-$(cd ${REPO_ROOT_DIR}; ls -d -1 $(dirname $0)/../vendor/k8s.io/code-generator 2>/dev/null || echo ../code-generator)}
|
||||
echo "=== Update Codegen for $MODULE_NAME"
|
||||
|
||||
# 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
|
||||
# instead of the $GOPATH directly. For normal projects this can be dropped.
|
||||
|
||||
group "Kubernetes Codegen"
|
||||
|
||||
# Knative Injection
|
||||
${REPO_ROOT_DIR}/hack/generate-knative.sh "injection" \
|
||||
knative.dev/pkg/client knative.dev/pkg/apis \
|
||||
|
|
@ -60,8 +57,9 @@ VERSIONED_CLIENTSET_PKG="k8s.io/apiextensions-apiserver/pkg/client/clientset/cli
|
|||
--go-header-file ${REPO_ROOT_DIR}/hack/boilerplate/boilerplate.go.txt \
|
||||
--force-genreconciler-kinds "CustomResourceDefinition"
|
||||
|
||||
group "Knative Codegen"
|
||||
|
||||
# Only deepcopy the Duck types, as they are not real resources.
|
||||
chmod +x ${CODEGEN_PKG}/generate-groups.sh
|
||||
${CODEGEN_PKG}/generate-groups.sh "deepcopy" \
|
||||
knative.dev/pkg/client knative.dev/pkg/apis \
|
||||
"duck:v1alpha1,v1beta1,v1" \
|
||||
|
|
@ -81,6 +79,7 @@ go run k8s.io/code-generator/cmd/deepcopy-gen --input-dirs \
|
|||
-O zz_generated.deepcopy \
|
||||
--go-header-file ${REPO_ROOT_DIR}/hack/boilerplate/boilerplate.go.txt
|
||||
|
||||
group "Update deps post-codegen"
|
||||
|
||||
# Make sure our dependencies are up-to-date
|
||||
${REPO_ROOT_DIR}/hack/update-deps.sh
|
||||
|
||||
|
|
|
|||
|
|
@ -96,5 +96,5 @@ func (e *ReconcilerEvent) As(target interface{}) bool {
|
|||
// Error returns the string that is formed by using the format string with the
|
||||
// provided args.
|
||||
func (e *ReconcilerEvent) Error() string {
|
||||
return fmt.Sprintf(e.Format, e.Args...)
|
||||
return fmt.Errorf(e.Format, e.Args...).Error()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -766,7 +766,7 @@ k8s.io/kube-openapi/pkg/util/sets
|
|||
k8s.io/utils/buffer
|
||||
k8s.io/utils/integer
|
||||
k8s.io/utils/trace
|
||||
# knative.dev/eventing v0.22.1-0.20210426130639-83a1713973d5
|
||||
# knative.dev/eventing v0.22.1-0.20210427180853-474fb5b41c3b
|
||||
## explicit
|
||||
knative.dev/eventing/pkg/apis/config
|
||||
knative.dev/eventing/pkg/apis/duck
|
||||
|
|
@ -782,7 +782,6 @@ knative.dev/eventing/pkg/apis/messaging/v1
|
|||
knative.dev/eventing/pkg/apis/sources
|
||||
knative.dev/eventing/pkg/apis/sources/config
|
||||
knative.dev/eventing/pkg/apis/sources/v1
|
||||
knative.dev/eventing/pkg/apis/sources/v1alpha1
|
||||
knative.dev/eventing/pkg/apis/sources/v1alpha2
|
||||
knative.dev/eventing/pkg/apis/sources/v1beta1
|
||||
knative.dev/eventing/pkg/apis/sources/v1beta2
|
||||
|
|
@ -792,15 +791,15 @@ knative.dev/eventing/pkg/client/clientset/versioned/typed/eventing/v1/fake
|
|||
knative.dev/eventing/pkg/client/clientset/versioned/typed/messaging/v1
|
||||
knative.dev/eventing/pkg/client/clientset/versioned/typed/sources/v1alpha2
|
||||
knative.dev/eventing/pkg/client/clientset/versioned/typed/sources/v1alpha2/fake
|
||||
# knative.dev/hack v0.0.0-20210426064739-88c69cd1eca7
|
||||
# knative.dev/hack v0.0.0-20210428122153-93ad9129c268
|
||||
## explicit
|
||||
knative.dev/hack
|
||||
# knative.dev/networking v0.0.0-20210426132139-7a7ad5197fe6
|
||||
# knative.dev/networking v0.0.0-20210428014353-796a80097840
|
||||
## explicit
|
||||
knative.dev/networking/pkg
|
||||
knative.dev/networking/pkg/apis/networking
|
||||
knative.dev/networking/pkg/apis/networking/v1alpha1
|
||||
# knative.dev/pkg v0.0.0-20210426101439-2a0fc657a712
|
||||
# knative.dev/pkg v0.0.0-20210428023153-5a308fa62139
|
||||
## explicit
|
||||
knative.dev/pkg/apis
|
||||
knative.dev/pkg/apis/duck
|
||||
|
|
@ -844,7 +843,7 @@ knative.dev/pkg/tracing/config
|
|||
knative.dev/pkg/tracing/propagation
|
||||
knative.dev/pkg/tracing/propagation/tracecontextb3
|
||||
knative.dev/pkg/tracker
|
||||
# knative.dev/serving v0.22.1-0.20210426060740-792c8d233f49
|
||||
# knative.dev/serving v0.22.1-0.20210428070553-6ed3b03f1545
|
||||
## explicit
|
||||
knative.dev/serving/pkg/apis/autoscaling
|
||||
knative.dev/serving/pkg/apis/autoscaling/v1alpha1
|
||||
|
|
|
|||
Loading…
Reference in New Issue