Auto-update dependencies (#166)

Produced via:
  `dep ensure -update knative.dev/test-infra knative.dev/pkg`
/assign n3wscott
/cc n3wscott
This commit is contained in:
Matt Moore 2019-12-24 09:54:26 -08:00 committed by Knative Prow Robot
parent 996755ee03
commit 0731b295e8
4 changed files with 36 additions and 15 deletions

6
Gopkg.lock generated
View File

@ -931,7 +931,7 @@
[[projects]]
branch = "master"
digest = "1:2a1f47dba842efe06d9fa10c0323f7b8f39a6b6e86e944a40668679f102f413e"
digest = "1:72ffa7ccc391446c34d98ce804c523c164c4979f8bd774e5c826348fb8b59970"
name = "knative.dev/pkg"
packages = [
"apis",
@ -950,7 +950,7 @@
"metrics/metricskey",
]
pruneopts = "T"
revision = "0094d3a89242cddcd8532df4632fb619b2d7da09"
revision = "e73c8084c2670725d3d9aefb2e1479870d5c36d3"
[[projects]]
branch = "master"
@ -961,7 +961,7 @@
"tools/dep-collector",
]
pruneopts = "UT"
revision = "9ea943f31f1b149ab3f853f228e6fb7e59ba9a59"
revision = "935a8f052a483d4a1b1bebe2c80235d6867a8d91"
[[projects]]
digest = "1:8730e0150dfb2b7e173890c8b9868e7a273082ef8e39f4940e3506a481cf895c"

View File

@ -54,7 +54,7 @@ func ChildName(parent, suffix string) string {
if d := longest - len(ret); d > 0 {
ret += suffix[:d]
}
// If due to trumming above we're terminating the string with a `-`,
// If due to trimming above we're terminating the string with a `-`,
// remove it.
return strings.TrimRight(ret, "-")
}

View File

@ -52,20 +52,25 @@ type Request struct {
// Addons: cluster addons to be added to cluster, such as istio
Addons []string
// EnableWorkloadIdentity: whether to enable Workload Identity -
// https://cloud.google.com/kubernetes-engine/docs/how-to/workload-identity or not
EnableWorkloadIdentity bool
}
// DeepCopy will make a deepcopy of the request struct.
func (r *Request) DeepCopy() *Request {
return &Request{
Project: r.Project,
GKEVersion: r.GKEVersion,
ClusterName: r.ClusterName,
MinNodes: r.MinNodes,
MaxNodes: r.MaxNodes,
NodeType: r.NodeType,
Region: r.Region,
Zone: r.Zone,
Addons: r.Addons,
Project: r.Project,
GKEVersion: r.GKEVersion,
ClusterName: r.ClusterName,
MinNodes: r.MinNodes,
MaxNodes: r.MaxNodes,
NodeType: r.NodeType,
Region: r.Region,
Zone: r.Zone,
Addons: r.Addons,
EnableWorkloadIdentity: r.EnableWorkloadIdentity,
}
}
@ -83,12 +88,15 @@ func NewCreateClusterRequest(request *Request) (*container.CreateClusterRequest,
if request.NodeType == "" {
return nil, errors.New("node type cannot be empty")
}
if request.EnableWorkloadIdentity && request.Project == "" {
return nil, errors.New("project cannot be empty if you want Workload Identity")
}
if request.GKEVersion == "" {
request.GKEVersion = defaultGKEVersion
}
return &container.CreateClusterRequest{
ccr := &container.CreateClusterRequest{
Cluster: &container.Cluster{
NodePools: []*container.NodePool{
{
@ -118,5 +126,14 @@ func NewCreateClusterRequest(request *Request) (*container.CreateClusterRequest,
// automatically generated by GKE SDK
MasterAuth: &container.MasterAuth{Username: "admin"},
},
}, nil
}
if request.EnableWorkloadIdentity {
// Equivalent to --identity-namespace=[PROJECT_ID].svc.id.goog, then
// we can configure a Kubernetes service account to act as a Google
// service account.
ccr.Cluster.WorkloadIdentityConfig = &container.WorkloadIdentityConfig{
IdentityNamespace: request.Project + ".svc.id.goog",
}
}
return ccr, nil
}

View File

@ -230,11 +230,15 @@ func (gc *gkeClient) createClusterWithRetries(gcpProject, name string, config Cl
addons = strings.Split(config.Addons, ",")
}
req := &gke.Request{
Project: gcpProject,
ClusterName: name,
MinNodes: config.NodeCount,
MaxNodes: config.NodeCount,
NodeType: config.NodeType,
Addons: addons,
// Enable Workload Identity for performance tests because we need to use a Kubernetes service account to act
// as a Google cloud service account, which is then used for authentication to the metrics data storage system.
EnableWorkloadIdentity: true,
}
creq, err := gke.NewCreateClusterRequest(req)
if err != nil {