Auto-update dependencies (#72)

Produced via:
  `dep ensure -update knative.dev/test-infra knative.dev/pkg`
/assign @mattmoor
This commit is contained in:
mattmoor-sockpuppet 2019-08-14 08:30:09 -07:00 committed by Knative Prow Robot
parent 9dd4330dc6
commit 701c8f52e8
10 changed files with 565 additions and 3 deletions

6
Gopkg.lock generated
View File

@ -927,7 +927,7 @@
[[projects]]
branch = "master"
digest = "1:668f401ec93fc68a0cee8a1ff986301c748313b243e1cbf077db688b47806f75"
digest = "1:7d668b9ed0ede5e4a99aaed9c9f7c786920de47b2c609a88bcff96c1cd54e7da"
name = "knative.dev/pkg"
packages = [
"apis",
@ -946,7 +946,7 @@
"metrics/metricskey",
]
pruneopts = "T"
revision = "a690d27530bdb0e8921805b7893bd4a7865bb215"
revision = "057c0dfb8f56cec704b8d54c1f0517596df78a55"
[[projects]]
branch = "master"
@ -957,7 +957,7 @@
"tools/dep-collector",
]
pruneopts = "UT"
revision = "debabfca4db6699ea762112d7bc439ce04a44690"
revision = "7fa4059a538fb5547e50f036db4e9f8d4eb998aa"
[solve-meta]
analyzer-name = "dep"

View File

@ -0,0 +1,157 @@
/*
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 v1beta1
import (
"time"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"knative.dev/pkg/apis"
"knative.dev/pkg/apis/duck"
apisv1alpha1 "knative.dev/pkg/apis/v1alpha1"
)
// Source is an Implementable "duck type".
var _ duck.Implementable = (*Source)(nil)
// +genclient
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// Source is the minimum resource shape to adhere to the Source Specification.
// This duck type is intended to allow implementors of Sources and
// Importers to verify their own resources meet the expectations.
// This is not a real resource.
// NOTE: The Source Specification is in progress and the shape and names could
// be modified until it has been accepted.
type Source struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Spec SourceSpec `json:"spec"`
Status SourceStatus `json:"status"`
}
type SourceSpec struct {
// Sink is a reference to an object that will resolve to a domain name or a
// URI directly to use as the sink.
Sink apisv1alpha1.Destination `json:"sink,omitempty"`
// CloudEventOverrides defines overrides to control the output format and
// modifications of the event sent to the sink.
// +optional
CloudEventOverrides *CloudEventOverrides `json:"ceOverrides,omitempty"`
}
// CloudEventOverrides defines arguments for a Source that control the output
// format of the CloudEvents produced by the Source.
type CloudEventOverrides struct {
// Extensions specify what attribute are added or overridden on the
// outbound event. Each `Extensions` key-value pair are set on the event as
// an attribute extension independently.
// +optional
Extensions map[string]string `json:"extensions,omitempty"`
}
// SourceStatus shows how we expect folks to embed Addressable in
// their Status field.
type SourceStatus struct {
// inherits duck/v1beta1 Status, which currently provides:
// * ObservedGeneration - the 'Generation' of the Service that was last
// processed by the controller.
// * Conditions - the latest available observations of a resource's current
// state.
Status `json:",inline"`
// SinkURI is the current active sink URI that has been configured for the
// Source.
// +optional
SinkURI *apis.URL `json:"sinkUri,omitempty"`
}
// IsReady returns true if the resource is ready overall.
func (ss *SourceStatus) IsReady() bool {
for _, c := range ss.Conditions {
switch c.Type {
// Look for the "happy" condition, which is the only condition that
// we can reliably understand to be the overall state of the resource.
case apis.ConditionReady, apis.ConditionSucceeded:
return c.IsTrue()
}
}
return false
}
var (
// Verify Source resources meet duck contracts.
_ duck.Populatable = (*Source)(nil)
_ apis.Listable = (*Source)(nil)
)
const (
// SourceConditionSinkProvided has status True when the Source
// has been configured with a sink target that is resolvable.
SourceConditionSinkProvided apis.ConditionType = "SinkProvided"
)
// GetFullType implements duck.Implementable
func (*Source) GetFullType() duck.Populatable {
return &Source{}
}
// Populate implements duck.Populatable
func (s *Source) Populate() {
s.Spec.Sink = apisv1alpha1.Destination{
URI: &apis.URL{
Scheme: "https",
Host: "tableflip.dev",
RawQuery: "flip=mattmoor",
},
}
s.Spec.CloudEventOverrides = &CloudEventOverrides{
Extensions: map[string]string{"boosh": "kakow"},
}
s.Status.ObservedGeneration = 42
s.Status.Conditions = Conditions{{
// Populate ALL fields
Type: SourceConditionSinkProvided,
Status: corev1.ConditionTrue,
LastTransitionTime: apis.VolatileTime{Inner: metav1.NewTime(time.Date(1984, 02, 28, 18, 52, 00, 00, time.UTC))},
}}
s.Status.SinkURI = &apis.URL{
Scheme: "https",
Host: "tableflip.dev",
RawQuery: "flip=mattmoor",
}
}
// GetListType implements apis.Listable
func (*Source) GetListType() runtime.Object {
return &SourceList{}
}
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// SourceList is a list of Source resources
type SourceList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata"`
Items []Source `json:"items"`
}

View File

@ -127,6 +127,29 @@ func (in *AddressableTypeList) DeepCopyObject() runtime.Object {
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *CloudEventOverrides) DeepCopyInto(out *CloudEventOverrides) {
*out = *in
if in.Extensions != nil {
in, out := &in.Extensions, &out.Extensions
*out = make(map[string]string, len(*in))
for key, val := range *in {
(*out)[key] = val
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CloudEventOverrides.
func (in *CloudEventOverrides) DeepCopy() *CloudEventOverrides {
if in == nil {
return nil
}
out := new(CloudEventOverrides)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in Conditions) DeepCopyInto(out *Conditions) {
{
@ -209,6 +232,111 @@ func (in *KResourceList) DeepCopyObject() runtime.Object {
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *Source) DeepCopyInto(out *Source) {
*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 Source.
func (in *Source) DeepCopy() *Source {
if in == nil {
return nil
}
out := new(Source)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *Source) 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 *SourceList) DeepCopyInto(out *SourceList) {
*out = *in
out.TypeMeta = in.TypeMeta
out.ListMeta = in.ListMeta
if in.Items != nil {
in, out := &in.Items, &out.Items
*out = make([]Source, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SourceList.
func (in *SourceList) DeepCopy() *SourceList {
if in == nil {
return nil
}
out := new(SourceList)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *SourceList) 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 *SourceSpec) DeepCopyInto(out *SourceSpec) {
*out = *in
in.Sink.DeepCopyInto(&out.Sink)
if in.CloudEventOverrides != nil {
in, out := &in.CloudEventOverrides, &out.CloudEventOverrides
*out = new(CloudEventOverrides)
(*in).DeepCopyInto(*out)
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SourceSpec.
func (in *SourceSpec) DeepCopy() *SourceSpec {
if in == nil {
return nil
}
out := new(SourceSpec)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *SourceStatus) DeepCopyInto(out *SourceStatus) {
*out = *in
in.Status.DeepCopyInto(&out.Status)
if in.SinkURI != nil {
in, out := &in.SinkURI, &out.SinkURI
*out = new(apis.URL)
(*in).DeepCopyInto(*out)
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SourceStatus.
func (in *SourceStatus) DeepCopy() *SourceStatus {
if in == nil {
return nil
}
out := new(SourceStatus)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *Status) DeepCopyInto(out *Status) {
*out = *in

View File

@ -0,0 +1,5 @@
## THIS IS STILL A WORK IN PROGRESS
## Test Infra 2.0 Supporting Libs
See [high level](https://docs.google.com/document/d/1QHPks3oRKccTpzAOJuU2tgHjyiA0Somm7PwdQVupyk0/edit#heading=h.x9snb54sjlu9) and [low level](https://docs.google.com/document/d/1PQ6DLL8kqMSSmciTSrR9RLaJt8sBgaziLEkwkP9TKec/edit#heading=h.x9snb54sjlu9) designs for more details

View File

@ -0,0 +1,29 @@
/*
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 boskos
// AcquireGKEProject acquires GKE Boskos Project
func AcquireGKEProject() (string, error) {
// TODO: implement the logic
return "", nil
}
// ReleaseGKEProject releases project
func ReleaseGKEProject(name string) error {
// TODO: implement the logic
return nil
}

View File

@ -0,0 +1,29 @@
/*
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 clustermanager
// Client is the entrypoint
type Client interface {
Setup(...interface{}) (ClusterOperations, error)
}
// ClusterOperations contains all provider specific logics
type ClusterOperations interface {
Provider() string
Acquire() error
Delete() error
}

View File

@ -0,0 +1,33 @@
/*
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 clustermanager provides support for managing clusters for e2e tests,
responsible for creating/deleting cluster, and cluster life cycle management if
running in Prow
usage example:
func acquireCluster() {
clusterOps := GKEClient{}.Setup(2, "n1-standard-8", "us-east1", "a", "myproject")
// Cast to GKEOperation
GKEOps := clusterOps.(GKECluster)
if err = GKEOps.Acquire(); err != nil {
log.Fatalf("Failed acquire cluster: '%v'", err)
}
log.Printf("GKE project is: %s", GKEOps.Project)
log.Printf("GKE cluster is: %v", GKEOps.Cluster)
}
*/
package clustermanager

View File

@ -0,0 +1,132 @@
/*
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 clustermanager
import (
"fmt"
"strings"
"knative.dev/pkg/testutils/clustermanager/boskos"
"knative.dev/pkg/testutils/common"
)
// GKEClient implements Client
type GKEClient struct {
}
// GKECluster implements ClusterOperations
type GKECluster struct {
// Project might be GKE specific, so put it here
Project *string
// NeedCleanup tells whether the cluster needs to be deleted afterwards
// This probably should be part of task wrapper's logic
NeedCleanup bool
// TODO: evaluate returning "google.golang.org/api/container/v1.Cluster" when implementing the creation logic
Cluster *string
// Exec is the function used for execute standard shell functions, return stdout and stderr
Exec func(string, ...string) ([]byte, error)
}
// Setup sets up a GKECluster client.
// numNodes: default to 3 if not provided
// nodeType: default to n1-standard-4 if not provided
// region: default to regional cluster if not provided, and use default backup regions
// zone: default is none, must be provided together with region
func (gs *GKEClient) Setup(numNodes *int, nodeType *string, region *string, zone *string, project *string) (ClusterOperations, error) {
gc := &GKECluster{
Exec: standardExec,
}
// check for local run
if nil != project { // if project is supplied, use it and create cluster
gc.Project = project
gc.NeedCleanup = true
} else if err := gc.checkEnvironment(); nil != err {
return nil, fmt.Errorf("failed checking existing cluster: '%v'", err)
} else if nil != gc.Cluster { // return if Cluster was already set by kubeconfig
return gc, nil
}
// check for Prow
if common.IsProw() {
project, err := boskos.AcquireGKEProject()
if nil != err {
return nil, fmt.Errorf("failed acquire boskos project: '%v'", err)
}
gc.Project = &project
}
if nil == gc.Project || "" == *gc.Project {
return nil, fmt.Errorf("gcp project must be set")
}
return gc, nil
}
// Provider returns gke
func (gc *GKECluster) Provider() string {
return "gke"
}
// Acquire gets existing cluster or create a new one
func (gc *GKECluster) Acquire() error {
// Check if using existing cluster
if nil != gc.Cluster {
return nil
}
// TODO: Perform GKE specific cluster creation logics
return nil
}
// Delete deletes a GKE cluster
func (gc *GKECluster) Delete() error {
if !gc.NeedCleanup {
return nil
}
// TODO: Perform GKE specific cluster deletion logics
return nil
}
// checks for existing cluster by looking at kubeconfig,
// and sets up gc.Project and gc.Cluster properly, otherwise fail it.
// if project can be derived from gcloud, sets it up as well
func (gc *GKECluster) checkEnvironment() error {
// if kubeconfig is configured, use it
output, err := gc.Exec("kubectl", "config", "current-context")
if nil == err {
// output should be in the form of gke_PROJECT_REGION_CLUSTER
parts := strings.Split(string(output), "_")
if len(parts) != 4 {
return fmt.Errorf("kubectl current-context is malformed: '%s'", string(output))
}
gc.Project = &parts[1]
gc.Cluster = &parts[3]
return nil
}
if string(output) != "" {
// this is unexpected error, should shout out directly
return fmt.Errorf("failed running kubectl config current-context: '%s'", string(output))
}
// if gcloud is pointing to a project, use it
output, err = gc.Exec("gcloud", "config", "get-value", "project")
if nil != err {
return fmt.Errorf("failed getting gcloud project: '%v'", err)
}
if string(output) != "" {
project := string(output)
gc.Project = &project
}
return nil
}

View File

@ -0,0 +1,26 @@
/*
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 clustermanager
import (
"os/exec"
)
// standardExec executes shell command and returns stdout and stderr
func standardExec(name string, args ...string) ([]byte, error) {
return exec.Command(name, args...).Output()
}

View File

@ -0,0 +1,23 @@
/*
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 common
// IsProw checks if the process is initialized by Prow
func IsProw() bool {
// TODO: Implement
return false
}