Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
d2ce184
Update image and tag parameter for Dockerfile.Windows
jingxu97 Aug 31, 2020
19baf87
Merge pull request #108 from jingxu97/Aug/imagetag
k8s-ci-robot Sep 1, 2020
c54450d
Workaround for job failure due to update in distroless base image
namrata-ibm Oct 8, 2020
243cb9b
Merge pull request #113 from linux-on-ibm-z/distroless
k8s-ci-robot Oct 8, 2020
fcc5b4f
Squashed 'release-tools/' changes from 3041b8a4..a0f195cc
pohly Oct 12, 2020
632f1a9
Merge commit 'fcc5b4fc35d00d31d13a4056dace95092a9b164e' into prow-upd…
pohly Oct 12, 2020
5bb43be
Revert to multiarch distroless base
namrata-ibm Oct 21, 2020
2b4cb43
Merge pull request #116 from linux-on-ibm-z/distroless-revert
k8s-ci-robot Oct 21, 2020
f7a2339
Merge pull request #115 from pohly/prow-update-master
k8s-ci-robot Oct 26, 2020
fc2bc0c
Squashed 'release-tools/' changes from a0f195cc..4aff857d
pohly Oct 27, 2020
568ed87
Merge commit 'fc2bc0c4255f65e0ad1ebcbe5363c72261a42493' into prow-upd…
pohly Oct 27, 2020
be7678e
Merge pull request #118 from pohly/prow-update-master
k8s-ci-robot Oct 28, 2020
6e02e2d
Bump csi-lib-utils to v0.9.0
jsafrane Nov 19, 2020
3ea33cf
Merge pull request #122 from jsafrane/bump-library-go
k8s-ci-robot Nov 19, 2020
73214ad
Squashed 'release-tools/' changes from 4aff857d..c6a88c6e
xing-yang Nov 19, 2020
bcaf1fa
Merge commit '73214ada7a3eeb73fd2a2bac4095c47f768eb595' into release_…
xing-yang Nov 19, 2020
6d99a38
Merge pull request #123 from kubernetes-csi/release_tools2
k8s-ci-robot Nov 19, 2020
6f93028
Introduce http-endpoint flag
verult Dec 8, 2020
57a2689
Return error when registration socket file exists but is not a socket
Jiawei0227 Dec 8, 2020
50b5a0d
Upgrade grpc-go to 1.31
Jiawei0227 Dec 8, 2020
511e5c6
Merge pull request #126 from Jiawei0227/master
k8s-ci-robot Dec 9, 2020
ba2b6cc
Merge pull request #125 from verult/http-endpoint
k8s-ci-robot Dec 9, 2020
5093e97
add --timeout for gRPC calls
pohly Nov 26, 2020
8dae566
Upgrade all dependency
Jiawei0227 Dec 11, 2020
fc3ab8c
Merge pull request #127 from Jiawei0227/dependency
k8s-ci-robot Dec 15, 2020
8ffcb21
Merge pull request #124 from pohly/timeout
k8s-ci-robot Dec 16, 2020
562f704
Add release-note for v2.1.0
Jiawei0227 Dec 16, 2020
043e339
Merge pull request #130 from Jiawei0227/changelog
k8s-ci-robot Dec 16, 2020
3510b0d
move release note to deprecations
msau42 Dec 17, 2020
80d42f2
Merge pull request #131 from msau42/docs
k8s-ci-robot Dec 18, 2020
ec1c915
Merge tag 'v2.1.0' into rebase-v2.1.0
jsafrane Jan 4, 2021
5badab7
UPSTREAM: <carry>: Update to 4.7 base images
jsafrane Jan 4, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
23 changes: 0 additions & 23 deletions CHANGELOG/CHANGELOG-2.0.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,3 @@
# Release notes for v2.0.1

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

# Changelog since v2.0.0

## Changes by Kind

### Uncategorized

- Update image and tag names for Windows to have separate parameters for nanoserver and servercore ([#111](https://github.com/kubernetes-csi/node-driver-registrar/pull/111), [@jingxu97](https://github.com/jingxu97))

## Dependencies

### Added
_Nothing has changed._

### Changed
_Nothing has changed._

### Removed
_Nothing has changed._

# Release notes for v2.0

[Documentation](https://kubernetes-csi.github.io/docs/)
Expand Down
235 changes: 235 additions & 0 deletions CHANGELOG/CHANGELOG-2.1.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Dockerfile.openshift.rhel7
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ WORKDIR /go/src/github.com/kubernetes-csi/node-driver-registrar
COPY . .
RUN make build

FROM registry.svc.ci.openshift.org/ocp/4.6:base
FROM registry.svc.ci.openshift.org/ocp/4.7:base
COPY --from=builder /go/src/github.com/kubernetes-csi/node-driver-registrar/bin/csi-node-driver-registrar /usr/bin/
ENTRYPOINT ["/usr/bin/csi-node-driver-registrar"]
17 changes: 14 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,15 @@ There are two UNIX domain sockets used by the node-driver-registrar:

### Optional arguments

* `--health-port`: This is the port of the health check server for the node-driver-registrar,
which checks if the registration socket exists. A value <= 0 disables the server.
Server is disabled by default.
* `--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.

* `--health-port`: (deprecated) This is the port of the health check server for the
node-driver-registrar, which checks if the registration socket exists. A value <= 0 disables
the server. Server is disabled by default.

* `--timeout <duration>`: Timeout of all calls to CSI driver. It should be set to a value that accommodates the `GetDriverName` calls. 1 second is used by default.

### Required permissions

Expand All @@ -70,6 +76,11 @@ permissions to:
* Access the registration socket (typically in `/var/lib/kubelet/plugins_registry/`).
* Used by the `node-driver-registrar` to register the driver with kubelet.

### Health Check

If `--http-endpoint` is set, the node-driver-registrar exposes a health check endpoint at the
specified address and the path `/healthz`, indicating whether the registration socket exists.

### Example

Here is an example sidecar spec in the driver DaemonSet. `<drivername.example.com>` should be replaced by
Expand Down
32 changes: 24 additions & 8 deletions cmd/csi-node-driver-registrar/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,11 @@ import (
"flag"
"fmt"
"os"
"strconv"
"time"

"k8s.io/klog"
"github.com/kubernetes-csi/csi-lib-utils/metrics"
"k8s.io/klog/v2"

"github.com/kubernetes-csi/csi-lib-utils/connection"
csirpc "github.com/kubernetes-csi/csi-lib-utils/rpc"
Expand All @@ -35,20 +37,19 @@ const (
// names
annotationKey = "csi.volume.kubernetes.io/nodeid"

// Default timeout of short CSI calls like GetPluginInfo
csiTimeout = time.Second

// Verify (and update, if needed) the node ID at this frequency.
sleepDuration = 2 * time.Minute
)

// Command line flags
var (
connectionTimeout = flag.Duration("connection-timeout", 0, "The --connection-timeout flag is deprecated")
operationTimeout = flag.Duration("timeout", time.Second, "Timeout for waiting for communication with driver")
csiAddress = flag.String("csi-address", "/run/csi/socket", "Path of the CSI driver socket that the node-driver-registrar will connect to.")
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, "TCP port for healthz requests. Set to 0 to disable the healthz server.")
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.")
showVersion = flag.Bool("version", false, "Show version.")
version = "unknown"

Expand Down Expand Up @@ -111,23 +112,37 @@ func main() {
}
klog.Infof("Version: %s", version)

if *healthzPort > 0 && *httpEndpoint != "" {
klog.Error("only one of `--health-port` and `--http-endpoint` can be set.")
os.Exit(1)
}
var addr string
if *healthzPort > 0 {
addr = ":" + strconv.Itoa(*healthzPort)
} else {
addr = *httpEndpoint
}

if *connectionTimeout != 0 {
klog.Warning("--connection-timeout is deprecated and will have no effect")
}

// Unused metrics manager, necessary for connection.Connect below
cmm := metrics.NewCSIMetricsManagerForSidecar("")

// Once https://github.com/container-storage-interface/spec/issues/159 is
// resolved, if plugin does not support PUBLISH_UNPUBLISH_VOLUME, then we
// can skip adding mapping to "csi.volume.kubernetes.io/nodeid" annotation.

klog.V(1).Infof("Attempting to open a gRPC connection with: %q", *csiAddress)
csiConn, err := connection.Connect(*csiAddress)
csiConn, err := connection.Connect(*csiAddress, cmm)
if err != nil {
klog.Errorf("error connecting to CSI driver: %v", err)
os.Exit(1)
}

klog.V(1).Infof("Calling CSI driver to discover driver name")
ctx, cancel := context.WithTimeout(context.Background(), csiTimeout)
ctx, cancel := context.WithTimeout(context.Background(), *operationTimeout)
defer cancel()

csiDriverName, err := csirpc.GetDriverName(ctx, csiConn)
Expand All @@ -137,7 +152,8 @@ func main() {
}

klog.V(2).Infof("CSI driver name: %q", csiDriverName)
cmm.SetDriverName(csiDriverName)

// Run forever
nodeRegister(csiDriverName)
nodeRegister(csiDriverName, addr)
}
19 changes: 8 additions & 11 deletions cmd/csi-node-driver-registrar/node_register.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,16 @@ import (
"os"
"os/signal"
"runtime"
"strconv"
"syscall"

"google.golang.org/grpc"

"github.com/kubernetes-csi/node-driver-registrar/pkg/util"
"k8s.io/klog"
"k8s.io/klog/v2"
registerapi "k8s.io/kubelet/pkg/apis/pluginregistration/v1"
)

func nodeRegister(
csiDriverName string,
) {
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.
Expand Down Expand Up @@ -66,7 +63,7 @@ func nodeRegister(
// Registers kubelet plugin watcher api.
registerapi.RegisterRegistrationServer(grpcServer, registrar)

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

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

http.HandleFunc("/healthz", func(w http.ResponseWriter, req *http.Request) {
socketExists, err := util.DoesSocketExist(socketPath)
Expand All @@ -105,7 +102,7 @@ func healthzServer(socketPath string, port int) {
}
})

klog.Fatal(http.ListenAndServe(":"+strconv.Itoa(port), nil))
klog.Fatal(http.ListenAndServe(httpEndpoint, nil))
}

func removeRegSocket(csiDriverName string) {
Expand Down
17 changes: 11 additions & 6 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,15 @@ go 1.15

require (
github.com/container-storage-interface/spec v1.3.0 // indirect
github.com/kubernetes-csi/csi-lib-utils v0.4.0-rc1
golang.org/x/sys v0.0.0-20200622214017-ed371f2e16b4
google.golang.org/grpc v1.27.0
k8s.io/client-go v0.19.0
k8s.io/klog v1.0.0
k8s.io/kubelet v0.19.0
github.com/go-logr/logr v0.3.0 // indirect
github.com/kubernetes-csi/csi-lib-utils v0.9.0
github.com/prometheus/client_golang v1.8.0 // indirect
github.com/prometheus/common v0.15.0 // indirect
golang.org/x/net v0.0.0-20201209123823-ac852fbbde11 // indirect
golang.org/x/sys v0.0.0-20201211090839-8ad439b19e0f
google.golang.org/genproto v0.0.0-20201211151036-40ec1c210f7a // indirect
google.golang.org/grpc v1.34.0
k8s.io/client-go v0.20.0
k8s.io/klog/v2 v2.4.0
k8s.io/kubelet v0.20.0
)
Loading