add prune and remove unused packages
This commit is contained in:
31
vendor/github.com/kubernetes-csi/csi-lib-utils/CONTRIBUTING.md
generated
vendored
31
vendor/github.com/kubernetes-csi/csi-lib-utils/CONTRIBUTING.md
generated
vendored
@@ -1,31 +0,0 @@
|
||||
# Contributing Guidelines
|
||||
|
||||
Welcome to Kubernetes. We are excited about the prospect of you joining our [community](https://github.com/kubernetes/community)! The Kubernetes community abides by the CNCF [code of conduct](code-of-conduct.md). Here is an excerpt:
|
||||
|
||||
_As contributors and maintainers of this project, and in the interest of fostering an open and welcoming community, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities._
|
||||
|
||||
## Getting Started
|
||||
|
||||
We have full documentation on how to get started contributing here:
|
||||
|
||||
<!---
|
||||
If your repo has certain guidelines for contribution, put them here ahead of the general k8s resources
|
||||
-->
|
||||
|
||||
- [Contributor License Agreement](https://git.k8s.io/community/CLA.md) Kubernetes projects require that you sign a Contributor License Agreement (CLA) before we can accept your pull requests
|
||||
- [Kubernetes Contributor Guide](http://git.k8s.io/community/contributors/guide) - Main contributor documentation, or you can just jump directly to the [contributing section](http://git.k8s.io/community/contributors/guide#contributing)
|
||||
- [Contributor Cheat Sheet](https://git.k8s.io/community/contributors/guide/contributor-cheatsheet.md) - Common resources for existing developers
|
||||
|
||||
## Mentorship
|
||||
|
||||
- [Mentoring Initiatives](https://git.k8s.io/community/mentoring) - We have a diverse set of mentorship programs available that are always looking for volunteers!
|
||||
|
||||
<!---
|
||||
Custom Information - if you're copying this template for the first time you can add custom content here, for example:
|
||||
|
||||
## Contact Information
|
||||
|
||||
- [Slack channel](https://kubernetes.slack.com/messages/kubernetes-users) - Replace `kubernetes-users` with your slack channel string, this will send users directly to your channel.
|
||||
- [Mailing list](URL)
|
||||
|
||||
-->
|
165
vendor/github.com/kubernetes-csi/csi-lib-utils/Gopkg.lock
generated
vendored
165
vendor/github.com/kubernetes-csi/csi-lib-utils/Gopkg.lock
generated
vendored
@@ -1,165 +0,0 @@
|
||||
# This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'.
|
||||
|
||||
|
||||
[[projects]]
|
||||
digest = "1:ffe9824d294da03b391f44e1ae8281281b4afc1bdaa9588c9097785e3af10cec"
|
||||
name = "github.com/davecgh/go-spew"
|
||||
packages = ["spew"]
|
||||
pruneopts = "NUT"
|
||||
revision = "8991bc29aa16c548c550c7ff78260e27b9ab7c73"
|
||||
version = "v1.1.1"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:bff0ce7c8e3d6357fa5a8549bbe4bdb620bddc13c11ae569aa7248ea92e2139f"
|
||||
name = "github.com/golang/protobuf"
|
||||
packages = [
|
||||
"descriptor",
|
||||
"proto",
|
||||
"protoc-gen-go/descriptor",
|
||||
"ptypes",
|
||||
"ptypes/any",
|
||||
"ptypes/duration",
|
||||
"ptypes/timestamp",
|
||||
"ptypes/wrappers",
|
||||
]
|
||||
pruneopts = "NUT"
|
||||
revision = "aa810b61a9c79d51363740d207bb46cf8e620ed5"
|
||||
version = "v1.2.0"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:0028cb19b2e4c3112225cd871870f2d9cf49b9b4276531f03438a88e94be86fe"
|
||||
name = "github.com/pmezard/go-difflib"
|
||||
packages = ["difflib"]
|
||||
pruneopts = "NUT"
|
||||
revision = "792786c7400a136282c1664665ae0a8db921c6c2"
|
||||
version = "v1.0.0"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:0331452965d8695c0a5633e0f509012987681a654f388f2ad0c3b2d7f7004b1c"
|
||||
name = "github.com/stretchr/testify"
|
||||
packages = [
|
||||
"assert",
|
||||
"require",
|
||||
]
|
||||
pruneopts = "NUT"
|
||||
revision = "f35b8ab0b5a2cef36673838d662e249dd9c94686"
|
||||
version = "v1.2.2"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
digest = "1:dc5dcbb306af980306fab456d4788e88c880177227bd488a92d5bef7d8743497"
|
||||
name = "golang.org/x/net"
|
||||
packages = [
|
||||
"context",
|
||||
"http/httpguts",
|
||||
"http2",
|
||||
"http2/hpack",
|
||||
"idna",
|
||||
"internal/timeseries",
|
||||
"trace",
|
||||
]
|
||||
pruneopts = "NUT"
|
||||
revision = "fae4c4e3ad76c295c3d6d259f898136b4bf833a8"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
digest = "1:134392bed1074be912a37ea13483f27e6e827f4e4d6cc319f69d3ac3617d5ac0"
|
||||
name = "golang.org/x/sys"
|
||||
packages = ["unix"]
|
||||
pruneopts = "NUT"
|
||||
revision = "4ed8d59d0b35e1e29334a206d1b3f38b1e5dfb31"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:e7071ed636b5422cc51c0e3a6cebc229d6c9fffc528814b519a980641422d619"
|
||||
name = "golang.org/x/text"
|
||||
packages = [
|
||||
"collate",
|
||||
"collate/build",
|
||||
"internal/colltab",
|
||||
"internal/gen",
|
||||
"internal/tag",
|
||||
"internal/triegen",
|
||||
"internal/ucd",
|
||||
"language",
|
||||
"secure/bidirule",
|
||||
"transform",
|
||||
"unicode/bidi",
|
||||
"unicode/cldr",
|
||||
"unicode/norm",
|
||||
"unicode/rangetable",
|
||||
]
|
||||
pruneopts = "NUT"
|
||||
revision = "f21a4dfb5e38f5895301dc265a8def02365cc3d0"
|
||||
version = "v0.3.0"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
digest = "1:56b0bca90b7e5d1facf5fbdacba23e4e0ce069d25381b8e2f70ef1e7ebfb9c1a"
|
||||
name = "google.golang.org/genproto"
|
||||
packages = ["googleapis/rpc/status"]
|
||||
pruneopts = "NUT"
|
||||
revision = "31ac5d88444a9e7ad18077db9a165d793ad06a2e"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:2f91d3e11b666570f8c923912f1cc8cf2f0c6b7371b2687ee67a8f73f08c6272"
|
||||
name = "google.golang.org/grpc"
|
||||
packages = [
|
||||
".",
|
||||
"balancer",
|
||||
"balancer/base",
|
||||
"balancer/roundrobin",
|
||||
"codes",
|
||||
"connectivity",
|
||||
"credentials",
|
||||
"encoding",
|
||||
"encoding/proto",
|
||||
"grpclog",
|
||||
"internal",
|
||||
"internal/backoff",
|
||||
"internal/channelz",
|
||||
"internal/envconfig",
|
||||
"internal/grpcrand",
|
||||
"internal/transport",
|
||||
"keepalive",
|
||||
"metadata",
|
||||
"naming",
|
||||
"peer",
|
||||
"resolver",
|
||||
"resolver/dns",
|
||||
"resolver/passthrough",
|
||||
"stats",
|
||||
"status",
|
||||
"tap",
|
||||
]
|
||||
pruneopts = "NUT"
|
||||
revision = "2e463a05d100327ca47ac218281906921038fd95"
|
||||
version = "v1.16.0"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:9cc257b3c9ff6a0158c9c661ab6eebda1fe8a4a4453cd5c4044dc9a2ebfb992b"
|
||||
name = "k8s.io/klog"
|
||||
packages = ["."]
|
||||
pruneopts = "NUT"
|
||||
revision = "a5bc97fbc634d635061f3146511332c7e313a55a"
|
||||
version = "v0.1.0"
|
||||
|
||||
[solve-meta]
|
||||
analyzer-name = "dep"
|
||||
analyzer-version = 1
|
||||
input-imports = [
|
||||
"github.com/golang/protobuf/descriptor",
|
||||
"github.com/golang/protobuf/proto",
|
||||
"github.com/golang/protobuf/protoc-gen-go/descriptor",
|
||||
"github.com/golang/protobuf/ptypes/timestamp",
|
||||
"github.com/golang/protobuf/ptypes/wrappers",
|
||||
"github.com/stretchr/testify/assert",
|
||||
"github.com/stretchr/testify/require",
|
||||
"golang.org/x/net/context",
|
||||
"google.golang.org/grpc",
|
||||
"google.golang.org/grpc/codes",
|
||||
"google.golang.org/grpc/connectivity",
|
||||
"google.golang.org/grpc/status",
|
||||
"k8s.io/klog",
|
||||
]
|
||||
solver-name = "gps-cdcl"
|
||||
solver-version = 1
|
7
vendor/github.com/kubernetes-csi/csi-lib-utils/Gopkg.toml
generated
vendored
7
vendor/github.com/kubernetes-csi/csi-lib-utils/Gopkg.toml
generated
vendored
@@ -1,7 +0,0 @@
|
||||
# Refer to https://golang.github.io/dep/docs/Gopkg.toml.html
|
||||
# for detailed Gopkg.toml documentation.
|
||||
|
||||
[prune]
|
||||
go-tests = true
|
||||
non-go = true
|
||||
unused-packages = true
|
20
vendor/github.com/kubernetes-csi/csi-lib-utils/Makefile
generated
vendored
20
vendor/github.com/kubernetes-csi/csi-lib-utils/Makefile
generated
vendored
@@ -1,20 +0,0 @@
|
||||
# Copyright 2018 The Kubernetes 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.
|
||||
|
||||
# No individual commands at the moment, just packages.
|
||||
CMDS=
|
||||
all:
|
||||
go build `go list ./... | grep -v 'vendor'`
|
||||
|
||||
include release-tools/build.make
|
7
vendor/github.com/kubernetes-csi/csi-lib-utils/OWNERS
generated
vendored
7
vendor/github.com/kubernetes-csi/csi-lib-utils/OWNERS
generated
vendored
@@ -1,7 +0,0 @@
|
||||
# See the OWNERS docs: https://git.k8s.io/community/contributors/guide/owners.md
|
||||
|
||||
approvers:
|
||||
- saad-ali
|
||||
- jsafrane
|
||||
- msau42
|
||||
- pohly
|
19
vendor/github.com/kubernetes-csi/csi-lib-utils/README.md
generated
vendored
19
vendor/github.com/kubernetes-csi/csi-lib-utils/README.md
generated
vendored
@@ -1,19 +0,0 @@
|
||||
# csi-lib-utils
|
||||
|
||||
TBD
|
||||
|
||||
## Community, discussion, contribution, and support
|
||||
|
||||
Learn how to engage with the Kubernetes community on the [community page](http://kubernetes.io/community/).
|
||||
|
||||
You can reach the maintainers of this project at:
|
||||
|
||||
- [Slack](http://slack.k8s.io/)
|
||||
- [Mailing List](https://groups.google.com/forum/#!forum/kubernetes-dev)
|
||||
|
||||
### Code of conduct
|
||||
|
||||
Participation in the Kubernetes community is governed by the [Kubernetes Code of Conduct](code-of-conduct.md).
|
||||
|
||||
[owners]: https://git.k8s.io/community/contributors/guide/owners.md
|
||||
[Creative Commons 4.0]: https://git.k8s.io/website/LICENSE
|
13
vendor/github.com/kubernetes-csi/csi-lib-utils/SECURITY_CONTACTS
generated
vendored
13
vendor/github.com/kubernetes-csi/csi-lib-utils/SECURITY_CONTACTS
generated
vendored
@@ -1,13 +0,0 @@
|
||||
# Defined below are the security contacts for this repo.
|
||||
#
|
||||
# They are the contact point for the Product Security Team to reach out
|
||||
# to for triaging and handling of incoming issues.
|
||||
#
|
||||
# The below names agree to abide by the
|
||||
# [Embargo Policy](https://github.com/kubernetes/sig-release/blob/master/security-release-process-documentation/security-release-process.md#embargo-policy)
|
||||
# and will be removed and replaced if they violate that agreement.
|
||||
#
|
||||
# DO NOT REPORT SECURITY VULNERABILITIES DIRECTLY TO THESE NAMES, FOLLOW THE
|
||||
# INSTRUCTIONS AT https://kubernetes.io/security/
|
||||
|
||||
saad-ali
|
3
vendor/github.com/kubernetes-csi/csi-lib-utils/code-of-conduct.md
generated
vendored
3
vendor/github.com/kubernetes-csi/csi-lib-utils/code-of-conduct.md
generated
vendored
@@ -1,3 +0,0 @@
|
||||
# Kubernetes Community Code of Conduct
|
||||
|
||||
Please refer to our [Kubernetes Community Code of Conduct](https://git.k8s.io/community/code-of-conduct.md)
|
308
vendor/github.com/kubernetes-csi/csi-lib-utils/connection/connection_test.go
generated
vendored
308
vendor/github.com/kubernetes-csi/csi-lib-utils/connection/connection_test.go
generated
vendored
@@ -1,308 +0,0 @@
|
||||
/*
|
||||
Copyright 2019 The Kubernetes 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 connection
|
||||
|
||||
import (
|
||||
"context"
|
||||
"io/ioutil"
|
||||
"net"
|
||||
"os"
|
||||
"path"
|
||||
"sync"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/codes"
|
||||
"google.golang.org/grpc/connectivity"
|
||||
"google.golang.org/grpc/status"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func tmpDir(t *testing.T) string {
|
||||
dir, err := ioutil.TempDir("", "connect")
|
||||
require.NoError(t, err, "creating temp directory")
|
||||
return dir
|
||||
}
|
||||
|
||||
const (
|
||||
serverSock = "server.sock"
|
||||
)
|
||||
|
||||
// startServer creates a gRPC server without any registered services.
|
||||
// The returned address can be used to connect to it. The cleanup
|
||||
// function stops it. It can be called multiple times.
|
||||
func startServer(t *testing.T, tmp string) (string, func()) {
|
||||
addr := path.Join(tmp, serverSock)
|
||||
listener, err := net.Listen("unix", addr)
|
||||
require.NoError(t, err, "listening on %s", addr)
|
||||
server := grpc.NewServer()
|
||||
var wg sync.WaitGroup
|
||||
wg.Add(1)
|
||||
go func() {
|
||||
defer wg.Done()
|
||||
if err := server.Serve(listener); err != nil {
|
||||
t.Logf("starting server failed: %s", err)
|
||||
}
|
||||
}()
|
||||
return addr, func() {
|
||||
server.Stop()
|
||||
wg.Wait()
|
||||
if err := os.Remove(addr); err != nil && !os.IsNotExist(err) {
|
||||
t.Logf("remove Unix socket: %s", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestConnect(t *testing.T) {
|
||||
tmp := tmpDir(t)
|
||||
defer os.RemoveAll(tmp)
|
||||
addr, stopServer := startServer(t, tmp)
|
||||
defer stopServer()
|
||||
|
||||
conn, err := Connect(addr)
|
||||
if assert.NoError(t, err, "connect via absolute path") &&
|
||||
assert.NotNil(t, conn, "got a connection") {
|
||||
assert.Equal(t, connectivity.Ready, conn.GetState(), "connection ready")
|
||||
err = conn.Close()
|
||||
assert.NoError(t, err, "closing connection")
|
||||
}
|
||||
}
|
||||
|
||||
func TestConnectUnix(t *testing.T) {
|
||||
tmp := tmpDir(t)
|
||||
defer os.RemoveAll(tmp)
|
||||
addr, stopServer := startServer(t, tmp)
|
||||
defer stopServer()
|
||||
|
||||
conn, err := Connect("unix:///" + addr)
|
||||
if assert.NoError(t, err, "connect with unix:/// prefix") &&
|
||||
assert.NotNil(t, conn, "got a connection") {
|
||||
assert.Equal(t, connectivity.Ready, conn.GetState(), "connection ready")
|
||||
err = conn.Close()
|
||||
assert.NoError(t, err, "closing connection")
|
||||
}
|
||||
}
|
||||
|
||||
func TestWaitForServer(t *testing.T) {
|
||||
tmp := tmpDir(t)
|
||||
defer os.RemoveAll(tmp)
|
||||
|
||||
// We cannot test that Connect() waits forever for the server
|
||||
// to appear, because then we would have to let the test run
|
||||
// forever.... What we can test is that it returns shortly
|
||||
// after the server appears.
|
||||
startTime := time.Now()
|
||||
var startTimeServer time.Time
|
||||
var stopServer func()
|
||||
var wg sync.WaitGroup
|
||||
wg.Add(1)
|
||||
defer func() {
|
||||
wg.Wait()
|
||||
stopServer()
|
||||
}()
|
||||
// Here we pick a relatively long delay before we start the
|
||||
// server. If gRPC did go into an exponential backoff before
|
||||
// retrying the connection attempt, then it probably would
|
||||
// not react promptly to the server becoming ready. Currently
|
||||
// it looks like gRPC tries to connect once per second, with
|
||||
// no exponential backoff.
|
||||
delay := 10 * time.Second
|
||||
go func() {
|
||||
defer wg.Done()
|
||||
t.Logf("sleeping %s before starting server", delay)
|
||||
time.Sleep(delay)
|
||||
startTimeServer = time.Now()
|
||||
_, stopServer = startServer(t, tmp)
|
||||
}()
|
||||
conn, err := Connect(path.Join(tmp, serverSock))
|
||||
if assert.NoError(t, err, "connect via absolute path") {
|
||||
endTime := time.Now()
|
||||
assert.NotNil(t, conn, "got a connection")
|
||||
assert.Equal(t, connectivity.Ready.String(), conn.GetState().String(), "connection ready")
|
||||
if assert.InEpsilon(t, 1*time.Second, endTime.Sub(startTimeServer), 5, "connection established shortly after server starts") {
|
||||
assert.InEpsilon(t, delay, endTime.Sub(startTime), 1)
|
||||
}
|
||||
err = conn.Close()
|
||||
assert.NoError(t, err, "closing connection")
|
||||
}
|
||||
}
|
||||
|
||||
func TestTimout(t *testing.T) {
|
||||
tmp := tmpDir(t)
|
||||
defer os.RemoveAll(tmp)
|
||||
|
||||
startTime := time.Now()
|
||||
timeout := 5 * time.Second
|
||||
conn, err := connect(path.Join(tmp, "no-such.sock"), []grpc.DialOption{grpc.WithTimeout(timeout)}, nil)
|
||||
endTime := time.Now()
|
||||
if assert.Error(t, err, "connection should fail") {
|
||||
assert.InEpsilon(t, timeout, endTime.Sub(startTime), 1, "connection timeout")
|
||||
} else {
|
||||
err := conn.Close()
|
||||
assert.NoError(t, err, "closing connection")
|
||||
}
|
||||
}
|
||||
|
||||
func TestReconnect(t *testing.T) {
|
||||
tmp := tmpDir(t)
|
||||
defer os.RemoveAll(tmp)
|
||||
addr, stopServer := startServer(t, tmp)
|
||||
defer func() {
|
||||
stopServer()
|
||||
}()
|
||||
|
||||
// Allow reconnection (the default).
|
||||
conn, err := Connect(addr)
|
||||
if assert.NoError(t, err, "connect via absolute path") &&
|
||||
assert.NotNil(t, conn, "got a connection") {
|
||||
defer conn.Close()
|
||||
assert.Equal(t, connectivity.Ready, conn.GetState(), "connection ready")
|
||||
|
||||
if err := conn.Invoke(context.Background(), "/connect.v0.Test/Ping", nil, nil); assert.Error(t, err) {
|
||||
errStatus, _ := status.FromError(err)
|
||||
assert.Equal(t, codes.Unimplemented, errStatus.Code(), "not implemented")
|
||||
}
|
||||
|
||||
stopServer()
|
||||
startTime := time.Now()
|
||||
if err := conn.Invoke(context.Background(), "/connect.v0.Test/Ping", nil, nil); assert.Error(t, err) {
|
||||
endTime := time.Now()
|
||||
errStatus, _ := status.FromError(err)
|
||||
assert.Equal(t, codes.Unavailable, errStatus.Code(), "connection lost")
|
||||
assert.InEpsilon(t, time.Second, endTime.Sub(startTime), 1, "connection loss should be detected quickly")
|
||||
}
|
||||
|
||||
// No reconnection either when the server comes back.
|
||||
_, stopServer = startServer(t, tmp)
|
||||
// We need to give gRPC some time. It does not attempt to reconnect
|
||||
// immediately. If we send the method call too soon, the test passes
|
||||
// even though a later method call will go through again.
|
||||
time.Sleep(5 * time.Second)
|
||||
startTime = time.Now()
|
||||
if err := conn.Invoke(context.Background(), "/connect.v0.Test/Ping", nil, nil); assert.Error(t, err) {
|
||||
endTime := time.Now()
|
||||
errStatus, _ := status.FromError(err)
|
||||
assert.Equal(t, codes.Unimplemented, errStatus.Code(), "not implemented")
|
||||
assert.InEpsilon(t, time.Second, endTime.Sub(startTime), 1, "connection loss should be covered from quickly")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestDisconnect(t *testing.T) {
|
||||
tmp := tmpDir(t)
|
||||
defer os.RemoveAll(tmp)
|
||||
addr, stopServer := startServer(t, tmp)
|
||||
defer func() {
|
||||
stopServer()
|
||||
}()
|
||||
|
||||
reconnectCount := 0
|
||||
conn, err := Connect(addr, OnConnectionLoss(func() bool {
|
||||
reconnectCount++
|
||||
// Don't reconnect.
|
||||
return false
|
||||
}))
|
||||
if assert.NoError(t, err, "connect via absolute path") &&
|
||||
assert.NotNil(t, conn, "got a connection") {
|
||||
defer conn.Close()
|
||||
assert.Equal(t, connectivity.Ready, conn.GetState(), "connection ready")
|
||||
|
||||
if err := conn.Invoke(context.Background(), "/connect.v0.Test/Ping", nil, nil); assert.Error(t, err) {
|
||||
errStatus, _ := status.FromError(err)
|
||||
assert.Equal(t, codes.Unimplemented, errStatus.Code(), "not implemented")
|
||||
}
|
||||
|
||||
stopServer()
|
||||
startTime := time.Now()
|
||||
if err := conn.Invoke(context.Background(), "/connect.v0.Test/Ping", nil, nil); assert.Error(t, err) {
|
||||
endTime := time.Now()
|
||||
errStatus, _ := status.FromError(err)
|
||||
assert.Equal(t, codes.Unavailable, errStatus.Code(), "connection lost")
|
||||
assert.InEpsilon(t, time.Second, endTime.Sub(startTime), 1, "connection loss should be detected quickly")
|
||||
}
|
||||
|
||||
// No reconnection either when the server comes back.
|
||||
_, stopServer = startServer(t, tmp)
|
||||
// We need to give gRPC some time. It does not attempt to reconnect
|
||||
// immediately. If we send the method call too soon, the test passes
|
||||
// even though a later method call will go through again.
|
||||
time.Sleep(5 * time.Second)
|
||||
startTime = time.Now()
|
||||
if err := conn.Invoke(context.Background(), "/connect.v0.Test/Ping", nil, nil); assert.Error(t, err) {
|
||||
endTime := time.Now()
|
||||
errStatus, _ := status.FromError(err)
|
||||
assert.Equal(t, codes.Unavailable, errStatus.Code(), "connection still lost")
|
||||
assert.InEpsilon(t, time.Second, endTime.Sub(startTime), 1, "connection loss should be detected quickly")
|
||||
}
|
||||
|
||||
assert.Equal(t, 1, reconnectCount, "connection loss callback should be called once")
|
||||
}
|
||||
}
|
||||
|
||||
func TestExplicitReconnect(t *testing.T) {
|
||||
tmp := tmpDir(t)
|
||||
defer os.RemoveAll(tmp)
|
||||
addr, stopServer := startServer(t, tmp)
|
||||
defer func() {
|
||||
stopServer()
|
||||
}()
|
||||
|
||||
reconnectCount := 0
|
||||
conn, err := Connect(addr, OnConnectionLoss(func() bool {
|
||||
reconnectCount++
|
||||
// Reconnect.
|
||||
return true
|
||||
}))
|
||||
if assert.NoError(t, err, "connect via absolute path") &&
|
||||
assert.NotNil(t, conn, "got a connection") {
|
||||
defer conn.Close()
|
||||
assert.Equal(t, connectivity.Ready, conn.GetState(), "connection ready")
|
||||
|
||||
if err := conn.Invoke(context.Background(), "/connect.v0.Test/Ping", nil, nil); assert.Error(t, err) {
|
||||
errStatus, _ := status.FromError(err)
|
||||
assert.Equal(t, codes.Unimplemented, errStatus.Code(), "not implemented")
|
||||
}
|
||||
|
||||
stopServer()
|
||||
startTime := time.Now()
|
||||
if err := conn.Invoke(context.Background(), "/connect.v0.Test/Ping", nil, nil); assert.Error(t, err) {
|
||||
endTime := time.Now()
|
||||
errStatus, _ := status.FromError(err)
|
||||
assert.Equal(t, codes.Unavailable, errStatus.Code(), "connection lost")
|
||||
assert.InEpsilon(t, time.Second, endTime.Sub(startTime), 1, "connection loss should be detected quickly")
|
||||
}
|
||||
|
||||
// No reconnection either when the server comes back.
|
||||
_, stopServer = startServer(t, tmp)
|
||||
// We need to give gRPC some time. It does not attempt to reconnect
|
||||
// immediately. If we send the method call too soon, the test passes
|
||||
// even though a later method call will go through again.
|
||||
time.Sleep(5 * time.Second)
|
||||
startTime = time.Now()
|
||||
if err := conn.Invoke(context.Background(), "/connect.v0.Test/Ping", nil, nil); assert.Error(t, err) {
|
||||
endTime := time.Now()
|
||||
errStatus, _ := status.FromError(err)
|
||||
assert.Equal(t, codes.Unimplemented, errStatus.Code(), "connection still lost")
|
||||
assert.InEpsilon(t, time.Second, endTime.Sub(startTime), 1, "connection loss should be recovered from quickly")
|
||||
}
|
||||
|
||||
assert.Equal(t, 1, reconnectCount, "connection loss callback should be called once")
|
||||
}
|
||||
}
|
224
vendor/github.com/kubernetes-csi/csi-lib-utils/protosanitizer/protosanitizer_test.go
generated
vendored
224
vendor/github.com/kubernetes-csi/csi-lib-utils/protosanitizer/protosanitizer_test.go
generated
vendored
@@ -1,224 +0,0 @@
|
||||
/*
|
||||
Copyright 2018 The Kubernetes 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 protosanitizer
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
"github.com/golang/protobuf/proto"
|
||||
csi03 "github.com/kubernetes-csi/csi-lib-utils/protosanitizer/test/csi03"
|
||||
csi "github.com/kubernetes-csi/csi-lib-utils/protosanitizer/test/csi10"
|
||||
"github.com/kubernetes-csi/csi-lib-utils/protosanitizer/test/csitest"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestStripSecrets(t *testing.T) {
|
||||
secretName := "secret-abc"
|
||||
secretValue := "123"
|
||||
|
||||
// CSI 0.3.0.
|
||||
createVolumeCSI03 := &csi03.CreateVolumeRequest{
|
||||
AccessibilityRequirements: &csi03.TopologyRequirement{
|
||||
Requisite: []*csi03.Topology{
|
||||
&csi03.Topology{
|
||||
Segments: map[string]string{
|
||||
"foo": "bar",
|
||||
"x": "y",
|
||||
},
|
||||
},
|
||||
&csi03.Topology{
|
||||
Segments: map[string]string{
|
||||
"a": "b",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
Name: "foo",
|
||||
VolumeCapabilities: []*csi03.VolumeCapability{
|
||||
&csi03.VolumeCapability{
|
||||
AccessType: &csi03.VolumeCapability_Mount{
|
||||
Mount: &csi03.VolumeCapability_MountVolume{
|
||||
FsType: "ext4",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
CapacityRange: &csi03.CapacityRange{
|
||||
RequiredBytes: 1024,
|
||||
},
|
||||
ControllerCreateSecrets: map[string]string{
|
||||
secretName: secretValue,
|
||||
"secret-xyz": "987",
|
||||
},
|
||||
}
|
||||
|
||||
// Current spec.
|
||||
createVolume := &csi.CreateVolumeRequest{
|
||||
AccessibilityRequirements: &csi.TopologyRequirement{
|
||||
Requisite: []*csi.Topology{
|
||||
&csi.Topology{
|
||||
Segments: map[string]string{
|
||||
"foo": "bar",
|
||||
"x": "y",
|
||||
},
|
||||
},
|
||||
&csi.Topology{
|
||||
Segments: map[string]string{
|
||||
"a": "b",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
Name: "foo",
|
||||
VolumeCapabilities: []*csi.VolumeCapability{
|
||||
&csi.VolumeCapability{
|
||||
AccessType: &csi.VolumeCapability_Mount{
|
||||
Mount: &csi.VolumeCapability_MountVolume{
|
||||
FsType: "ext4",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
CapacityRange: &csi.CapacityRange{
|
||||
RequiredBytes: 1024,
|
||||
},
|
||||
Secrets: map[string]string{
|
||||
secretName: secretValue,
|
||||
"secret-xyz": "987",
|
||||
},
|
||||
}
|
||||
|
||||
// Revised spec with more secret fields.
|
||||
createVolumeFuture := &csitest.CreateVolumeRequest{
|
||||
CapacityRange: &csitest.CapacityRange{
|
||||
RequiredBytes: 1024,
|
||||
},
|
||||
MaybeSecretMap: map[int64]*csitest.VolumeCapability{
|
||||
1: &csitest.VolumeCapability{ArraySecret: "aaa"},
|
||||
2: &csitest.VolumeCapability{ArraySecret: "bbb"},
|
||||
},
|
||||
Name: "foo",
|
||||
NewSecretInt: 42,
|
||||
Seecreets: map[string]string{
|
||||
secretName: secretValue,
|
||||
"secret-xyz": "987",
|
||||
},
|
||||
VolumeCapabilities: []*csitest.VolumeCapability{
|
||||
&csitest.VolumeCapability{
|
||||
AccessType: &csitest.VolumeCapability_Mount{
|
||||
Mount: &csitest.VolumeCapability_MountVolume{
|
||||
FsType: "ext4",
|
||||
},
|
||||
},
|
||||
ArraySecret: "knock knock",
|
||||
},
|
||||
&csitest.VolumeCapability{
|
||||
ArraySecret: "Who's there?",
|
||||
},
|
||||
},
|
||||
VolumeContentSource: &csitest.VolumeContentSource{
|
||||
Type: &csitest.VolumeContentSource_Volume{
|
||||
Volume: &csitest.VolumeContentSource_VolumeSource{
|
||||
VolumeId: "abc",
|
||||
OneofSecretField: "hello",
|
||||
},
|
||||
},
|
||||
NestedSecretField: "world",
|
||||
},
|
||||
}
|
||||
|
||||
type testcase struct {
|
||||
original, stripped interface{}
|
||||
}
|
||||
|
||||
cases := []testcase{
|
||||
{nil, "null"},
|
||||
{1, "1"},
|
||||
{"hello world", `"hello world"`},
|
||||
{true, "true"},
|
||||
{false, "false"},
|
||||
{&csi.CreateVolumeRequest{}, `{}`},
|
||||
// Test case from https://github.com/kubernetes-csi/csi-lib-utils/pull/1#pullrequestreview-180126394.
|
||||
{&csi.CreateVolumeRequest{
|
||||
Name: "test-volume",
|
||||
CapacityRange: &csi.CapacityRange{
|
||||
RequiredBytes: int64(1024),
|
||||
LimitBytes: int64(1024),
|
||||
},
|
||||
VolumeCapabilities: []*csi.VolumeCapability{
|
||||
&csi.VolumeCapability{
|
||||
AccessType: &csi.VolumeCapability_Mount{
|
||||
Mount: &csi.VolumeCapability_MountVolume{
|
||||
FsType: "ext4",
|
||||
MountFlags: []string{"flag1", "flag2", "flag3"},
|
||||
},
|
||||
},
|
||||
AccessMode: &csi.VolumeCapability_AccessMode{
|
||||
Mode: csi.VolumeCapability_AccessMode_MULTI_NODE_MULTI_WRITER,
|
||||
},
|
||||
},
|
||||
},
|
||||
Secrets: map[string]string{"secret1": "secret1", "secret2": "secret2"},
|
||||
Parameters: map[string]string{"param1": "param1", "param2": "param2"},
|
||||
VolumeContentSource: &csi.VolumeContentSource{},
|
||||
AccessibilityRequirements: &csi.TopologyRequirement{},
|
||||
}, `{"accessibility_requirements":{},"capacity_range":{"limit_bytes":1024,"required_bytes":1024},"name":"test-volume","parameters":{"param1":"param1","param2":"param2"},"secrets":"***stripped***","volume_capabilities":[{"AccessType":{"Mount":{"fs_type":"ext4","mount_flags":["flag1","flag2","flag3"]}},"access_mode":{"mode":5}}],"volume_content_source":{"Type":null}}`},
|
||||
{createVolume, `{"accessibility_requirements":{"requisite":[{"segments":{"foo":"bar","x":"y"}},{"segments":{"a":"b"}}]},"capacity_range":{"required_bytes":1024},"name":"foo","secrets":"***stripped***","volume_capabilities":[{"AccessType":{"Mount":{"fs_type":"ext4"}}}]}`},
|
||||
{createVolumeCSI03, `{"accessibility_requirements":{"requisite":[{"segments":{"foo":"bar","x":"y"}},{"segments":{"a":"b"}}]},"capacity_range":{"required_bytes":1024},"controller_create_secrets":"***stripped***","name":"foo","volume_capabilities":[{"AccessType":{"Mount":{"fs_type":"ext4"}}}]}`},
|
||||
{&csitest.CreateVolumeRequest{}, `{}`},
|
||||
{createVolumeFuture,
|
||||
// Secrets are *not* removed from all fields yet. This will have to be fixed one way or another
|
||||
// before the CSI spec can start using secrets there (currently it doesn't).
|
||||
// The test is still useful because it shows that also complicated fields get serialized.
|
||||
// `{"capacity_range":{"required_bytes":1024},"maybe_secret_map":{"1":{"AccessType":null,"array_secret":"***stripped***"},"2":{"AccessType":null,"array_secret":"***stripped***"}},"name":"foo","new_secret_int":"***stripped***","seecreets":"***stripped***","volume_capabilities":[{"AccessType":{"Mount":{"fs_type":"ext4"}},"array_secret":"***stripped***"},{"AccessType":null,"array_secret":"***stripped***"}],"volume_content_source":{"Type":{"Volume":{"oneof_secret_field":"***stripped***","volume_id":"abc"}},"nested_secret_field":"***stripped***"}}`,
|
||||
`{"capacity_range":{"required_bytes":1024},"maybe_secret_map":{"1":{"AccessType":null,"array_secret":"aaa"},"2":{"AccessType":null,"array_secret":"bbb"}},"name":"foo","new_secret_int":"***stripped***","seecreets":"***stripped***","volume_capabilities":[{"AccessType":{"Mount":{"fs_type":"ext4"}},"array_secret":"***stripped***"},{"AccessType":null,"array_secret":"***stripped***"}],"volume_content_source":{"Type":{"Volume":{"oneof_secret_field":"hello","volume_id":"abc"}},"nested_secret_field":"***stripped***"}}`,
|
||||
},
|
||||
}
|
||||
|
||||
// Message from revised spec as received by a sidecar based on the current spec.
|
||||
// The XXX_unrecognized field contains secrets and must not get logged.
|
||||
unknownFields := &csi.CreateVolumeRequest{}
|
||||
data, err := proto.Marshal(createVolumeFuture)
|
||||
if assert.NoError(t, err, "marshall future message") &&
|
||||
assert.NoError(t, proto.Unmarshal(data, unknownFields), "unmarshal with unknown fields") {
|
||||
cases = append(cases, testcase{unknownFields,
|
||||
`{"capacity_range":{"required_bytes":1024},"name":"foo","secrets":"***stripped***","volume_capabilities":[{"AccessType":{"Mount":{"fs_type":"ext4"}}},{"AccessType":null}],"volume_content_source":{"Type":{"Volume":{"volume_id":"abc"}}}}`,
|
||||
})
|
||||
}
|
||||
|
||||
for _, c := range cases {
|
||||
before := fmt.Sprint(c.original)
|
||||
var stripped fmt.Stringer
|
||||
if _, ok := c.original.(*csi03.CreateVolumeRequest); ok {
|
||||
stripped = StripSecretsCSI03(c.original)
|
||||
} else {
|
||||
stripped = StripSecrets(c.original)
|
||||
}
|
||||
if assert.Equal(t, c.stripped, fmt.Sprintf("%s", stripped), "unexpected result for fmt s of %s", c.original) {
|
||||
if assert.Equal(t, c.stripped, fmt.Sprintf("%v", stripped), "unexpected result for fmt v of %s", c.original) {
|
||||
assert.Equal(t, c.stripped, fmt.Sprintf("%+v", stripped), "unexpected result for fmt +v of %s", c.original)
|
||||
}
|
||||
}
|
||||
assert.Equal(t, before, fmt.Sprint(c.original), "original value modified")
|
||||
}
|
||||
|
||||
// The secret is hidden because StripSecrets is a struct referencing it.
|
||||
dump := fmt.Sprintf("%#v", StripSecrets(createVolume))
|
||||
assert.NotContains(t, dump, secretName)
|
||||
assert.NotContains(t, dump, secretValue)
|
||||
}
|
5
vendor/github.com/kubernetes-csi/csi-lib-utils/protosanitizer/test/.gitignore
generated
vendored
5
vendor/github.com/kubernetes-csi/csi-lib-utils/protosanitizer/test/.gitignore
generated
vendored
@@ -1,5 +0,0 @@
|
||||
/protoc
|
||||
/protoc-gen-go
|
||||
/csi.a
|
||||
/.protoc
|
||||
.build
|
136
vendor/github.com/kubernetes-csi/csi-lib-utils/protosanitizer/test/Makefile
generated
vendored
136
vendor/github.com/kubernetes-csi/csi-lib-utils/protosanitizer/test/Makefile
generated
vendored
@@ -1,136 +0,0 @@
|
||||
all: build
|
||||
|
||||
########################################################################
|
||||
## GOLANG ##
|
||||
########################################################################
|
||||
|
||||
# If GOPATH isn't defined then set its default location.
|
||||
ifeq (,$(strip $(GOPATH)))
|
||||
GOPATH := $(HOME)/go
|
||||
else
|
||||
# If GOPATH is already set then update GOPATH to be its own
|
||||
# first element.
|
||||
GOPATH := $(word 1,$(subst :, ,$(GOPATH)))
|
||||
endif
|
||||
export GOPATH
|
||||
|
||||
|
||||
########################################################################
|
||||
## PROTOC ##
|
||||
########################################################################
|
||||
|
||||
# Only set PROTOC_VER if it has an empty value.
|
||||
ifeq (,$(strip $(PROTOC_VER)))
|
||||
PROTOC_VER := 3.5.1
|
||||
endif
|
||||
|
||||
PROTOC_OS := $(shell uname -s)
|
||||
ifeq (Darwin,$(PROTOC_OS))
|
||||
PROTOC_OS := osx
|
||||
endif
|
||||
|
||||
PROTOC_ARCH := $(shell uname -m)
|
||||
ifeq (i386,$(PROTOC_ARCH))
|
||||
PROTOC_ARCH := x86_32
|
||||
endif
|
||||
|
||||
PROTOC := ./protoc
|
||||
PROTOC_ZIP := protoc-$(PROTOC_VER)-$(PROTOC_OS)-$(PROTOC_ARCH).zip
|
||||
PROTOC_URL := https://github.com/google/protobuf/releases/download/v$(PROTOC_VER)/$(PROTOC_ZIP)
|
||||
PROTOC_TMP_DIR := .protoc
|
||||
PROTOC_TMP_BIN := $(PROTOC_TMP_DIR)/bin/protoc
|
||||
|
||||
$(PROTOC):
|
||||
-mkdir -p "$(PROTOC_TMP_DIR)" && \
|
||||
curl -L $(PROTOC_URL) -o "$(PROTOC_TMP_DIR)/$(PROTOC_ZIP)" && \
|
||||
unzip "$(PROTOC_TMP_DIR)/$(PROTOC_ZIP)" -d "$(PROTOC_TMP_DIR)" && \
|
||||
chmod 0755 "$(PROTOC_TMP_BIN)" && \
|
||||
cp -f "$(PROTOC_TMP_BIN)" "$@"
|
||||
stat "$@" > /dev/null 2>&1
|
||||
|
||||
|
||||
########################################################################
|
||||
## PROTOC-GEN-GO ##
|
||||
########################################################################
|
||||
|
||||
# This is the recipe for getting and installing the go plug-in
|
||||
# for protoc
|
||||
PROTOC_GEN_GO_PKG := github.com/golang/protobuf/protoc-gen-go
|
||||
PROTOC_GEN_GO := protoc-gen-go
|
||||
$(PROTOC_GEN_GO): PROTOBUF_PKG := $(dir $(PROTOC_GEN_GO_PKG))
|
||||
$(PROTOC_GEN_GO): PROTOBUF_VERSION := v1.2.0
|
||||
$(PROTOC_GEN_GO):
|
||||
mkdir -p $(dir $(GOPATH)/src/$(PROTOBUF_PKG))
|
||||
test -d $(GOPATH)/src/$(PROTOBUF_PKG)/.git || git clone https://$(PROTOBUF_PKG) $(GOPATH)/src/$(PROTOBUF_PKG)
|
||||
(cd $(GOPATH)/src/$(PROTOBUF_PKG) && \
|
||||
(test "$$(git describe --tags | head -1)" = "$(PROTOBUF_VERSION)" || \
|
||||
(git fetch && git checkout tags/$(PROTOBUF_VERSION))))
|
||||
(cd $(GOPATH)/src/$(PROTOBUF_PKG) && go get -v -d $$(go list -f '{{ .ImportPath }}' ./...)) && \
|
||||
go build -o "$@" $(PROTOC_GEN_GO_PKG)
|
||||
|
||||
|
||||
########################################################################
|
||||
## PATH ##
|
||||
########################################################################
|
||||
|
||||
# Update PATH with the current directory. This enables the protoc
|
||||
# binary to discover the protoc-gen-go binary, built inside this
|
||||
# directory.
|
||||
export PATH := $(shell pwd):$(PATH)
|
||||
|
||||
|
||||
########################################################################
|
||||
## BUILD ##
|
||||
########################################################################
|
||||
CSI_PROTO := ./csitest.proto
|
||||
CSI_PKG_ROOT := github.com/kubernetes-csi/csi-lib-utils/protosanitizer/test
|
||||
CSI_PKG_SUB := $(shell cat $(CSI_PROTO) | sed -n -e 's/^package.\([^;]*\).v[0-9]\+;$$/\1/p'|tr '.' '/')
|
||||
CSI_BUILD := $(CSI_PKG_SUB)/.build
|
||||
CSI_GO := $(CSI_PKG_SUB)/csitest.pb.go
|
||||
CSI_A := csi.a
|
||||
CSI_GO_TMP := $(CSI_BUILD)/$(CSI_PKG_ROOT)/csitest.pb.go
|
||||
|
||||
# This recipe generates the go language bindings to a temp area.
|
||||
$(CSI_GO_TMP): HERE := $(shell pwd)
|
||||
$(CSI_GO_TMP): PTYPES_PKG := github.com/golang/protobuf/ptypes
|
||||
$(CSI_GO_TMP): GO_OUT := plugins=grpc
|
||||
$(CSI_GO_TMP): GO_OUT := $(GO_OUT),Mgoogle/protobuf/descriptor.proto=github.com/golang/protobuf/protoc-gen-go/descriptor
|
||||
$(CSI_GO_TMP): GO_OUT := $(GO_OUT),Mgoogle/protobuf/wrappers.proto=$(PTYPES_PKG)/wrappers
|
||||
$(CSI_GO_TMP): GO_OUT := $(GO_OUT):"$(HERE)/$(CSI_BUILD)"
|
||||
$(CSI_GO_TMP): INCLUDE := -I$(GOPATH)/src -I$(HERE)/$(PROTOC_TMP_DIR)/include
|
||||
$(CSI_GO_TMP): $(CSI_PROTO) | $(PROTOC) $(PROTOC_GEN_GO)
|
||||
@mkdir -p "$(@D)"
|
||||
(cd "$(GOPATH)/src" && \
|
||||
$(HERE)/$(PROTOC) $(INCLUDE) --go_out=$(GO_OUT) "$(CSI_PKG_ROOT)/$(<F)")
|
||||
|
||||
# The temp language bindings are compared to the ones that are
|
||||
# versioned. If they are different then it means the language
|
||||
# bindings were not updated prior to being committed.
|
||||
$(CSI_GO): $(CSI_GO_TMP)
|
||||
ifeq (true,$(TRAVIS))
|
||||
diff "$@" "$?"
|
||||
else
|
||||
@mkdir -p "$(@D)"
|
||||
diff "$@" "$?" > /dev/null 2>&1 || cp -f "$?" "$@"
|
||||
endif
|
||||
|
||||
# This recipe builds the Go archive from the sources in three steps:
|
||||
#
|
||||
# 1. Go get any missing dependencies.
|
||||
# 2. Cache the packages.
|
||||
# 3. Build the archive file.
|
||||
$(CSI_A): $(CSI_GO)
|
||||
go get -v -d ./...
|
||||
go install ./$(CSI_PKG_SUB)
|
||||
go build -o "$@" ./$(CSI_PKG_SUB)
|
||||
|
||||
build: $(CSI_A)
|
||||
|
||||
clean:
|
||||
go clean -i ./...
|
||||
rm -rf "$(CSI_A)" "$(CSI_GO)" "$(CSI_BUILD)"
|
||||
|
||||
clobber: clean
|
||||
rm -fr "$(PROTOC)" "$(PROTOC_GEN_GO)" "$(CSI_PKG_SUB)" "$(PROTOC_TMP_DIR)"
|
||||
|
||||
.PHONY: clean clobber
|
2
vendor/github.com/kubernetes-csi/csi-lib-utils/protosanitizer/test/README.md
generated
vendored
2
vendor/github.com/kubernetes-csi/csi-lib-utils/protosanitizer/test/README.md
generated
vendored
@@ -1,2 +0,0 @@
|
||||
This is a *modified* version of the CSI 1.0.0 spec. It's only purpose is
|
||||
to test the stripping of secret fields.
|
1203
vendor/github.com/kubernetes-csi/csi-lib-utils/protosanitizer/test/csi.proto
generated
vendored
1203
vendor/github.com/kubernetes-csi/csi-lib-utils/protosanitizer/test/csi.proto
generated
vendored
File diff suppressed because it is too large
Load Diff
4991
vendor/github.com/kubernetes-csi/csi-lib-utils/protosanitizer/test/csi03/csi.pb.go
generated
vendored
4991
vendor/github.com/kubernetes-csi/csi-lib-utils/protosanitizer/test/csi03/csi.pb.go
generated
vendored
File diff suppressed because it is too large
Load Diff
5277
vendor/github.com/kubernetes-csi/csi-lib-utils/protosanitizer/test/csi10/csi.pb.go
generated
vendored
5277
vendor/github.com/kubernetes-csi/csi-lib-utils/protosanitizer/test/csi10/csi.pb.go
generated
vendored
File diff suppressed because it is too large
Load Diff
1217
vendor/github.com/kubernetes-csi/csi-lib-utils/protosanitizer/test/csitest.proto
generated
vendored
1217
vendor/github.com/kubernetes-csi/csi-lib-utils/protosanitizer/test/csitest.proto
generated
vendored
File diff suppressed because it is too large
Load Diff
5326
vendor/github.com/kubernetes-csi/csi-lib-utils/protosanitizer/test/csitest/csitest.pb.go
generated
vendored
5326
vendor/github.com/kubernetes-csi/csi-lib-utils/protosanitizer/test/csitest/csitest.pb.go
generated
vendored
File diff suppressed because it is too large
Load Diff
31
vendor/github.com/kubernetes-csi/csi-lib-utils/release-tools/CONTRIBUTING.md
generated
vendored
31
vendor/github.com/kubernetes-csi/csi-lib-utils/release-tools/CONTRIBUTING.md
generated
vendored
@@ -1,31 +0,0 @@
|
||||
# Contributing Guidelines
|
||||
|
||||
Welcome to Kubernetes. We are excited about the prospect of you joining our [community](https://github.com/kubernetes/community)! The Kubernetes community abides by the CNCF [code of conduct](code-of-conduct.md). Here is an excerpt:
|
||||
|
||||
_As contributors and maintainers of this project, and in the interest of fostering an open and welcoming community, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities._
|
||||
|
||||
## Getting Started
|
||||
|
||||
We have full documentation on how to get started contributing here:
|
||||
|
||||
<!---
|
||||
If your repo has certain guidelines for contribution, put them here ahead of the general k8s resources
|
||||
-->
|
||||
|
||||
- [Contributor License Agreement](https://git.k8s.io/community/CLA.md) Kubernetes projects require that you sign a Contributor License Agreement (CLA) before we can accept your pull requests
|
||||
- [Kubernetes Contributor Guide](http://git.k8s.io/community/contributors/guide) - Main contributor documentation, or you can just jump directly to the [contributing section](http://git.k8s.io/community/contributors/guide#contributing)
|
||||
- [Contributor Cheat Sheet](https://git.k8s.io/community/contributors/guide/contributor-cheatsheet.md) - Common resources for existing developers
|
||||
|
||||
## Mentorship
|
||||
|
||||
- [Mentoring Initiatives](https://git.k8s.io/community/mentoring) - We have a diverse set of mentorship programs available that are always looking for volunteers!
|
||||
|
||||
<!---
|
||||
Custom Information - if you're copying this template for the first time you can add custom content here, for example:
|
||||
|
||||
## Contact Information
|
||||
|
||||
- [Slack channel](https://kubernetes.slack.com/messages/kubernetes-users) - Replace `kubernetes-users` with your slack channel string, this will send users directly to your channel.
|
||||
- [Mailing list](URL)
|
||||
|
||||
-->
|
11
vendor/github.com/kubernetes-csi/csi-lib-utils/release-tools/OWNERS
generated
vendored
11
vendor/github.com/kubernetes-csi/csi-lib-utils/release-tools/OWNERS
generated
vendored
@@ -1,11 +0,0 @@
|
||||
# See the OWNERS docs: https://git.k8s.io/community/contributors/guide/owners.md
|
||||
|
||||
approvers:
|
||||
- saad-ali
|
||||
- msau42
|
||||
- pohly
|
||||
|
||||
reviewers:
|
||||
- saad-ali
|
||||
- msau42
|
||||
- pohly
|
51
vendor/github.com/kubernetes-csi/csi-lib-utils/release-tools/README.md
generated
vendored
51
vendor/github.com/kubernetes-csi/csi-lib-utils/release-tools/README.md
generated
vendored
@@ -1,51 +0,0 @@
|
||||
# [csi-release-tools](https://github.com/kubernetes-csi/csi-release-tools)
|
||||
|
||||
These build and test rules can be shared between different Go projects
|
||||
without modifications. Customization for the different projects happen
|
||||
in the top-level Makefile.
|
||||
|
||||
The rules include support for building and pushing Docker images, with
|
||||
the following features:
|
||||
- one or more command and image per project
|
||||
- push canary and/or tagged release images
|
||||
- automatically derive the image tag(s) from repo tags
|
||||
- the source code revision is stored in a "revision" image label
|
||||
- never overwrites an existing release image
|
||||
|
||||
Usage
|
||||
-----
|
||||
|
||||
The expected repository layout is:
|
||||
- `cmd/*/*.go` - source code for each command
|
||||
- `cmd/*/Dockerfile` - docker file for each command or
|
||||
Dockerfile in the root when only building a single command
|
||||
- `Makefile` - includes `release-tools/build.make` and sets
|
||||
configuration variables
|
||||
- `.travis.yml` - a symlink to `release-tools/.travis.yml`
|
||||
|
||||
To create a release, tag a certain revision with a name that
|
||||
starts with `v`, for example `v1.0.0`, then `make push`
|
||||
while that commit is checked out.
|
||||
|
||||
It does not matter on which branch that revision exists, i.e. it is
|
||||
possible to create releases directly from master. A release branch can
|
||||
still be created for maintenance releases later if needed.
|
||||
|
||||
Release branches are expected to be named `release-x.y` for releases
|
||||
`x.y.z`. Building from such a branch creates `x.y-canary`
|
||||
images. Building from master creates the main `canary` image.
|
||||
|
||||
Sharing and updating
|
||||
--------------------
|
||||
|
||||
[`git subtree`](https://github.com/git/git/blob/master/contrib/subtree/git-subtree.txt)
|
||||
is the recommended way of maintaining a copy of the rules inside the
|
||||
`release-tools` directory of a project. This way, it is possible to make
|
||||
changes also locally, test them and then push them back to the shared
|
||||
repository at a later time.
|
||||
|
||||
Cheat sheet:
|
||||
|
||||
- `git subtree add --prefix=release-tools https://github.com/kubernetes-csi/csi-release-tools.git master` - add release tools to a repo which does not have them yet (only once)
|
||||
- `git subtree pull --prefix=release-tools https://github.com/kubernetes-csi/csi-release-tools.git master` - update local copy to latest upstream (whenever upstream changes)
|
||||
- edit, `git commit`, `git subtree push --prefix=release-tools git@github.com:<user>/csi-release-tools.git <my-new-or-existing-branch>` - push to a new branch before submitting a PR
|
5
vendor/github.com/kubernetes-csi/csi-lib-utils/release-tools/RELEASE.md
generated
vendored
5
vendor/github.com/kubernetes-csi/csi-lib-utils/release-tools/RELEASE.md
generated
vendored
@@ -1,5 +0,0 @@
|
||||
# Release Process
|
||||
|
||||
No tagged releases are planned at this point. The intention is to keep
|
||||
the master branch in a state such that it can be used for all
|
||||
supported branches in downstream repos which use these files.
|
14
vendor/github.com/kubernetes-csi/csi-lib-utils/release-tools/SECURITY_CONTACTS
generated
vendored
14
vendor/github.com/kubernetes-csi/csi-lib-utils/release-tools/SECURITY_CONTACTS
generated
vendored
@@ -1,14 +0,0 @@
|
||||
# Defined below are the security contacts for this repo.
|
||||
#
|
||||
# They are the contact point for the Product Security Team to reach out
|
||||
# to for triaging and handling of incoming issues.
|
||||
#
|
||||
# The below names agree to abide by the
|
||||
# [Embargo Policy](https://github.com/kubernetes/sig-release/blob/master/security-release-process-documentation/security-release-process.md#embargo-policy)
|
||||
# and will be removed and replaced if they violate that agreement.
|
||||
#
|
||||
# DO NOT REPORT SECURITY VULNERABILITIES DIRECTLY TO THESE NAMES, FOLLOW THE
|
||||
# INSTRUCTIONS AT https://kubernetes.io/security/
|
||||
|
||||
saad-ali
|
||||
msau42
|
124
vendor/github.com/kubernetes-csi/csi-lib-utils/release-tools/build.make
generated
vendored
124
vendor/github.com/kubernetes-csi/csi-lib-utils/release-tools/build.make
generated
vendored
@@ -1,124 +0,0 @@
|
||||
# Copyright 2019 The Kubernetes 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.
|
||||
|
||||
.PHONY: build-% build container-% container push-% push clean test
|
||||
|
||||
# A space-separated list of all commands in the repository, must be
|
||||
# set in main Makefile of a repository.
|
||||
# CMDS=
|
||||
|
||||
# This is the default. It can be overridden in the main Makefile after
|
||||
# including build.make.
|
||||
REGISTRY_NAME=quay.io/k8scsi
|
||||
|
||||
# Revision that gets built into each binary via the main.version
|
||||
# string. Uses the `git describe` output based on the most recent
|
||||
# version tag with a short revision suffix or, if nothing has been
|
||||
# tagged yet, just the revision.
|
||||
#
|
||||
# Beware that tags may also be missing in shallow clones as done by
|
||||
# some CI systems (like TravisCI, which pulls only 50 commits).
|
||||
REV=$(shell git describe --long --tags --match='v*' --dirty 2>/dev/null || git rev-list -n1 HEAD)
|
||||
|
||||
# A space-separated list of image tags under which the current build is to be pushed.
|
||||
# Determined dynamically.
|
||||
IMAGE_TAGS=
|
||||
|
||||
# A "canary" image gets built if the current commit is the head of the remote "master" branch.
|
||||
# That branch does not exist when building some other branch in TravisCI.
|
||||
IMAGE_TAGS+=$(shell if [ "$$(git rev-list -n1 HEAD)" = "$$(git rev-list -n1 origin/master 2>/dev/null)" ]; then echo "canary"; fi)
|
||||
|
||||
# A "X.Y.Z-canary" image gets built if the current commit is the head of a "origin/release-X.Y.Z" branch.
|
||||
# The actual suffix does not matter, only the "release-" prefix is checked.
|
||||
IMAGE_TAGS+=$(shell git branch -r --points-at=HEAD | grep 'origin/release-' | grep -v -e ' -> ' | sed -e 's;.*/release-\(.*\);\1-canary;')
|
||||
|
||||
# A release image "vX.Y.Z" gets built if there is a tag of that format for the current commit.
|
||||
# --abbrev=0 suppresses long format, only showing the closest tag.
|
||||
IMAGE_TAGS+=$(shell tagged="$$(git describe --tags --match='v*' --abbrev=0)"; if [ "$$tagged" ] && [ "$$(git rev-list -n1 HEAD)" = "$$(git rev-list -n1 $$tagged)" ]; then echo $$tagged; fi)
|
||||
|
||||
# Images are named after the command contained in them.
|
||||
IMAGE_NAME=$(REGISTRY_NAME)/$*
|
||||
|
||||
ifdef V
|
||||
# Adding "-alsologtostderr" assumes that all test binaries contain glog. This is not guaranteed.
|
||||
TESTARGS = -v -args -alsologtostderr -v 5
|
||||
else
|
||||
TESTARGS =
|
||||
endif
|
||||
|
||||
# Specific packages can be excluded from each of the tests below by setting the *_FILTER_CMD variables
|
||||
# to something like "| grep -v 'github.com/kubernetes-csi/project/pkg/foobar'". See usage below.
|
||||
|
||||
build-%:
|
||||
mkdir -p bin
|
||||
CGO_ENABLED=0 GOOS=linux go build -a -ldflags '-X main.version=$(REV) -extldflags "-static"' -o ./bin/$* ./cmd/$*
|
||||
|
||||
container-%: build-%
|
||||
docker build -t $*:latest -f $(shell if [ -e ./cmd/$*/Dockerfile ]; then echo ./cmd/$*/Dockerfile; else echo Dockerfile; fi) --label revision=$(REV) .
|
||||
|
||||
push-%: container-%
|
||||
set -ex; \
|
||||
push_image () { \
|
||||
docker tag $*:latest $(IMAGE_NAME):$$tag; \
|
||||
docker push $(IMAGE_NAME):$$tag; \
|
||||
}; \
|
||||
for tag in $(IMAGE_TAGS); do \
|
||||
if [ "$$tag" = "canary" ] || echo "$$tag" | grep -q -e '-canary$$'; then \
|
||||
: "creating or overwriting canary image"; \
|
||||
push_image; \
|
||||
elif docker pull $(IMAGE_NAME):$$tag 2>&1 | tee /dev/stderr | grep -q "manifest for $(IMAGE_NAME):$$tag not found"; then \
|
||||
: "creating release image"; \
|
||||
push_image; \
|
||||
else \
|
||||
: "release image $(IMAGE_NAME):$$tag already exists, skipping push"; \
|
||||
fi; \
|
||||
done
|
||||
|
||||
build: $(CMDS:%=build-%)
|
||||
container: $(CMDS:%=container-%)
|
||||
push: $(CMDS:%=push-%)
|
||||
|
||||
clean:
|
||||
-rm -rf bin
|
||||
|
||||
test:
|
||||
|
||||
.PHONY: test-go
|
||||
test: test-go
|
||||
test-go:
|
||||
@ echo; echo "### $@:"
|
||||
go test `go list ./... | grep -v 'vendor' $(TEST_GO_FILTER_CMD)` $(TESTARGS)
|
||||
|
||||
.PHONY: test-vet
|
||||
test: test-vet
|
||||
test-vet:
|
||||
@ echo; echo "### $@:"
|
||||
go vet `go list ./... | grep -v vendor $(TEST_VET_FILTER_CMD)`
|
||||
|
||||
.PHONY: test-fmt
|
||||
test: test-fmt
|
||||
test-fmt:
|
||||
@ echo; echo "### $@:"
|
||||
files=$$(find . -name '*.go' | grep -v './vendor' $(TEST_FMT_FILTER_CMD)); \
|
||||
if [ $$(gofmt -d $$files | wc -l) -ne 0 ]; then \
|
||||
echo "formatting errors:"; \
|
||||
gofmt -d $$files; \
|
||||
false; \
|
||||
fi
|
||||
|
||||
.PHONY: test-subtree
|
||||
test: test-subtree
|
||||
test-subtree:
|
||||
@ echo; echo "### $@:"
|
||||
./release-tools/verify-subtree.sh release-tools
|
3
vendor/github.com/kubernetes-csi/csi-lib-utils/release-tools/code-of-conduct.md
generated
vendored
3
vendor/github.com/kubernetes-csi/csi-lib-utils/release-tools/code-of-conduct.md
generated
vendored
@@ -1,3 +0,0 @@
|
||||
# Kubernetes Community Code of Conduct
|
||||
|
||||
Please refer to our [Kubernetes Community Code of Conduct](https://git.k8s.io/community/code-of-conduct.md)
|
14
vendor/github.com/kubernetes-csi/csi-lib-utils/release-tools/travis.yml
generated
vendored
14
vendor/github.com/kubernetes-csi/csi-lib-utils/release-tools/travis.yml
generated
vendored
@@ -1,14 +0,0 @@
|
||||
language: go
|
||||
sudo: required
|
||||
services:
|
||||
- docker
|
||||
matrix:
|
||||
include:
|
||||
- go: 1.11.1
|
||||
script:
|
||||
- make -k all test
|
||||
after_success:
|
||||
- if [ "${TRAVIS_PULL_REQUEST}" == "false" ]; then
|
||||
docker login -u "${DOCKER_USERNAME}" -p "${DOCKER_PASSWORD}" quay.io;
|
||||
make push;
|
||||
fi
|
41
vendor/github.com/kubernetes-csi/csi-lib-utils/release-tools/verify-subtree.sh
generated
vendored
41
vendor/github.com/kubernetes-csi/csi-lib-utils/release-tools/verify-subtree.sh
generated
vendored
@@ -1,41 +0,0 @@
|
||||
#! /bin/sh -e
|
||||
#
|
||||
# Copyright 2019 The Kubernetes 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.
|
||||
|
||||
# This script verifies that the content of a directory managed
|
||||
# by "git subtree" has not been modified locally. It does that
|
||||
# by looking for commits that modify the files with the
|
||||
# subtree prefix (aka directory) while ignoring merge
|
||||
# commits. Merge commits are where "git subtree" pulls the
|
||||
# upstream files into the directory.
|
||||
#
|
||||
# Theoretically a developer can subvert this check by modifying files
|
||||
# in a merge commit, but in practice that shouldn't happen.
|
||||
|
||||
DIR="$1"
|
||||
if [ ! "$DIR" ]; then
|
||||
echo "usage: $0 <directory>" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
REV=$(git log -n1 --format=format:%H --no-merges -- "$DIR")
|
||||
if [ "$REV" ]; then
|
||||
echo "Directory '$DIR' contains non-upstream changes:"
|
||||
echo
|
||||
git log --no-merges -- "$DIR"
|
||||
exit 1
|
||||
else
|
||||
echo "$DIR is a clean copy of upstream."
|
||||
fi
|
Reference in New Issue
Block a user