Skip to content

Commit

Permalink
feat: remove unused variable NODE_NAME (#545)
Browse files Browse the repository at this point in the history
This variable is unused. It does not matter where HCCM is running, as
long as it can talk to the Kubernetes & Hetzner Cloud APIs.
  • Loading branch information
apricote committed Oct 25, 2023
1 parent 693f38e commit a659408
Show file tree
Hide file tree
Showing 6 changed files with 0 additions and 23 deletions.
2 changes: 0 additions & 2 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@ test:lint:
test:unit:
stage: test
image: golang:1.21
variables:
NODE_NAME: "test"
script:
- go test ./... -v

Expand Down
4 changes: 0 additions & 4 deletions chart/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,6 @@ env:
secretKeyRef:
name: hcloud
key: token
NODE_NAME:
valueFrom:
fieldRef:
fieldPath: spec.nodeName

image:
repository: hetznercloud/hcloud-cloud-controller-manager
Expand Down
4 changes: 0 additions & 4 deletions deploy/ccm-networks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,6 @@ spec:
secretKeyRef:
key: token
name: hcloud
- name: NODE_NAME
valueFrom:
fieldRef:
fieldPath: spec.nodeName
- name: HCLOUD_NETWORK
valueFrom:
secretKeyRef:
Expand Down
4 changes: 0 additions & 4 deletions deploy/ccm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,6 @@ spec:
secretKeyRef:
key: token
name: hcloud
- name: NODE_NAME
valueFrom:
fieldRef:
fieldPath: spec.nodeName
image: hetznercloud/hcloud-cloud-controller-manager:v1.18.0 # x-release-please-version
ports:
- name: metrics
Expand Down
5 changes: 0 additions & 5 deletions hcloud/cloud.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ const (
hcloudLoadBalancersDisableIPv6 = "HCLOUD_LOAD_BALANCERS_DISABLE_IPV6"
hcloudMetricsEnabledENVVar = "HCLOUD_METRICS_ENABLED"
hcloudMetricsAddress = ":8233"
nodeNameENVVar = "NODE_NAME"
providerName = "hcloud"
)

Expand All @@ -76,10 +75,6 @@ func newCloud(_ io.Reader) (cloudprovider.Interface, error) {
if len(token) != 64 {
return nil, fmt.Errorf("entered token is invalid (must be exactly 64 characters long)")
}
nodeName := os.Getenv(nodeNameENVVar)
if nodeName == "" {
return nil, fmt.Errorf("environment variable %q is required", nodeNameENVVar)
}

opts := []hcloud.ClientOption{
hcloud.WithToken(token),
Expand Down
4 changes: 0 additions & 4 deletions hcloud/cloud_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ func TestNewCloud(t *testing.T) {
resetEnv := Setenv(t,
"HCLOUD_ENDPOINT", env.Server.URL,
"HCLOUD_TOKEN", "jr5g7ZHpPptyhJzZyHw2Pqu4g9gTqDvEceYpngPf79jN_NOT_VALID_dzhepnahq",
"NODE_NAME", "test",
"HCLOUD_METRICS_ENABLED", "false",
)
defer resetEnv()
Expand Down Expand Up @@ -104,7 +103,6 @@ func TestNewCloudConnectionNotPossible(t *testing.T) {
resetEnv := Setenv(t,
"HCLOUD_ENDPOINT", "http://127.0.0.1:4711/v1",
"HCLOUD_TOKEN", "jr5g7ZHpPptyhJzZyHw2Pqu4g9gTqDvEceYpngPf79jN_NOT_VALID_dzhepnahq",
"NODE_NAME", "test",
"HCLOUD_METRICS_ENABLED", "false",
)
defer resetEnv()
Expand All @@ -121,7 +119,6 @@ func TestNewCloudInvalidToken(t *testing.T) {
resetEnv := Setenv(t,
"HCLOUD_ENDPOINT", env.Server.URL,
"HCLOUD_TOKEN", "jr5g7ZHpPptyhJzZyHw2Pqu4g9gTqDvEceYpngPf79jN_NOT_VALID_dzhepnahq",
"NODE_NAME", "test",
"HCLOUD_METRICS_ENABLED", "false",
)
defer resetEnv()
Expand Down Expand Up @@ -149,7 +146,6 @@ func TestCloud(t *testing.T) {
resetEnv := Setenv(t,
"HCLOUD_ENDPOINT", env.Server.URL,
"HCLOUD_TOKEN", "jr5g7ZHpPptyhJzZyHw2Pqu4g9gTqDvEceYpngPf79jN_NOT_VALID_dzhepnahq",
"NODE_NAME", "test",
"HCLOUD_METRICS_ENABLED", "false",
)
defer resetEnv()
Expand Down

0 comments on commit a659408

Please sign in to comment.