mirror of https://github.com/knative/client.git
Upgrade deprecated v1alpha1 DomainMapping API to newer one (#1856)
Signed-off-by: pingjiang <xiangpingjiang1998@gmail.com>
This commit is contained in:
parent
9676e46c63
commit
494fe87a78
8
go.mod
8
go.mod
|
|
@ -23,9 +23,9 @@ require (
|
|||
knative.dev/client-pkg v0.0.0-20230809014238-38d2dc0dd50a
|
||||
knative.dev/eventing v0.38.1-0.20230815095940-29ac3eee64a4
|
||||
knative.dev/hack v0.0.0-20230815012940-044c02b7a447
|
||||
knative.dev/networking v0.0.0-20230815014240-ed0534b4ef83
|
||||
knative.dev/pkg v0.0.0-20230815012542-6519affc772b
|
||||
knative.dev/serving v0.38.1-0.20230815122740-5e20e1e82550
|
||||
knative.dev/networking v0.0.0-20230817140742-4bfcc9fb6012
|
||||
knative.dev/pkg v0.0.0-20230815132840-4f651e092853
|
||||
knative.dev/serving v0.38.1-0.20230818202718-e9425f8d5260
|
||||
sigs.k8s.io/yaml v1.3.0
|
||||
)
|
||||
|
||||
|
|
@ -111,7 +111,7 @@ require (
|
|||
golang.org/x/text v0.12.0 // indirect
|
||||
golang.org/x/time v0.3.0 // indirect
|
||||
golang.org/x/tools v0.12.0 // indirect
|
||||
gomodules.xyz/jsonpatch/v2 v2.2.0 // indirect
|
||||
gomodules.xyz/jsonpatch/v2 v2.3.0 // indirect
|
||||
google.golang.org/api v0.136.0 // indirect
|
||||
google.golang.org/appengine v1.6.7 // indirect
|
||||
google.golang.org/genproto v0.0.0-20230803162519-f966b187b2e5 // indirect
|
||||
|
|
|
|||
17
go.sum
17
go.sum
|
|
@ -95,7 +95,6 @@ github.com/envoyproxy/go-control-plane v0.9.7/go.mod h1:cwu0lG7PUMfa9snN8LXBig5y
|
|||
github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk=
|
||||
github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.mod h1:hliV/p42l8fGbc6Y9bQ70uLwIvmJyVE5k4iMKlh8wCQ=
|
||||
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
|
||||
github.com/evanphx/json-patch v0.5.2/go.mod h1:ZWS5hhDbVDyob71nXKNL0+PWn6ToqBHMikGIFbs31qQ=
|
||||
github.com/evanphx/json-patch v5.6.0+incompatible h1:jBYDEEiFBPxA0v50tFdvOzQQTCvpL6mnFh5mB2/l16U=
|
||||
github.com/evanphx/json-patch v5.6.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk=
|
||||
github.com/evanphx/json-patch/v5 v5.6.0 h1:b91NhWfaz02IuVxO9faSllyAtNXHMPkC5J8sJCLunww=
|
||||
|
|
@ -666,8 +665,8 @@ golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8T
|
|||
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
gomodules.xyz/jsonpatch/v2 v2.2.0 h1:4pT439QV83L+G9FkcCriY6EkpcK6r6bK+A5FBUMI7qY=
|
||||
gomodules.xyz/jsonpatch/v2 v2.2.0/go.mod h1:WXp+iVDkoLQqPudfQ9GBlwB2eZ5DKOnjQZCYdOS8GPY=
|
||||
gomodules.xyz/jsonpatch/v2 v2.3.0 h1:8NFhfS6gzxNqjLIYnZxg319wZ5Qjnx4m/CcX+Klzazc=
|
||||
gomodules.xyz/jsonpatch/v2 v2.3.0/go.mod h1:AH3dM2RI6uoBZxn3LVrfvJ3E0/9dG4cSrbuBJT4moAY=
|
||||
google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE=
|
||||
google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M=
|
||||
google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg=
|
||||
|
|
@ -842,12 +841,12 @@ knative.dev/eventing v0.38.1-0.20230815095940-29ac3eee64a4 h1:619xUZrwrv3xuterMg
|
|||
knative.dev/eventing v0.38.1-0.20230815095940-29ac3eee64a4/go.mod h1:InEIckt+XICxXXYy2P4kqEJ4nMDXqI1iCUZ84vGDRbM=
|
||||
knative.dev/hack v0.0.0-20230815012940-044c02b7a447 h1:Lr4O/WEyZHuUBFbqATYdQlfLXvhPUCluF4zlgRi59T4=
|
||||
knative.dev/hack v0.0.0-20230815012940-044c02b7a447/go.mod h1:yk2OjGDsbEnQjfxdm0/HJKS2WqTLEFg/N6nUs6Rqx3Q=
|
||||
knative.dev/networking v0.0.0-20230815014240-ed0534b4ef83 h1:F1tP5OIXfk2YX/0KE+8DyuFw8bNrWzQSWXRba6k/aVQ=
|
||||
knative.dev/networking v0.0.0-20230815014240-ed0534b4ef83/go.mod h1:Ao0oO/s5ARZP2jllEoGWbLgpCb2nI4OCUutylpSyxpw=
|
||||
knative.dev/pkg v0.0.0-20230815012542-6519affc772b h1:Gr7PGAgYAMvihhoF7fskqRLmqX/Mt+/su2t81KFpgRc=
|
||||
knative.dev/pkg v0.0.0-20230815012542-6519affc772b/go.mod h1:D9D8LkOtlJBC09i+6nbTdZ5LAKsAbTJkkGGXEh2BPYI=
|
||||
knative.dev/serving v0.38.1-0.20230815122740-5e20e1e82550 h1:0+LkICVjcTWTUWvhPddxhmvxttwpBdGx92msRoTQ1pM=
|
||||
knative.dev/serving v0.38.1-0.20230815122740-5e20e1e82550/go.mod h1:XNvj91QrfYWMMLSVo42q6P4X6XtNeOUKIEM5dwMjgGA=
|
||||
knative.dev/networking v0.0.0-20230817140742-4bfcc9fb6012 h1:eaeZPgJzsJMnJaekbG8TYAfF/PUX8Xmdb8Oqnb+QO1k=
|
||||
knative.dev/networking v0.0.0-20230817140742-4bfcc9fb6012/go.mod h1:iGxfnvUJ3gGqtKnoOXhLzNCZeGxVnH4xdClYuh5vB4o=
|
||||
knative.dev/pkg v0.0.0-20230815132840-4f651e092853 h1:OyAYpXLa/jQWClFxRegCccGySyX2/1BVRtKaAWRE/xM=
|
||||
knative.dev/pkg v0.0.0-20230815132840-4f651e092853/go.mod h1:Y5Tis5nMoapB9iTZywW20Qnv/7LBahrtHz9Sm6+l3LE=
|
||||
knative.dev/serving v0.38.1-0.20230818202718-e9425f8d5260 h1:3lhCzzCQp+KHS5Ms+9YUw64iiZy0VSxWTmXNXdY4cZE=
|
||||
knative.dev/serving v0.38.1-0.20230818202718-e9425f8d5260/go.mod h1:NV6PfPFIjLoDdm9sgo1ccvWG6owBZeQld/bNxWt/8D0=
|
||||
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=
|
||||
|
|
|
|||
|
|
@ -223,7 +223,7 @@ func completeDomain(config *completionConfig) (suggestions []string) {
|
|||
if err != nil {
|
||||
return
|
||||
}
|
||||
client, err := config.params.NewServingV1alpha1Client(namespace)
|
||||
client, err := config.params.NewServingV1beta1Client(namespace)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ import (
|
|||
"k8s.io/client-go/tools/clientcmd"
|
||||
clienteventingv1beta2 "knative.dev/client/pkg/eventing/v1beta2"
|
||||
v1beta1 "knative.dev/client/pkg/messaging/v1"
|
||||
clientv1alpha1 "knative.dev/client/pkg/serving/v1alpha1"
|
||||
clientv1beta1 "knative.dev/client/pkg/serving/v1beta1"
|
||||
clientsourcesv1 "knative.dev/client/pkg/sources/v1"
|
||||
"knative.dev/client/pkg/sources/v1beta2"
|
||||
eventingv1beta2 "knative.dev/eventing/pkg/apis/eventing/v1beta2"
|
||||
|
|
@ -47,9 +47,9 @@ import (
|
|||
"knative.dev/eventing/pkg/client/clientset/versioned/typed/eventing/v1/fake"
|
||||
beta2fake "knative.dev/eventing/pkg/client/clientset/versioned/typed/eventing/v1beta2/fake"
|
||||
servingv1 "knative.dev/serving/pkg/apis/serving/v1"
|
||||
"knative.dev/serving/pkg/apis/serving/v1alpha1"
|
||||
servingv1beta1 "knative.dev/serving/pkg/apis/serving/v1beta1"
|
||||
servingv1fake "knative.dev/serving/pkg/client/clientset/versioned/typed/serving/v1/fake"
|
||||
servingv1alpha1fake "knative.dev/serving/pkg/client/clientset/versioned/typed/serving/v1alpha1/fake"
|
||||
servingv1beta1fake "knative.dev/serving/pkg/client/clientset/versioned/typed/serving/v1beta1/fake"
|
||||
)
|
||||
|
||||
type testType struct {
|
||||
|
|
@ -104,7 +104,7 @@ var (
|
|||
testNsServices = []servingv1.Service{testSvc1, testSvc2, testSvc3}
|
||||
|
||||
fakeServing = &servingv1fake.FakeServingV1{Fake: &clienttesting.Fake{}}
|
||||
fakeServingAlpha = &servingv1alpha1fake.FakeServingV1alpha1{Fake: &clienttesting.Fake{}}
|
||||
fakeServingAlpha = &servingv1beta1fake.FakeServingV1beta1{Fake: &clienttesting.Fake{}}
|
||||
)
|
||||
|
||||
var (
|
||||
|
|
@ -185,28 +185,28 @@ var (
|
|||
)
|
||||
|
||||
var (
|
||||
testDomain1 = v1alpha1.DomainMapping{
|
||||
testDomain1 = servingv1beta1.DomainMapping{
|
||||
TypeMeta: metav1.TypeMeta{
|
||||
Kind: "DomainMapping",
|
||||
APIVersion: "serving.knative.dev/v1alpha1",
|
||||
APIVersion: "serving.knative.dev/v1beta1",
|
||||
},
|
||||
ObjectMeta: metav1.ObjectMeta{Name: "test-domain-1", Namespace: testNs},
|
||||
}
|
||||
testDomain2 = v1alpha1.DomainMapping{
|
||||
testDomain2 = servingv1beta1.DomainMapping{
|
||||
TypeMeta: metav1.TypeMeta{
|
||||
Kind: "DomainMapping",
|
||||
APIVersion: "serving.knative.dev/v1alpha1",
|
||||
APIVersion: "serving.knative.dev/v1beta1",
|
||||
},
|
||||
ObjectMeta: metav1.ObjectMeta{Name: "test-domain-2", Namespace: testNs},
|
||||
}
|
||||
testDomain3 = v1alpha1.DomainMapping{
|
||||
testDomain3 = servingv1beta1.DomainMapping{
|
||||
TypeMeta: metav1.TypeMeta{
|
||||
Kind: "DomainMapping",
|
||||
APIVersion: "serving.knative.dev/v1alpha1",
|
||||
APIVersion: "serving.knative.dev/v1beta1",
|
||||
},
|
||||
ObjectMeta: metav1.ObjectMeta{Name: "test-domain-3", Namespace: testNs},
|
||||
}
|
||||
testNsDomains = []v1alpha1.DomainMapping{testDomain1, testDomain2, testDomain3}
|
||||
testNsDomains = []servingv1beta1.DomainMapping{testDomain1, testDomain2, testDomain3}
|
||||
)
|
||||
|
||||
var (
|
||||
|
|
@ -443,8 +443,8 @@ current-context: x
|
|||
NewEventingClient: func(namespace string) (clienteventingv1.KnEventingClient, error) {
|
||||
return clienteventingv1.NewKnEventingClient(fakeEventing, namespace), nil
|
||||
},
|
||||
NewServingV1alpha1Client: func(namespace string) (clientv1alpha1.KnServingClient, error) {
|
||||
return clientv1alpha1.NewKnServingClient(fakeServingAlpha, namespace), nil
|
||||
NewServingV1beta1Client: func(namespace string) (clientv1beta1.KnServingClient, error) {
|
||||
return clientv1beta1.NewKnServingClient(fakeServingAlpha, namespace), nil
|
||||
},
|
||||
NewSourcesClient: func(namespace string) (clientsourcesv1.KnSourcesClient, error) {
|
||||
return clientsourcesv1.NewKnSourcesClient(fakeSources, namespace), nil
|
||||
|
|
@ -864,7 +864,7 @@ func TestResourceNameCompletionFuncDomain(t *testing.T) {
|
|||
if a.GetNamespace() == errorNs {
|
||||
return true, nil, errors.NewInternalError(fmt.Errorf("unable to list domains"))
|
||||
}
|
||||
return true, &v1alpha1.DomainMappingList{Items: testNsDomains}, nil
|
||||
return true, &servingv1beta1.DomainMappingList{Items: testNsDomains}, nil
|
||||
})
|
||||
|
||||
tests := []testType{
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ import (
|
|||
"k8s.io/apimachinery/pkg/util/validation"
|
||||
knerrors "knative.dev/client/pkg/errors"
|
||||
"knative.dev/client/pkg/kn/commands"
|
||||
clientv1alpha1 "knative.dev/client/pkg/serving/v1alpha1"
|
||||
clientv1beta1 "knative.dev/client/pkg/serving/v1beta1"
|
||||
)
|
||||
|
||||
// NewDomainMappingCreateCommand to create event channels
|
||||
|
|
@ -58,12 +58,12 @@ func NewDomainMappingCreateCommand(p *commands.KnParams) *cobra.Command {
|
|||
if refFlags.tls != "" && len(errs) != 0 {
|
||||
return fmt.Errorf("invalid secret name %q: %s", refFlags.tls, errs[0])
|
||||
}
|
||||
builder := clientv1alpha1.NewDomainMappingBuilder(name).
|
||||
builder := clientv1beta1.NewDomainMappingBuilder(name).
|
||||
Namespace(namespace).
|
||||
Reference(*reference).
|
||||
TLS(refFlags.tls)
|
||||
|
||||
client, err := p.NewServingV1alpha1Client(namespace)
|
||||
client, err := p.NewServingV1beta1Client(namespace)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,12 +20,12 @@ import (
|
|||
"gotest.tools/v3/assert"
|
||||
|
||||
dynamicfake "knative.dev/client/pkg/dynamic/fake"
|
||||
"knative.dev/client/pkg/serving/v1alpha1"
|
||||
"knative.dev/client/pkg/serving/v1beta1"
|
||||
"knative.dev/client/pkg/util"
|
||||
)
|
||||
|
||||
func TestDomainMappingCreate(t *testing.T) {
|
||||
client := v1alpha1.NewMockKnServiceClient(t)
|
||||
client := v1beta1.NewMockKnServiceClient(t)
|
||||
dynamicClient := dynamicfake.CreateFakeKnDynamicClient(client.Namespace(), createService("foo"))
|
||||
|
||||
servingRecorder := client.Recorder()
|
||||
|
|
@ -46,7 +46,7 @@ func TestDomainMappingCreate(t *testing.T) {
|
|||
servingRecorder.Validate()
|
||||
}
|
||||
func TestDomainMappingCreateWithError(t *testing.T) {
|
||||
client := v1alpha1.NewMockKnServiceClient(t)
|
||||
client := v1beta1.NewMockKnServiceClient(t)
|
||||
dynamicClient := dynamicfake.CreateFakeKnDynamicClient(client.Namespace(), createService("foo"))
|
||||
|
||||
// No call should be recorded
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ func NewDomainMappingDeleteCommand(p *commands.KnParams) *cobra.Command {
|
|||
return err
|
||||
}
|
||||
|
||||
client, err := p.NewServingV1alpha1Client(namespace)
|
||||
client, err := p.NewServingV1beta1Client(namespace)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,12 +21,12 @@ import (
|
|||
"gotest.tools/v3/assert"
|
||||
|
||||
dynamicfake "knative.dev/client/pkg/dynamic/fake"
|
||||
"knative.dev/client/pkg/serving/v1alpha1"
|
||||
"knative.dev/client/pkg/serving/v1beta1"
|
||||
"knative.dev/client/pkg/util"
|
||||
)
|
||||
|
||||
func TestDomainMappingDelete(t *testing.T) {
|
||||
client := v1alpha1.NewMockKnServiceClient(t)
|
||||
client := v1beta1.NewMockKnServiceClient(t)
|
||||
|
||||
servingRecorder := client.Recorder()
|
||||
servingRecorder.DeleteDomainMapping("foo.bar", nil)
|
||||
|
|
@ -39,7 +39,7 @@ func TestDomainMappingDelete(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestDomainMappingDeleteNotFound(t *testing.T) {
|
||||
client := v1alpha1.NewMockKnServiceClient(t)
|
||||
client := v1beta1.NewMockKnServiceClient(t)
|
||||
|
||||
servingRecorder := client.Recorder()
|
||||
servingRecorder.DeleteDomainMapping("foo.bar", errors.New("domainmappings.serving.knative.dev \"foo.bar\" not found"))
|
||||
|
|
@ -52,7 +52,7 @@ func TestDomainMappingDeleteNotFound(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestDomainMappingDeleteWithError(t *testing.T) {
|
||||
client := v1alpha1.NewMockKnServiceClient(t)
|
||||
client := v1beta1.NewMockKnServiceClient(t)
|
||||
dynamicClient := dynamicfake.CreateFakeKnDynamicClient(client.Namespace(), createService("foo"))
|
||||
|
||||
// No call should be recorded
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ import (
|
|||
|
||||
"knative.dev/client/pkg/kn/commands"
|
||||
"knative.dev/client/pkg/printers"
|
||||
"knative.dev/serving/pkg/apis/serving/v1alpha1"
|
||||
"knative.dev/serving/pkg/apis/serving/v1beta1"
|
||||
)
|
||||
|
||||
// NewDomainMappingDescribeCommand represents 'kn route describe' command
|
||||
|
|
@ -48,7 +48,7 @@ func NewDomainMappingDescribeCommand(p *commands.KnParams) *cobra.Command {
|
|||
return err
|
||||
}
|
||||
|
||||
client, err := p.NewServingV1alpha1Client(namespace)
|
||||
client, err := p.NewServingV1beta1Client(namespace)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
@ -84,7 +84,7 @@ func NewDomainMappingDescribeCommand(p *commands.KnParams) *cobra.Command {
|
|||
return cmd
|
||||
}
|
||||
|
||||
func describe(w io.Writer, domainMapping *v1alpha1.DomainMapping, printDetails bool) error {
|
||||
func describe(w io.Writer, domainMapping *v1beta1.DomainMapping, printDetails bool) error {
|
||||
dw := printers.NewPrefixWriter(w)
|
||||
commands.WriteMetadata(dw, &domainMapping.ObjectMeta, printDetails)
|
||||
dw.WriteLine()
|
||||
|
|
|
|||
|
|
@ -24,15 +24,15 @@ import (
|
|||
"gotest.tools/v3/assert"
|
||||
"gotest.tools/v3/assert/cmp"
|
||||
|
||||
"knative.dev/client/pkg/serving/v1alpha1"
|
||||
"knative.dev/client/pkg/serving/v1beta1"
|
||||
"knative.dev/client/pkg/util"
|
||||
"knative.dev/pkg/apis"
|
||||
duckv1 "knative.dev/pkg/apis/duck/v1"
|
||||
servingv1alpha1 "knative.dev/serving/pkg/apis/serving/v1alpha1"
|
||||
servingv1beta1 "knative.dev/serving/pkg/apis/serving/v1beta1"
|
||||
)
|
||||
|
||||
func TestDomainMappingDescribe(t *testing.T) {
|
||||
client := v1alpha1.NewMockKnServiceClient(t)
|
||||
client := v1beta1.NewMockKnServiceClient(t)
|
||||
|
||||
servingRecorder := client.Recorder()
|
||||
servingRecorder.GetDomainMapping("foo.bar", getDomainMapping(), nil)
|
||||
|
|
@ -60,7 +60,7 @@ func TestDomainMappingDescribe(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestDomainMappingDescribeDiffNamespace(t *testing.T) {
|
||||
client := v1alpha1.NewMockKnServiceClient(t)
|
||||
client := v1beta1.NewMockKnServiceClient(t)
|
||||
|
||||
servingRecorder := client.Recorder()
|
||||
servingRecorder.GetDomainMapping("foo.bar", getDomainMapping("otherNS"), nil)
|
||||
|
|
@ -80,7 +80,7 @@ func TestDomainMappingDescribeDiffNamespace(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestDomainMappingDescribeError(t *testing.T) {
|
||||
client := v1alpha1.NewMockKnServiceClient(t)
|
||||
client := v1beta1.NewMockKnServiceClient(t)
|
||||
|
||||
servingRecorder := client.Recorder()
|
||||
servingRecorder.GetDomainMapping("foo.bar", getDomainMapping(), errors.New("domainmappings.serving.knative.dev 'foo.bar' not found"))
|
||||
|
|
@ -92,7 +92,7 @@ func TestDomainMappingDescribeError(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestDomainMappingDescribeNameError(t *testing.T) {
|
||||
client := v1alpha1.NewMockKnServiceClient(t)
|
||||
client := v1beta1.NewMockKnServiceClient(t)
|
||||
|
||||
servingRecorder := client.Recorder()
|
||||
|
||||
|
|
@ -110,7 +110,7 @@ func TestDomainMappingDescribeNameError(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestDomainMappingDescribeURL(t *testing.T) {
|
||||
client := v1alpha1.NewMockKnServiceClient(t)
|
||||
client := v1beta1.NewMockKnServiceClient(t)
|
||||
|
||||
servingRecorder := client.Recorder()
|
||||
servingRecorder.GetDomainMapping("foo.bar", getDomainMapping(), nil)
|
||||
|
|
@ -123,7 +123,7 @@ func TestDomainMappingDescribeURL(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestDomainMappingDescribeYAML(t *testing.T) {
|
||||
client := v1alpha1.NewMockKnServiceClient(t)
|
||||
client := v1beta1.NewMockKnServiceClient(t)
|
||||
|
||||
servingRecorder := client.Recorder()
|
||||
servingRecorder.GetDomainMapping("foo.bar", getDomainMapping(), nil)
|
||||
|
|
@ -135,7 +135,7 @@ func TestDomainMappingDescribeYAML(t *testing.T) {
|
|||
servingRecorder.Validate()
|
||||
}
|
||||
|
||||
func getDomainMapping(ns ...string) *servingv1alpha1.DomainMapping {
|
||||
func getDomainMapping(ns ...string) *servingv1beta1.DomainMapping {
|
||||
serviceNamespace := "default"
|
||||
if len(ns) == 1 {
|
||||
serviceNamespace = ns[0]
|
||||
|
|
@ -143,9 +143,9 @@ func getDomainMapping(ns ...string) *servingv1alpha1.DomainMapping {
|
|||
dm := createDomainMapping("foo.bar", createServiceRef("foo", serviceNamespace), "")
|
||||
dm.TypeMeta = v1.TypeMeta{
|
||||
Kind: "DomainMapping",
|
||||
APIVersion: servingv1alpha1.SchemeGroupVersion.String(),
|
||||
APIVersion: servingv1beta1.SchemeGroupVersion.String(),
|
||||
}
|
||||
dm.Status = servingv1alpha1.DomainMappingStatus{
|
||||
dm.Status = servingv1beta1.DomainMappingStatus{
|
||||
Status: duckv1.Status{
|
||||
Conditions: duckv1.Conditions{
|
||||
apis.Condition{
|
||||
|
|
|
|||
|
|
@ -30,10 +30,10 @@ import (
|
|||
dynamicfake "knative.dev/client/pkg/dynamic/fake"
|
||||
"knative.dev/client/pkg/kn/commands"
|
||||
knflags "knative.dev/client/pkg/kn/flags"
|
||||
clientservingv1alpha1 "knative.dev/client/pkg/serving/v1alpha1"
|
||||
clientservingv1beta1 "knative.dev/client/pkg/serving/v1beta1"
|
||||
duckv1 "knative.dev/pkg/apis/duck/v1"
|
||||
servingv1 "knative.dev/serving/pkg/apis/serving/v1"
|
||||
servingv1alpha1 "knative.dev/serving/pkg/apis/serving/v1alpha1"
|
||||
servingv1beta1 "knative.dev/serving/pkg/apis/serving/v1beta1"
|
||||
)
|
||||
|
||||
// Helper methods
|
||||
|
|
@ -148,13 +148,13 @@ func TestRefFlagAdd(t *testing.T) {
|
|||
assert.Equal(t, "ref", c.Flag("ref").Name)
|
||||
}
|
||||
|
||||
func executeDomainCommand(client clientservingv1alpha1.KnServingClient, dynamicClient kndynamic.KnDynamicClient, args ...string) (string, error) {
|
||||
func executeDomainCommand(client clientservingv1beta1.KnServingClient, dynamicClient kndynamic.KnDynamicClient, args ...string) (string, error) {
|
||||
knParams := &commands.KnParams{}
|
||||
knParams.ClientConfig = blankConfig
|
||||
|
||||
output := new(bytes.Buffer)
|
||||
knParams.Output = output
|
||||
knParams.NewServingV1alpha1Client = func(namespace string) (clientservingv1alpha1.KnServingClient, error) {
|
||||
knParams.NewServingV1beta1Client = func(namespace string) (clientservingv1beta1.KnServingClient, error) {
|
||||
return client, nil
|
||||
}
|
||||
knParams.NewDynamicClient = func(namespace string) (kndynamic.KnDynamicClient, error) {
|
||||
|
|
@ -178,8 +178,8 @@ func createService(name string) *servingv1.Service {
|
|||
}
|
||||
}
|
||||
|
||||
func createDomainMapping(name string, ref duckv1.KReference, tls string) *servingv1alpha1.DomainMapping {
|
||||
return clientservingv1alpha1.NewDomainMappingBuilder(name).Namespace("default").Reference(ref).TLS(tls).Build()
|
||||
func createDomainMapping(name string, ref duckv1.KReference, tls string) *servingv1beta1.DomainMapping {
|
||||
return clientservingv1beta1.NewDomainMappingBuilder(name).Namespace("default").Reference(ref).TLS(tls).Build()
|
||||
}
|
||||
|
||||
func createServiceRef(service, namespace string) duckv1.KReference {
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ package domain
|
|||
import (
|
||||
metav1beta1 "k8s.io/apimachinery/pkg/apis/meta/v1beta1"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"knative.dev/serving/pkg/apis/serving/v1alpha1"
|
||||
"knative.dev/serving/pkg/apis/serving/v1beta1"
|
||||
|
||||
"knative.dev/client/pkg/kn/commands"
|
||||
hprinters "knative.dev/client/pkg/printers"
|
||||
|
|
@ -37,7 +37,7 @@ func DomainMappingListHandlers(h hprinters.PrintHandler) {
|
|||
}
|
||||
|
||||
// printDomainMappingList populates the Knative domain mapping list table rows
|
||||
func printDomainMappingList(domainMappingList *v1alpha1.DomainMappingList, options hprinters.PrintOptions) ([]metav1beta1.TableRow, error) {
|
||||
func printDomainMappingList(domainMappingList *v1beta1.DomainMappingList, options hprinters.PrintOptions) ([]metav1beta1.TableRow, error) {
|
||||
rows := make([]metav1beta1.TableRow, 0, len(domainMappingList.Items))
|
||||
for i := range domainMappingList.Items {
|
||||
dm := &domainMappingList.Items[i]
|
||||
|
|
@ -51,7 +51,7 @@ func printDomainMappingList(domainMappingList *v1alpha1.DomainMappingList, optio
|
|||
}
|
||||
|
||||
// printDomainMapping populates the Knative domain mapping table rows
|
||||
func printDomainMapping(domainMapping *v1alpha1.DomainMapping, options hprinters.PrintOptions) ([]metav1beta1.TableRow, error) {
|
||||
func printDomainMapping(domainMapping *v1beta1.DomainMapping, options hprinters.PrintOptions) ([]metav1beta1.TableRow, error) {
|
||||
name := domainMapping.Name
|
||||
url := domainMapping.Status.URL
|
||||
ready := commands.ReadyCondition(domainMapping.Status.Conditions)
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ func NewDomainMappingListCommand(p *commands.KnParams) *cobra.Command {
|
|||
listFlags.EnsureWithNamespace()
|
||||
}
|
||||
|
||||
client, err := p.NewServingV1alpha1Client(namespace)
|
||||
client, err := p.NewServingV1beta1Client(namespace)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,19 +20,19 @@ import (
|
|||
|
||||
"gotest.tools/v3/assert"
|
||||
|
||||
"knative.dev/client/pkg/serving/v1alpha1"
|
||||
"knative.dev/client/pkg/serving/v1beta1"
|
||||
"knative.dev/client/pkg/util"
|
||||
servingv1alpha1 "knative.dev/serving/pkg/apis/serving/v1alpha1"
|
||||
servingv1beta1 "knative.dev/serving/pkg/apis/serving/v1beta1"
|
||||
"knative.dev/serving/pkg/client/clientset/versioned/scheme"
|
||||
)
|
||||
|
||||
func TestDomainMappingList(t *testing.T) {
|
||||
client := v1alpha1.NewMockKnServiceClient(t)
|
||||
client := v1beta1.NewMockKnServiceClient(t)
|
||||
|
||||
dm1 := createDomainMapping("foo1", createServiceRef("foo1", "default"), "")
|
||||
dm2 := createDomainMapping("foo2", createServiceRef("foo2", "default"), "")
|
||||
servingRecorder := client.Recorder()
|
||||
servingRecorder.ListDomainMappings(&servingv1alpha1.DomainMappingList{Items: []servingv1alpha1.DomainMapping{*dm1, *dm2}}, nil)
|
||||
servingRecorder.ListDomainMappings(&servingv1beta1.DomainMappingList{Items: []servingv1beta1.DomainMapping{*dm1, *dm2}}, nil)
|
||||
|
||||
out, err := executeDomainCommand(client, nil, "list")
|
||||
assert.NilError(t, err, "Domain mapping should be listed")
|
||||
|
|
@ -46,10 +46,10 @@ func TestDomainMappingList(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestDomainMappingListEmpty(t *testing.T) {
|
||||
client := v1alpha1.NewMockKnServiceClient(t)
|
||||
client := v1beta1.NewMockKnServiceClient(t)
|
||||
|
||||
servingRecorder := client.Recorder()
|
||||
servingRecorder.ListDomainMappings(&servingv1alpha1.DomainMappingList{}, nil)
|
||||
servingRecorder.ListDomainMappings(&servingv1beta1.DomainMappingList{}, nil)
|
||||
|
||||
out, err := executeDomainCommand(client, nil, "list")
|
||||
assert.NilError(t, err)
|
||||
|
|
@ -59,16 +59,16 @@ func TestDomainMappingListEmpty(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestChannelListEmptyWithOutputSet(t *testing.T) {
|
||||
client := v1alpha1.NewMockKnServiceClient(t)
|
||||
client := v1beta1.NewMockKnServiceClient(t)
|
||||
|
||||
servingRecorder := client.Recorder()
|
||||
domainMappingList := &servingv1alpha1.DomainMappingList{}
|
||||
err := util.UpdateGroupVersionKindWithScheme(domainMappingList, servingv1alpha1.SchemeGroupVersion, scheme.Scheme)
|
||||
domainMappingList := &servingv1beta1.DomainMappingList{}
|
||||
err := util.UpdateGroupVersionKindWithScheme(domainMappingList, servingv1beta1.SchemeGroupVersion, scheme.Scheme)
|
||||
assert.NilError(t, err)
|
||||
servingRecorder.ListDomainMappings(domainMappingList, nil)
|
||||
|
||||
out, err := executeDomainCommand(client, nil, "list", "-o", "json")
|
||||
assert.NilError(t, err)
|
||||
assert.Check(t, util.ContainsAll(out, "\"apiVersion\": \""+servingv1alpha1.SchemeGroupVersion.String()+"\"", "\"kind\": \"DomainMappingList\"", "\"items\": []"))
|
||||
assert.Check(t, util.ContainsAll(out, "\"apiVersion\": \""+servingv1beta1.SchemeGroupVersion.String()+"\"", "\"kind\": \"DomainMappingList\"", "\"items\": []"))
|
||||
servingRecorder.Validate()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ import (
|
|||
"fmt"
|
||||
|
||||
"knative.dev/client/pkg/config"
|
||||
"knative.dev/serving/pkg/apis/serving/v1alpha1"
|
||||
"knative.dev/serving/pkg/apis/serving/v1beta1"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
|
|
@ -47,12 +47,12 @@ func NewDomainMappingUpdateCommand(p *commands.KnParams) *cobra.Command {
|
|||
return err
|
||||
}
|
||||
|
||||
client, err := p.NewServingV1alpha1Client(namespace)
|
||||
client, err := p.NewServingV1beta1Client(namespace)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
updateFunc := func(toUpdate *v1alpha1.DomainMapping) (*v1alpha1.DomainMapping, error) {
|
||||
updateFunc := func(toUpdate *v1beta1.DomainMapping) (*v1beta1.DomainMapping, error) {
|
||||
if toUpdate.GetDeletionTimestamp() != nil {
|
||||
return nil, fmt.Errorf("can't update domain mapping '%s' because it has been marked for deletion", name)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,12 +24,12 @@ import (
|
|||
"gotest.tools/v3/assert"
|
||||
|
||||
dynamicfake "knative.dev/client/pkg/dynamic/fake"
|
||||
"knative.dev/client/pkg/serving/v1alpha1"
|
||||
"knative.dev/client/pkg/serving/v1beta1"
|
||||
"knative.dev/client/pkg/util"
|
||||
)
|
||||
|
||||
func TestDomainMappingUpdate(t *testing.T) {
|
||||
client := v1alpha1.NewMockKnServiceClient(t)
|
||||
client := v1beta1.NewMockKnServiceClient(t)
|
||||
dynamicClient := dynamicfake.CreateFakeKnDynamicClient(client.Namespace(), createService("foo"), createService("bar"))
|
||||
|
||||
servingRecorder := client.Recorder()
|
||||
|
|
@ -44,7 +44,7 @@ func TestDomainMappingUpdate(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestDomainMappingUpdateNotFound(t *testing.T) {
|
||||
client := v1alpha1.NewMockKnServiceClient(t)
|
||||
client := v1beta1.NewMockKnServiceClient(t)
|
||||
|
||||
servingRecorder := client.Recorder()
|
||||
servingRecorder.GetDomainMapping("foo.bar", nil, errors.New("domainmappings.serving.knative.dev \"foo.bar\" not found"))
|
||||
|
|
@ -57,7 +57,7 @@ func TestDomainMappingUpdateNotFound(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestDomainMappingUpdateDeletingError(t *testing.T) {
|
||||
client := v1alpha1.NewMockKnServiceClient(t)
|
||||
client := v1beta1.NewMockKnServiceClient(t)
|
||||
|
||||
deletingDM := createDomainMapping("foo.bar", createServiceRef("foo", "default"), "")
|
||||
deletingDM.DeletionTimestamp = &v1.Time{Time: time.Now()}
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ import (
|
|||
sourcesv1client "knative.dev/eventing/pkg/client/clientset/versioned/typed/sources/v1"
|
||||
sourcesv1beta2client "knative.dev/eventing/pkg/client/clientset/versioned/typed/sources/v1beta2"
|
||||
servingv1client "knative.dev/serving/pkg/client/clientset/versioned/typed/serving/v1"
|
||||
servingv1alpha1client "knative.dev/serving/pkg/client/clientset/versioned/typed/serving/v1alpha1"
|
||||
servingv1beta1client "knative.dev/serving/pkg/client/clientset/versioned/typed/serving/v1beta1"
|
||||
|
||||
"knative.dev/client/pkg/util"
|
||||
|
||||
|
|
@ -41,7 +41,7 @@ import (
|
|||
clienteventingv1beta2 "knative.dev/client/pkg/eventing/v1beta2"
|
||||
clientmessagingv1 "knative.dev/client/pkg/messaging/v1"
|
||||
clientservingv1 "knative.dev/client/pkg/serving/v1"
|
||||
clientservingv1alpha1 "knative.dev/client/pkg/serving/v1alpha1"
|
||||
clientservingv1beta1 "knative.dev/client/pkg/serving/v1beta1"
|
||||
clientsourcesv1 "knative.dev/client/pkg/sources/v1"
|
||||
clientsourcesv1beta2 "knative.dev/client/pkg/sources/v1beta2"
|
||||
)
|
||||
|
|
@ -58,7 +58,7 @@ type KnParams struct {
|
|||
ClientConfig clientcmd.ClientConfig
|
||||
NewKubeClient func() (kubernetes.Interface, error)
|
||||
NewServingClient func(namespace string) (clientservingv1.KnServingClient, error)
|
||||
NewServingV1alpha1Client func(namespace string) (clientservingv1alpha1.KnServingClient, error)
|
||||
NewServingV1beta1Client func(namespace string) (clientservingv1beta1.KnServingClient, error)
|
||||
NewGitopsServingClient func(namespace string, dir string) (clientservingv1.KnServingClient, error)
|
||||
NewSourcesClient func(namespace string) (clientsourcesv1.KnSourcesClient, error)
|
||||
NewSourcesV1beta2Client func(namespace string) (clientsourcesv1beta2.KnSourcesClient, error)
|
||||
|
|
@ -83,8 +83,8 @@ func (params *KnParams) Initialize() {
|
|||
params.NewServingClient = params.newServingClient
|
||||
}
|
||||
|
||||
if params.NewServingV1alpha1Client == nil {
|
||||
params.NewServingV1alpha1Client = params.newServingClientV1alpha1
|
||||
if params.NewServingV1beta1Client == nil {
|
||||
params.NewServingV1beta1Client = params.newServingClientV1beta1
|
||||
}
|
||||
|
||||
if params.NewGitopsServingClient == nil {
|
||||
|
|
@ -143,17 +143,17 @@ func (params *KnParams) newServingClient(namespace string) (clientservingv1.KnSe
|
|||
return clientservingv1.NewKnServingClient(client, namespace), nil
|
||||
}
|
||||
|
||||
func (params *KnParams) newServingClientV1alpha1(namespace string) (clientservingv1alpha1.KnServingClient, error) {
|
||||
func (params *KnParams) newServingClientV1beta1(namespace string) (clientservingv1beta1.KnServingClient, error) {
|
||||
restConfig, err := params.RestConfig()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
client, err := servingv1alpha1client.NewForConfig(restConfig)
|
||||
client, err := servingv1beta1client.NewForConfig(restConfig)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return clientservingv1alpha1.NewKnServingClient(client, namespace), nil
|
||||
return clientservingv1beta1.NewKnServingClient(client, namespace), nil
|
||||
}
|
||||
|
||||
func (params *KnParams) newGitopsServingClient(namespace string, dir string) (clientservingv1.KnServingClient, error) {
|
||||
|
|
|
|||
|
|
@ -353,7 +353,7 @@ func TestNewSourcesV1beta2Client(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func TestNewServingV1alpha1Clients(t *testing.T) {
|
||||
func TestNewServingV1beta1Clients(t *testing.T) {
|
||||
basic, err := clientcmd.NewClientConfigFromBytes([]byte(BASIC_KUBECONFIG))
|
||||
namespace := "test"
|
||||
if err != nil {
|
||||
|
|
@ -381,7 +381,7 @@ func TestNewServingV1alpha1Clients(t *testing.T) {
|
|||
LogHTTP: tc.logHttp,
|
||||
}
|
||||
|
||||
servingV1alpha1Client, err := p.newServingClientV1alpha1(namespace)
|
||||
servingV1beta1Client, err := p.newServingClientV1beta1(namespace)
|
||||
|
||||
switch len(tc.expectedErrString) {
|
||||
case 0:
|
||||
|
|
@ -397,8 +397,8 @@ func TestNewServingV1alpha1Clients(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
if servingV1alpha1Client != nil {
|
||||
assert.Assert(t, servingV1alpha1Client.Namespace() == namespace)
|
||||
if servingV1beta1Client != nil {
|
||||
assert.Assert(t, servingV1beta1Client.Namespace() == namespace)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -507,7 +507,7 @@ func TestInitialize(t *testing.T) {
|
|||
params := &KnParams{}
|
||||
params.Initialize()
|
||||
assert.Assert(t, params.NewServingClient != nil)
|
||||
assert.Assert(t, params.NewServingV1alpha1Client != nil)
|
||||
assert.Assert(t, params.NewServingV1beta1Client != nil)
|
||||
assert.Assert(t, params.NewGitopsServingClient != nil)
|
||||
assert.Assert(t, params.NewSourcesClient != nil)
|
||||
assert.Assert(t, params.NewEventingClient != nil)
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package v1alpha1
|
||||
package v1beta1
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
|
@ -28,26 +28,26 @@ import (
|
|||
"k8s.io/apimachinery/pkg/runtime"
|
||||
knerrors "knative.dev/client/pkg/errors"
|
||||
"knative.dev/client/pkg/util"
|
||||
servingv1alpha1 "knative.dev/serving/pkg/apis/serving/v1alpha1"
|
||||
servingv1beta1 "knative.dev/serving/pkg/apis/serving/v1beta1"
|
||||
"knative.dev/serving/pkg/client/clientset/versioned/scheme"
|
||||
clientv1alpha1 "knative.dev/serving/pkg/client/clientset/versioned/typed/serving/v1alpha1"
|
||||
clientv1beta1 "knative.dev/serving/pkg/client/clientset/versioned/typed/serving/v1beta1"
|
||||
)
|
||||
|
||||
type DomainUpdateFunc func(origDomain *servingv1alpha1.DomainMapping) (*servingv1alpha1.DomainMapping, error)
|
||||
type DomainUpdateFunc func(origDomain *servingv1beta1.DomainMapping) (*servingv1beta1.DomainMapping, error)
|
||||
|
||||
// KnServingClient to work with Serving v1alpha1 resources
|
||||
// KnServingClient to work with Serving v1beta1 resources
|
||||
type KnServingClient interface {
|
||||
// Namespace in which this client is operating for
|
||||
Namespace() string
|
||||
|
||||
// GetDomainMapping
|
||||
GetDomainMapping(ctx context.Context, name string) (*servingv1alpha1.DomainMapping, error)
|
||||
GetDomainMapping(ctx context.Context, name string) (*servingv1beta1.DomainMapping, error)
|
||||
|
||||
// CreateDomainMapping
|
||||
CreateDomainMapping(ctx context.Context, domainMapping *servingv1alpha1.DomainMapping) error
|
||||
CreateDomainMapping(ctx context.Context, domainMapping *servingv1beta1.DomainMapping) error
|
||||
|
||||
// UpdateDomainMapping
|
||||
UpdateDomainMapping(ctx context.Context, domainMapping *servingv1alpha1.DomainMapping) error
|
||||
UpdateDomainMapping(ctx context.Context, domainMapping *servingv1beta1.DomainMapping) error
|
||||
|
||||
// UpdateDomainMappingWithRetry
|
||||
UpdateDomainMappingWithRetry(ctx context.Context, name string, updateFunc DomainUpdateFunc, nrRetries int) error
|
||||
|
|
@ -56,16 +56,16 @@ type KnServingClient interface {
|
|||
DeleteDomainMapping(ctx context.Context, name string) error
|
||||
|
||||
// ListDomainMappings
|
||||
ListDomainMappings(ctx context.Context) (*servingv1alpha1.DomainMappingList, error)
|
||||
ListDomainMappings(ctx context.Context) (*servingv1beta1.DomainMappingList, error)
|
||||
}
|
||||
|
||||
type knServingClient struct {
|
||||
client clientv1alpha1.ServingV1alpha1Interface
|
||||
client clientv1beta1.ServingV1beta1Interface
|
||||
namespace string
|
||||
}
|
||||
|
||||
// NewKnServingClient create a new client facade for the provided namespace
|
||||
func NewKnServingClient(client clientv1alpha1.ServingV1alpha1Interface, namespace string) KnServingClient {
|
||||
func NewKnServingClient(client clientv1beta1.ServingV1beta1Interface, namespace string) KnServingClient {
|
||||
return &knServingClient{
|
||||
client: client,
|
||||
namespace: namespace,
|
||||
|
|
@ -78,7 +78,7 @@ func (cl *knServingClient) Namespace() string {
|
|||
}
|
||||
|
||||
// GetDomainMapping gets DomainMapping by name
|
||||
func (cl *knServingClient) GetDomainMapping(ctx context.Context, name string) (*servingv1alpha1.DomainMapping, error) {
|
||||
func (cl *knServingClient) GetDomainMapping(ctx context.Context, name string) (*servingv1beta1.DomainMapping, error) {
|
||||
dm, err := cl.client.DomainMappings(cl.namespace).Get(ctx, name, v1.GetOptions{})
|
||||
if err != nil {
|
||||
return nil, knerrors.GetError(err)
|
||||
|
|
@ -91,7 +91,7 @@ func (cl *knServingClient) GetDomainMapping(ctx context.Context, name string) (*
|
|||
}
|
||||
|
||||
// CreateDomainMapping creates provided DomainMapping
|
||||
func (cl *knServingClient) CreateDomainMapping(ctx context.Context, domainMapping *servingv1alpha1.DomainMapping) error {
|
||||
func (cl *knServingClient) CreateDomainMapping(ctx context.Context, domainMapping *servingv1beta1.DomainMapping) error {
|
||||
_, err := cl.client.DomainMappings(cl.namespace).Create(ctx, domainMapping, v1.CreateOptions{})
|
||||
if err != nil {
|
||||
return knerrors.GetError(err)
|
||||
|
|
@ -100,7 +100,7 @@ func (cl *knServingClient) CreateDomainMapping(ctx context.Context, domainMappin
|
|||
}
|
||||
|
||||
// UpdateDomainMapping updates provided DomainMapping
|
||||
func (cl *knServingClient) UpdateDomainMapping(ctx context.Context, domainMapping *servingv1alpha1.DomainMapping) error {
|
||||
func (cl *knServingClient) UpdateDomainMapping(ctx context.Context, domainMapping *servingv1beta1.DomainMapping) error {
|
||||
_, err := cl.client.DomainMappings(cl.namespace).Update(ctx, domainMapping, v1.UpdateOptions{})
|
||||
if err != nil {
|
||||
return knerrors.GetError(err)
|
||||
|
|
@ -147,7 +147,7 @@ func (cl *knServingClient) DeleteDomainMapping(ctx context.Context, name string)
|
|||
}
|
||||
|
||||
// ListDomainMappings lists all DomainMappings
|
||||
func (cl *knServingClient) ListDomainMappings(ctx context.Context) (*servingv1alpha1.DomainMappingList, error) {
|
||||
func (cl *knServingClient) ListDomainMappings(ctx context.Context) (*servingv1beta1.DomainMappingList, error) {
|
||||
domainMappingList, err := cl.client.DomainMappings(cl.namespace).List(ctx, v1.ListOptions{})
|
||||
if err != nil {
|
||||
return nil, knerrors.GetError(err)
|
||||
|
|
@ -157,7 +157,7 @@ func (cl *knServingClient) ListDomainMappings(ctx context.Context) (*servingv1al
|
|||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
dmListNew.Items = make([]servingv1alpha1.DomainMapping, len(domainMappingList.Items))
|
||||
dmListNew.Items = make([]servingv1beta1.DomainMapping, len(domainMappingList.Items))
|
||||
for idx, domainMapping := range domainMappingList.Items {
|
||||
domainMappingClone := domainMapping.DeepCopy()
|
||||
err := updateServingGvk(domainMappingClone)
|
||||
|
|
@ -170,17 +170,17 @@ func (cl *knServingClient) ListDomainMappings(ctx context.Context) (*servingv1al
|
|||
}
|
||||
|
||||
func updateServingGvk(obj runtime.Object) error {
|
||||
return util.UpdateGroupVersionKindWithScheme(obj, servingv1alpha1.SchemeGroupVersion, scheme.Scheme)
|
||||
return util.UpdateGroupVersionKindWithScheme(obj, servingv1beta1.SchemeGroupVersion, scheme.Scheme)
|
||||
}
|
||||
|
||||
// DomainMappingBuilder is for building the domainMapping
|
||||
type DomainMappingBuilder struct {
|
||||
domainMapping *servingv1alpha1.DomainMapping
|
||||
domainMapping *servingv1beta1.DomainMapping
|
||||
}
|
||||
|
||||
// NewDomainMappingBuilder for building domainMapping object
|
||||
func NewDomainMappingBuilder(name string) *DomainMappingBuilder {
|
||||
return &DomainMappingBuilder{domainMapping: &servingv1alpha1.DomainMapping{
|
||||
return &DomainMappingBuilder{domainMapping: &servingv1beta1.DomainMapping{
|
||||
ObjectMeta: v1.ObjectMeta{
|
||||
Name: name,
|
||||
},
|
||||
|
|
@ -204,11 +204,11 @@ func (b *DomainMappingBuilder) TLS(cert string) *DomainMappingBuilder {
|
|||
if cert == "" {
|
||||
return b
|
||||
}
|
||||
b.domainMapping.Spec.TLS = &servingv1alpha1.SecretTLS{SecretName: cert}
|
||||
b.domainMapping.Spec.TLS = &servingv1beta1.SecretTLS{SecretName: cert}
|
||||
return b
|
||||
}
|
||||
|
||||
// Build to return an instance of domainMapping object
|
||||
func (b *DomainMappingBuilder) Build() *servingv1alpha1.DomainMapping {
|
||||
func (b *DomainMappingBuilder) Build() *servingv1beta1.DomainMapping {
|
||||
return b.domainMapping
|
||||
}
|
||||
|
|
@ -12,14 +12,14 @@
|
|||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package v1alpha1
|
||||
package v1beta1
|
||||
|
||||
import (
|
||||
"context"
|
||||
"testing"
|
||||
|
||||
"knative.dev/client/pkg/util/mock"
|
||||
servingv1alpha1 "knative.dev/serving/pkg/apis/serving/v1alpha1"
|
||||
servingv1beta1 "knative.dev/serving/pkg/apis/serving/v1beta1"
|
||||
)
|
||||
|
||||
// MockKnServingClient client mock
|
||||
|
|
@ -61,14 +61,14 @@ func (c *MockKnServingClient) Namespace() string {
|
|||
}
|
||||
|
||||
// GetDomainMapping mock function recorder
|
||||
func (sr *ServingRecorder) GetDomainMapping(name interface{}, domainMapping *servingv1alpha1.DomainMapping, err error) {
|
||||
func (sr *ServingRecorder) GetDomainMapping(name interface{}, domainMapping *servingv1beta1.DomainMapping, err error) {
|
||||
sr.r.Add("GetDomainMapping", []interface{}{name}, []interface{}{domainMapping, err})
|
||||
}
|
||||
|
||||
// GetDomainMapping mock function
|
||||
func (c *MockKnServingClient) GetDomainMapping(ctx context.Context, name string) (*servingv1alpha1.DomainMapping, error) {
|
||||
func (c *MockKnServingClient) GetDomainMapping(ctx context.Context, name string) (*servingv1beta1.DomainMapping, error) {
|
||||
call := c.recorder.r.VerifyCall("GetDomainMapping", name)
|
||||
return call.Result[0].(*servingv1alpha1.DomainMapping), mock.ErrorOrNil(call.Result[1])
|
||||
return call.Result[0].(*servingv1beta1.DomainMapping), mock.ErrorOrNil(call.Result[1])
|
||||
}
|
||||
|
||||
// CreateDomainMapping recorder function
|
||||
|
|
@ -77,7 +77,7 @@ func (sr *ServingRecorder) CreateDomainMapping(domainMapping interface{}, err er
|
|||
}
|
||||
|
||||
// CreateDomainMapping mock function
|
||||
func (c *MockKnServingClient) CreateDomainMapping(ctx context.Context, domainMapping *servingv1alpha1.DomainMapping) error {
|
||||
func (c *MockKnServingClient) CreateDomainMapping(ctx context.Context, domainMapping *servingv1beta1.DomainMapping) error {
|
||||
call := c.recorder.r.VerifyCall("CreateDomainMapping", domainMapping)
|
||||
return mock.ErrorOrNil(call.Result[0])
|
||||
}
|
||||
|
|
@ -88,7 +88,7 @@ func (sr *ServingRecorder) UpdateDomainMapping(domainMapping interface{}, err er
|
|||
}
|
||||
|
||||
// UpdateDomainMapping mock function
|
||||
func (c *MockKnServingClient) UpdateDomainMapping(ctx context.Context, domainMapping *servingv1alpha1.DomainMapping) error {
|
||||
func (c *MockKnServingClient) UpdateDomainMapping(ctx context.Context, domainMapping *servingv1beta1.DomainMapping) error {
|
||||
call := c.recorder.r.VerifyCall("UpdateDomainMapping", domainMapping)
|
||||
return mock.ErrorOrNil(call.Result[0])
|
||||
}
|
||||
|
|
@ -109,12 +109,12 @@ func (c *MockKnServingClient) DeleteDomainMapping(ctx context.Context, name stri
|
|||
}
|
||||
|
||||
// ListDomainMappings recorder function
|
||||
func (sr *ServingRecorder) ListDomainMappings(domainMappingList *servingv1alpha1.DomainMappingList, err error) {
|
||||
func (sr *ServingRecorder) ListDomainMappings(domainMappingList *servingv1beta1.DomainMappingList, err error) {
|
||||
sr.r.Add("ListDomainMappings", nil, []interface{}{domainMappingList, err})
|
||||
}
|
||||
|
||||
// ListDomainMappings mock function
|
||||
func (c *MockKnServingClient) ListDomainMappings(ctx context.Context) (*servingv1alpha1.DomainMappingList, error) {
|
||||
func (c *MockKnServingClient) ListDomainMappings(ctx context.Context) (*servingv1beta1.DomainMappingList, error) {
|
||||
call := c.recorder.r.VerifyCall("ListDomainMappings")
|
||||
return call.Result[0].(*servingv1alpha1.DomainMappingList), mock.ErrorOrNil(call.Result[1])
|
||||
return call.Result[0].(*servingv1beta1.DomainMappingList), mock.ErrorOrNil(call.Result[1])
|
||||
}
|
||||
|
|
@ -12,13 +12,13 @@
|
|||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package v1alpha1
|
||||
package v1beta1
|
||||
|
||||
import (
|
||||
"context"
|
||||
"testing"
|
||||
|
||||
"knative.dev/serving/pkg/apis/serving/v1alpha1"
|
||||
"knative.dev/serving/pkg/apis/serving/v1beta1"
|
||||
)
|
||||
|
||||
func TestMockKnClient(t *testing.T) {
|
||||
|
|
@ -28,22 +28,22 @@ func TestMockKnClient(t *testing.T) {
|
|||
recorder := client.Recorder()
|
||||
|
||||
// Record all services
|
||||
recorder.GetDomainMapping("hello.foo.bar", &v1alpha1.DomainMapping{}, nil)
|
||||
recorder.CreateDomainMapping(&v1alpha1.DomainMapping{}, nil)
|
||||
recorder.GetDomainMapping("hello.foo.bar", &v1beta1.DomainMapping{}, nil)
|
||||
recorder.CreateDomainMapping(&v1beta1.DomainMapping{}, nil)
|
||||
recorder.DeleteDomainMapping("hello.foo.bar", nil)
|
||||
recorder.UpdateDomainMapping(&v1alpha1.DomainMapping{}, nil)
|
||||
recorder.UpdateDomainMapping(&v1beta1.DomainMapping{}, nil)
|
||||
|
||||
recorder.GetDomainMapping("hello.foo.bar", &v1alpha1.DomainMapping{}, nil)
|
||||
recorder.UpdateDomainMapping(&v1alpha1.DomainMapping{}, nil)
|
||||
recorder.ListDomainMappings(&v1alpha1.DomainMappingList{}, nil)
|
||||
recorder.GetDomainMapping("hello.foo.bar", &v1beta1.DomainMapping{}, nil)
|
||||
recorder.UpdateDomainMapping(&v1beta1.DomainMapping{}, nil)
|
||||
recorder.ListDomainMappings(&v1beta1.DomainMappingList{}, nil)
|
||||
|
||||
// Call all services
|
||||
ctx := context.Background()
|
||||
client.GetDomainMapping(ctx, "hello.foo.bar")
|
||||
client.CreateDomainMapping(ctx, &v1alpha1.DomainMapping{})
|
||||
client.CreateDomainMapping(ctx, &v1beta1.DomainMapping{})
|
||||
client.DeleteDomainMapping(ctx, "hello.foo.bar")
|
||||
client.UpdateDomainMapping(ctx, &v1alpha1.DomainMapping{})
|
||||
client.UpdateDomainMappingWithRetry(ctx, "hello.foo.bar", func(origDomain *v1alpha1.DomainMapping) (*v1alpha1.DomainMapping, error) {
|
||||
client.UpdateDomainMapping(ctx, &v1beta1.DomainMapping{})
|
||||
client.UpdateDomainMappingWithRetry(ctx, "hello.foo.bar", func(origDomain *v1beta1.DomainMapping) (*v1beta1.DomainMapping, error) {
|
||||
return origDomain, nil
|
||||
}, 10)
|
||||
client.ListDomainMappings(ctx)
|
||||
|
|
@ -12,7 +12,7 @@
|
|||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package v1alpha1
|
||||
package v1beta1
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
|
@ -30,9 +30,9 @@ import (
|
|||
|
||||
"knative.dev/client/pkg/util"
|
||||
duckv1 "knative.dev/pkg/apis/duck/v1"
|
||||
servingv1alpha1 "knative.dev/serving/pkg/apis/serving/v1alpha1"
|
||||
servingv1beta1 "knative.dev/serving/pkg/apis/serving/v1beta1"
|
||||
"knative.dev/serving/pkg/client/clientset/versioned/scheme"
|
||||
servingv1alpha1fake "knative.dev/serving/pkg/client/clientset/versioned/typed/serving/v1alpha1/fake"
|
||||
servingv1beta1fake "knative.dev/serving/pkg/client/clientset/versioned/typed/serving/v1beta1/fake"
|
||||
)
|
||||
|
||||
const (
|
||||
|
|
@ -40,8 +40,8 @@ const (
|
|||
domainMappingResource = "domainmappings"
|
||||
)
|
||||
|
||||
func setup() (serving servingv1alpha1fake.FakeServingV1alpha1, client KnServingClient) {
|
||||
serving = servingv1alpha1fake.FakeServingV1alpha1{Fake: &clienttesting.Fake{}}
|
||||
func setup() (serving servingv1beta1fake.FakeServingV1beta1, client KnServingClient) {
|
||||
serving = servingv1beta1fake.FakeServingV1beta1{Fake: &clienttesting.Fake{}}
|
||||
client = NewKnServingClient(&serving, testNamespace)
|
||||
return
|
||||
}
|
||||
|
|
@ -61,7 +61,7 @@ func TestGetDomainMapping(t *testing.T) {
|
|||
if name == domainName {
|
||||
return true, dm, nil
|
||||
}
|
||||
return true, nil, errors.NewNotFound(servingv1alpha1.Resource("dm"), name)
|
||||
return true, nil, errors.NewNotFound(servingv1beta1.Resource("dm"), name)
|
||||
})
|
||||
|
||||
t.Run("get domain mapping by name returns object", func(t *testing.T) {
|
||||
|
|
@ -188,7 +188,7 @@ func TestUpdateDomainMappingWithRetry(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("Update domain mapping successfully without any retries", func(t *testing.T) {
|
||||
err := client.UpdateDomainMappingWithRetry(context.Background(), domainName, func(domain *servingv1alpha1.DomainMapping) (*servingv1alpha1.DomainMapping, error) {
|
||||
err := client.UpdateDomainMappingWithRetry(context.Background(), domainName, func(domain *servingv1beta1.DomainMapping) (*servingv1beta1.DomainMapping, error) {
|
||||
return domain, nil
|
||||
}, maxAttempts)
|
||||
assert.NilError(t, err, "No retries required as no conflict error occurred")
|
||||
|
|
@ -196,7 +196,7 @@ func TestUpdateDomainMappingWithRetry(t *testing.T) {
|
|||
|
||||
t.Run("Update domain mapping with retry after max retries", func(t *testing.T) {
|
||||
attemptCount = maxAttempts - 1
|
||||
err := client.UpdateDomainMappingWithRetry(context.Background(), domainName, func(domain *servingv1alpha1.DomainMapping) (*servingv1alpha1.DomainMapping, error) {
|
||||
err := client.UpdateDomainMappingWithRetry(context.Background(), domainName, func(domain *servingv1beta1.DomainMapping) (*servingv1beta1.DomainMapping, error) {
|
||||
return domain, nil
|
||||
}, maxAttempts)
|
||||
assert.NilError(t, err, "Update retried %d times and succeeded", maxAttempts)
|
||||
|
|
@ -205,7 +205,7 @@ func TestUpdateDomainMappingWithRetry(t *testing.T) {
|
|||
|
||||
t.Run("Update domain mapping with retry and fail with conflict after exhausting max retries", func(t *testing.T) {
|
||||
attemptCount = maxAttempts
|
||||
err := client.UpdateDomainMappingWithRetry(context.Background(), domainName, func(domain *servingv1alpha1.DomainMapping) (*servingv1alpha1.DomainMapping, error) {
|
||||
err := client.UpdateDomainMappingWithRetry(context.Background(), domainName, func(domain *servingv1beta1.DomainMapping) (*servingv1beta1.DomainMapping, error) {
|
||||
return domain, nil
|
||||
}, maxAttempts)
|
||||
assert.ErrorType(t, err, errors.IsConflict, "Update retried %d times and failed", maxAttempts)
|
||||
|
|
@ -214,7 +214,7 @@ func TestUpdateDomainMappingWithRetry(t *testing.T) {
|
|||
|
||||
t.Run("Update domain mapping with retry and fail with conflict after exhausting max retries", func(t *testing.T) {
|
||||
attemptCount = maxAttempts
|
||||
err := client.UpdateDomainMappingWithRetry(context.Background(), domainName, func(domain *servingv1alpha1.DomainMapping) (*servingv1alpha1.DomainMapping, error) {
|
||||
err := client.UpdateDomainMappingWithRetry(context.Background(), domainName, func(domain *servingv1beta1.DomainMapping) (*servingv1beta1.DomainMapping, error) {
|
||||
return domain, nil
|
||||
}, maxAttempts)
|
||||
assert.ErrorType(t, err, errors.IsConflict, "Update retried %d times and failed", maxAttempts)
|
||||
|
|
@ -222,28 +222,28 @@ func TestUpdateDomainMappingWithRetry(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("Update domain mapping with retry fails with a non conflict error", func(t *testing.T) {
|
||||
err := client.UpdateDomainMappingWithRetry(context.Background(), "errorDomain", func(domain *servingv1alpha1.DomainMapping) (*servingv1alpha1.DomainMapping, error) {
|
||||
err := client.UpdateDomainMappingWithRetry(context.Background(), "errorDomain", func(domain *servingv1beta1.DomainMapping) (*servingv1beta1.DomainMapping, error) {
|
||||
return domain, nil
|
||||
}, maxAttempts)
|
||||
assert.ErrorType(t, err, errors.IsInternalError)
|
||||
})
|
||||
|
||||
t.Run("Update domain mapping with retry fails with resource already deleted error", func(t *testing.T) {
|
||||
err := client.UpdateDomainMappingWithRetry(context.Background(), "deletedDomain", func(domain *servingv1alpha1.DomainMapping) (*servingv1alpha1.DomainMapping, error) {
|
||||
err := client.UpdateDomainMappingWithRetry(context.Background(), "deletedDomain", func(domain *servingv1beta1.DomainMapping) (*servingv1beta1.DomainMapping, error) {
|
||||
return domain, nil
|
||||
}, maxAttempts)
|
||||
assert.ErrorContains(t, err, "marked for deletion")
|
||||
})
|
||||
|
||||
t.Run("Update domain mapping with retry fails with error from updateFunc", func(t *testing.T) {
|
||||
err := client.UpdateDomainMappingWithRetry(context.Background(), domainName, func(domain *servingv1alpha1.DomainMapping) (*servingv1alpha1.DomainMapping, error) {
|
||||
err := client.UpdateDomainMappingWithRetry(context.Background(), domainName, func(domain *servingv1beta1.DomainMapping) (*servingv1beta1.DomainMapping, error) {
|
||||
return domain, fmt.Errorf("error updating object")
|
||||
}, maxAttempts)
|
||||
assert.ErrorContains(t, err, "error updating object")
|
||||
})
|
||||
|
||||
t.Run("Update domain mapping with retry fails with error from GetDomainMapping", func(t *testing.T) {
|
||||
err := client.UpdateDomainMappingWithRetry(context.Background(), "getErrorDomain", func(domain *servingv1alpha1.DomainMapping) (*servingv1alpha1.DomainMapping, error) {
|
||||
err := client.UpdateDomainMappingWithRetry(context.Background(), "getErrorDomain", func(domain *servingv1beta1.DomainMapping) (*servingv1beta1.DomainMapping, error) {
|
||||
return domain, nil
|
||||
}, maxAttempts)
|
||||
assert.ErrorType(t, err, errors.IsInternalError)
|
||||
|
|
@ -262,7 +262,7 @@ func TestDeleteDomainMapping(t *testing.T) {
|
|||
if name == domainName {
|
||||
return true, nil, nil
|
||||
}
|
||||
return true, nil, errors.NewNotFound(servingv1alpha1.Resource(domainMappingResource), name)
|
||||
return true, nil, errors.NewNotFound(servingv1beta1.Resource(domainMappingResource), name)
|
||||
})
|
||||
|
||||
t.Run("delete domain mapping returns no error", func(t *testing.T) {
|
||||
|
|
@ -288,7 +288,7 @@ func TestListDomainMappings(t *testing.T) {
|
|||
serving.AddReactor("list", domainMappingResource,
|
||||
func(a clienttesting.Action) (bool, runtime.Object, error) {
|
||||
assert.Equal(t, testNamespace, a.GetNamespace())
|
||||
return true, &servingv1alpha1.DomainMappingList{Items: []servingv1alpha1.DomainMapping{*dm1, *dm2, *dm3}}, nil
|
||||
return true, &servingv1beta1.DomainMappingList{Items: []servingv1beta1.DomainMapping{*dm1, *dm2, *dm3}}, nil
|
||||
})
|
||||
listServices, err := client.ListDomainMappings(context.Background())
|
||||
assert.NilError(t, err)
|
||||
|
|
@ -304,18 +304,18 @@ func TestListDomainMappings(t *testing.T) {
|
|||
}
|
||||
|
||||
func validateGroupVersionKind(t *testing.T, obj runtime.Object) {
|
||||
gvkExpected, err := util.GetGroupVersionKind(obj, servingv1alpha1.SchemeGroupVersion, scheme.Scheme)
|
||||
gvkExpected, err := util.GetGroupVersionKind(obj, servingv1beta1.SchemeGroupVersion, scheme.Scheme)
|
||||
assert.NilError(t, err)
|
||||
gvkGiven := obj.GetObjectKind().GroupVersionKind()
|
||||
fmt.Println(gvkGiven.String())
|
||||
assert.Equal(t, *gvkExpected, gvkGiven, "GVK should be the same")
|
||||
}
|
||||
|
||||
func createDomainMapping(name string, ref duckv1.KReference) *servingv1alpha1.DomainMapping {
|
||||
func createDomainMapping(name string, ref duckv1.KReference) *servingv1beta1.DomainMapping {
|
||||
return NewDomainMappingBuilder(name).Namespace("default").Reference(ref).Build()
|
||||
}
|
||||
|
||||
func createDomainMappingWithTls(name string, ref duckv1.KReference, tls string) *servingv1alpha1.DomainMapping {
|
||||
func createDomainMappingWithTls(name string, ref duckv1.KReference, tls string) *servingv1beta1.DomainMapping {
|
||||
return NewDomainMappingBuilder(name).Namespace("default").Reference(ref).TLS(tls).Build()
|
||||
}
|
||||
func createServiceRef(service, namespace string) duckv1.KReference {
|
||||
|
|
@ -1,7 +1,6 @@
|
|||
package jsonpatch
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"reflect"
|
||||
|
|
@ -24,21 +23,28 @@ func (j *Operation) Json() string {
|
|||
}
|
||||
|
||||
func (j *Operation) MarshalJSON() ([]byte, error) {
|
||||
var b bytes.Buffer
|
||||
b.WriteString("{")
|
||||
b.WriteString(fmt.Sprintf(`"op":"%s"`, j.Operation))
|
||||
b.WriteString(fmt.Sprintf(`,"path":"%s"`, j.Path))
|
||||
// Consider omitting Value for non-nullable operations.
|
||||
if j.Value != nil || j.Operation == "replace" || j.Operation == "add" {
|
||||
v, err := json.Marshal(j.Value)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
b.WriteString(`,"value":`)
|
||||
b.Write(v)
|
||||
// Ensure for add and replace we emit `value: null`
|
||||
if j.Value == nil && (j.Operation == "replace" || j.Operation == "add") {
|
||||
return json.Marshal(struct {
|
||||
Operation string `json:"op"`
|
||||
Path string `json:"path"`
|
||||
Value interface{} `json:"value"`
|
||||
}{
|
||||
Operation: j.Operation,
|
||||
Path: j.Path,
|
||||
})
|
||||
}
|
||||
b.WriteString("}")
|
||||
return b.Bytes(), nil
|
||||
// otherwise just marshal normally. We cannot literally do json.Marshal(j) as it would be recursively
|
||||
// calling this function.
|
||||
return json.Marshal(struct {
|
||||
Operation string `json:"op"`
|
||||
Path string `json:"path"`
|
||||
Value interface{} `json:"value,omitempty"`
|
||||
}{
|
||||
Operation: j.Operation,
|
||||
Path: j.Path,
|
||||
Value: j.Value,
|
||||
})
|
||||
}
|
||||
|
||||
type ByPath []Operation
|
||||
|
|
@ -149,9 +155,6 @@ func makePath(path string, newPart interface{}) string {
|
|||
if path == "" {
|
||||
return "/" + key
|
||||
}
|
||||
if strings.HasSuffix(path, "/") {
|
||||
return path + key
|
||||
}
|
||||
return path + "/" + key
|
||||
}
|
||||
|
||||
|
|
@ -211,22 +214,18 @@ func handleValues(av, bv interface{}, p string, patch []Operation) ([]Operation,
|
|||
}
|
||||
case []interface{}:
|
||||
bt := bv.([]interface{})
|
||||
if isSimpleArray(at) && isSimpleArray(bt) {
|
||||
patch = append(patch, compareEditDistance(at, bt, p)...)
|
||||
} else {
|
||||
n := min(len(at), len(bt))
|
||||
for i := len(at) - 1; i >= n; i-- {
|
||||
patch = append(patch, NewOperation("remove", makePath(p, i), nil))
|
||||
}
|
||||
for i := n; i < len(bt); i++ {
|
||||
patch = append(patch, NewOperation("add", makePath(p, i), bt[i]))
|
||||
}
|
||||
for i := 0; i < n; i++ {
|
||||
var err error
|
||||
patch, err = handleValues(at[i], bt[i], makePath(p, i), patch)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
n := min(len(at), len(bt))
|
||||
for i := len(at) - 1; i >= n; i-- {
|
||||
patch = append(patch, NewOperation("remove", makePath(p, i), nil))
|
||||
}
|
||||
for i := n; i < len(bt); i++ {
|
||||
patch = append(patch, NewOperation("add", makePath(p, i), bt[i]))
|
||||
}
|
||||
for i := 0; i < n; i++ {
|
||||
var err error
|
||||
patch, err = handleValues(at[i], bt[i], makePath(p, i), patch)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
default:
|
||||
|
|
@ -235,100 +234,9 @@ func handleValues(av, bv interface{}, p string, patch []Operation) ([]Operation,
|
|||
return patch, nil
|
||||
}
|
||||
|
||||
func isBasicType(a interface{}) bool {
|
||||
switch a.(type) {
|
||||
case string, float64, bool:
|
||||
default:
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
func isSimpleArray(a []interface{}) bool {
|
||||
for i := range a {
|
||||
switch a[i].(type) {
|
||||
case string, float64, bool:
|
||||
default:
|
||||
val := reflect.ValueOf(a[i])
|
||||
if val.Kind() == reflect.Map {
|
||||
for _, k := range val.MapKeys() {
|
||||
av := val.MapIndex(k)
|
||||
if av.Kind() == reflect.Ptr || av.Kind() == reflect.Interface {
|
||||
if av.IsNil() {
|
||||
continue
|
||||
}
|
||||
av = av.Elem()
|
||||
}
|
||||
if av.Kind() != reflect.String && av.Kind() != reflect.Float64 && av.Kind() != reflect.Bool {
|
||||
return false
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
// https://en.wikipedia.org/wiki/Wagner%E2%80%93Fischer_algorithm
|
||||
// Adapted from https://github.com/texttheater/golang-levenshtein
|
||||
func compareEditDistance(s, t []interface{}, p string) []Operation {
|
||||
m := len(s)
|
||||
n := len(t)
|
||||
|
||||
d := make([][]int, m+1)
|
||||
for i := 0; i <= m; i++ {
|
||||
d[i] = make([]int, n+1)
|
||||
d[i][0] = i
|
||||
}
|
||||
for j := 0; j <= n; j++ {
|
||||
d[0][j] = j
|
||||
}
|
||||
|
||||
for j := 1; j <= n; j++ {
|
||||
for i := 1; i <= m; i++ {
|
||||
if reflect.DeepEqual(s[i-1], t[j-1]) {
|
||||
d[i][j] = d[i-1][j-1] // no op required
|
||||
} else {
|
||||
del := d[i-1][j] + 1
|
||||
add := d[i][j-1] + 1
|
||||
rep := d[i-1][j-1] + 1
|
||||
d[i][j] = min(rep, min(add, del))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return backtrace(s, t, p, m, n, d)
|
||||
}
|
||||
|
||||
func min(x int, y int) int {
|
||||
if y < x {
|
||||
return y
|
||||
}
|
||||
return x
|
||||
}
|
||||
|
||||
func backtrace(s, t []interface{}, p string, i int, j int, matrix [][]int) []Operation {
|
||||
if i > 0 && matrix[i-1][j]+1 == matrix[i][j] {
|
||||
op := NewOperation("remove", makePath(p, i-1), nil)
|
||||
return append([]Operation{op}, backtrace(s, t, p, i-1, j, matrix)...)
|
||||
}
|
||||
if j > 0 && matrix[i][j-1]+1 == matrix[i][j] {
|
||||
op := NewOperation("add", makePath(p, i), t[j-1])
|
||||
return append([]Operation{op}, backtrace(s, t, p, i, j-1, matrix)...)
|
||||
}
|
||||
if i > 0 && j > 0 && matrix[i-1][j-1]+1 == matrix[i][j] {
|
||||
if isBasicType(s[0]) {
|
||||
op := NewOperation("replace", makePath(p, i-1), t[j-1])
|
||||
return append([]Operation{op}, backtrace(s, t, p, i-1, j-1, matrix)...)
|
||||
}
|
||||
|
||||
p2, _ := handleValues(s[i-1], t[j-1], makePath(p, i-1), []Operation{})
|
||||
return append(p2, backtrace(s, t, p, i-1, j-1, matrix)...)
|
||||
}
|
||||
if i > 0 && j > 0 && matrix[i-1][j-1] == matrix[i][j] {
|
||||
return backtrace(s, t, p, i-1, j-1, matrix)
|
||||
}
|
||||
return []Operation{}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ import (
|
|||
"strings"
|
||||
"text/template"
|
||||
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/utils/lru"
|
||||
cm "knative.dev/pkg/configmap"
|
||||
|
|
@ -321,6 +322,14 @@ func defaultConfig() *Config {
|
|||
}
|
||||
}
|
||||
|
||||
// NewConfigFromConfigMap returns a Config for the given configmap
|
||||
func NewConfigFromConfigMap(config *corev1.ConfigMap) (*Config, error) {
|
||||
if config == nil {
|
||||
return NewConfigFromMap(nil)
|
||||
}
|
||||
return NewConfigFromMap(config.Data)
|
||||
}
|
||||
|
||||
// NewConfigFromMap creates a Config from the supplied data.
|
||||
func NewConfigFromMap(data map[string]string) (*Config, error) {
|
||||
nc := defaultConfig()
|
||||
|
|
@ -436,6 +445,11 @@ func NewConfigFromMap(data map[string]string) (*Config, error) {
|
|||
return nc, nil
|
||||
}
|
||||
|
||||
// InternalTLSEnabled returns whether or not dataplane-trust is disabled
|
||||
func (c *Config) InternalTLSEnabled() bool {
|
||||
return c.DataplaneTrust != TrustDisabled
|
||||
}
|
||||
|
||||
// GetDomainTemplate returns the golang Template from the config map
|
||||
// or panics (the value is validated during CM validation and at
|
||||
// this point guaranteed to be parseable).
|
||||
|
|
|
|||
|
|
@ -1,9 +0,0 @@
|
|||
# Knative Serving API v1alpha1
|
||||
|
||||
This is the implementation of the Knative Serving API, which is specified in
|
||||
[`docs/spec/spec.md`](/docs/spec/spec.md) and verified via
|
||||
[the conformance tests](/test/conformance).
|
||||
|
||||
**Updates to this implementation should include a corresponding change to
|
||||
[the spec](/docs/spec/spec.md) and [the conformance tests](/test/conformance).**
|
||||
([#780](https://github.com/knative/serving/issues/780))
|
||||
|
|
@ -1,51 +0,0 @@
|
|||
/*
|
||||
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 v1alpha1
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"knative.dev/pkg/apis"
|
||||
)
|
||||
|
||||
const (
|
||||
// ConditionTypeConvertible is a Warning condition that is set on
|
||||
// resources when they cannot be converted to warn of a forthcoming
|
||||
// breakage.
|
||||
ConditionTypeConvertible apis.ConditionType = "Convertible"
|
||||
)
|
||||
|
||||
// CannotConvertError is returned when a field cannot be converted.
|
||||
type CannotConvertError struct {
|
||||
Message string
|
||||
Field string
|
||||
}
|
||||
|
||||
var _ error = (*CannotConvertError)(nil)
|
||||
|
||||
// Error implements error
|
||||
func (cce *CannotConvertError) Error() string {
|
||||
return cce.Message
|
||||
}
|
||||
|
||||
// ConvertErrorf creates a CannotConvertError from the field name and format string.
|
||||
func ConvertErrorf(field, msg string, args ...interface{}) error {
|
||||
return &CannotConvertError{
|
||||
Message: fmt.Sprintf(msg, args...),
|
||||
Field: field,
|
||||
}
|
||||
}
|
||||
|
|
@ -1,24 +0,0 @@
|
|||
/*
|
||||
Copyright 2018 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.
|
||||
*/
|
||||
|
||||
// +k8s:deepcopy-gen=package
|
||||
// +groupName=serving.knative.dev
|
||||
|
||||
// Package v1alpha1 contains the v1alpha1 versions of the serving apis.
|
||||
// Api versions allow the api contract for a resource to be changed while keeping
|
||||
// backward compatibility by support multiple concurrent versions
|
||||
// of the same resource
|
||||
package v1alpha1
|
||||
|
|
@ -1,36 +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"
|
||||
"knative.dev/serving/pkg/apis/serving"
|
||||
)
|
||||
|
||||
// SetDefaults implements apis.Defaultable.
|
||||
func (dm *DomainMapping) SetDefaults(ctx context.Context) {
|
||||
ctx = apis.WithinParent(ctx, dm.ObjectMeta)
|
||||
dm.Spec.Ref.SetDefaults(apis.WithinSpec(ctx))
|
||||
|
||||
if apis.IsInUpdate(ctx) {
|
||||
serving.SetUserInfo(ctx, apis.GetBaseline(ctx).(*DomainMapping).Spec, dm.Spec, dm)
|
||||
} else {
|
||||
serving.SetUserInfo(ctx, nil, dm.Spec, dm)
|
||||
}
|
||||
}
|
||||
|
|
@ -1,180 +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 (
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
netv1alpha1 "knative.dev/networking/pkg/apis/networking/v1alpha1"
|
||||
"knative.dev/pkg/apis"
|
||||
)
|
||||
|
||||
var domainMappingCondSet = apis.NewLivingConditionSet(
|
||||
DomainMappingConditionDomainClaimed,
|
||||
DomainMappingConditionReferenceResolved,
|
||||
DomainMappingConditionIngressReady,
|
||||
DomainMappingConditionCertificateProvisioned,
|
||||
)
|
||||
|
||||
// GetConditionSet retrieves the condition set for this resource. Implements the KRShaped interface.
|
||||
func (*DomainMapping) GetConditionSet() apis.ConditionSet {
|
||||
return domainMappingCondSet
|
||||
}
|
||||
|
||||
// GetGroupVersionKind returns the GroupVersionKind.
|
||||
func (dm *DomainMapping) GetGroupVersionKind() schema.GroupVersionKind {
|
||||
return SchemeGroupVersion.WithKind("DomainMapping")
|
||||
}
|
||||
|
||||
// IsReady returns true if the DomainMapping is ready.
|
||||
func (dms *DomainMappingStatus) IsReady() bool {
|
||||
return domainMappingCondSet.Manage(dms).IsHappy()
|
||||
}
|
||||
|
||||
// IsReady returns true if the Status condition DomainMappingConditionReady
|
||||
// is true and the latest spec has been observed.
|
||||
func (dm *DomainMapping) IsReady() bool {
|
||||
dms := dm.Status
|
||||
return dms.ObservedGeneration == dm.Generation &&
|
||||
dms.GetCondition(DomainMappingConditionReady).IsTrue()
|
||||
}
|
||||
|
||||
// InitializeConditions sets the initial values to the conditions.
|
||||
func (dms *DomainMappingStatus) InitializeConditions() {
|
||||
domainMappingCondSet.Manage(dms).InitializeConditions()
|
||||
}
|
||||
|
||||
const (
|
||||
// AutoTLSNotEnabledMessage is the message which is set on the
|
||||
// DomainMappingConditionCertificateProvisioned condition when it is set to True
|
||||
// because AutoTLS was not enabled.
|
||||
AutoTLSNotEnabledMessage = "autoTLS is not enabled"
|
||||
// TLSCertificateProvidedExternally indicates that a TLS secret won't be created or managed
|
||||
// instead a reference to an existing TLS secret should have been provided in the DomainMapping spec
|
||||
TLSCertificateProvidedExternally = "TLS certificate was provided externally"
|
||||
)
|
||||
|
||||
// MarkTLSNotEnabled sets DomainMappingConditionCertificateProvisioned to true when
|
||||
// certificate provisioning was skipped because TLS was not enabled.
|
||||
func (dms *DomainMappingStatus) MarkTLSNotEnabled(msg string) {
|
||||
domainMappingCondSet.Manage(dms).MarkTrueWithReason(DomainMappingConditionCertificateProvisioned,
|
||||
"TLSNotEnabled", msg)
|
||||
}
|
||||
|
||||
func (dms *DomainMappingStatus) MarkCertificateNotRequired(msg string) {
|
||||
domainMappingCondSet.Manage(dms).MarkTrueWithReason(DomainMappingConditionCertificateProvisioned,
|
||||
"CertificateExternallyProvided", msg)
|
||||
}
|
||||
|
||||
// MarkCertificateReady marks the DomainMappingConditionCertificateProvisioned
|
||||
// condition to indicate that the Certificate is ready.
|
||||
func (dms *DomainMappingStatus) MarkCertificateReady(name string) {
|
||||
domainMappingCondSet.Manage(dms).MarkTrue(DomainMappingConditionCertificateProvisioned)
|
||||
}
|
||||
|
||||
// MarkCertificateNotReady marks the DomainMappingConditionCertificateProvisioned
|
||||
// condition to indicate that the Certificate is not ready.
|
||||
func (dms *DomainMappingStatus) MarkCertificateNotReady(name string) {
|
||||
domainMappingCondSet.Manage(dms).MarkUnknown(DomainMappingConditionCertificateProvisioned,
|
||||
"CertificateNotReady",
|
||||
"Certificate %s is not ready.", name)
|
||||
}
|
||||
|
||||
// MarkCertificateNotOwned changes the DomainMappingConditionCertificateProvisioned
|
||||
// status to be false with the reason being that there is an existing
|
||||
// certificate with the name we wanted to use.
|
||||
func (dms *DomainMappingStatus) MarkCertificateNotOwned(name string) {
|
||||
domainMappingCondSet.Manage(dms).MarkFalse(DomainMappingConditionCertificateProvisioned,
|
||||
"CertificateNotOwned",
|
||||
"There is an existing certificate %s that we don't own.", name)
|
||||
}
|
||||
|
||||
// MarkCertificateProvisionFailed marks the
|
||||
// DomainMappingConditionCertificateProvisioned condition to indicate that the
|
||||
// Certificate provisioning failed.
|
||||
func (dms *DomainMappingStatus) MarkCertificateProvisionFailed(name string) {
|
||||
domainMappingCondSet.Manage(dms).MarkFalse(DomainMappingConditionCertificateProvisioned,
|
||||
"CertificateProvisionFailed",
|
||||
"Certificate %s failed to be provisioned.", name)
|
||||
}
|
||||
|
||||
// MarkHTTPDowngrade sets DomainMappingConditionCertificateProvisioned to true when plain
|
||||
// HTTP is enabled even when Certificate is not ready.
|
||||
func (dms *DomainMappingStatus) MarkHTTPDowngrade(name string) {
|
||||
domainMappingCondSet.Manage(dms).MarkTrueWithReason(DomainMappingConditionCertificateProvisioned,
|
||||
"HTTPDowngrade",
|
||||
"Certificate %s is not ready downgrade HTTP.", name)
|
||||
}
|
||||
|
||||
// MarkIngressNotConfigured changes the IngressReady condition to be unknown to reflect
|
||||
// that the Ingress does not yet have a Status.
|
||||
func (dms *DomainMappingStatus) MarkIngressNotConfigured() {
|
||||
domainMappingCondSet.Manage(dms).MarkUnknown(DomainMappingConditionIngressReady,
|
||||
"IngressNotConfigured", "Ingress has not yet been reconciled.")
|
||||
}
|
||||
|
||||
// MarkDomainClaimed updates the DomainMappingConditionDomainClaimed condition
|
||||
// to indicate that the domain was successfully claimed.
|
||||
func (dms *DomainMappingStatus) MarkDomainClaimed() {
|
||||
domainMappingCondSet.Manage(dms).MarkTrue(DomainMappingConditionDomainClaimed)
|
||||
}
|
||||
|
||||
// MarkDomainClaimNotOwned updates the DomainMappingConditionDomainClaimed
|
||||
// condition to indicate that the domain is already in use by another
|
||||
// DomainMapping.
|
||||
func (dms *DomainMappingStatus) MarkDomainClaimNotOwned() {
|
||||
domainMappingCondSet.Manage(dms).MarkFalse(DomainMappingConditionDomainClaimed, "DomainAlreadyClaimed",
|
||||
"The domain name is already in use by another DomainMapping")
|
||||
}
|
||||
|
||||
// MarkDomainClaimFailed updates the DomainMappingConditionDomainClaimed
|
||||
// condition to indicate that creating the ClusterDomainClaim failed.
|
||||
func (dms *DomainMappingStatus) MarkDomainClaimFailed(reason string) {
|
||||
domainMappingCondSet.Manage(dms).MarkFalse(DomainMappingConditionDomainClaimed, "DomainClaimFailed", reason)
|
||||
}
|
||||
|
||||
// MarkReferenceResolved sets the DomainMappingConditionReferenceResolved
|
||||
// condition to true.
|
||||
func (dms *DomainMappingStatus) MarkReferenceResolved() {
|
||||
domainMappingCondSet.Manage(dms).MarkTrue(DomainMappingConditionReferenceResolved)
|
||||
}
|
||||
|
||||
// MarkReferenceNotResolved sets the DomainMappingConditionReferenceResolved
|
||||
// condition to false.
|
||||
func (dms *DomainMappingStatus) MarkReferenceNotResolved(reason string) {
|
||||
domainMappingCondSet.Manage(dms).MarkFalse(DomainMappingConditionReferenceResolved, "ResolveFailed", reason)
|
||||
}
|
||||
|
||||
// PropagateIngressStatus updates the DomainMappingConditionIngressReady
|
||||
// condition according to the underlying Ingress's status.
|
||||
func (dms *DomainMappingStatus) PropagateIngressStatus(cs netv1alpha1.IngressStatus) {
|
||||
cc := cs.GetCondition(netv1alpha1.IngressConditionReady)
|
||||
if cc == nil {
|
||||
dms.MarkIngressNotConfigured()
|
||||
return
|
||||
}
|
||||
|
||||
m := domainMappingCondSet.Manage(dms)
|
||||
switch cc.Status {
|
||||
case corev1.ConditionTrue:
|
||||
m.MarkTrue(DomainMappingConditionIngressReady)
|
||||
case corev1.ConditionFalse:
|
||||
m.MarkFalse(DomainMappingConditionIngressReady, cc.Reason, cc.Message)
|
||||
case corev1.ConditionUnknown:
|
||||
m.MarkUnknown(DomainMappingConditionIngressReady, cc.Reason, cc.Message)
|
||||
}
|
||||
}
|
||||
|
|
@ -1,135 +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/pkg/apis"
|
||||
duckv1 "knative.dev/pkg/apis/duck/v1"
|
||||
)
|
||||
|
||||
// +genclient
|
||||
// +genreconciler
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
|
||||
// DomainMapping is a mapping from a custom hostname to an Addressable.
|
||||
type DomainMapping struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
// Standard object's metadata.
|
||||
// More info: https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#metadata
|
||||
// +optional
|
||||
metav1.ObjectMeta `json:"metadata,omitempty"`
|
||||
|
||||
// Spec is the desired state of the DomainMapping.
|
||||
// More info: https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#spec-and-status
|
||||
// +optional
|
||||
Spec DomainMappingSpec `json:"spec,omitempty"`
|
||||
|
||||
// Status is the current state of the DomainMapping.
|
||||
// More info: https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#spec-and-status
|
||||
// +optional
|
||||
Status DomainMappingStatus `json:"status,omitempty"`
|
||||
}
|
||||
|
||||
// Verify that DomainMapping adheres to the appropriate interfaces.
|
||||
var (
|
||||
// Check that DomainMapping may be validated and defaulted.
|
||||
_ apis.Validatable = (*DomainMapping)(nil)
|
||||
_ apis.Defaultable = (*DomainMapping)(nil)
|
||||
|
||||
// Check that the type conforms to the duck Knative Resource shape.
|
||||
_ duckv1.KRShaped = (*DomainMapping)(nil)
|
||||
)
|
||||
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
|
||||
// DomainMappingList is a collection of DomainMapping objects.
|
||||
type DomainMappingList struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
// Standard object metadata.
|
||||
// More info: https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#metadata
|
||||
// +optional
|
||||
metav1.ListMeta `json:"metadata,omitempty"`
|
||||
|
||||
// Items is the list of DomainMapping objects.
|
||||
Items []DomainMapping `json:"items"`
|
||||
}
|
||||
|
||||
// SecretTLS wrapper for TLS SecretName.
|
||||
type SecretTLS struct {
|
||||
// SecretName is the name of the existing secret used to terminate TLS traffic.
|
||||
SecretName string `json:"secretName"`
|
||||
}
|
||||
|
||||
// DomainMappingSpec describes the DomainMapping the user wishes to exist.
|
||||
type DomainMappingSpec struct {
|
||||
// Ref specifies the target of the Domain Mapping.
|
||||
//
|
||||
// The object identified by the Ref must be an Addressable with a URL of the
|
||||
// form `{name}.{namespace}.{domain}` where `{domain}` is the cluster domain,
|
||||
// and `{name}` and `{namespace}` are the name and namespace of a Kubernetes
|
||||
// Service.
|
||||
//
|
||||
// This contract is satisfied by Knative types such as Knative Services and
|
||||
// Knative Routes, and by Kubernetes Services.
|
||||
Ref duckv1.KReference `json:"ref"`
|
||||
|
||||
// TLS allows the DomainMapping to terminate TLS traffic with an existing secret.
|
||||
// +optional
|
||||
TLS *SecretTLS `json:"tls,omitempty"`
|
||||
}
|
||||
|
||||
// DomainMappingStatus describes the current state of the DomainMapping.
|
||||
type DomainMappingStatus struct {
|
||||
duckv1.Status `json:",inline"`
|
||||
|
||||
// URL is the URL of this DomainMapping.
|
||||
// +optional
|
||||
URL *apis.URL `json:"url,omitempty"`
|
||||
|
||||
// Address holds the information needed for a DomainMapping to be the target of an event.
|
||||
// +optional
|
||||
Address *duckv1.Addressable `json:"address,omitempty"`
|
||||
}
|
||||
|
||||
const (
|
||||
// DomainMappingConditionReady is set when the DomainMapping is configured
|
||||
// and the Ingress is ready.
|
||||
DomainMappingConditionReady = apis.ConditionReady
|
||||
|
||||
// DomainMappingConditionReferenceResolved reflects whether the Ref
|
||||
// has been successfully resolved to an existing object.
|
||||
DomainMappingConditionReferenceResolved apis.ConditionType = "ReferenceResolved"
|
||||
|
||||
// DomainMappingConditionIngressReady reflects the readiness of the
|
||||
// underlying Ingress resource.
|
||||
DomainMappingConditionIngressReady apis.ConditionType = "IngressReady"
|
||||
|
||||
// DomainMappingConditionDomainClaimed reflects that the ClusterDomainClaim
|
||||
// for this DomainMapping exists, and is owned by this DomainMapping.
|
||||
DomainMappingConditionDomainClaimed apis.ConditionType = "DomainClaimed"
|
||||
|
||||
// DomainMappingConditionCertificateProvisioned is set to False when the
|
||||
// Knative Certificates fail to be provisioned for the DomainMapping.
|
||||
DomainMappingConditionCertificateProvisioned apis.ConditionType = "CertificateProvisioned"
|
||||
)
|
||||
|
||||
// GetStatus retrieves the status of the DomainMapping. Implements the KRShaped interface.
|
||||
func (dm *DomainMapping) GetStatus() *duckv1.Status {
|
||||
return &dm.Status.Status
|
||||
}
|
||||
|
|
@ -1,73 +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"
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"k8s.io/apimachinery/pkg/util/validation"
|
||||
"k8s.io/apimachinery/pkg/util/validation/field"
|
||||
"knative.dev/pkg/apis"
|
||||
"knative.dev/pkg/network"
|
||||
"knative.dev/serving/pkg/apis/serving"
|
||||
)
|
||||
|
||||
// Validate makes sure that DomainMapping is properly configured.
|
||||
func (dm *DomainMapping) Validate(ctx context.Context) *apis.FieldError {
|
||||
errs := dm.validateMetadata(ctx).ViaField("metadata")
|
||||
|
||||
ctx = apis.WithinParent(ctx, dm.ObjectMeta)
|
||||
errs = errs.Also(dm.Spec.Validate(apis.WithinSpec(ctx)).ViaField("spec"))
|
||||
|
||||
return errs
|
||||
}
|
||||
|
||||
// validateMetadata validates the metadata section of a DomainMapping.
|
||||
func (dm *DomainMapping) validateMetadata(ctx context.Context) (errs *apis.FieldError) {
|
||||
if dm.GenerateName != "" {
|
||||
errs = errs.Also(apis.ErrDisallowedFields("generateName"))
|
||||
}
|
||||
|
||||
err := validation.IsFullyQualifiedDomainName(field.NewPath("name"), dm.Name)
|
||||
if err != nil {
|
||||
errs = errs.Also(apis.ErrGeneric(fmt.Sprintf(
|
||||
"invalid name %q: %s", dm.Name, err.ToAggregate()), "name"))
|
||||
}
|
||||
|
||||
clusterLocalDomain := network.GetClusterDomainName()
|
||||
if strings.HasSuffix(dm.Name, "."+clusterLocalDomain) {
|
||||
errs = errs.Also(apis.ErrGeneric(
|
||||
fmt.Sprintf("invalid name %q: must not be a subdomain of cluster local domain %q", dm.Name, clusterLocalDomain), "name"))
|
||||
}
|
||||
|
||||
if apis.IsInUpdate(ctx) {
|
||||
original := apis.GetBaseline(ctx).(*DomainMapping)
|
||||
errs = errs.Also(
|
||||
apis.ValidateCreatorAndModifier(original.Spec, dm.Spec,
|
||||
original.GetAnnotations(), dm.GetAnnotations(), serving.GroupName).ViaField("annotations"),
|
||||
)
|
||||
}
|
||||
|
||||
return errs
|
||||
}
|
||||
|
||||
// Validate makes sure the DomainMappingSpec is properly configured.
|
||||
func (spec *DomainMappingSpec) Validate(ctx context.Context) *apis.FieldError {
|
||||
return spec.Ref.Validate(ctx).ViaField("ref")
|
||||
}
|
||||
|
|
@ -1,55 +0,0 @@
|
|||
/*
|
||||
Copyright 2018 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/serving/pkg/apis/serving"
|
||||
|
||||
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: serving.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 registers the addKnownTypes function.
|
||||
SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes)
|
||||
// AddToScheme applies all the stored functions to the scheme.
|
||||
AddToScheme = SchemeBuilder.AddToScheme
|
||||
)
|
||||
|
||||
// Adds the list of known types to Scheme.
|
||||
func addKnownTypes(scheme *runtime.Scheme) error {
|
||||
scheme.AddKnownTypes(SchemeGroupVersion,
|
||||
&DomainMapping{},
|
||||
&DomainMappingList{},
|
||||
)
|
||||
metav1.AddToGroupVersion(scheme, SchemeGroupVersion)
|
||||
return nil
|
||||
}
|
||||
|
|
@ -1,170 +0,0 @@
|
|||
//go:build !ignore_autogenerated
|
||||
// +build !ignore_autogenerated
|
||||
|
||||
/*
|
||||
Copyright 2022 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"
|
||||
apis "knative.dev/pkg/apis"
|
||||
v1 "knative.dev/pkg/apis/duck/v1"
|
||||
)
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *CannotConvertError) DeepCopyInto(out *CannotConvertError) {
|
||||
*out = *in
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CannotConvertError.
|
||||
func (in *CannotConvertError) DeepCopy() *CannotConvertError {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(CannotConvertError)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *DomainMapping) DeepCopyInto(out *DomainMapping) {
|
||||
*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 DomainMapping.
|
||||
func (in *DomainMapping) DeepCopy() *DomainMapping {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(DomainMapping)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *DomainMapping) 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 *DomainMappingList) DeepCopyInto(out *DomainMappingList) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ListMeta.DeepCopyInto(&out.ListMeta)
|
||||
if in.Items != nil {
|
||||
in, out := &in.Items, &out.Items
|
||||
*out = make([]DomainMapping, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DomainMappingList.
|
||||
func (in *DomainMappingList) DeepCopy() *DomainMappingList {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(DomainMappingList)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *DomainMappingList) 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 *DomainMappingSpec) DeepCopyInto(out *DomainMappingSpec) {
|
||||
*out = *in
|
||||
in.Ref.DeepCopyInto(&out.Ref)
|
||||
if in.TLS != nil {
|
||||
in, out := &in.TLS, &out.TLS
|
||||
*out = new(SecretTLS)
|
||||
**out = **in
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DomainMappingSpec.
|
||||
func (in *DomainMappingSpec) DeepCopy() *DomainMappingSpec {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(DomainMappingSpec)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *DomainMappingStatus) DeepCopyInto(out *DomainMappingStatus) {
|
||||
*out = *in
|
||||
in.Status.DeepCopyInto(&out.Status)
|
||||
if in.URL != nil {
|
||||
in, out := &in.URL, &out.URL
|
||||
*out = new(apis.URL)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
if in.Address != nil {
|
||||
in, out := &in.Address, &out.Address
|
||||
*out = new(v1.Addressable)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DomainMappingStatus.
|
||||
func (in *DomainMappingStatus) DeepCopy() *DomainMappingStatus {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(DomainMappingStatus)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *SecretTLS) DeepCopyInto(out *SecretTLS) {
|
||||
*out = *in
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SecretTLS.
|
||||
func (in *SecretTLS) DeepCopy() *SecretTLS {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(SecretTLS)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
|
@ -27,7 +27,6 @@ import (
|
|||
flowcontrol "k8s.io/client-go/util/flowcontrol"
|
||||
autoscalingv1alpha1 "knative.dev/serving/pkg/client/clientset/versioned/typed/autoscaling/v1alpha1"
|
||||
servingv1 "knative.dev/serving/pkg/client/clientset/versioned/typed/serving/v1"
|
||||
servingv1alpha1 "knative.dev/serving/pkg/client/clientset/versioned/typed/serving/v1alpha1"
|
||||
servingv1beta1 "knative.dev/serving/pkg/client/clientset/versioned/typed/serving/v1beta1"
|
||||
)
|
||||
|
||||
|
|
@ -36,7 +35,6 @@ type Interface interface {
|
|||
AutoscalingV1alpha1() autoscalingv1alpha1.AutoscalingV1alpha1Interface
|
||||
ServingV1() servingv1.ServingV1Interface
|
||||
ServingV1beta1() servingv1beta1.ServingV1beta1Interface
|
||||
ServingV1alpha1() servingv1alpha1.ServingV1alpha1Interface
|
||||
}
|
||||
|
||||
// Clientset contains the clients for groups.
|
||||
|
|
@ -45,7 +43,6 @@ type Clientset struct {
|
|||
autoscalingV1alpha1 *autoscalingv1alpha1.AutoscalingV1alpha1Client
|
||||
servingV1 *servingv1.ServingV1Client
|
||||
servingV1beta1 *servingv1beta1.ServingV1beta1Client
|
||||
servingV1alpha1 *servingv1alpha1.ServingV1alpha1Client
|
||||
}
|
||||
|
||||
// AutoscalingV1alpha1 retrieves the AutoscalingV1alpha1Client
|
||||
|
|
@ -63,11 +60,6 @@ func (c *Clientset) ServingV1beta1() servingv1beta1.ServingV1beta1Interface {
|
|||
return c.servingV1beta1
|
||||
}
|
||||
|
||||
// ServingV1alpha1 retrieves the ServingV1alpha1Client
|
||||
func (c *Clientset) ServingV1alpha1() servingv1alpha1.ServingV1alpha1Interface {
|
||||
return c.servingV1alpha1
|
||||
}
|
||||
|
||||
// Discovery retrieves the DiscoveryClient
|
||||
func (c *Clientset) Discovery() discovery.DiscoveryInterface {
|
||||
if c == nil {
|
||||
|
|
@ -124,10 +116,6 @@ func NewForConfigAndClient(c *rest.Config, httpClient *http.Client) (*Clientset,
|
|||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
cs.servingV1alpha1, err = servingv1alpha1.NewForConfigAndClient(&configShallowCopy, httpClient)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
cs.DiscoveryClient, err = discovery.NewDiscoveryClientForConfigAndClient(&configShallowCopy, httpClient)
|
||||
if err != nil {
|
||||
|
|
@ -152,7 +140,6 @@ func New(c rest.Interface) *Clientset {
|
|||
cs.autoscalingV1alpha1 = autoscalingv1alpha1.New(c)
|
||||
cs.servingV1 = servingv1.New(c)
|
||||
cs.servingV1beta1 = servingv1beta1.New(c)
|
||||
cs.servingV1alpha1 = servingv1alpha1.New(c)
|
||||
|
||||
cs.DiscoveryClient = discovery.NewDiscoveryClient(c)
|
||||
return &cs
|
||||
|
|
|
|||
|
|
@ -26,7 +26,6 @@ import (
|
|||
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
|
||||
autoscalingv1alpha1 "knative.dev/serving/pkg/apis/autoscaling/v1alpha1"
|
||||
servingv1 "knative.dev/serving/pkg/apis/serving/v1"
|
||||
servingv1alpha1 "knative.dev/serving/pkg/apis/serving/v1alpha1"
|
||||
servingv1beta1 "knative.dev/serving/pkg/apis/serving/v1beta1"
|
||||
)
|
||||
|
||||
|
|
@ -37,7 +36,6 @@ var localSchemeBuilder = runtime.SchemeBuilder{
|
|||
autoscalingv1alpha1.AddToScheme,
|
||||
servingv1.AddToScheme,
|
||||
servingv1beta1.AddToScheme,
|
||||
servingv1alpha1.AddToScheme,
|
||||
}
|
||||
|
||||
// AddToScheme adds all types of this clientset into the given scheme. This allows composition
|
||||
|
|
|
|||
|
|
@ -1,20 +0,0 @@
|
|||
/*
|
||||
Copyright 2022 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 client-gen. DO NOT EDIT.
|
||||
|
||||
// This package has the automatically generated typed clients.
|
||||
package v1alpha1
|
||||
|
|
@ -1,195 +0,0 @@
|
|||
/*
|
||||
Copyright 2022 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 client-gen. DO NOT EDIT.
|
||||
|
||||
package v1alpha1
|
||||
|
||||
import (
|
||||
"context"
|
||||
"time"
|
||||
|
||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
types "k8s.io/apimachinery/pkg/types"
|
||||
watch "k8s.io/apimachinery/pkg/watch"
|
||||
rest "k8s.io/client-go/rest"
|
||||
v1alpha1 "knative.dev/serving/pkg/apis/serving/v1alpha1"
|
||||
scheme "knative.dev/serving/pkg/client/clientset/versioned/scheme"
|
||||
)
|
||||
|
||||
// DomainMappingsGetter has a method to return a DomainMappingInterface.
|
||||
// A group's client should implement this interface.
|
||||
type DomainMappingsGetter interface {
|
||||
DomainMappings(namespace string) DomainMappingInterface
|
||||
}
|
||||
|
||||
// DomainMappingInterface has methods to work with DomainMapping resources.
|
||||
type DomainMappingInterface interface {
|
||||
Create(ctx context.Context, domainMapping *v1alpha1.DomainMapping, opts v1.CreateOptions) (*v1alpha1.DomainMapping, error)
|
||||
Update(ctx context.Context, domainMapping *v1alpha1.DomainMapping, opts v1.UpdateOptions) (*v1alpha1.DomainMapping, error)
|
||||
UpdateStatus(ctx context.Context, domainMapping *v1alpha1.DomainMapping, opts v1.UpdateOptions) (*v1alpha1.DomainMapping, error)
|
||||
Delete(ctx context.Context, name string, opts v1.DeleteOptions) error
|
||||
DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error
|
||||
Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.DomainMapping, error)
|
||||
List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.DomainMappingList, error)
|
||||
Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error)
|
||||
Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.DomainMapping, err error)
|
||||
DomainMappingExpansion
|
||||
}
|
||||
|
||||
// domainMappings implements DomainMappingInterface
|
||||
type domainMappings struct {
|
||||
client rest.Interface
|
||||
ns string
|
||||
}
|
||||
|
||||
// newDomainMappings returns a DomainMappings
|
||||
func newDomainMappings(c *ServingV1alpha1Client, namespace string) *domainMappings {
|
||||
return &domainMappings{
|
||||
client: c.RESTClient(),
|
||||
ns: namespace,
|
||||
}
|
||||
}
|
||||
|
||||
// Get takes name of the domainMapping, and returns the corresponding domainMapping object, and an error if there is any.
|
||||
func (c *domainMappings) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.DomainMapping, err error) {
|
||||
result = &v1alpha1.DomainMapping{}
|
||||
err = c.client.Get().
|
||||
Namespace(c.ns).
|
||||
Resource("domainmappings").
|
||||
Name(name).
|
||||
VersionedParams(&options, scheme.ParameterCodec).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// List takes label and field selectors, and returns the list of DomainMappings that match those selectors.
|
||||
func (c *domainMappings) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.DomainMappingList, err error) {
|
||||
var timeout time.Duration
|
||||
if opts.TimeoutSeconds != nil {
|
||||
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
|
||||
}
|
||||
result = &v1alpha1.DomainMappingList{}
|
||||
err = c.client.Get().
|
||||
Namespace(c.ns).
|
||||
Resource("domainmappings").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Timeout(timeout).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Watch returns a watch.Interface that watches the requested domainMappings.
|
||||
func (c *domainMappings) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
|
||||
var timeout time.Duration
|
||||
if opts.TimeoutSeconds != nil {
|
||||
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
|
||||
}
|
||||
opts.Watch = true
|
||||
return c.client.Get().
|
||||
Namespace(c.ns).
|
||||
Resource("domainmappings").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Timeout(timeout).
|
||||
Watch(ctx)
|
||||
}
|
||||
|
||||
// Create takes the representation of a domainMapping and creates it. Returns the server's representation of the domainMapping, and an error, if there is any.
|
||||
func (c *domainMappings) Create(ctx context.Context, domainMapping *v1alpha1.DomainMapping, opts v1.CreateOptions) (result *v1alpha1.DomainMapping, err error) {
|
||||
result = &v1alpha1.DomainMapping{}
|
||||
err = c.client.Post().
|
||||
Namespace(c.ns).
|
||||
Resource("domainmappings").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Body(domainMapping).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Update takes the representation of a domainMapping and updates it. Returns the server's representation of the domainMapping, and an error, if there is any.
|
||||
func (c *domainMappings) Update(ctx context.Context, domainMapping *v1alpha1.DomainMapping, opts v1.UpdateOptions) (result *v1alpha1.DomainMapping, err error) {
|
||||
result = &v1alpha1.DomainMapping{}
|
||||
err = c.client.Put().
|
||||
Namespace(c.ns).
|
||||
Resource("domainmappings").
|
||||
Name(domainMapping.Name).
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Body(domainMapping).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// UpdateStatus was generated because the type contains a Status member.
|
||||
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
|
||||
func (c *domainMappings) UpdateStatus(ctx context.Context, domainMapping *v1alpha1.DomainMapping, opts v1.UpdateOptions) (result *v1alpha1.DomainMapping, err error) {
|
||||
result = &v1alpha1.DomainMapping{}
|
||||
err = c.client.Put().
|
||||
Namespace(c.ns).
|
||||
Resource("domainmappings").
|
||||
Name(domainMapping.Name).
|
||||
SubResource("status").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Body(domainMapping).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Delete takes name of the domainMapping and deletes it. Returns an error if one occurs.
|
||||
func (c *domainMappings) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
|
||||
return c.client.Delete().
|
||||
Namespace(c.ns).
|
||||
Resource("domainmappings").
|
||||
Name(name).
|
||||
Body(&opts).
|
||||
Do(ctx).
|
||||
Error()
|
||||
}
|
||||
|
||||
// DeleteCollection deletes a collection of objects.
|
||||
func (c *domainMappings) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
|
||||
var timeout time.Duration
|
||||
if listOpts.TimeoutSeconds != nil {
|
||||
timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second
|
||||
}
|
||||
return c.client.Delete().
|
||||
Namespace(c.ns).
|
||||
Resource("domainmappings").
|
||||
VersionedParams(&listOpts, scheme.ParameterCodec).
|
||||
Timeout(timeout).
|
||||
Body(&opts).
|
||||
Do(ctx).
|
||||
Error()
|
||||
}
|
||||
|
||||
// Patch applies the patch and returns the patched domainMapping.
|
||||
func (c *domainMappings) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.DomainMapping, err error) {
|
||||
result = &v1alpha1.DomainMapping{}
|
||||
err = c.client.Patch(pt).
|
||||
Namespace(c.ns).
|
||||
Resource("domainmappings").
|
||||
Name(name).
|
||||
SubResource(subresources...).
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Body(data).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
|
@ -1,21 +0,0 @@
|
|||
/*
|
||||
Copyright 2022 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 client-gen. DO NOT EDIT.
|
||||
|
||||
package v1alpha1
|
||||
|
||||
type DomainMappingExpansion interface{}
|
||||
|
|
@ -1,107 +0,0 @@
|
|||
/*
|
||||
Copyright 2022 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 client-gen. DO NOT EDIT.
|
||||
|
||||
package v1alpha1
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
rest "k8s.io/client-go/rest"
|
||||
v1alpha1 "knative.dev/serving/pkg/apis/serving/v1alpha1"
|
||||
"knative.dev/serving/pkg/client/clientset/versioned/scheme"
|
||||
)
|
||||
|
||||
type ServingV1alpha1Interface interface {
|
||||
RESTClient() rest.Interface
|
||||
DomainMappingsGetter
|
||||
}
|
||||
|
||||
// ServingV1alpha1Client is used to interact with features provided by the serving.knative.dev group.
|
||||
type ServingV1alpha1Client struct {
|
||||
restClient rest.Interface
|
||||
}
|
||||
|
||||
func (c *ServingV1alpha1Client) DomainMappings(namespace string) DomainMappingInterface {
|
||||
return newDomainMappings(c, namespace)
|
||||
}
|
||||
|
||||
// NewForConfig creates a new ServingV1alpha1Client for the given config.
|
||||
// NewForConfig is equivalent to NewForConfigAndClient(c, httpClient),
|
||||
// where httpClient was generated with rest.HTTPClientFor(c).
|
||||
func NewForConfig(c *rest.Config) (*ServingV1alpha1Client, error) {
|
||||
config := *c
|
||||
if err := setConfigDefaults(&config); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
httpClient, err := rest.HTTPClientFor(&config)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return NewForConfigAndClient(&config, httpClient)
|
||||
}
|
||||
|
||||
// NewForConfigAndClient creates a new ServingV1alpha1Client for the given config and http client.
|
||||
// Note the http client provided takes precedence over the configured transport values.
|
||||
func NewForConfigAndClient(c *rest.Config, h *http.Client) (*ServingV1alpha1Client, error) {
|
||||
config := *c
|
||||
if err := setConfigDefaults(&config); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
client, err := rest.RESTClientForConfigAndClient(&config, h)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &ServingV1alpha1Client{client}, nil
|
||||
}
|
||||
|
||||
// NewForConfigOrDie creates a new ServingV1alpha1Client for the given config and
|
||||
// panics if there is an error in the config.
|
||||
func NewForConfigOrDie(c *rest.Config) *ServingV1alpha1Client {
|
||||
client, err := NewForConfig(c)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return client
|
||||
}
|
||||
|
||||
// New creates a new ServingV1alpha1Client for the given RESTClient.
|
||||
func New(c rest.Interface) *ServingV1alpha1Client {
|
||||
return &ServingV1alpha1Client{c}
|
||||
}
|
||||
|
||||
func setConfigDefaults(config *rest.Config) error {
|
||||
gv := v1alpha1.SchemeGroupVersion
|
||||
config.GroupVersion = &gv
|
||||
config.APIPath = "/apis"
|
||||
config.NegotiatedSerializer = scheme.Codecs.WithoutConversion()
|
||||
|
||||
if config.UserAgent == "" {
|
||||
config.UserAgent = rest.DefaultKubernetesUserAgent()
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// RESTClient returns a RESTClient that is used to communicate
|
||||
// with API server by this client implementation.
|
||||
func (c *ServingV1alpha1Client) RESTClient() rest.Interface {
|
||||
if c == nil {
|
||||
return nil
|
||||
}
|
||||
return c.restClient
|
||||
}
|
||||
|
|
@ -27,34 +27,34 @@ import (
|
|||
types "k8s.io/apimachinery/pkg/types"
|
||||
watch "k8s.io/apimachinery/pkg/watch"
|
||||
testing "k8s.io/client-go/testing"
|
||||
v1alpha1 "knative.dev/serving/pkg/apis/serving/v1alpha1"
|
||||
v1beta1 "knative.dev/serving/pkg/apis/serving/v1beta1"
|
||||
)
|
||||
|
||||
// FakeDomainMappings implements DomainMappingInterface
|
||||
type FakeDomainMappings struct {
|
||||
Fake *FakeServingV1alpha1
|
||||
Fake *FakeServingV1beta1
|
||||
ns string
|
||||
}
|
||||
|
||||
var domainmappingsResource = schema.GroupVersionResource{Group: "serving.knative.dev", Version: "v1alpha1", Resource: "domainmappings"}
|
||||
var domainmappingsResource = schema.GroupVersionResource{Group: "serving.knative.dev", Version: "v1beta1", Resource: "domainmappings"}
|
||||
|
||||
var domainmappingsKind = schema.GroupVersionKind{Group: "serving.knative.dev", Version: "v1alpha1", Kind: "DomainMapping"}
|
||||
var domainmappingsKind = schema.GroupVersionKind{Group: "serving.knative.dev", Version: "v1beta1", Kind: "DomainMapping"}
|
||||
|
||||
// Get takes name of the domainMapping, and returns the corresponding domainMapping object, and an error if there is any.
|
||||
func (c *FakeDomainMappings) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.DomainMapping, err error) {
|
||||
func (c *FakeDomainMappings) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.DomainMapping, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewGetAction(domainmappingsResource, c.ns, name), &v1alpha1.DomainMapping{})
|
||||
Invokes(testing.NewGetAction(domainmappingsResource, c.ns, name), &v1beta1.DomainMapping{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v1alpha1.DomainMapping), err
|
||||
return obj.(*v1beta1.DomainMapping), err
|
||||
}
|
||||
|
||||
// List takes label and field selectors, and returns the list of DomainMappings that match those selectors.
|
||||
func (c *FakeDomainMappings) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.DomainMappingList, err error) {
|
||||
func (c *FakeDomainMappings) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.DomainMappingList, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewListAction(domainmappingsResource, domainmappingsKind, c.ns, opts), &v1alpha1.DomainMappingList{})
|
||||
Invokes(testing.NewListAction(domainmappingsResource, domainmappingsKind, c.ns, opts), &v1beta1.DomainMappingList{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
|
|
@ -64,8 +64,8 @@ func (c *FakeDomainMappings) List(ctx context.Context, opts v1.ListOptions) (res
|
|||
if label == nil {
|
||||
label = labels.Everything()
|
||||
}
|
||||
list := &v1alpha1.DomainMappingList{ListMeta: obj.(*v1alpha1.DomainMappingList).ListMeta}
|
||||
for _, item := range obj.(*v1alpha1.DomainMappingList).Items {
|
||||
list := &v1beta1.DomainMappingList{ListMeta: obj.(*v1beta1.DomainMappingList).ListMeta}
|
||||
for _, item := range obj.(*v1beta1.DomainMappingList).Items {
|
||||
if label.Matches(labels.Set(item.Labels)) {
|
||||
list.Items = append(list.Items, item)
|
||||
}
|
||||
|
|
@ -81,43 +81,43 @@ func (c *FakeDomainMappings) Watch(ctx context.Context, opts v1.ListOptions) (wa
|
|||
}
|
||||
|
||||
// Create takes the representation of a domainMapping and creates it. Returns the server's representation of the domainMapping, and an error, if there is any.
|
||||
func (c *FakeDomainMappings) Create(ctx context.Context, domainMapping *v1alpha1.DomainMapping, opts v1.CreateOptions) (result *v1alpha1.DomainMapping, err error) {
|
||||
func (c *FakeDomainMappings) Create(ctx context.Context, domainMapping *v1beta1.DomainMapping, opts v1.CreateOptions) (result *v1beta1.DomainMapping, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewCreateAction(domainmappingsResource, c.ns, domainMapping), &v1alpha1.DomainMapping{})
|
||||
Invokes(testing.NewCreateAction(domainmappingsResource, c.ns, domainMapping), &v1beta1.DomainMapping{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v1alpha1.DomainMapping), err
|
||||
return obj.(*v1beta1.DomainMapping), err
|
||||
}
|
||||
|
||||
// Update takes the representation of a domainMapping and updates it. Returns the server's representation of the domainMapping, and an error, if there is any.
|
||||
func (c *FakeDomainMappings) Update(ctx context.Context, domainMapping *v1alpha1.DomainMapping, opts v1.UpdateOptions) (result *v1alpha1.DomainMapping, err error) {
|
||||
func (c *FakeDomainMappings) Update(ctx context.Context, domainMapping *v1beta1.DomainMapping, opts v1.UpdateOptions) (result *v1beta1.DomainMapping, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewUpdateAction(domainmappingsResource, c.ns, domainMapping), &v1alpha1.DomainMapping{})
|
||||
Invokes(testing.NewUpdateAction(domainmappingsResource, c.ns, domainMapping), &v1beta1.DomainMapping{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v1alpha1.DomainMapping), err
|
||||
return obj.(*v1beta1.DomainMapping), err
|
||||
}
|
||||
|
||||
// UpdateStatus was generated because the type contains a Status member.
|
||||
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
|
||||
func (c *FakeDomainMappings) UpdateStatus(ctx context.Context, domainMapping *v1alpha1.DomainMapping, opts v1.UpdateOptions) (*v1alpha1.DomainMapping, error) {
|
||||
func (c *FakeDomainMappings) UpdateStatus(ctx context.Context, domainMapping *v1beta1.DomainMapping, opts v1.UpdateOptions) (*v1beta1.DomainMapping, error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewUpdateSubresourceAction(domainmappingsResource, "status", c.ns, domainMapping), &v1alpha1.DomainMapping{})
|
||||
Invokes(testing.NewUpdateSubresourceAction(domainmappingsResource, "status", c.ns, domainMapping), &v1beta1.DomainMapping{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v1alpha1.DomainMapping), err
|
||||
return obj.(*v1beta1.DomainMapping), err
|
||||
}
|
||||
|
||||
// Delete takes name of the domainMapping and deletes it. Returns an error if one occurs.
|
||||
func (c *FakeDomainMappings) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
|
||||
_, err := c.Fake.
|
||||
Invokes(testing.NewDeleteActionWithOptions(domainmappingsResource, c.ns, name, opts), &v1alpha1.DomainMapping{})
|
||||
Invokes(testing.NewDeleteActionWithOptions(domainmappingsResource, c.ns, name, opts), &v1beta1.DomainMapping{})
|
||||
|
||||
return err
|
||||
}
|
||||
|
|
@ -126,17 +126,17 @@ func (c *FakeDomainMappings) Delete(ctx context.Context, name string, opts v1.De
|
|||
func (c *FakeDomainMappings) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
|
||||
action := testing.NewDeleteCollectionAction(domainmappingsResource, c.ns, listOpts)
|
||||
|
||||
_, err := c.Fake.Invokes(action, &v1alpha1.DomainMappingList{})
|
||||
_, err := c.Fake.Invokes(action, &v1beta1.DomainMappingList{})
|
||||
return err
|
||||
}
|
||||
|
||||
// Patch applies the patch and returns the patched domainMapping.
|
||||
func (c *FakeDomainMappings) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.DomainMapping, err error) {
|
||||
func (c *FakeDomainMappings) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.DomainMapping, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewPatchSubresourceAction(domainmappingsResource, c.ns, name, pt, data, subresources...), &v1alpha1.DomainMapping{})
|
||||
Invokes(testing.NewPatchSubresourceAction(domainmappingsResource, c.ns, name, pt, data, subresources...), &v1beta1.DomainMapping{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v1alpha1.DomainMapping), err
|
||||
return obj.(*v1beta1.DomainMapping), err
|
||||
}
|
||||
|
|
@ -21,20 +21,20 @@ package fake
|
|||
import (
|
||||
rest "k8s.io/client-go/rest"
|
||||
testing "k8s.io/client-go/testing"
|
||||
v1alpha1 "knative.dev/serving/pkg/client/clientset/versioned/typed/serving/v1alpha1"
|
||||
v1beta1 "knative.dev/serving/pkg/client/clientset/versioned/typed/serving/v1beta1"
|
||||
)
|
||||
|
||||
type FakeServingV1alpha1 struct {
|
||||
type FakeServingV1beta1 struct {
|
||||
*testing.Fake
|
||||
}
|
||||
|
||||
func (c *FakeServingV1alpha1) DomainMappings(namespace string) v1alpha1.DomainMappingInterface {
|
||||
func (c *FakeServingV1beta1) DomainMappings(namespace string) v1beta1.DomainMappingInterface {
|
||||
return &FakeDomainMappings{c, namespace}
|
||||
}
|
||||
|
||||
// RESTClient returns a RESTClient that is used to communicate
|
||||
// with API server by this client implementation.
|
||||
func (c *FakeServingV1alpha1) RESTClient() rest.Interface {
|
||||
func (c *FakeServingV1beta1) RESTClient() rest.Interface {
|
||||
var ret *rest.RESTClient
|
||||
return ret
|
||||
}
|
||||
|
|
@ -34,7 +34,6 @@ import (
|
|||
networkingv1alpha1 "knative.dev/networking/pkg/client/clientset/versioned/typed/networking/v1alpha1"
|
||||
"knative.dev/serving/pkg/client/clientset/versioned"
|
||||
servingv1 "knative.dev/serving/pkg/client/clientset/versioned/typed/serving/v1"
|
||||
servingv1alpha1 "knative.dev/serving/pkg/client/clientset/versioned/typed/serving/v1alpha1"
|
||||
servingv1beta1 "knative.dev/serving/pkg/client/clientset/versioned/typed/serving/v1beta1"
|
||||
|
||||
// Every E2E test requires this, so add it here.
|
||||
|
|
@ -43,18 +42,12 @@ import (
|
|||
|
||||
// Clients holds instances of interfaces for making requests to Knative Serving.
|
||||
type Clients struct {
|
||||
KubeClient kubernetes.Interface
|
||||
ServingAlphaClient *ServingAlphaClients
|
||||
ServingBetaClient *ServingBetaClients
|
||||
ServingClient *ServingClients
|
||||
NetworkingClient *NetworkingClients
|
||||
Dynamic dynamic.Interface
|
||||
Apiextensions *apiextensionsv1.ApiextensionsV1Client
|
||||
}
|
||||
|
||||
// ServingAlphaClients holds instances of interfaces for making requests to knative serving clients.
|
||||
type ServingAlphaClients struct {
|
||||
DomainMappings servingv1alpha1.DomainMappingInterface
|
||||
KubeClient kubernetes.Interface
|
||||
ServingBetaClient *ServingBetaClients
|
||||
ServingClient *ServingClients
|
||||
NetworkingClient *NetworkingClients
|
||||
Dynamic dynamic.Interface
|
||||
Apiextensions *apiextensionsv1.ApiextensionsV1Client
|
||||
}
|
||||
|
||||
// ServingBetaClients holds instances of interfaces for making requests to knative serving clients.
|
||||
|
|
@ -100,11 +93,6 @@ func NewClients(cfg *rest.Config, namespace string) (*Clients, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
clients.ServingAlphaClient, err = newServingAlphaClients(cfg, namespace)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
clients.ServingBetaClient, err = newServingBetaClients(cfg, namespace)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
|
@ -142,19 +130,6 @@ func newNetworkingClients(cfg *rest.Config, namespace string) (*NetworkingClient
|
|||
}, nil
|
||||
}
|
||||
|
||||
// newServingAlphaClients instantiates and returns the serving clientset required to make requests to the
|
||||
// knative serving cluster.
|
||||
func newServingAlphaClients(cfg *rest.Config, namespace string) (*ServingAlphaClients, error) {
|
||||
cs, err := versioned.NewForConfig(cfg)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &ServingAlphaClients{
|
||||
DomainMappings: cs.ServingV1alpha1().DomainMappings(namespace),
|
||||
}, nil
|
||||
}
|
||||
|
||||
// newServingBetaClients instantiates and returns the serving clientset required to make requests to the
|
||||
// knative serving cluster.
|
||||
func newServingBetaClients(cfg *rest.Config, namespace string) (*ServingBetaClients, error) {
|
||||
|
|
|
|||
|
|
@ -407,8 +407,8 @@ golang.org/x/tools/internal/gocommand
|
|||
golang.org/x/tools/internal/gopathwalk
|
||||
golang.org/x/tools/internal/imports
|
||||
golang.org/x/tools/internal/typeparams
|
||||
# gomodules.xyz/jsonpatch/v2 v2.2.0
|
||||
## explicit; go 1.12
|
||||
# gomodules.xyz/jsonpatch/v2 v2.3.0
|
||||
## explicit; go 1.20
|
||||
gomodules.xyz/jsonpatch/v2
|
||||
# google.golang.org/api v0.136.0
|
||||
## explicit; go 1.19
|
||||
|
|
@ -974,7 +974,7 @@ knative.dev/eventing/pkg/client/clientset/versioned/typed/sources/v1beta2/fake
|
|||
# knative.dev/hack v0.0.0-20230815012940-044c02b7a447
|
||||
## explicit; go 1.18
|
||||
knative.dev/hack
|
||||
# knative.dev/networking v0.0.0-20230815014240-ed0534b4ef83
|
||||
# knative.dev/networking v0.0.0-20230817140742-4bfcc9fb6012
|
||||
## explicit; go 1.18
|
||||
knative.dev/networking/pkg
|
||||
knative.dev/networking/pkg/apis/networking
|
||||
|
|
@ -989,7 +989,7 @@ knative.dev/networking/pkg/http/probe
|
|||
knative.dev/networking/pkg/http/proxy
|
||||
knative.dev/networking/pkg/http/stats
|
||||
knative.dev/networking/pkg/k8s
|
||||
# knative.dev/pkg v0.0.0-20230815012542-6519affc772b
|
||||
# knative.dev/pkg v0.0.0-20230815132840-4f651e092853
|
||||
## explicit; go 1.18
|
||||
knative.dev/pkg/apis
|
||||
knative.dev/pkg/apis/duck
|
||||
|
|
@ -1039,14 +1039,13 @@ knative.dev/pkg/tracing/config
|
|||
knative.dev/pkg/tracing/propagation
|
||||
knative.dev/pkg/tracing/propagation/tracecontextb3
|
||||
knative.dev/pkg/tracker
|
||||
# knative.dev/serving v0.38.1-0.20230815122740-5e20e1e82550
|
||||
# knative.dev/serving v0.38.1-0.20230818202718-e9425f8d5260
|
||||
## explicit; go 1.18
|
||||
knative.dev/serving/pkg/apis/autoscaling
|
||||
knative.dev/serving/pkg/apis/autoscaling/v1alpha1
|
||||
knative.dev/serving/pkg/apis/config
|
||||
knative.dev/serving/pkg/apis/serving
|
||||
knative.dev/serving/pkg/apis/serving/v1
|
||||
knative.dev/serving/pkg/apis/serving/v1alpha1
|
||||
knative.dev/serving/pkg/apis/serving/v1beta1
|
||||
knative.dev/serving/pkg/autoscaler/config
|
||||
knative.dev/serving/pkg/autoscaler/config/autoscalerconfig
|
||||
|
|
@ -1055,9 +1054,8 @@ knative.dev/serving/pkg/client/clientset/versioned/scheme
|
|||
knative.dev/serving/pkg/client/clientset/versioned/typed/autoscaling/v1alpha1
|
||||
knative.dev/serving/pkg/client/clientset/versioned/typed/serving/v1
|
||||
knative.dev/serving/pkg/client/clientset/versioned/typed/serving/v1/fake
|
||||
knative.dev/serving/pkg/client/clientset/versioned/typed/serving/v1alpha1
|
||||
knative.dev/serving/pkg/client/clientset/versioned/typed/serving/v1alpha1/fake
|
||||
knative.dev/serving/pkg/client/clientset/versioned/typed/serving/v1beta1
|
||||
knative.dev/serving/pkg/client/clientset/versioned/typed/serving/v1beta1/fake
|
||||
knative.dev/serving/pkg/gc
|
||||
knative.dev/serving/pkg/networking
|
||||
knative.dev/serving/pkg/reconciler/route/config
|
||||
|
|
|
|||
Loading…
Reference in New Issue