Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cherry-pick of #15 to release-1.0: Remove retrieval of node name #16

Merged
merged 1 commit into from
Dec 27, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion cmd/node-driver-registrar/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,5 +136,5 @@ func main() {
glog.V(2).Infof("CSI driver name: %q", csiDriverName)

// Run forever
nodeRegister(csiConn, csiDriverName)
nodeRegister(csiDriverName)
}
22 changes: 0 additions & 22 deletions cmd/node-driver-registrar/node_register.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ limitations under the License.
package main

import (
"context"
"fmt"
"net"
"os"
Expand All @@ -27,32 +26,11 @@ import (
"github.com/golang/glog"
"golang.org/x/sys/unix"
registerapi "k8s.io/kubernetes/pkg/kubelet/apis/pluginregistration/v1alpha1"

"github.com/kubernetes-csi/node-driver-registrar/pkg/connection"
)

func nodeRegister(
csiConn connection.CSIConnection,
csiDriverName string,
) {
// Fetch node name from environment variable
k8sNodeName := os.Getenv("KUBE_NODE_NAME")
if k8sNodeName == "" {
glog.Error("Node name not found. The environment variable KUBE_NODE_NAME is empty.")
os.Exit(1)
}

// Get CSI Driver Node ID
glog.V(1).Infof("Calling CSI driver to discover node ID.")
ctx, cancel := context.WithTimeout(context.Background(), csiTimeout)
defer cancel()
csiDriverNodeId, err := csiConn.NodeGetId(ctx)
if err != nil {
glog.Error(err.Error())
os.Exit(1)
}
glog.V(2).Infof("CSI driver node ID: %q", csiDriverNodeId)

// 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