Skip to content

Commit

Permalink
Merge pull request #120 from dobsonj/rebase-v1.2.0
Browse files Browse the repository at this point in the history
Bug 1924503: Rebase v1.2.0
  • Loading branch information
openshift-merge-robot committed May 12, 2021
2 parents 5f54908 + 663302e commit b5dd2b3
Show file tree
Hide file tree
Showing 1,525 changed files with 119,603 additions and 12,895 deletions.
1 change: 0 additions & 1 deletion .travis.yml

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
97 changes: 97 additions & 0 deletions CHANGELOG/CHANGELOG-1.2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
# Release notes for 1.2.0

[Documentation](https://kubernetes-csi.github.io)

# Changelog since 1.1.0

## Urgent Upgrade Notes

### (No, really, you MUST read this before you upgrade)

- For drivers that support CSI Migration, a "migrated" label was added to the csi_sidecar_operations_seconds metric that indicates if the call is from the migration path. Metric collectors should be updated with the new field ([#138](https://github.com/kubernetes-csi/external-resizer/pull/138), [@nearora-msft](https://github.com/nearora-msft))

## Changes by Kind

### Bug fixes

- Fix a bug that when CSI migration is enabled and PV is using GA topology label, resizing is not work. ([#139](https://github.com/kubernetes-csi/external-resizer/pull/139), [@Jiawei0227](https://github.com/Jiawei0227))

### Other (Cleanup or Flake)

- Updated runtime (Go 1.16) and dependencies ([#141](https://github.com/kubernetes-csi/external-resizer/pull/141), [@pohly](https://github.com/pohly))

### Feature

- Add a feature-gate `AnnotateFsResize` to allow users to restore size of deleted PVCs. This feature requires Kubernetes 1.21. ([#140](https://github.com/kubernetes-csi/external-resizer/pull/140), [@sunpa93](https://github.com/sunpa93))

## Dependencies

### Added
- github.com/coreos/go-oidc: [v2.1.0+incompatible](https://github.com/coreos/go-oidc/tree/v2.1.0)
- github.com/moby/spdystream: [v0.2.0](https://github.com/moby/spdystream/tree/v0.2.0)
- github.com/niemeyer/pretty: [a10e7ca](https://github.com/niemeyer/pretty/tree/a10e7ca)
- github.com/pquerna/cachecontrol: [0dec1b3](https://github.com/pquerna/cachecontrol/tree/0dec1b3)
- gopkg.in/natefinch/lumberjack.v2: v2.0.0
- gopkg.in/square/go-jose.v2: v2.2.2
- k8s.io/apiserver: v0.20.0
- sigs.k8s.io/apiserver-network-proxy/konnectivity-client: v0.0.14

### Changed
- github.com/Azure/go-autorest/autorest: [v0.11.1 → v0.11.12](https://github.com/Azure/go-autorest/autorest/compare/v0.11.1...v0.11.12)
- github.com/cncf/udpa/go: [efcf912 → 5459f2c](https://github.com/cncf/udpa/go/compare/efcf912...5459f2c)
- github.com/container-storage-interface/spec: [v1.3.0 → v1.4.0](https://github.com/container-storage-interface/spec/compare/v1.3.0...v1.4.0)
- github.com/coreos/go-semver: [v0.2.0 → v0.3.0](https://github.com/coreos/go-semver/compare/v0.2.0...v0.3.0)
- github.com/coreos/go-systemd: [39ca1b0 → 95778df](https://github.com/coreos/go-systemd/compare/39ca1b0...95778df)
- github.com/coreos/pkg: [3ac0863 → 399ea9e](https://github.com/coreos/pkg/compare/3ac0863...399ea9e)
- github.com/creack/pty: [v1.1.7 → v1.1.11](https://github.com/creack/pty/compare/v1.1.7...v1.1.11)
- github.com/dustin/go-humanize: [bb3d318 → v1.0.0](https://github.com/dustin/go-humanize/compare/bb3d318...v1.0.0)
- github.com/emicklei/go-restful: [ff4f55a → v2.9.5+incompatible](https://github.com/emicklei/go-restful/compare/ff4f55a...v2.9.5)
- github.com/envoyproxy/go-control-plane: [v0.9.7 → fd9021f](https://github.com/envoyproxy/go-control-plane/compare/v0.9.7...fd9021f)
- github.com/fsnotify/fsnotify: [v1.4.9 → v1.4.7](https://github.com/fsnotify/fsnotify/compare/v1.4.9...v1.4.7)
- github.com/go-logr/logr: [v0.3.0 → v0.4.0](https://github.com/go-logr/logr/compare/v0.3.0...v0.4.0)
- github.com/gogo/protobuf: [v1.3.1 → v1.3.2](https://github.com/gogo/protobuf/compare/v1.3.1...v1.3.2)
- github.com/golang/protobuf: [v1.4.3 → v1.5.1](https://github.com/golang/protobuf/compare/v1.4.3...v1.5.1)
- github.com/google/go-cmp: [v0.5.4 → v0.5.5](https://github.com/google/go-cmp/compare/v0.5.4...v0.5.5)
- github.com/googleapis/gnostic: [v0.5.3 → v0.5.4](https://github.com/googleapis/gnostic/compare/v0.5.3...v0.5.4)
- github.com/gorilla/websocket: [4201258 → v1.4.2](https://github.com/gorilla/websocket/compare/4201258...v1.4.2)
- github.com/imdario/mergo: [v0.3.11 → v0.3.12](https://github.com/imdario/mergo/compare/v0.3.11...v0.3.12)
- github.com/kisielk/errcheck: [v1.2.0 → v1.5.0](https://github.com/kisielk/errcheck/compare/v1.2.0...v1.5.0)
- github.com/kr/text: [v0.1.0 → v0.2.0](https://github.com/kr/text/compare/v0.1.0...v0.2.0)
- github.com/kubernetes-csi/csi-lib-utils: [v0.9.0 → v0.9.1](https://github.com/kubernetes-csi/csi-lib-utils/compare/v0.9.0...v0.9.1)
- github.com/mailru/easyjson: [b2ccc51 → v0.7.0](https://github.com/mailru/easyjson/compare/b2ccc51...v0.7.0)
- github.com/moby/term: [672ec06 → df9cb8a](https://github.com/moby/term/compare/672ec06...df9cb8a)
- github.com/munnerz/goautoneg: [a547fc6 → a7dc8b6](https://github.com/munnerz/goautoneg/compare/a547fc6...a7dc8b6)
- github.com/prometheus/common: [v0.15.0 → v0.19.0](https://github.com/prometheus/common/compare/v0.15.0...v0.19.0)
- github.com/prometheus/procfs: [v0.2.0 → v0.6.0](https://github.com/prometheus/procfs/compare/v0.2.0...v0.6.0)
- github.com/tmc/grpc-websocket-proxy: [89b8d40 → 0ad062e](https://github.com/tmc/grpc-websocket-proxy/compare/89b8d40...0ad062e)
- github.com/yuin/goldmark: [v1.1.32 → v1.2.1](https://github.com/yuin/goldmark/compare/v1.1.32...v1.2.1)
- go.etcd.io/bbolt: v1.3.3 → v1.3.5
- go.etcd.io/etcd: 3cf2f69 → dd1b699
- golang.org/x/crypto: 9d13527 → 5ea612d
- golang.org/x/net: 986b41b → d523dce
- golang.org/x/oauth2: 08078c5 → cd4f82c
- golang.org/x/sync: 6e8e738 → 09787c9
- golang.org/x/sys: f9fddec → c4fcb01
- golang.org/x/term: 2321bbc → de623e6
- golang.org/x/text: v0.3.4 → v0.3.5
- golang.org/x/time: 7e3f01d → f8bda1e
- golang.org/x/tools: b303f43 → 113979e
- google.golang.org/genproto: 8c77b98 → 75c7a85
- google.golang.org/grpc: v1.34.0 → v1.36.0
- google.golang.org/protobuf: v1.25.0 → v1.26.0
- gopkg.in/check.v1: 41f04d3 → 8fa4692
- gopkg.in/yaml.v3: eeeca48 → 496545a
- gotest.tools/v3: v3.0.2 → v3.0.3
- k8s.io/api: v0.20.0 → v0.21.0
- k8s.io/apimachinery: v0.21.0-alpha.0 → v0.21.0
- k8s.io/client-go: v0.20.0 → v0.21.0
- k8s.io/component-base: v0.20.0 → v0.21.0
- k8s.io/csi-translation-lib: v0.20.0 → v0.21.0
- k8s.io/klog/v2: v2.4.0 → v2.8.0
- k8s.io/kube-openapi: d219536 → f622666
- k8s.io/utils: 67b214c → 2afb431
- sigs.k8s.io/structured-merge-diff/v4: v4.0.2 → v4.1.0

### Removed
- github.com/docker/spdystream: [449fdfc](https://github.com/docker/spdystream/tree/449fdfc)
- gotest.tools: v2.2.0+incompatible
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
[![Build Status](https://travis-ci.org/kubernetes-csi/external-resizer.svg?branch=master)](https://travis-ci.org/kubernetes-csi/external-resizer)

# CSI Resizer

The CSI `external-resizer` is a sidecar container that watches the Kubernetes API server for `PersistentVolumeClaim` updates and
Expand All @@ -16,7 +14,7 @@ This information reflects the head of this branch.

| Compatible with CSI Version | Container Image | [Min K8s Version](https://kubernetes-csi.github.io/docs/kubernetes-compatibility.html#minimum-version) | [Recommended K8s Version](https://kubernetes-csi.github.io/docs/kubernetes-compatibility.html#recommended-version) |
| ------------------------------------------------------------------------------------------ | -------------------------------| --------------- | ------------- |
| [CSI Spec v1.2.0](https://github.com/container-storage-interface/spec/releases/tag/v1.2.0) | k8s.gcr.io/sig-storage/csi-provisioner | 1.16 | 1.16 |
| [CSI Spec v1.2.0](https://github.com/container-storage-interface/spec/releases/tag/v1.2.0) | k8s.gcr.io/sig-storage/csi-resizer | 1.16 | 1.16 |


## Feature status
Expand Down Expand Up @@ -63,6 +61,10 @@ Note that the external-resizer does not scale with more replicas. Only one exter

* `--handle-volume-inuse-error <true/false>`: Enable or disable volume-in-use error handling in external-resizer. Defaults to `true` and resize-controller will watch for all pods in all namespaces to check if PVC being expanded is in-use by a pod or not before retrying volume expansion if CSI driver throws volume-in-use error. Setting this to `false` will cause external-resizer to ignore volume-in-use error and resize-controller will retry volume expansion even if volume is already in use by a pod and CSI driver does not support expansion of in-use volumes. If CSI driver being used supports online expansion, it might be desirable to set `handle-volume-inuse-error` to `false` - to save costs associated with watching all pods in the cluster.

* `-feature-gates**: A set of key/value pairs that describe alpha/experimental features of external-resizer.
* `AnnotateFsResize=true|false` (ALPHA - default=false): Store current size of pvc in pv's annotation, so as if pvc is deleted while expansion was pending on the node, the size of pvc can be restored to old value. This permits
expansion on the node in case pvc was deleted while expansion was pending on the node (but completed in the controller). Use of this feature depends on Kubernetes version 1.21.

#### Other recognized arguments

* `--kubeconfig <path>`: Path to Kubernetes client configuration that the external-resizer uses to connect to Kubernetes API server. When omitted, default token provided by Kubernetes will be used. This option is useful only when the external-resizer does not run as a Kubernetes pod, e.g. for debugging. Either this or `--master` needs to be set if the external-resizer is being run out of cluster.
Expand Down
21 changes: 21 additions & 0 deletions cmd/csi-resizer/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
"fmt"
"net/http"
"os"
"strings"
"time"

"github.com/kubernetes-csi/csi-lib-utils/metrics"
Expand All @@ -36,9 +37,12 @@ import (
"github.com/kubernetes-csi/external-resizer/pkg/controller"
"github.com/kubernetes-csi/external-resizer/pkg/resizer"
"github.com/kubernetes-csi/external-resizer/pkg/util"
csitrans "k8s.io/csi-translation-lib"

"k8s.io/apimachinery/pkg/util/wait"
utilfeature "k8s.io/apiserver/pkg/util/feature"
"k8s.io/client-go/informers"
cflag "k8s.io/component-base/cli/flag"
"k8s.io/klog/v2"
)

Expand Down Expand Up @@ -68,10 +72,13 @@ var (

handleVolumeInUseError = flag.Bool("handle-volume-inuse-error", true, "Flag to turn on/off capability to handle volume in use error in resizer controller. Defaults to true if not set.")

featureGates map[string]bool

version = "unknown"
)

func main() {
flag.Var(cflag.NewMapStringBool(&featureGates), "feature-gates", "A set of key=value paris that describe feature gates for alpha/experimental features for csi external resizer."+"Options are:\n"+strings.Join(utilfeature.DefaultFeatureGate.KnownFeatures(), "\n"))
klog.InitFlags(nil)
flag.Set("logtostderr", "true")
flag.Parse()
Expand All @@ -90,6 +97,9 @@ func main() {
if addr == "" {
addr = *httpEndpoint
}
if err := utilfeature.DefaultMutableFeatureGate.SetFromMap(featureGates); err != nil {
klog.Fatal(err)
}

var config *rest.Config
var err error
Expand Down Expand Up @@ -127,6 +137,17 @@ func main() {
}
klog.V(2).Infof("CSI driver name: %q", driverName)

translator := csitrans.New()
if translator.IsMigratedCSIDriverByName(driverName) {
metricsManager = metrics.NewCSIMetricsManagerWithOptions(driverName, metrics.WithMigration())
migratedCsiClient, err := csi.New(*csiAddress, *timeout, metricsManager)
if err != nil {
klog.Fatal(err.Error())
}
csiClient.CloseConnection()
csiClient = migratedCsiClient
}

csiResizer, err := resizer.NewResizerFromClient(
csiClient,
*timeout,
Expand Down
58 changes: 31 additions & 27 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,49 +1,53 @@
module github.com/kubernetes-csi/external-resizer

go 1.15
go 1.16

require (
github.com/container-storage-interface/spec v1.3.0
github.com/go-logr/logr v0.3.0 // indirect
github.com/google/go-cmp v0.5.4 // indirect
github.com/container-storage-interface/spec v1.4.0
github.com/golang/protobuf v1.5.1 // indirect
github.com/google/gofuzz v1.2.0 // indirect
github.com/googleapis/gnostic v0.5.3 // indirect
github.com/googleapis/gnostic v0.5.4 // indirect
github.com/hashicorp/golang-lru v0.5.4 // indirect
github.com/imdario/mergo v0.3.11 // indirect
github.com/kubernetes-csi/csi-lib-utils v0.9.0
github.com/imdario/mergo v0.3.12 // indirect
github.com/kubernetes-csi/csi-lib-utils v0.9.1
github.com/prometheus/client_golang v1.9.0 // indirect
golang.org/x/crypto v0.0.0-20201217014255-9d1352758620 // indirect
golang.org/x/net v0.0.0-20201216054612-986b41b23924 // indirect
golang.org/x/oauth2 v0.0.0-20201208152858-08078c50e5b5 // indirect
golang.org/x/term v0.0.0-20201210144234-2321bbc49cbf // indirect
golang.org/x/time v0.0.0-20201208040808-7e3f01d25324 // indirect
github.com/prometheus/common v0.19.0 // indirect
github.com/prometheus/procfs v0.6.0 // indirect
golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4 // indirect
golang.org/x/oauth2 v0.0.0-20210313182246-cd4f82c27b84 // indirect
golang.org/x/sys v0.0.0-20210317225723-c4fcb01b228e // indirect
golang.org/x/term v0.0.0-20210317153231-de623e64d2a6 // indirect
golang.org/x/text v0.3.5 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto v0.0.0-20201214200347-8c77b98c765d // indirect
google.golang.org/grpc v1.34.0
gopkg.in/yaml.v2 v2.4.0 // indirect
k8s.io/api v0.20.0
k8s.io/apimachinery v0.21.0-alpha.0
k8s.io/client-go v0.20.0
k8s.io/component-base v0.20.0 // indirect
k8s.io/csi-translation-lib v0.20.0
k8s.io/klog/v2 v2.4.0
google.golang.org/genproto v0.0.0-20210317182105-75c7a8546eb9 // indirect
google.golang.org/grpc v1.36.0
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
k8s.io/api v0.21.0
k8s.io/apimachinery v0.21.0
k8s.io/apiserver v0.0.0-00010101000000-000000000000
k8s.io/client-go v0.21.0
k8s.io/component-base v0.21.0
k8s.io/csi-translation-lib v0.21.0
k8s.io/klog/v2 v2.8.0
k8s.io/kube-openapi v0.0.0-20210305164622-f622666832c1 // indirect
k8s.io/utils v0.0.0-20210305010621-2afb4311ab10 // indirect
)

replace (
k8s.io/api => k8s.io/api v0.20.0
k8s.io/api => k8s.io/api v0.21.0
k8s.io/apiextensions-apiserver => k8s.io/apiextensions-apiserver v0.20.0
k8s.io/apimachinery => k8s.io/apimachinery v0.21.0-alpha.0
k8s.io/apimachinery => k8s.io/apimachinery v0.21.0
k8s.io/apiserver => k8s.io/apiserver v0.20.0
k8s.io/cli-runtime => k8s.io/cli-runtime v0.20.0
k8s.io/client-go => k8s.io/client-go v0.20.0
k8s.io/client-go => k8s.io/client-go v0.21.0
k8s.io/cloud-provider => k8s.io/cloud-provider v0.20.0
k8s.io/cluster-bootstrap => k8s.io/cluster-bootstrap v0.20.0
k8s.io/code-generator => k8s.io/code-generator v0.20.1-rc.1
k8s.io/component-base => k8s.io/component-base v0.20.0
k8s.io/component-base => k8s.io/component-base v0.21.0
k8s.io/component-helpers => k8s.io/component-helpers v0.20.0
k8s.io/controller-manager => k8s.io/controller-manager v0.20.0
k8s.io/cri-api => k8s.io/cri-api v0.20.1-rc.1
k8s.io/csi-translation-lib => k8s.io/csi-translation-lib v0.20.0
k8s.io/csi-translation-lib => k8s.io/csi-translation-lib v0.21.0
k8s.io/kube-aggregator => k8s.io/kube-aggregator v0.20.0
k8s.io/kube-controller-manager => k8s.io/kube-controller-manager v0.20.0
k8s.io/kube-proxy => k8s.io/kube-proxy v0.20.0
Expand All @@ -53,7 +57,7 @@ replace (
k8s.io/legacy-cloud-providers => k8s.io/legacy-cloud-providers v0.20.0
k8s.io/metrics => k8s.io/metrics v0.20.0
k8s.io/mount-utils => k8s.io/mount-utils v0.20.1-rc.1
k8s.io/node-api => k8s.io/node-api v0.19.0
k8s.io/node-api => k8s.io/node-api v0.21.0
k8s.io/sample-apiserver => k8s.io/sample-apiserver v0.20.0
k8s.io/sample-cli-plugin => k8s.io/sample-cli-plugin v0.20.0
k8s.io/sample-controller => k8s.io/sample-controller v0.20.0
Expand Down
Loading

0 comments on commit b5dd2b3

Please sign in to comment.