Skip to content

Commit

Permalink
upgrade to latest dependencies
Browse files Browse the repository at this point in the history
bumping knative.dev/pkg 15e6cdf...339c22b:
  > 339c22b Add AuthenticatableType duck type (# 3056)

Signed-off-by: Knative Automation <[email protected]>
  • Loading branch information
knative-automation committed Jun 17, 2024
1 parent 3b8764c commit 3f01299
Show file tree
Hide file tree
Showing 5 changed files with 178 additions and 4 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ require (
k8s.io/code-generator v0.29.2
k8s.io/utils v0.0.0-20240102154912-e7106e64919e
knative.dev/hack v0.0.0-20240607132042-09143140a254
knative.dev/pkg v0.0.0-20240610120318-15e6cdf2f386
knative.dev/pkg v0.0.0-20240614135239-339c22b8218c
sigs.k8s.io/yaml v1.4.0
)

Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -671,8 +671,8 @@ k8s.io/utils v0.0.0-20240102154912-e7106e64919e h1:eQ/4ljkx21sObifjzXwlPKpdGLrCf
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/go.mod h1:yk2OjGDsbEnQjfxdm0/HJKS2WqTLEFg/N6nUs6Rqx3Q=
knative.dev/pkg v0.0.0-20240610120318-15e6cdf2f386 h1:nxFTT6DrXr70Zi2BK8nc57ts0/smyavd/uBRBbtqg94=
knative.dev/pkg v0.0.0-20240610120318-15e6cdf2f386/go.mod h1:l7R8/SteYph0mZDsVgq3fVs4mWp1DaYx9BJJX68U6ik=
knative.dev/pkg v0.0.0-20240614135239-339c22b8218c h1:OaKrY7L6rzWTvs51JlieJajL40F6CpBbvO1aZspg2EA=
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/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0=
rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA=
Expand Down
93 changes: 93 additions & 0 deletions vendor/knative.dev/pkg/apis/duck/v1/auth_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,21 @@ limitations under the License.

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
// in the resource status.
type AuthStatus struct {
Expand All @@ -28,3 +43,81 @@ type AuthStatus struct {
// when the component uses multiple identities (e.g. in case of a Parallel).
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"`
}
81 changes: 81 additions & 0 deletions vendor/knative.dev/pkg/apis/duck/v1/zz_generated.deepcopy.go

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

2 changes: 1 addition & 1 deletion vendor/modules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -711,7 +711,7 @@ k8s.io/utils/trace
# knative.dev/hack v0.0.0-20240607132042-09143140a254
## explicit; go 1.18
knative.dev/hack
# knative.dev/pkg v0.0.0-20240610120318-15e6cdf2f386
# knative.dev/pkg v0.0.0-20240614135239-339c22b8218c
## explicit; go 1.21
knative.dev/pkg/apis
knative.dev/pkg/apis/duck
Expand Down

0 comments on commit 3f01299

Please sign in to comment.