Skip to content

Commit

Permalink
Merge pull request kubernetes-csi#36 from jsafrane/rebase-v2.5.1
Browse files Browse the repository at this point in the history
Bug 2097286: Rebase to v2.5.1 for OCP 4.12
  • Loading branch information
openshift-ci[bot] authored Jun 15, 2022
2 parents ef64b18 + fa77281 commit 710109c
Show file tree
Hide file tree
Showing 133 changed files with 6,097 additions and 4,456 deletions.
23 changes: 23 additions & 0 deletions CHANGELOG/CHANGELOG-2.4.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Release notes for v2.4.0

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

# Changelog since v2.3.0

## Changes by Kind

### Feature

- Added `linux/arm` platform for multiarch image ([#161](https://github.com/kubernetes-csi/node-driver-registrar/pull/161), [@c0va23](https://github.com/c0va23))
- Added an option to enable pprof profiling with --enable-pprof. The profiling server port can be configured using --http-endpoint. ([#171](https://github.com/kubernetes-csi/node-driver-registrar/pull/171), [@aramase](https://github.com/aramase))

## Dependencies

### Added
_Nothing has changed._

### Changed
_Nothing has changed._

### Removed
_Nothing has changed._
22 changes: 22 additions & 0 deletions CHANGELOG/CHANGELOG-2.5.1.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Release notes for v2.5.1

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

# Changelog since v2.5.0

## Changes by Kind

### Bug or Regression

- Corrects the handler used to serve http requests, the /healthz and /debug/ endpoints are available now. (#190, @cnmcavoy)

## Dependencies

### Added
_Nothing has changed._

### Changed
- github.com/prometheus/client_golang: [v1.11.0 → v1.11.1](https://github.com/prometheus/client_golang/compare/v1.11.0...v1.11.1)

### Removed
_Nothing has changed._
104 changes: 104 additions & 0 deletions CHANGELOG/CHANGELOG-2.5.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
# Release notes for v2.5.0

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

# Changelog since v2.4.0

## Changes by Kind

### Uncategorized

- Kubernetes dependencies of this sidecar have been updated to v1.23.0 (#177, @humblec)

### Feature

- Add support to build arm/v7 images ([#178](https://github.com/kubernetes-csi/livenessprobe/pull/178), [@mauriciopoppe](https://github.com/mauriciopoppe))

## Dependencies

### Added
- github.com/cncf/xds/go: [fbca930](https://github.com/cncf/xds/go/tree/fbca930)
- github.com/coreos/go-systemd/v22: [v22.3.2](https://github.com/coreos/go-systemd/v22/tree/v22.3.2)
- github.com/getkin/kin-openapi: [v0.76.0](https://github.com/getkin/kin-openapi/tree/v0.76.0)
- github.com/go-logr/zapr: [v1.2.0](https://github.com/go-logr/zapr/tree/v1.2.0)
- github.com/godbus/dbus/v5: [v5.0.4](https://github.com/godbus/dbus/v5/tree/v5.0.4)
- github.com/google/martian/v3: [v3.1.0](https://github.com/google/martian/v3/tree/v3.1.0)
- github.com/gorilla/mux: [v1.8.0](https://github.com/gorilla/mux/tree/v1.8.0)
- github.com/kr/fs: [v0.1.0](https://github.com/kr/fs/tree/v0.1.0)
- github.com/pkg/sftp: [v1.10.1](https://github.com/pkg/sftp/tree/v1.10.1)
- go.etcd.io/etcd/api/v3: v3.5.0
- go.etcd.io/etcd/client/pkg/v3: v3.5.0
- go.etcd.io/etcd/client/v2: v2.305.0
- go.uber.org/goleak: v1.1.10
- sigs.k8s.io/json: c049b76

### Changed
- cloud.google.com/go/bigquery: v1.4.0 → v1.8.0
- cloud.google.com/go/pubsub: v1.2.0 → v1.3.1
- cloud.google.com/go/storage: v1.6.0 → v1.10.0
- cloud.google.com/go: v0.54.0 → v0.81.0
- github.com/benbjohnson/clock: [v1.0.3 → v1.1.0](https://github.com/benbjohnson/clock/compare/v1.0.3...v1.1.0)
- github.com/bketelsen/crypt: [5cbc8cc → v0.0.4](https://github.com/bketelsen/crypt/compare/5cbc8cc...v0.0.4)
- github.com/envoyproxy/go-control-plane: [668b12f → 63b5d3c](https://github.com/envoyproxy/go-control-plane/compare/668b12f...63b5d3c)
- github.com/evanphx/json-patch: [v4.11.0+incompatible → v4.12.0+incompatible](https://github.com/evanphx/json-patch/compare/v4.11.0...v4.12.0)
- github.com/go-logr/logr: [v0.4.0 → v1.2.0](https://github.com/go-logr/logr/compare/v0.4.0...v1.2.0)
- github.com/go-openapi/jsonpointer: [v0.19.3 → v0.19.5](https://github.com/go-openapi/jsonpointer/compare/v0.19.3...v0.19.5)
- github.com/golang/mock: [v1.4.1 → v1.5.0](https://github.com/golang/mock/compare/v1.4.1...v1.5.0)
- github.com/google/pprof: [1ebb73c → cbba55b](https://github.com/google/pprof/compare/1ebb73c...cbba55b)
- github.com/ianlancetaylor/demangle: [5e5cf60 → 28f6c0f](https://github.com/ianlancetaylor/demangle/compare/5e5cf60...28f6c0f)
- github.com/json-iterator/go: [v1.1.11 → v1.1.12](https://github.com/json-iterator/go/compare/v1.1.11...v1.1.12)
- github.com/magiconair/properties: [v1.8.1 → v1.8.5](https://github.com/magiconair/properties/compare/v1.8.1...v1.8.5)
- github.com/mitchellh/go-homedir: [v1.1.0 → v1.0.0](https://github.com/mitchellh/go-homedir/compare/v1.1.0...v1.0.0)
- github.com/mitchellh/mapstructure: [v1.1.2 → v1.4.1](https://github.com/mitchellh/mapstructure/compare/v1.1.2...v1.4.1)
- github.com/modern-go/reflect2: [v1.0.1 → v1.0.2](https://github.com/modern-go/reflect2/compare/v1.0.1...v1.0.2)
- github.com/pelletier/go-toml: [v1.2.0 → v1.9.3](https://github.com/pelletier/go-toml/compare/v1.2.0...v1.9.3)
- github.com/prometheus/common: [v0.26.0 → v0.28.0](https://github.com/prometheus/common/compare/v0.26.0...v0.28.0)
- github.com/spf13/afero: [v1.2.2 → v1.6.0](https://github.com/spf13/afero/compare/v1.2.2...v1.6.0)
- github.com/spf13/cast: [v1.3.0 → v1.3.1](https://github.com/spf13/cast/compare/v1.3.0...v1.3.1)
- github.com/spf13/cobra: [v1.1.3 → v1.2.1](https://github.com/spf13/cobra/compare/v1.1.3...v1.2.1)
- github.com/spf13/jwalterweatherman: [v1.0.0 → v1.1.0](https://github.com/spf13/jwalterweatherman/compare/v1.0.0...v1.1.0)
- github.com/spf13/viper: [v1.7.0 → v1.8.1](https://github.com/spf13/viper/compare/v1.7.0...v1.8.1)
- github.com/yuin/goldmark: [v1.3.5 → v1.4.0](https://github.com/yuin/goldmark/compare/v1.3.5...v1.4.0)
- go.opencensus.io: v0.22.3 → v0.23.0
- go.uber.org/zap: v1.17.0 → v1.19.0
- golang.org/x/crypto: 5ea612d → 32db794
- golang.org/x/net: 37e1c6a → e898025
- golang.org/x/oauth2: bf48bf1 → 2bc19b1
- golang.org/x/sys: 59db8d7 → f4d4317
- golang.org/x/term: 6a3ed07 → 6886f2d
- golang.org/x/text: v0.3.6 → v0.3.7
- golang.org/x/tools: v0.1.2 → d4cc65f
- google.golang.org/api: v0.20.0 → v0.44.0
- google.golang.org/appengine: v1.6.5 → v1.6.7
- google.golang.org/genproto: f16073e → fe13028
- google.golang.org/grpc: v1.38.0 → v1.40.0
- google.golang.org/protobuf: v1.26.0 → v1.27.1
- gopkg.in/ini.v1: v1.51.0 → v1.62.0
- honnef.co/go/tools: v0.0.1-2020.1.3 → v0.0.1-2020.1.4
- k8s.io/api: v0.22.0 → v0.23.0
- k8s.io/apimachinery: v0.22.0 → v0.23.0
- k8s.io/client-go: v0.22.0 → v0.23.0
- k8s.io/component-base: v0.22.0 → v0.23.0
- k8s.io/gengo: 3a45101 → 485abfe
- k8s.io/klog/v2: v2.9.0 → v2.30.0
- k8s.io/kube-openapi: 9528897 → e816edb
- k8s.io/kubelet: v0.22.0 → v0.23.0
- k8s.io/utils: 4b05e18 → cb0fa31

### Removed
- github.com/coreos/bbolt: [v1.3.2](https://github.com/coreos/bbolt/tree/v1.3.2)
- github.com/coreos/etcd: [v3.3.13+incompatible](https://github.com/coreos/etcd/tree/v3.3.13)
- github.com/coreos/go-systemd: [95778df](https://github.com/coreos/go-systemd/tree/95778df)
- github.com/coreos/pkg: [399ea9e](https://github.com/coreos/pkg/tree/399ea9e)
- github.com/dgrijalva/jwt-go: [v3.2.0+incompatible](https://github.com/dgrijalva/jwt-go/tree/v3.2.0)
- github.com/dgryski/go-sip13: [e10d5fe](https://github.com/dgryski/go-sip13/tree/e10d5fe)
- github.com/grpc-ecosystem/go-grpc-middleware: [v1.0.0](https://github.com/grpc-ecosystem/go-grpc-middleware/tree/v1.0.0)
- github.com/grpc-ecosystem/go-grpc-prometheus: [v1.2.0](https://github.com/grpc-ecosystem/go-grpc-prometheus/tree/v1.2.0)
- github.com/jonboulle/clockwork: [v0.1.0](https://github.com/jonboulle/clockwork/tree/v0.1.0)
- github.com/oklog/ulid: [v1.3.1](https://github.com/oklog/ulid/tree/v1.3.1)
- github.com/prometheus/tsdb: [v0.7.1](https://github.com/prometheus/tsdb/tree/v0.7.1)
- github.com/soheilhy/cmux: [v0.1.4](https://github.com/soheilhy/cmux/tree/v0.1.4)
- github.com/tmc/grpc-websocket-proxy: [0ad062e](https://github.com/tmc/grpc-websocket-proxy/tree/0ad062e)
- github.com/xiang90/probing: [43a291a](https://github.com/xiang90/probing/tree/43a291a)
- go.etcd.io/bbolt: v1.3.2
- gopkg.in/resty.v1: v1.12.0
20 changes: 12 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ the CSI calls on.

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) |
| ------------------------------------------------------------------------------------------ | ------------------------------------------------------- | --------------- |
| [CSI Spec v1.3.0](https://github.com/container-storage-interface/spec/releases/tag/v1.3.0) | k8s.gcr.io/sig-storage/csi-node-driver-registrar | 1.13 |
| Compatible with CSI Version | Container Image | [Min K8s Version](https://kubernetes-csi.github.io/docs/kubernetes-compatibility.html#minimum-version) |
| ------------------------------------------------------------------------------------------ | ------------------------------------------------ | ------------------------------------------------------------------------------------------------------ |
| [CSI Spec v1.5.0](https://github.com/container-storage-interface/spec/releases/tag/v1.5.0) | k8s.gcr.io/sig-storage/csi-node-driver-registrar | 1.13 |

For release-0.4 and below, please refer to the [driver-registrar
repository](https://github.com/kubernetes-csi/driver-registrar).
Expand Down Expand Up @@ -62,6 +62,8 @@ There are two UNIX domain sockets used by the node-driver-registrar:

* `--mode <mode>` (default: `--mode=registration`): The running mode of node-driver-registrar. `registration` runs node-driver-registrar as a long running process to register the driver with kubelet. `kubelet-registration-probe` runs as a health check and returns a status code of 0 if the driver was registered successfully. In the probe definition make sure that the value of `--kubelet-registration-path` is the same as in the container.

* `--enable-pprof`: Enable pprof profiling on the TCP network address specified by `--http-endpoint`.

### Required permissions

The node-driver-registrar does not interact with the Kubernetes API, so no RBAC
Expand Down Expand Up @@ -92,7 +94,7 @@ The value of `--kubelet-registration-path` must be the same as the one set in th
```yaml
containers:
- name: csi-driver-registrar
image: k8s.gcr.io/sig-storage/csi-node-driver-registrar:v2.3.0
image: k8s.gcr.io/sig-storage/csi-node-driver-registrar:v2.5.1
args:
- "--v=5"
- "--csi-address=/csi/csi.sock"
Expand All @@ -103,14 +105,15 @@ The value of `--kubelet-registration-path` must be the same as the one set in th
- /csi-node-driver-registrar
- --kubelet-registration-path=/var/lib/kubelet/plugins/<drivername.example.com>/csi.sock
- --mode=kubelet-registration-probe
initialDelaySeconds: 3
initialDelaySeconds: 30
timeoutSeconds: 15
```
**Windows**
```yaml
containers:
- name: csi-driver-registrar
image: k8s.gcr.io/sig-storage/csi-node-driver-registrar:v2.3.0
image: k8s.gcr.io/sig-storage/csi-node-driver-registrar:v2.5.1
args:
- --v=5
- --csi-address=unix://C:\\csi\\csi.sock
Expand All @@ -121,7 +124,8 @@ The value of `--kubelet-registration-path` must be the same as the one set in th
- /csi-node-driver-registrar.exe
- --kubelet-registration-path=C:\\var\\lib\\kubelet\\plugins\\<drivername.example.com>\\csi.sock
- --mode=kubelet-registration-probe
initialDelaySeconds: 3
initialDelaySeconds: 30
timeoutSeconds: 15
```
Related issue [#143](https://github.com/kubernetes-csi/node-driver-registrar/issues/143)
Expand All @@ -134,7 +138,7 @@ the actual driver's name.
```bash
containers:
- name: csi-driver-registrar
image: k8s.gcr.io/sig-storage/csi-node-driver-registrar:v2.3.0
image: k8s.gcr.io/sig-storage/csi-node-driver-registrar:v2.5.1
args:
- "--csi-address=/csi/csi.sock"
- "--kubelet-registration-path=/var/lib/kubelet/plugins/<drivername.example.com>/csi.sock"
Expand Down
8 changes: 5 additions & 3 deletions cmd/csi-node-driver-registrar/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"context"
"flag"
"fmt"
_ "net/http/pprof"
"os"
"path/filepath"
"strconv"
Expand Down Expand Up @@ -48,7 +49,7 @@ const (
ModeRegistration = "registration"

// ModeKubeletRegistrationProbe makes node-driver-registrar act as an exec probe
// that checks if the kubelet plugin registration succeded.
// that checks if the kubelet plugin registration succeeded.
ModeKubeletRegistrationProbe = "kubelet-registration-probe"
)

Expand All @@ -66,9 +67,10 @@ var (
pluginRegistrationPath = flag.String("plugin-registration-path", "/registration", "Path to Kubernetes plugin registration directory.")
kubeletRegistrationPath = flag.String("kubelet-registration-path", "", "Path of the CSI driver socket on the Kubernetes host machine.")
healthzPort = flag.Int("health-port", 0, "(deprecated) TCP port for healthz requests. Set to 0 to disable the healthz server. Only one of `--health-port` and `--http-endpoint` can be set.")
httpEndpoint = flag.String("http-endpoint", "", "The TCP network address where the HTTP server for diagnostics, including the health check indicating whether the registration socket exists, will listen (example: `:8080`). The default is empty string, which means the server is disabled. Only one of `--health-port` and `--http-endpoint` can be set.")
httpEndpoint = flag.String("http-endpoint", "", "The TCP network address where the HTTP server for diagnostics, including pprof and the health check indicating whether the registration socket exists, will listen (example: `:8080`). The default is empty string, which means the server is disabled. Only one of `--health-port` and `--http-endpoint` can be set.")
showVersion = flag.Bool("version", false, "Show version.")
mode = flag.String("mode", ModeRegistration, `The running mode of node-driver-registrar. "registration" runs node-driver-registrar as a long running process. "kubelet-registration-probe" runs as a health check and returns a status code of 0 if the driver was registered successfully, in the probe definition make sure that the value of --kubelet-registration-path is the same as in the container.`)
enableProfile = flag.Bool("enable-pprof", false, "enable pprof profiling")

// Set during compilation time
version = "unknown"
Expand All @@ -86,7 +88,7 @@ type registrationServer struct {

var _ registerapi.RegistrationServer = registrationServer{}

// NewregistrationServer returns an initialized registrationServer instance
// newRegistrationServer returns an initialized registrationServer instance
func newRegistrationServer(driverName string, endpoint string, versions []string) registerapi.RegistrationServer {
return &registrationServer{
driverName: driverName,
Expand Down
29 changes: 21 additions & 8 deletions cmd/csi-node-driver-registrar/node_register.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"fmt"
"net"
"net/http"
"net/http/pprof"
"os"
"os/signal"
"runtime"
Expand All @@ -35,7 +36,7 @@ import (
func nodeRegister(csiDriverName, httpEndpoint string) {
// When kubeletRegistrationPath is specified then driver-registrar ONLY acts
// as gRPC server which replies to registration requests initiated by kubelet's
// pluginswatcher infrastructure. Node labeling is done by kubelet's csi code.
// plugins watcher infrastructure. Node labeling is done by kubelet's csi code.
registrar := newRegistrationServer(csiDriverName, *kubeletRegistrationPath, supportedVersions)
socketPath := buildSocketPath(csiDriverName)
if err := util.CleanupSocketFile(socketPath); err != nil {
Expand All @@ -61,14 +62,14 @@ func nodeRegister(csiDriverName, httpEndpoint string) {
klog.Infof("Registration Server started at: %s\n", socketPath)
grpcServer := grpc.NewServer()

// Before registing node-driver-registrar with the kubelet ensure that the lockfile doesn't exist
// Before registering node-driver-registrar with the kubelet ensure that the lockfile doesn't exist
// a lockfile may exist because the container was forcefully shutdown
util.CleanupFile(registrationProbePath)

// Registers kubelet plugin watcher api.
registerapi.RegisterRegistrationServer(grpcServer, registrar)

go healthzServer(socketPath, httpEndpoint)
go httpServer(socketPath, httpEndpoint)
go removeRegSocket(csiDriverName)
// Starts service
if err := grpcServer.Serve(lis); err != nil {
Expand All @@ -86,14 +87,16 @@ func buildSocketPath(csiDriverName string) string {
return fmt.Sprintf("%s/%s-reg.sock", *pluginRegistrationPath, csiDriverName)
}

func healthzServer(socketPath string, httpEndpoint string) {
func httpServer(socketPath string, httpEndpoint string) {
if httpEndpoint == "" {
klog.Infof("Skipping healthz server because HTTP endpoint is set to: %q", httpEndpoint)
klog.Infof("Skipping HTTP server because endpoint is set to: %q", httpEndpoint)
return
}
klog.Infof("Starting healthz server at HTTP endpoint: %v\n", httpEndpoint)
klog.Infof("Starting HTTP server at endpoint: %v\n", httpEndpoint)

http.HandleFunc("/healthz", func(w http.ResponseWriter, req *http.Request) {
// Prepare http endpoint for healthz + profiling (if enabled)
mux := http.NewServeMux()
mux.HandleFunc("/healthz", func(w http.ResponseWriter, req *http.Request) {
socketExists, err := util.DoesSocketExist(socketPath)
if err == nil && socketExists {
w.WriteHeader(http.StatusOK)
Expand All @@ -110,7 +113,17 @@ func healthzServer(socketPath string, httpEndpoint string) {
}
})

klog.Fatal(http.ListenAndServe(httpEndpoint, nil))
if *enableProfile {
klog.InfoS("Starting profiling", "endpoint", httpEndpoint)

mux.HandleFunc("/debug/pprof/", pprof.Index)
mux.HandleFunc("/debug/pprof/cmdline", pprof.Cmdline)
mux.HandleFunc("/debug/pprof/profile", pprof.Profile)
mux.HandleFunc("/debug/pprof/symbol", pprof.Symbol)
mux.HandleFunc("/debug/pprof/trace", pprof.Trace)
}

klog.Fatal(http.ListenAndServe(httpEndpoint, mux))
}

func removeRegSocket(csiDriverName string) {
Expand Down
Loading

0 comments on commit 710109c

Please sign in to comment.