Skip to content

Commit

Permalink
Update to 0.22 deps (#52)
Browse files Browse the repository at this point in the history
* Update to 0.22 deps

* update knative-eventing-kafka to 0.22

* upate version in kafka tests, too

* upate version in kafka tests, too
  • Loading branch information
rhuss authored Apr 7, 2021
1 parent dc68a6a commit f101c88
Show file tree
Hide file tree
Showing 17 changed files with 717 additions and 73 deletions.
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ require (
gotest.tools/v3 v3.0.3
k8s.io/apimachinery v0.19.7
k8s.io/client-go v0.19.7
knative.dev/client v0.21.1-0.20210330082320-885f2a9bc996
knative.dev/eventing-kafka v0.21.1-0.20210330170621-ec5dc671a6a8
knative.dev/client v0.22.0
knative.dev/eventing-kafka v0.22.0
knative.dev/hack v0.0.0-20210325223819-b6ab329907d3
knative.dev/pkg v0.0.0-20210330162221-808d62257db6
knative.dev/pkg v0.0.0-20210331065221-952fdd90dbb0
)

replace github.com/go-openapi/spec => github.com/go-openapi/spec v0.19.3
39 changes: 15 additions & 24 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1333,45 +1333,36 @@ k8s.io/utils v0.0.0-20200729134348-d5654de09c73/go.mod h1:jPW/WVKK9YHAvNhRxK0md/
k8s.io/utils v0.0.0-20210111153108-fddb29f9d009 h1:0T5IaWHO3sJTEmCP6mUlBvMukxPKUQWqiI/YuiBNMiQ=
k8s.io/utils v0.0.0-20210111153108-fddb29f9d009/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA=
knative.dev/caching v0.0.0-20210215030244-1212288570f0/go.mod h1:rAPalJe9Lx3jHffJpackk5WjZYl3j2QvXUgw0GPllxQ=
knative.dev/caching v0.0.0-20210311181225-4b366c7a9f99/go.mod h1:OlAEAfCSUjHVetZp/hpMw3lzAGHfTEQyu2a5dgf/7Qo=
knative.dev/caching v0.0.0-20210331063521-5691bb38d441/go.mod h1:CfW7OVs7gzUXJj0OrIe8YlWEC4Qe0Avnq+5b81/Gw1s=
knative.dev/client v0.21.0/go.mod h1:1En9uxMhk62EReWR1d66/d3tnpkot/D3vBRfmuidFNc=
knative.dev/client v0.21.1-0.20210330082320-885f2a9bc996 h1:hzBLtKkSuTw0iveImS1UkM2e98t5ACl8Aw9YBZzeBhM=
knative.dev/client v0.21.1-0.20210330082320-885f2a9bc996/go.mod h1:jNcqeBq5mEJ8Y9c6hQv7Tm/uwLx5T5KRu1da16O2OlY=
knative.dev/client v0.22.0 h1:rtTlRwnydC+DkP+u0dSXv+yW97xc3HtzDKpbvIfTHYQ=
knative.dev/client v0.22.0/go.mod h1:h0AqleNSlOqhDBhgAkhD5V4IXPcqxhCn2cfLJExqa/U=
knative.dev/eventing v0.21.0/go.mod h1:JjbVEOTJJHqo9CTxbTfrMn018hG8fOr3UfBoCJ7KWaA=
knative.dev/eventing v0.21.1-0.20210312002228-3b427377abe0/go.mod h1:k/F174UcHeY70F00RAExTv2/wg8yUR20EPYX3hlD3+8=
knative.dev/eventing v0.21.1-0.20210330142021-dca8b0acf039 h1:skDjBvseFTDncrI6ZF5Vxu9dP9innYrZictqXgqtsaU=
knative.dev/eventing v0.21.1-0.20210330142021-dca8b0acf039/go.mod h1:UE4xmtZ/fZWmbFOLL9u1WuBxxnTm9GmGQceuKram4Kg=
knative.dev/eventing-kafka v0.21.1-0.20210330170621-ec5dc671a6a8 h1:iLFrRgMSo6d90B69XtaxuUXLHl+WewhP8hesxa5WEOQ=
knative.dev/eventing-kafka v0.21.1-0.20210330170621-ec5dc671a6a8/go.mod h1:uEdM0f3cao/decH+hIXWgSd4FzmRvRLz7vmhBHrE2Ig=
knative.dev/eventing v0.22.0 h1:esDaddfSmiVhLKDnUCVVunSdNeHklVEz0fsqs3NupuQ=
knative.dev/eventing v0.22.0/go.mod h1:LOG7bh0eZQkbYANcnORwke6Yy6aUu62o8GeByaOFfRQ=
knative.dev/eventing-kafka v0.22.0 h1:4Y38npo+j0OfiJbSe919Wcgdl4tNgprd2t+dsTMA+iE=
knative.dev/eventing-kafka v0.22.0/go.mod h1:9FhotJRL329R03cArNsI8fGddLMLpQwlWuyfytUU20E=
knative.dev/hack v0.0.0-20210203173706-8368e1f6eacf/go.mod h1:PHt8x8yX5Z9pPquBEfIj0X66f8iWkWfR0S/sarACJrI=
knative.dev/hack v0.0.0-20210309141825-9b73a256fd9a/go.mod h1:PHt8x8yX5Z9pPquBEfIj0X66f8iWkWfR0S/sarACJrI=
knative.dev/hack v0.0.0-20210317214554-58edbdc42966/go.mod h1:PHt8x8yX5Z9pPquBEfIj0X66f8iWkWfR0S/sarACJrI=
knative.dev/hack v0.0.0-20210325223819-b6ab329907d3 h1:km0Rrh0T9/wA2pivQm1hqSPVwgNgGCHC2WNn3GakZmE=
knative.dev/hack v0.0.0-20210325223819-b6ab329907d3/go.mod h1:PHt8x8yX5Z9pPquBEfIj0X66f8iWkWfR0S/sarACJrI=
knative.dev/hack/schema v0.0.0-20210325223819-b6ab329907d3/go.mod h1:ffjwmdcrH5vN3mPhO8RrF2KfNnbHeCE2C60A+2cv3U0=
knative.dev/networking v0.0.0-20210215030235-088986a1c2a3/go.mod h1:pmAMQjMqQUxpK0UyjE71KljMs6rwDMVIAlvrZsU3I6Y=
knative.dev/networking v0.0.0-20210216014426-94bfc013982b/go.mod h1:Crdn87hxdFd3Jj6PIyrjzGnr8OGHX35k5xo9jlOrjjA=
knative.dev/networking v0.0.0-20210311182125-f51c10d6fcf0/go.mod h1:dBcp0JBxATXsbCKK43cA6LxTricz4Ur3dPHataW5J64=
knative.dev/networking v0.0.0-20210311190926-430a689490e6/go.mod h1:dBcp0JBxATXsbCKK43cA6LxTricz4Ur3dPHataW5J64=
knative.dev/networking v0.0.0-20210329132124-45fe1f5dd35e h1:KVdsfMbpNRON/IMxZJkSlcaCVS6ot9G01A9nxht0eD8=
knative.dev/networking v0.0.0-20210329132124-45fe1f5dd35e/go.mod h1:sfplBxhMqToDapZRmMK2CWvaKmmIEH9MSDCF+c1uMGE=
knative.dev/networking v0.0.0-20210331064822-999a7708876c h1:7ggsYXtltPHjbgxi76hg5g2eOtmg8KaBIP40XJsfMyA=
knative.dev/networking v0.0.0-20210331064822-999a7708876c/go.mod h1:0V6M1AaWPL/MtQLuEx0NxiwDdtb8Y4b4f7P3C8sp0zo=
knative.dev/pkg v0.0.0-20210212203835-448ae657fb5f/go.mod h1:TJSdebQOWX5N2bszohOYVi0H1QtXbtlYLuMghAFBMhY=
knative.dev/pkg v0.0.0-20210215165523-84c98f3c3e7a/go.mod h1:TJSdebQOWX5N2bszohOYVi0H1QtXbtlYLuMghAFBMhY=
knative.dev/pkg v0.0.0-20210216013737-584933f8280b/go.mod h1:TJSdebQOWX5N2bszohOYVi0H1QtXbtlYLuMghAFBMhY=
knative.dev/pkg v0.0.0-20210310173525-bbe0bb3eb1e0/go.mod h1:pn/vClSL/iCW40TlFR91EhtmMmsyPQR2V2LavDAOOMs=
knative.dev/pkg v0.0.0-20210311174826-40488532be3f/go.mod h1:pn/vClSL/iCW40TlFR91EhtmMmsyPQR2V2LavDAOOMs=
knative.dev/pkg v0.0.0-20210318052054-dfeeb1817679/go.mod h1:o1aTlbc+h60DP9P6nd/WmP99Ny9Ls3U/JIjL4xMgqpw=
knative.dev/pkg v0.0.0-20210329065222-9d92ea16c0d3/go.mod h1:PD5g8hUCXq6iR3tILjmZeJBvQfXGnHMPKryq54qHJhg=
knative.dev/pkg v0.0.0-20210330073320-3b7934e599fb h1:xZ7pyPKZTLiDWN4hBTNde5NzmuPKFaV3NVItE18qRZY=
knative.dev/pkg v0.0.0-20210330073320-3b7934e599fb/go.mod h1:PD5g8hUCXq6iR3tILjmZeJBvQfXGnHMPKryq54qHJhg=
knative.dev/pkg v0.0.0-20210330162221-808d62257db6 h1:hl6lY5ShQ7g7E0I+nPbknXwOOgaKmkJ+7TkCrCo80x0=
knative.dev/pkg v0.0.0-20210330162221-808d62257db6/go.mod h1:PD5g8hUCXq6iR3tILjmZeJBvQfXGnHMPKryq54qHJhg=
knative.dev/pkg v0.0.0-20210331062321-6317ec6066f4/go.mod h1:PD5g8hUCXq6iR3tILjmZeJBvQfXGnHMPKryq54qHJhg=
knative.dev/pkg v0.0.0-20210331065221-952fdd90dbb0 h1:z05hcB4br0qz7JdwIoUSTXLTF+7ThuJ+R6NFfXd1Y4Q=
knative.dev/pkg v0.0.0-20210331065221-952fdd90dbb0/go.mod h1:PD5g8hUCXq6iR3tILjmZeJBvQfXGnHMPKryq54qHJhg=
knative.dev/reconciler-test v0.0.0-20210216030508-77f50054d024/go.mod h1:RP/K5xJylB72Go6eAsXYEsQHp4zCCNMNjmsqhvq7wko=
knative.dev/reconciler-test v0.0.0-20210311161026-af80deacbe19/go.mod h1:BqljHB9eQj66yPyxOj62syip0ZZtiG0lw76XrtRe36M=
knative.dev/reconciler-test v0.0.0-20210329193624-ea6f47034b61/go.mod h1:QSd2hWDDwFh+9AHOkiECsj2ZY2DGJBKnj6aT6LITBuw=
knative.dev/reconciler-test v0.0.0-20210329214021-2a67496462a4/go.mod h1:qLfJMHc0i9ENTSet/SUp/FcQm4QVfNTX8ZC//aVQN0M=
knative.dev/serving v0.21.0/go.mod h1:PU9k1Y6YMG27XQldEu5agNkcebvSafUXKXPircQYCsE=
knative.dev/serving v0.21.1-0.20210311225828-1583394c61cb h1:HX5EVjJJqIUoDAWmfulMnGvPFeKJkAC6GAuj9/y97Ig=
knative.dev/serving v0.21.1-0.20210311225828-1583394c61cb/go.mod h1:5cO/KA08FzPBPuCa5CU2lEGZOP8V/zUgvoluuPcL1lQ=
knative.dev/serving v0.22.0 h1:7l7PglDjVA2McFoQNgPvChBrn2koEsvlB+f7LU8bnJk=
knative.dev/serving v0.22.0/go.mod h1:20yuZH4F7cvoovC2Pi1uQBoIbOjllapVSKDkWAXkItA=
modernc.org/cc v1.0.0/go.mod h1:1Sk4//wdnYJiUIxnW8ddKpaOJCF37yAdqYnkxUpaYxw=
modernc.org/golex v1.0.0/go.mod h1:b/QX9oBD/LhixY6NDh+IdGv17hgB+51fET1i2kPSmvk=
modernc.org/mathutil v1.0.0/go.mod h1:wU0vUrJsVWBZ4P6e7xtFJEhFSNsfRLJ8H458uRjg03k=
Expand Down
6 changes: 3 additions & 3 deletions test/e2e-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ export PATH=$PATH:${REPO_ROOT_DIR}
# Will create and delete this namespace (used for all tests, modify if you want a different one used)
export KN_E2E_NAMESPACE=kne2etests

export KNATIVE_EVENTING_VERSION="0.21.0"
export KNATIVE_SERVING_VERSION="0.21.0"
export KNATIVE_EVENTING_VERSION="0.22.0"
export KNATIVE_SERVING_VERSION="0.22.0"

# Strimzi installation config template used for starting up Kafka clusters.
readonly STRIMZI_INSTALLATION_CONFIG_TEMPLATE="${REPO_ROOT_DIR}/test/config/100-strimzi-cluster-operator-0.20.0.yaml"
Expand All @@ -42,7 +42,7 @@ readonly KAFKA_CRD_CONFIG_TEMPLATE="400-kafka-config.yaml"
# Real Kafka channel CRD config , generated from the template directory and modified template file.
readonly KAFKA_CRD_CONFIG_DIR="$(mktemp -d)"
# Kafka channel CRD config template directory.
readonly KAFKA_SOURCE_CRD_YAML="https://github.com/knative-sandbox/eventing-kafka/releases/download/v0.21.0/source.yaml"
readonly KAFKA_SOURCE_CRD_YAML="https://github.com/knative-sandbox/eventing-kafka/releases/download/v0.22.0/source.yaml"

run() {
# Create cluster
Expand Down
42 changes: 31 additions & 11 deletions vendor/knative.dev/client/pkg/kn/commands/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import (
messagingv1beta1 "knative.dev/eventing/pkg/client/clientset/versioned/typed/messaging/v1beta1"
sourcesv1alpha2client "knative.dev/eventing/pkg/client/clientset/versioned/typed/sources/v1alpha2"
servingv1client "knative.dev/serving/pkg/client/clientset/versioned/typed/serving/v1"
servingv1alpha1client "knative.dev/serving/pkg/client/clientset/versioned/typed/serving/v1alpha1"

"knative.dev/client/pkg/sources/v1alpha2"
"knative.dev/client/pkg/util"
Expand All @@ -36,21 +37,23 @@ import (
clienteventingv1beta1 "knative.dev/client/pkg/eventing/v1beta1"
clientmessagingv1beta1 "knative.dev/client/pkg/messaging/v1beta1"
clientservingv1 "knative.dev/client/pkg/serving/v1"
clientservingv1alpha1 "knative.dev/client/pkg/serving/v1alpha1"
)

// KnParams for creating commands. Useful for inserting mocks for testing.
type KnParams struct {
Output io.Writer
KubeCfgPath string
KubeContext string
KubeCluster string
ClientConfig clientcmd.ClientConfig
NewServingClient func(namespace string) (clientservingv1.KnServingClient, error)
NewGitopsServingClient func(namespace string, dir string) (clientservingv1.KnServingClient, error)
NewSourcesClient func(namespace string) (v1alpha2.KnSourcesClient, error)
NewEventingClient func(namespace string) (clienteventingv1beta1.KnEventingClient, error)
NewMessagingClient func(namespace string) (clientmessagingv1beta1.KnMessagingClient, error)
NewDynamicClient func(namespace string) (clientdynamic.KnDynamicClient, error)
Output io.Writer
KubeCfgPath string
KubeContext string
KubeCluster string
ClientConfig clientcmd.ClientConfig
NewServingClient func(namespace string) (clientservingv1.KnServingClient, error)
NewServingV1alpha1Client func(namespace string) (clientservingv1alpha1.KnServingClient, error)
NewGitopsServingClient func(namespace string, dir string) (clientservingv1.KnServingClient, error)
NewSourcesClient func(namespace string) (v1alpha2.KnSourcesClient, error)
NewEventingClient func(namespace string) (clienteventingv1beta1.KnEventingClient, error)
NewMessagingClient func(namespace string) (clientmessagingv1beta1.KnMessagingClient, error)
NewDynamicClient func(namespace string) (clientdynamic.KnDynamicClient, error)

// General global options
LogHTTP bool
Expand All @@ -64,6 +67,10 @@ func (params *KnParams) Initialize() {
params.NewServingClient = params.newServingClient
}

if params.NewServingV1alpha1Client == nil {
params.NewServingV1alpha1Client = params.newServingClientV1alpha1
}

if params.NewGitopsServingClient == nil {
params.NewGitopsServingClient = params.newGitopsServingClient
}
Expand Down Expand Up @@ -98,6 +105,19 @@ func (params *KnParams) newServingClient(namespace string) (clientservingv1.KnSe
return clientservingv1.NewKnServingClient(client, namespace), nil
}

func (params *KnParams) newServingClientV1alpha1(namespace string) (clientservingv1alpha1.KnServingClient, error) {
restConfig, err := params.RestConfig()
if err != nil {
return nil, err
}

client, err := servingv1alpha1client.NewForConfig(restConfig)
if err != nil {
return nil, err
}
return clientservingv1alpha1.NewKnServingClient(client, namespace), nil
}

func (params *KnParams) newGitopsServingClient(namespace string, dir string) (clientservingv1.KnServingClient, error) {
return clientservingv1.NewKnServingGitOpsClient(namespace, dir), nil
}
Expand Down
166 changes: 166 additions & 0 deletions vendor/knative.dev/client/pkg/serving/v1alpha1/client.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,166 @@
// Copyright © 2021 The Knative Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package v1alpha1

import (
"context"

duckv1 "knative.dev/pkg/apis/duck/v1"

v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
knerrors "knative.dev/client/pkg/errors"
"knative.dev/client/pkg/util"
servingv1alpha1 "knative.dev/serving/pkg/apis/serving/v1alpha1"
"knative.dev/serving/pkg/client/clientset/versioned/scheme"
clientv1alpha1 "knative.dev/serving/pkg/client/clientset/versioned/typed/serving/v1alpha1"
)

// KnServingClient to work with Serving v1alpha1 resources
type KnServingClient interface {
// Namespace in which this client is operating for
Namespace() string

// GetDomainMapping
GetDomainMapping(ctx context.Context, name string) (*servingv1alpha1.DomainMapping, error)

// CreateDomainMapping
CreateDomainMapping(ctx context.Context, domainMapping *servingv1alpha1.DomainMapping) error

// UpdateDomainMapping
UpdateDomainMapping(ctx context.Context, domainMapping *servingv1alpha1.DomainMapping) error

// DeleteDomainMapping
DeleteDomainMapping(ctx context.Context, name string) error

// ListDomainMappings
ListDomainMappings(ctx context.Context) (*servingv1alpha1.DomainMappingList, error)
}

type knServingClient struct {
client clientv1alpha1.ServingV1alpha1Interface
namespace string
}

// NewKnServingClient create a new client facade for the provided namespace
func NewKnServingClient(client clientv1alpha1.ServingV1alpha1Interface, namespace string) KnServingClient {
return &knServingClient{
client: client,
namespace: namespace,
}
}

// Namespace in which this client is operating for
func (cl *knServingClient) Namespace() string {
return cl.namespace
}

// GetDomainMapping gets DomainMapping by name
func (cl *knServingClient) GetDomainMapping(ctx context.Context, name string) (*servingv1alpha1.DomainMapping, error) {
dm, err := cl.client.DomainMappings(cl.namespace).Get(ctx, name, v1.GetOptions{})
if err != nil {
return nil, knerrors.GetError(err)
}
err = updateServingGvk(dm)
if err != nil {
return nil, err
}
return dm, nil
}

// CreateDomainMapping creates provided DomainMapping
func (cl *knServingClient) CreateDomainMapping(ctx context.Context, domainMapping *servingv1alpha1.DomainMapping) error {
_, err := cl.client.DomainMappings(cl.namespace).Create(ctx, domainMapping, v1.CreateOptions{})
if err != nil {
return knerrors.GetError(err)
}
return updateServingGvk(domainMapping)
}

// UpdateDomainMapping updates provided DomainMapping
func (cl *knServingClient) UpdateDomainMapping(ctx context.Context, domainMapping *servingv1alpha1.DomainMapping) error {
_, err := cl.client.DomainMappings(cl.namespace).Update(ctx, domainMapping, v1.UpdateOptions{})
if err != nil {
return knerrors.GetError(err)
}
return updateServingGvk(domainMapping)
}

// DeleteDomainMapping deletes DomainMapping by name
func (cl *knServingClient) DeleteDomainMapping(ctx context.Context, name string) error {
err := cl.client.DomainMappings(cl.namespace).Delete(ctx, name, v1.DeleteOptions{})
if err != nil {
return knerrors.GetError(err)
}
return nil
}

// ListDomainMappings lists all DomainMappings
func (cl *knServingClient) ListDomainMappings(ctx context.Context) (*servingv1alpha1.DomainMappingList, error) {
domainMappingList, err := cl.client.DomainMappings(cl.namespace).List(ctx, v1.ListOptions{})
if err != nil {
return nil, knerrors.GetError(err)
}
dmListNew := domainMappingList.DeepCopy()
err = updateServingGvk(dmListNew)
if err != nil {
return nil, err
}
dmListNew.Items = make([]servingv1alpha1.DomainMapping, len(domainMappingList.Items))
for idx, domainMapping := range domainMappingList.Items {
domainMappingClone := domainMapping.DeepCopy()
err := updateServingGvk(domainMappingClone)
if err != nil {
return nil, err
}
dmListNew.Items[idx] = *domainMappingClone
}
return dmListNew, nil
}

func updateServingGvk(obj runtime.Object) error {
return util.UpdateGroupVersionKindWithScheme(obj, servingv1alpha1.SchemeGroupVersion, scheme.Scheme)
}

// DomainMappingBuilder is for building the domainMapping
type DomainMappingBuilder struct {
domainMapping *servingv1alpha1.DomainMapping
}

// NewDomainMappingBuilder for building domainMapping object
func NewDomainMappingBuilder(name string) *DomainMappingBuilder {
return &DomainMappingBuilder{domainMapping: &servingv1alpha1.DomainMapping{
ObjectMeta: v1.ObjectMeta{
Name: name,
},
}}
}

// Namespace for domainMapping builder
func (b *DomainMappingBuilder) Namespace(ns string) *DomainMappingBuilder {
b.domainMapping.Namespace = ns
return b
}

// Reference for domainMapping builder
func (b *DomainMappingBuilder) Reference(reference duckv1.KReference) *DomainMappingBuilder {
b.domainMapping.Spec.Ref = reference
return b
}

// Build to return an instance of domainMapping object
func (b *DomainMappingBuilder) Build() *servingv1alpha1.DomainMapping {
return b.domainMapping
}
Loading

0 comments on commit f101c88

Please sign in to comment.