Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
843bddc
Add steps on promoting release images
msau42 Aug 5, 2020
d8a2530
Merge pull request #95 from msau42/add-release-process
k8s-ci-robot Aug 7, 2020
82d108a
switch to Go 1.15
pohly Aug 12, 2020
1fbb636
Merge pull request #97 from pohly/go-1.15
k8s-ci-robot Aug 12, 2020
260d125
Make nanoserver tag configurable
Aug 13, 2020
3b4a2f1
prow.sh: fix installing Go for Kubernetes 1.19.0
pohly Aug 14, 2020
0979c09
prow.sh: fix E2E suite for Kubernetes >= 1.18
pohly Aug 14, 2020
60e1cd3
Merge pull request #98 from pohly/kubernetes-1-19-fixes
k8s-ci-robot Aug 14, 2020
d530705
HTTP server for liveness probe, check registration socket exists
chrishenzie Aug 10, 2020
c59a0b0
release-tools: update
pohly Aug 14, 2020
5d01f04
Update registry for sample container in README
chrishenzie Aug 14, 2020
8b4183e
Merge pull request #102 from pohly/prow-update-master
k8s-ci-robot Aug 17, 2020
c41832c
Merge pull request #103 from chrishenzie/update-registry
k8s-ci-robot Aug 17, 2020
6d15148
Merge pull request #99 from chrishenzie/http-liveness-probe
k8s-ci-robot Aug 17, 2020
d7cf728
Update 2.0 changelog
msau42 Aug 24, 2020
4b16ef0
Merge pull request #105 from msau42/changelog
k8s-ci-robot Aug 26, 2020
b82f1dd
Bump kube version to 1.19.0 and CSI spec to 1.3.0
humblec Aug 27, 2020
620ee86
Update documentation for CSI spec support matrix
humblec Aug 27, 2020
668e54a
Bump go version to 1.15.0
humblec Aug 27, 2020
b2d375f
Merge pull request #101 from mainred/nanoserver-tag-configurable
k8s-ci-robot Aug 28, 2020
d0e94e2
Merge pull request #106 from humblec/kube-1.19
k8s-ci-robot Aug 28, 2020
c3a68b3
Update 2.0 changelog
msau42 Aug 28, 2020
74cddc9
Merge pull request #107 from msau42/changelog
k8s-ci-robot Aug 28, 2020
f2eca70
Update image and tag parameter for Dockerfile.Windows
jingxu97 Aug 31, 2020
644570e
Merge pull request #111 from jingxu97/cptest
k8s-ci-robot Sep 3, 2020
abfb6bf
Add v2.0.1 changelog
msau42 Sep 3, 2020
1aaa13a
Merge pull request #112 from msau42/release-2.0
k8s-ci-robot Sep 3, 2020
7579a55
Merge tag 'v2.0.1' into rebase-v2.0.1
jsafrane Sep 8, 2020
853c40f
UPSTREAM: <carry>: bump go version
jsafrane Sep 8, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 46 additions & 13 deletions CHANGELOG/CHANGELOG-2.0.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,30 @@
# 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/)

# Changelog since v1.3.0

## Urgent Upgrade Notes
Expand All @@ -13,13 +37,20 @@

### Feature

- Windows and multiarch Linux images are now available. The Dockerfile must accept a "binary" build argument. ([#84](https://github.com/kubernetes-csi/node-driver-registrar/pull/84), [@pohly](https://github.com/pohly))
- Adds a new flag --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. ([#99](https://github.com/kubernetes-csi/node-driver-registrar/pull/99), [@chrishenzie](https://github.com/chrishenzie))
- Windows and multiarch Linux images are now available.
The Dockerfile must accept a "binary" build argument. ([#84](https://github.com/kubernetes-csi/node-driver-registrar/pull/84), [@pohly](https://github.com/pohly))

### Bug or Regression

- Registration socket is removed on node-driver-registrar shutdown, de-registering the CSI driver from kubelet. ([#61](https://github.com/kubernetes-csi/node-driver-registrar/pull/61), [@Madhu-1](https://github.com/Madhu-1))

### Uncategorized

- Build with Go 1.15 ([#102](https://github.com/kubernetes-csi/node-driver-registrar/pull/102), [@pohly](https://github.com/pohly))
- Make image, tag and registry configurable in docker file for windows build of node driver registrar. ([#77](https://github.com/kubernetes-csi/node-driver-registrar/pull/77), [@jingxu97](https://github.com/jingxu97))
- Use v1 API for plugin registration with kubelet ([#96](https://github.com/kubernetes-csi/node-driver-registrar/pull/96), [@gnufied](https://github.com/gnufied))
- Registration socket is now removed on node-driver-registrar shutdown, de-registering the CSI driver from kubelet. ([#61](https://github.com/kubernetes-csi/node-driver-registrar/pull/61), [@Madhu-1](https://github.com/Madhu-1))
- Make nanoserver tag configurable ([#101](https://github.com/kubernetes-csi/node-driver-registrar/pull/101), [@mainred](https://github.com/mainred))
- The addition of the --plugin-registration-path flag allows users to dynamically configure the registration path; this flag defaults to the currently hardcoded value of `/registration` so actions can be taken to consume this change but is not required ([#95](https://github.com/kubernetes-csi/node-driver-registrar/pull/95), [@prithviramesh](https://github.com/prithviramesh))

## Dependencies

Expand Down Expand Up @@ -59,7 +90,7 @@
- github.com/emicklei/go-restful: [ff4f55a](https://github.com/emicklei/go-restful/tree/ff4f55a)
- github.com/envoyproxy/go-control-plane: [5f8ba28](https://github.com/envoyproxy/go-control-plane/tree/5f8ba28)
- github.com/envoyproxy/protoc-gen-validate: [v0.1.0](https://github.com/envoyproxy/protoc-gen-validate/tree/v0.1.0)
- github.com/evanphx/json-patch: [e83c0a1](https://github.com/evanphx/json-patch/tree/e83c0a1)
- github.com/evanphx/json-patch: [v4.9.0+incompatible](https://github.com/evanphx/json-patch/tree/v4.9.0)
- github.com/fsnotify/fsnotify: [v1.4.9](https://github.com/fsnotify/fsnotify/tree/v1.4.9)
- github.com/ghodss/yaml: [73d445a](https://github.com/ghodss/yaml/tree/73d445a)
- github.com/go-gl/glfw/v3.3/glfw: [12ad95a](https://github.com/go-gl/glfw/v3.3/glfw/tree/12ad95a)
Expand Down Expand Up @@ -121,7 +152,7 @@
- go.uber.org/atomic: v1.4.0
- go.uber.org/multierr: v1.1.0
- go.uber.org/zap: v1.10.0
- golang.org/x/crypto: bac4c82
- golang.org/x/crypto: 75b2880
- golang.org/x/exp: da58074
- golang.org/x/image: cff245a
- golang.org/x/lint: fdd1cda
Expand All @@ -142,30 +173,32 @@
- gotest.tools/v3: v3.0.2
- gotest.tools: v2.2.0+incompatible
- honnef.co/go/tools: v0.0.1-2019.2.3
- k8s.io/api: v0.19.0-rc.2
- k8s.io/apimachinery: v0.19.0-rc.2
- k8s.io/component-base: v0.19.0-rc.2
- k8s.io/api: v0.19.0
- k8s.io/apimachinery: v0.19.0
- k8s.io/component-base: v0.19.0
- k8s.io/gengo: 3a45101
- k8s.io/klog/v2: v2.2.0
- k8s.io/kube-openapi: 656914f
- k8s.io/kubelet: v0.19.0-rc.2
- k8s.io/utils: 0bdb4ca
- k8s.io/kube-openapi: 6aeccd4
- k8s.io/kubelet: v0.19.0
- k8s.io/utils: d5654de
- rsc.io/binaryregexp: v0.2.0
- sigs.k8s.io/structured-merge-diff/v3: 43c19bb
- sigs.k8s.io/structured-merge-diff/v4: v4.0.1
- sigs.k8s.io/yaml: v1.2.0

### Changed
- github.com/container-storage-interface/spec: [v1.0.0 → v1.3.0](https://github.com/container-storage-interface/spec/compare/v1.0.0...v1.3.0)
- github.com/davecgh/go-spew: [v1.1.0 → v1.1.1](https://github.com/davecgh/go-spew/compare/v1.1.0...v1.1.1)
- github.com/gogo/protobuf: [v1.0.0 → v1.3.1](https://github.com/gogo/protobuf/compare/v1.0.0...v1.3.1)
- github.com/golang/protobuf: [v1.1.0 → v1.4.2](https://github.com/golang/protobuf/compare/v1.1.0...v1.4.2)
- github.com/stretchr/objx: [v0.1.0 → v0.1.1](https://github.com/stretchr/objx/compare/v0.1.0...v0.1.1)
- golang.org/x/net: 22ae77b → d3edc99
- golang.org/x/net: 22ae77b → ab34263
- golang.org/x/sys: dd2ff4a → ed371f2
- golang.org/x/text: v0.3.0 → v0.3.3
- google.golang.org/genproto: 2c5e7ac → cb27e3a
- google.golang.org/grpc: v1.10.0 → v1.27.0
- gopkg.in/check.v1: 20d25e2 → 41f04d3
- gopkg.in/yaml.v2: v2.2.2 → v2.2.8
- k8s.io/client-go: v11.0.0+incompatible → v0.19.0
- k8s.io/klog: v0.1.0 → v1.0.0

### Removed
Expand Down
10 changes: 6 additions & 4 deletions Dockerfile.Windows
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
ARG BASE_IMAGE=servercore
ARG BASE_IMAGE_TAG=1809
ARG CORE_IMAGE=servercore
ARG CORE_IMAGE_TAG=1809
ARG BUILD_IMAGE=nanoserver
ARG BUILD_IMAGE_TAG=1809
ARG REGISTRY=mcr.microsoft.com/windows

FROM ${REGISTRY}/${BASE_IMAGE}:${BASE_IMAGE_TAG} as core
FROM mcr.microsoft.com/windows/nanoserver:1809
FROM ${REGISTRY}/${CORE_IMAGE}:${CORE_IMAGE_TAG} as core
FROM ${REGISTRY}/${BUILD_IMAGE}:${BUILD_IMAGE_TAG}
LABEL description="CSI Node driver registrar"

COPY ./bin/csi-node-driver-registrar.exe /csi-node-driver-registrar.exe
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile.openshift.rhel7
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
FROM registry.svc.ci.openshift.org/ocp/builder:golang-1.14 AS builder
FROM registry.svc.ci.openshift.org/ocp/builder:golang-1.15 AS builder
WORKDIR /go/src/github.com/kubernetes-csi/node-driver-registrar
COPY . .
RUN make build

FROM registry.svc.ci.openshift.org/ocp/4.0:base
FROM registry.svc.ci.openshift.org/ocp/4.6: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"]
20 changes: 18 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,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) |
| ------------------------------------------------------------------------------------------ | ------------------------------------------------------- | --------------- |
| [CSI Spec v1.0.0](https://github.com/container-storage-interface/spec/releases/tag/v1.0.0) | k8s.gcr.io/sig-storage/csi-node-driver-registrar | 1.13 |
| [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 |

For release-0.4 and below, please refer to the [driver-registrar
repository](https://github.com/kubernetes-csi/driver-registrar).
Expand Down Expand Up @@ -50,6 +50,12 @@ There are two UNIX domain sockets used by the node-driver-registrar:
`/var/lib/kubelet/plugins/<drivername.example.com>/csi.sock). Note this is NOT
the path to the registration socket.

### 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.

### Required permissions

The node-driver-registrar does not interact with the Kubernetes API, so no RBAC
Expand All @@ -72,15 +78,25 @@ the actual driver's name.
```bash
containers:
- name: csi-driver-registrar
image: quay.io/k8scsi/csi-node-driver-registrar:v1.0.2
image: k8s.gcr.io/sig-storage/csi-node-driver-registrar:v1.3.0
args:
- "--csi-address=/csi/csi.sock"
- "--kubelet-registration-path=/var/lib/kubelet/plugins/<drivername.example.com>/csi.sock"
- "--health-port=9809"
volumeMounts:
- name: plugin-dir
mountPath: /csi
- name: registration-dir
mountPath: /registration
ports:
- containerPort: 9809
name: healthz
livenessProbe:
httpGet:
path: /healthz
port: healthz
initialDelaySeconds: 5
timeoutSeconds: 5
volumes:
- name: registration-dir
hostPath:
Expand Down
1 change: 1 addition & 0 deletions cmd/csi-node-driver-registrar/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ var (
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.")
showVersion = flag.Bool("version", false, "Show version.")
version = "unknown"

Expand Down
30 changes: 30 additions & 0 deletions cmd/csi-node-driver-registrar/node_register.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,11 @@ package main
import (
"fmt"
"net"
"net/http"
"os"
"os/signal"
"runtime"
"strconv"
"syscall"

"google.golang.org/grpc"
Expand Down Expand Up @@ -64,6 +66,7 @@ func nodeRegister(
// Registers kubelet plugin watcher api.
registerapi.RegisterRegistrationServer(grpcServer, registrar)

go healthzServer(socketPath, *healthzPort)
go removeRegSocket(csiDriverName)
// Starts service
if err := grpcServer.Serve(lis); err != nil {
Expand All @@ -78,6 +81,33 @@ 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)
return
}
klog.Infof("Starting healthz server on port: %v\n", port)

http.HandleFunc("/healthz", func(w http.ResponseWriter, req *http.Request) {
socketExists, err := util.DoesSocketExist(socketPath)
if err == nil && socketExists {
w.WriteHeader(http.StatusOK)
w.Write([]byte(`ok`))
klog.V(5).Infof("health check succeeded")
} else if err != nil {
w.WriteHeader(http.StatusInternalServerError)
w.Write([]byte(err.Error()))
klog.Errorf("health check failed: %+v", err)
} else if !socketExists {
w.WriteHeader(http.StatusNotFound)
w.Write([]byte("registration socket does not exist"))
klog.Errorf("health check failed, registration socket does not exist")
}
})

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

func removeRegSocket(csiDriverName string) {
sigc := make(chan os.Signal, 1)
signal.Notify(sigc, syscall.SIGTERM)
Expand Down
8 changes: 4 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
module github.com/kubernetes-csi/node-driver-registrar

go 1.13
go 1.15

require (
github.com/container-storage-interface/spec v1.0.0 // indirect
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-rc.2
k8s.io/client-go v0.19.0
k8s.io/klog v1.0.0
k8s.io/kubelet v0.19.0-rc.2
k8s.io/kubelet v0.19.0
)
31 changes: 16 additions & 15 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWR
github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI=
github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU=
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
github.com/container-storage-interface/spec v1.0.0 h1:3DyXuJgf9MU6kyULESegQUmozsSxhpyrrv9u5bfwA3E=
github.com/container-storage-interface/spec v1.0.0/go.mod h1:6URME8mwIBbpVyZV93Ce5St17xBiQJQY67NDsuohiy4=
github.com/container-storage-interface/spec v1.3.0 h1:wMH4UIoWnK/TXYw8mbcIHgZmB6kHOeIsYsiaTJwa6bc=
github.com/container-storage-interface/spec v1.3.0/go.mod h1:6URME8mwIBbpVyZV93Ce5St17xBiQJQY67NDsuohiy4=
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
Expand All @@ -55,7 +55,7 @@ github.com/elazarl/goproxy v0.0.0-20180725130230-947c36da3153/go.mod h1:/Zj4wYkg
github.com/emicklei/go-restful v0.0.0-20170410110728-ff4f55a20633/go.mod h1:otzb+WCGbkyDHkqmQmT5YD2WR4BBwUdeQoFo8l/7tVs=
github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
github.com/evanphx/json-patch v0.0.0-20190815234213-e83c0a1c26c8/go.mod h1:pmLOTb3x90VhIKxsA9yeQG5yfOkkKnkk1h+Ql8NDYDw=
github.com/evanphx/json-patch v4.9.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk=
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ=
github.com/ghodss/yaml v0.0.0-20150909031657-73d445a93680/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
Expand Down Expand Up @@ -198,7 +198,7 @@ golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8U
golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20191206172530-e9b2fee46413/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20200220183623-bac4c82f6975/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8=
Expand Down Expand Up @@ -234,6 +234,8 @@ golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLL
golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e h1:3G+cUijn7XD+S4eJFddp53Pv7+slrESplyjG25HgL+k=
golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
golang.org/x/net v0.0.0-20200707034311-ab3426394381 h1:VXak5I6aEWmAXeQjA+QSZzlgNrpq9mjcfDemuexIKsU=
golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
Expand Down Expand Up @@ -364,22 +366,21 @@ honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWh
honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg=
k8s.io/api v0.19.0-rc.2/go.mod h1:9nHeM2gbqeaL7yN6UFvOxKzLG5gZ4v+DJ6bpavDetZo=
k8s.io/apimachinery v0.19.0-rc.2/go.mod h1:eHbWZVMaaewmYBAUuRYnAmTTMtDhvpPNZuh8/6Yl7v0=
k8s.io/client-go v0.19.0-rc.2 h1:ttUSnt95lsdRvw1MIIMppozF7BA4KMVzIxduU973h3M=
k8s.io/client-go v0.19.0-rc.2/go.mod h1:8ELpdR+MEbL/z6gbYHpB52eKPKOVJNKj4I1WiR3g87A=
k8s.io/component-base v0.19.0-rc.2/go.mod h1:aqXtywSxbTRUXnC1+1+DFIT1GXBxb6SogGhsHXmEbyc=
k8s.io/api v0.19.0/go.mod h1:I1K45XlvTrDjmj5LoM5LuP/KYrhWbjUKT/SoPG0qTjw=
k8s.io/apimachinery v0.19.0/go.mod h1:DnPGDnARWFvYa3pMHgSxtbZb7gpzzAZ1pTfaUNDVlmA=
k8s.io/client-go v0.19.0 h1:1+0E0zfWFIWeyRhQYWzimJOyAk2UT7TiARaLNwJCf7k=
k8s.io/client-go v0.19.0/go.mod h1:H9E/VT95blcFQnlyShFgnFT9ZnJOAceiUHM3MlRC+mU=
k8s.io/component-base v0.19.0/go.mod h1:dKsY8BxkA+9dZIAh2aWJLL/UdASFDNtGYTCItL4LM7Y=
k8s.io/gengo v0.0.0-20200413195148-3a45101e95ac/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0=
k8s.io/klog v1.0.0 h1:Pt+yjF5aB1xDSVbau4VsWe+dQNzA0qv1LlXdC2dF6Q8=
k8s.io/klog v1.0.0/go.mod h1:4Bi6QPql/J/LkTDqv7R/cd3hPo4k2DG6Ptcz060Ez5I=
k8s.io/klog/v2 v2.0.0/go.mod h1:PBfzABfn139FHAV07az/IF9Wp1bkk3vpT2XSJ76fSDE=
k8s.io/klog/v2 v2.2.0/go.mod h1:Od+F08eJP+W3HUb4pSrPpgp9DGU4GzlpG/TmITuYh/Y=
k8s.io/kube-openapi v0.0.0-20200427153329-656914f816f9/go.mod h1:bfCVj+qXcEaE5SCvzBaqpOySr6tuCcpPKqF6HD8nyCw=
k8s.io/kubelet v0.19.0-rc.2 h1:FI1PqAwIL5Z3IxG6cN/EAZ+PsPQNYKfRAALJUuW5Vxc=
k8s.io/kubelet v0.19.0-rc.2/go.mod h1:6ECA16RAWCHq0RW0/g8Y44gUxtCIWzUNI0nqC7PTNCY=
k8s.io/utils v0.0.0-20200720150651-0bdb4ca86cbc/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA=
k8s.io/kube-openapi v0.0.0-20200805222855-6aeccd4b50c6/go.mod h1:UuqjUnNftUyPE5H64/qeyjQoUZhGpeFDVdxjTeEVN2o=
k8s.io/kubelet v0.19.0 h1:1x+ZC2o7rRKy+bMen5u3PpBdterOck7i4EpZUM3zDfE=
k8s.io/kubelet v0.19.0/go.mod h1:cGds22piF/LnFzfAaIT+efvOYBHVYdunqka6NVuNw9g=
k8s.io/utils v0.0.0-20200729134348-d5654de09c73/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA=
rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8=
sigs.k8s.io/structured-merge-diff/v3 v3.0.0-20200116222232-67a7b8c61874/go.mod h1:PlARxl6Hbt/+BC80dRLi1qAmnMqwqDg62YvvVkZjemw=
sigs.k8s.io/structured-merge-diff/v3 v3.0.1-0.20200706213357-43c19bbb7fba/go.mod h1:V06abazjHneE37ZdSY/UUwPVgcJMKI/jU5XGUjgIKoc=
sigs.k8s.io/structured-merge-diff/v4 v4.0.1/go.mod h1:bJZC9H9iH24zzfZ/41RGcq60oK1F7G282QMXDPYydCw=
sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o=
sigs.k8s.io/yaml v1.2.0/go.mod h1:yfXDCHCao9+ENCvLSE62v9VSji2MKu5jeNfTrofGhJc=
20 changes: 15 additions & 5 deletions pkg/util/util_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,25 @@ func Umask(mask int) (int, error) {
}

func CleanupSocketFile(socketPath string) error {
fi, err := os.Stat(socketPath)
if err == nil && (fi.Mode()&os.ModeSocket) != 0 {
// Remove any socket, stale or not, but fall through for other files
socketExists, err := DoesSocketExist(socketPath)
if err != nil {
return err
}
if socketExists {
if err := os.Remove(socketPath); err != nil {
return fmt.Errorf("failed to remove stale socket %s with error: %+v", socketPath, err)
}
}
return nil
}

func DoesSocketExist(socketPath string) (bool, error) {
fi, err := os.Stat(socketPath)
if err == nil && (fi.Mode()&os.ModeSocket) != 0 {
return true, nil
}
if err != nil && !os.IsNotExist(err) {
return fmt.Errorf("failed to stat the socket %s with error: %+v", socketPath, err)
return false, fmt.Errorf("failed to stat the socket %s with error: %+v", socketPath, err)
}
return nil
return false, nil
}
Loading