mirror of https://github.com/knative/caching.git
upgrade to latest dependencies (#874)
bumping knative.dev/pkg 15e6cdf...339c22b: > 339c22b Add AuthenticatableType duck type (# 3056) Signed-off-by: Knative Automation <automation@knative.team>
This commit is contained in:
parent
23ec42b218
commit
52069666b5
2
go.mod
2
go.mod
|
@ -11,7 +11,7 @@ require (
|
||||||
k8s.io/code-generator v0.29.2
|
k8s.io/code-generator v0.29.2
|
||||||
k8s.io/kube-openapi v0.0.0-20231010175941-2dd684a91f00
|
k8s.io/kube-openapi v0.0.0-20231010175941-2dd684a91f00
|
||||||
knative.dev/hack v0.0.0-20240607132042-09143140a254
|
knative.dev/hack v0.0.0-20240607132042-09143140a254
|
||||||
knative.dev/pkg v0.0.0-20240610120318-15e6cdf2f386
|
knative.dev/pkg v0.0.0-20240614135239-339c22b8218c
|
||||||
)
|
)
|
||||||
|
|
||||||
require (
|
require (
|
||||||
|
|
4
go.sum
4
go.sum
|
@ -663,8 +663,8 @@ k8s.io/utils v0.0.0-20240102154912-e7106e64919e h1:eQ/4ljkx21sObifjzXwlPKpdGLrCf
|
||||||
k8s.io/utils v0.0.0-20240102154912-e7106e64919e/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0=
|
k8s.io/utils v0.0.0-20240102154912-e7106e64919e/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0=
|
||||||
knative.dev/hack v0.0.0-20240607132042-09143140a254 h1:1YFnu3U6dWZg0oxm6GU8kEdA9A+BvSWKJO7sg3N0kq8=
|
knative.dev/hack v0.0.0-20240607132042-09143140a254 h1:1YFnu3U6dWZg0oxm6GU8kEdA9A+BvSWKJO7sg3N0kq8=
|
||||||
knative.dev/hack v0.0.0-20240607132042-09143140a254/go.mod h1:yk2OjGDsbEnQjfxdm0/HJKS2WqTLEFg/N6nUs6Rqx3Q=
|
knative.dev/hack v0.0.0-20240607132042-09143140a254/go.mod h1:yk2OjGDsbEnQjfxdm0/HJKS2WqTLEFg/N6nUs6Rqx3Q=
|
||||||
knative.dev/pkg v0.0.0-20240610120318-15e6cdf2f386 h1:nxFTT6DrXr70Zi2BK8nc57ts0/smyavd/uBRBbtqg94=
|
knative.dev/pkg v0.0.0-20240614135239-339c22b8218c h1:OaKrY7L6rzWTvs51JlieJajL40F6CpBbvO1aZspg2EA=
|
||||||
knative.dev/pkg v0.0.0-20240610120318-15e6cdf2f386/go.mod h1:l7R8/SteYph0mZDsVgq3fVs4mWp1DaYx9BJJX68U6ik=
|
knative.dev/pkg v0.0.0-20240614135239-339c22b8218c/go.mod h1:l7R8/SteYph0mZDsVgq3fVs4mWp1DaYx9BJJX68U6ik=
|
||||||
rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8=
|
rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8=
|
||||||
rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0=
|
rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0=
|
||||||
rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA=
|
rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA=
|
||||||
|
|
|
@ -16,6 +16,21 @@ limitations under the License.
|
||||||
|
|
||||||
package v1
|
package v1
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"fmt"
|
||||||
|
|
||||||
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
|
"k8s.io/apimachinery/pkg/runtime"
|
||||||
|
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||||
|
"knative.dev/pkg/apis"
|
||||||
|
"knative.dev/pkg/apis/duck/ducktypes"
|
||||||
|
"knative.dev/pkg/kmeta"
|
||||||
|
"knative.dev/pkg/ptr"
|
||||||
|
)
|
||||||
|
|
||||||
|
// +genduck
|
||||||
|
|
||||||
// AuthStatus is meant to provide the generated service account name
|
// AuthStatus is meant to provide the generated service account name
|
||||||
// in the resource status.
|
// in the resource status.
|
||||||
type AuthStatus struct {
|
type AuthStatus struct {
|
||||||
|
@ -28,3 +43,81 @@ type AuthStatus struct {
|
||||||
// when the component uses multiple identities (e.g. in case of a Parallel).
|
// when the component uses multiple identities (e.g. in case of a Parallel).
|
||||||
ServiceAccountNames []string `json:"serviceAccountNames,omitempty"`
|
ServiceAccountNames []string `json:"serviceAccountNames,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||||
|
|
||||||
|
// AuthenticatableType is a skeleton type wrapping AuthStatus in the manner we expect
|
||||||
|
// resource writers defining compatible resources to embed it. We will
|
||||||
|
// typically use this type to deserialize AuthenticatableType ObjectReferences and
|
||||||
|
// access the AuthenticatableType data. This is not a real resource.
|
||||||
|
type AuthenticatableType struct {
|
||||||
|
metav1.TypeMeta `json:",inline"`
|
||||||
|
metav1.ObjectMeta `json:"metadata,omitempty"`
|
||||||
|
|
||||||
|
Status AuthenticatableStatus `json:"status"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type AuthenticatableStatus struct {
|
||||||
|
// Auth contains the service account name for the subscription
|
||||||
|
// +optional
|
||||||
|
Auth *AuthStatus `json:"auth,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
var (
|
||||||
|
// AuthStatus is a Convertible type.
|
||||||
|
_ apis.Convertible = (*AuthStatus)(nil)
|
||||||
|
|
||||||
|
// Verify AuthenticatableType resources meet duck contracts.
|
||||||
|
_ apis.Listable = (*AuthenticatableType)(nil)
|
||||||
|
_ ducktypes.Populatable = (*AuthenticatableType)(nil)
|
||||||
|
_ kmeta.OwnerRefable = (*AuthenticatableType)(nil)
|
||||||
|
)
|
||||||
|
|
||||||
|
// GetFullType implements duck.Implementable
|
||||||
|
func (*AuthStatus) GetFullType() ducktypes.Populatable {
|
||||||
|
return &AuthenticatableType{}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ConvertTo implements apis.Convertible
|
||||||
|
func (a *AuthStatus) ConvertTo(_ context.Context, to apis.Convertible) error {
|
||||||
|
return fmt.Errorf("v1 is the highest known version, got: %T", to)
|
||||||
|
}
|
||||||
|
|
||||||
|
// ConvertFrom implements apis.Convertible
|
||||||
|
func (a *AuthStatus) ConvertFrom(_ context.Context, from apis.Convertible) error {
|
||||||
|
return fmt.Errorf("v1 is the highest known version, got: %T", from)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Populate implements duck.Populatable
|
||||||
|
func (t *AuthenticatableType) Populate() {
|
||||||
|
t.Status = AuthenticatableStatus{
|
||||||
|
Auth: &AuthStatus{
|
||||||
|
// Populate ALL fields
|
||||||
|
ServiceAccountName: ptr.String("foo"),
|
||||||
|
ServiceAccountNames: []string{
|
||||||
|
"bar",
|
||||||
|
"baz",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetGroupVersionKind implements kmeta.OwnerRefable
|
||||||
|
func (t *AuthenticatableType) GetGroupVersionKind() schema.GroupVersionKind {
|
||||||
|
return t.GroupVersionKind()
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetListType implements apis.Listable
|
||||||
|
func (*AuthenticatableType) GetListType() runtime.Object {
|
||||||
|
return &AuthenticatableTypeList{}
|
||||||
|
}
|
||||||
|
|
||||||
|
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||||
|
|
||||||
|
// AuthenticatableTypeList is a list of AuthenticatableType resources
|
||||||
|
type AuthenticatableTypeList struct {
|
||||||
|
metav1.TypeMeta `json:",inline"`
|
||||||
|
metav1.ListMeta `json:"metadata"`
|
||||||
|
|
||||||
|
Items []AuthenticatableType `json:"items"`
|
||||||
|
}
|
||||||
|
|
|
@ -176,6 +176,87 @@ func (in *AuthStatus) DeepCopy() *AuthStatus {
|
||||||
return out
|
return out
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||||
|
func (in *AuthenticatableStatus) DeepCopyInto(out *AuthenticatableStatus) {
|
||||||
|
*out = *in
|
||||||
|
if in.Auth != nil {
|
||||||
|
in, out := &in.Auth, &out.Auth
|
||||||
|
*out = new(AuthStatus)
|
||||||
|
(*in).DeepCopyInto(*out)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AuthenticatableStatus.
|
||||||
|
func (in *AuthenticatableStatus) DeepCopy() *AuthenticatableStatus {
|
||||||
|
if in == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
out := new(AuthenticatableStatus)
|
||||||
|
in.DeepCopyInto(out)
|
||||||
|
return out
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||||
|
func (in *AuthenticatableType) DeepCopyInto(out *AuthenticatableType) {
|
||||||
|
*out = *in
|
||||||
|
out.TypeMeta = in.TypeMeta
|
||||||
|
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
||||||
|
in.Status.DeepCopyInto(&out.Status)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AuthenticatableType.
|
||||||
|
func (in *AuthenticatableType) DeepCopy() *AuthenticatableType {
|
||||||
|
if in == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
out := new(AuthenticatableType)
|
||||||
|
in.DeepCopyInto(out)
|
||||||
|
return out
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||||
|
func (in *AuthenticatableType) 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 *AuthenticatableTypeList) DeepCopyInto(out *AuthenticatableTypeList) {
|
||||||
|
*out = *in
|
||||||
|
out.TypeMeta = in.TypeMeta
|
||||||
|
in.ListMeta.DeepCopyInto(&out.ListMeta)
|
||||||
|
if in.Items != nil {
|
||||||
|
in, out := &in.Items, &out.Items
|
||||||
|
*out = make([]AuthenticatableType, len(*in))
|
||||||
|
for i := range *in {
|
||||||
|
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AuthenticatableTypeList.
|
||||||
|
func (in *AuthenticatableTypeList) DeepCopy() *AuthenticatableTypeList {
|
||||||
|
if in == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
out := new(AuthenticatableTypeList)
|
||||||
|
in.DeepCopyInto(out)
|
||||||
|
return out
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||||
|
func (in *AuthenticatableTypeList) 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.
|
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||||
func (in *Binding) DeepCopyInto(out *Binding) {
|
func (in *Binding) DeepCopyInto(out *Binding) {
|
||||||
*out = *in
|
*out = *in
|
||||||
|
|
|
@ -0,0 +1,18 @@
|
||||||
|
/*
|
||||||
|
Copyright 2019 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 ptr holds utilities for taking pointer references to values.
|
||||||
|
package ptr
|
|
@ -0,0 +1,67 @@
|
||||||
|
/*
|
||||||
|
Copyright 2019 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 ptr
|
||||||
|
|
||||||
|
import "time"
|
||||||
|
|
||||||
|
// Int32 is a helper for turning integers into pointers for use in
|
||||||
|
// API types that want *int32.
|
||||||
|
func Int32(i int32) *int32 {
|
||||||
|
return &i
|
||||||
|
}
|
||||||
|
|
||||||
|
// Int64 is a helper for turning integers into pointers for use in
|
||||||
|
// API types that want *int64.
|
||||||
|
func Int64(i int64) *int64 {
|
||||||
|
return &i
|
||||||
|
}
|
||||||
|
|
||||||
|
// Float32 is a helper for turning floats into pointers for use in
|
||||||
|
// API types that want *float32.
|
||||||
|
func Float32(f float32) *float32 {
|
||||||
|
return &f
|
||||||
|
}
|
||||||
|
|
||||||
|
// Float64 is a helper for turning floats into pointers for use in
|
||||||
|
// API types that want *float64.
|
||||||
|
func Float64(f float64) *float64 {
|
||||||
|
return &f
|
||||||
|
}
|
||||||
|
|
||||||
|
// Bool is a helper for turning bools into pointers for use in
|
||||||
|
// API types that want *bool.
|
||||||
|
func Bool(b bool) *bool {
|
||||||
|
return &b
|
||||||
|
}
|
||||||
|
|
||||||
|
// String is a helper for turning strings into pointers for use in
|
||||||
|
// API types that want *string.
|
||||||
|
func String(s string) *string {
|
||||||
|
return &s
|
||||||
|
}
|
||||||
|
|
||||||
|
// Duration is a helper for turning time.Duration into pointers for use in
|
||||||
|
// API types that want *time.Duration.
|
||||||
|
func Duration(t time.Duration) *time.Duration {
|
||||||
|
return &t
|
||||||
|
}
|
||||||
|
|
||||||
|
// Time is a helper for turning a const time.Time into a pointer for use in
|
||||||
|
// API types that want *time.Duration.
|
||||||
|
func Time(t time.Time) *time.Time {
|
||||||
|
return &t
|
||||||
|
}
|
|
@ -0,0 +1,91 @@
|
||||||
|
/*
|
||||||
|
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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package ptr
|
||||||
|
|
||||||
|
import "time"
|
||||||
|
|
||||||
|
// Int32Value is a helper for turning pointers to integers into values for use
|
||||||
|
// in API types that want int32.
|
||||||
|
func Int32Value(i *int32) int32 {
|
||||||
|
if i == nil {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
return *i
|
||||||
|
}
|
||||||
|
|
||||||
|
// Int64Value is a helper for turning pointers to integers into values for use
|
||||||
|
// in API types that want int64.
|
||||||
|
func Int64Value(i *int64) int64 {
|
||||||
|
if i == nil {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
return *i
|
||||||
|
}
|
||||||
|
|
||||||
|
// Float32Value is a helper for turning pointers to floats into values for use
|
||||||
|
// in API types that want float32.
|
||||||
|
func Float32Value(f *float32) float32 {
|
||||||
|
if f == nil {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
return *f
|
||||||
|
}
|
||||||
|
|
||||||
|
// Float64Value is a helper for turning pointers to floats into values for use
|
||||||
|
// in API types that want float64.
|
||||||
|
func Float64Value(f *float64) float64 {
|
||||||
|
if f == nil {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
return *f
|
||||||
|
}
|
||||||
|
|
||||||
|
// BoolValue is a helper for turning pointers to bools into values for use in
|
||||||
|
// API types that want bool.
|
||||||
|
func BoolValue(b *bool) bool {
|
||||||
|
if b == nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
return *b
|
||||||
|
}
|
||||||
|
|
||||||
|
// StringValue is a helper for turning pointers to strings into values for use
|
||||||
|
// in API types that want string.
|
||||||
|
func StringValue(s *string) string {
|
||||||
|
if s == nil {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
return *s
|
||||||
|
}
|
||||||
|
|
||||||
|
// DurationValue is a helper for turning *time.Duration into values for use in
|
||||||
|
// API types that want time.Duration.
|
||||||
|
func DurationValue(t *time.Duration) time.Duration {
|
||||||
|
if t == nil {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
return *t
|
||||||
|
}
|
||||||
|
|
||||||
|
// TimeValue is a helper for turning *time.Time into values for use in API
|
||||||
|
// types that want API types that want time.Time.
|
||||||
|
func TimeValue(t *time.Time) time.Time {
|
||||||
|
if t == nil {
|
||||||
|
return time.Time{}
|
||||||
|
}
|
||||||
|
return *t
|
||||||
|
}
|
|
@ -687,7 +687,7 @@ k8s.io/utils/trace
|
||||||
# knative.dev/hack v0.0.0-20240607132042-09143140a254
|
# knative.dev/hack v0.0.0-20240607132042-09143140a254
|
||||||
## explicit; go 1.18
|
## explicit; go 1.18
|
||||||
knative.dev/hack
|
knative.dev/hack
|
||||||
# knative.dev/pkg v0.0.0-20240610120318-15e6cdf2f386
|
# knative.dev/pkg v0.0.0-20240614135239-339c22b8218c
|
||||||
## explicit; go 1.21
|
## explicit; go 1.21
|
||||||
knative.dev/pkg/apis
|
knative.dev/pkg/apis
|
||||||
knative.dev/pkg/apis/duck
|
knative.dev/pkg/apis/duck
|
||||||
|
@ -714,6 +714,7 @@ knative.dev/pkg/logging/logkey
|
||||||
knative.dev/pkg/metrics
|
knative.dev/pkg/metrics
|
||||||
knative.dev/pkg/metrics/metricskey
|
knative.dev/pkg/metrics/metricskey
|
||||||
knative.dev/pkg/network
|
knative.dev/pkg/network
|
||||||
|
knative.dev/pkg/ptr
|
||||||
knative.dev/pkg/reconciler
|
knative.dev/pkg/reconciler
|
||||||
knative.dev/pkg/signals
|
knative.dev/pkg/signals
|
||||||
knative.dev/pkg/system
|
knative.dev/pkg/system
|
||||||
|
|
Loading…
Reference in New Issue