Skip to content

Commit cb769eb

Browse files
Merge pull request #131 from shiftstack/merge-bot-master
Merge https://github.com/kubernetes/cloud-provider-openstack:master into master
2 parents 96818ec + a0a8b01 commit cb769eb

File tree

26 files changed

+86
-101
lines changed

26 files changed

+86
-101
lines changed

charts/openstack-cloud-controller-manager/templates/secret.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,10 @@ metadata:
55
name: {{ .Values.secret.name | default "cloud-config" }}
66
type: Opaque
77
data:
8+
{{ if .Values.cloudConfigContents -}}
9+
cloud.conf: |
10+
{{ .Values.cloudConfigContents | b64enc }}
11+
{{ else -}}
812
cloud.conf: {{ include "cloudConfig" . | b64enc }}
13+
{{ end -}}
914
{{- end }}

docs/cinder-csi-plugin/features.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ This feature enables driver to consider the topology constraints while creating
3535
`topology.cinder.csi.openstack.org/zone` : Availability by Zone
3636
* `allowedTopologies` can be specified in storage class to restrict the topology of provisioned volumes to specific zones and should be used as replacement of `availability` parameter.
3737
* To disable: set `--feature-gates=Topology=false` in external-provisioner (container `csi-provisioner` of `csi-cinder-controllerplugin`).
38+
* If using Helm, it can be disabled by setting `Values.csi.provisioner.topology: "false"`
3839

3940
For usage, refer [sample app](./examples.md#use-topology)
4041

pkg/autohealing/cloudprovider/openstack/provider.go

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -253,10 +253,11 @@ func (provider CloudProvider) waitForServerDetachVolumes(serverID string, timeou
253253
}
254254

255255
// FirstTimeRepair Handle the first time repair for a node
256-
// 1) If the node is the first time in error, reboot and uncordon it
257-
// 2) If the node is not the first time in error, check if the last reboot time is in provider.Config.RebuildDelayAfterReboot
258-
// That said, if the node has been found in broken status before but has been long time since then, the processed variable
259-
// will be kept as False, which means the node need to be rebuilt to fix it, otherwise it means the has been processed.
256+
// 1. If the node is the first time in error, reboot and uncordon it
257+
// 2. If the node is not the first time in error, check if the last reboot time is in provider.Config.RebuildDelayAfterReboot
258+
// That said, if the node has been found in broken status before but has been long time since then, the processed variable
259+
// will be kept as False, which means the node need to be rebuilt to fix it, otherwise it means the has been processed.
260+
//
260261
// The bool type return value means that if the node has been processed from a first time repair PoV
261262
func (provider CloudProvider) firstTimeRepair(n healthcheck.NodeInfo, serverID string, firstTimeRebootNodes map[string]healthcheck.NodeInfo) (bool, error) {
262263
var firstTimeUnhealthy = true
@@ -313,12 +314,14 @@ func (provider CloudProvider) firstTimeRepair(n healthcheck.NodeInfo, serverID s
313314
}
314315

315316
// Repair For master nodes: detach etcd and docker volumes, find the root
316-
// volume, then shutdown the VM, marks the both the VM and the root
317-
// volume (heat resource) as "unhealthy" then trigger Heat stack update
318-
// in order to rebuild the node. The information this function needs:
319-
// - Nova VM ID
320-
// - Root volume ID
321-
// - Heat stack ID and resource ID.
317+
//
318+
// volume, then shutdown the VM, marks the both the VM and the root
319+
// volume (heat resource) as "unhealthy" then trigger Heat stack update
320+
// in order to rebuild the node. The information this function needs:
321+
// - Nova VM ID
322+
// - Root volume ID
323+
// - Heat stack ID and resource ID.
324+
//
322325
// For worker nodes: Call Magnum resize API directly.
323326
func (provider CloudProvider) Repair(nodes []healthcheck.NodeInfo) error {
324327
if len(nodes) == 0 {

pkg/autohealing/healthcheck/plugin_endpoint.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ package healthcheck
1919
import (
2020
"crypto/tls"
2121
"fmt"
22-
"io/ioutil"
2322
"net/http"
23+
"os"
2424
"strings"
2525
"time"
2626

@@ -157,7 +157,7 @@ func (check *EndpointCheck) Check(node NodeInfo, controller NodeController) bool
157157

158158
if check.RequireToken {
159159
if check.Token == "" {
160-
b, err := ioutil.ReadFile(TokenPath)
160+
b, err := os.ReadFile(TokenPath)
161161
if err != nil {
162162
log.Warningf("Node %s, failed to get token from %s, skip the check", nodeName, TokenPath)
163163
return true

pkg/client/client.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,17 +38,17 @@ import (
3838
)
3939

4040
type AuthOpts struct {
41-
AuthURL string `gcfg:"auth-url" mapstructure:"auth-url" name:"os-authURL" dependsOn:"os-password|os-trustID|os-applicationCredentialSecret|os-applicationCredentialID|os-applicationCredentialName|os-clientCertPath"`
41+
AuthURL string `gcfg:"auth-url" mapstructure:"auth-url" name:"os-authURL" dependsOn:"os-password|os-trustID|os-applicationCredentialSecret|os-clientCertPath"`
4242
UserID string `gcfg:"user-id" mapstructure:"user-id" name:"os-userID" value:"optional" dependsOn:"os-password"`
4343
Username string `name:"os-userName" value:"optional" dependsOn:"os-password"`
4444
Password string `name:"os-password" value:"optional" dependsOn:"os-domainID|os-domainName,os-projectID|os-projectName,os-userID|os-userName"`
45-
TenantID string `gcfg:"tenant-id" mapstructure:"project-id" name:"os-projectID" value:"optional" dependsOn:"os-password|os-applicationCredentialID|os-applicationCredentialName|os-clientCertPath"`
46-
TenantName string `gcfg:"tenant-name" mapstructure:"project-name" name:"os-projectName" value:"optional" dependsOn:"os-password|os-applicationCredentialID|os-applicationCredentialName|os-clientCertPath"`
45+
TenantID string `gcfg:"tenant-id" mapstructure:"project-id" name:"os-projectID" value:"optional" dependsOn:"os-password|os-clientCertPath"`
46+
TenantName string `gcfg:"tenant-name" mapstructure:"project-name" name:"os-projectName" value:"optional" dependsOn:"os-password|os-clientCertPath"`
4747
TrustID string `gcfg:"trust-id" mapstructure:"trust-id" name:"os-trustID" value:"optional"`
4848
TrusteeID string `gcfg:"trustee-id" mapstructure:"trustee-id" name:"os-trusteeID" value:"optional" dependsOn:"os-trustID"`
4949
TrusteePassword string `gcfg:"trustee-password" mapstructure:"trustee-password" name:"os-trusteePassword" value:"optional" dependsOn:"os-trustID"`
50-
DomainID string `gcfg:"domain-id" mapstructure:"domain-id" name:"os-domainID" value:"optional" dependsOn:"os-password|os-applicationCredentialID|os-applicationCredentialName|os-clientCertPath"`
51-
DomainName string `gcfg:"domain-name" mapstructure:"domain-name" name:"os-domainName" value:"optional" dependsOn:"os-password|os-applicationCredentialID|os-applicationCredentialName|os-clientCertPath"`
50+
DomainID string `gcfg:"domain-id" mapstructure:"domain-id" name:"os-domainID" value:"optional" dependsOn:"os-password|os-clientCertPath"`
51+
DomainName string `gcfg:"domain-name" mapstructure:"domain-name" name:"os-domainName" value:"optional" dependsOn:"os-password|os-clientCertPath"`
5252
TenantDomainID string `gcfg:"tenant-domain-id" mapstructure:"project-domain-id" name:"os-projectDomainID" value:"optional"`
5353
TenantDomainName string `gcfg:"tenant-domain-name" mapstructure:"project-domain-name" name:"os-projectDomainName" value:"optional"`
5454
UserDomainID string `gcfg:"user-domain-id" mapstructure:"user-domain-id" name:"os-userDomainID" value:"optional"`
@@ -69,9 +69,9 @@ type AuthOpts struct {
6969
CloudsFile string `gcfg:"clouds-file,omitempty" mapstructure:"clouds-file,omitempty" name:"os-cloudsFile" value:"optional"`
7070
Cloud string `gcfg:"cloud,omitempty" mapstructure:"cloud,omitempty" name:"os-cloud" value:"optional"`
7171

72-
ApplicationCredentialID string `gcfg:"application-credential-id" mapstructure:"application-credential-id" name:"os-applicationCredentialID" value:"optional"`
73-
ApplicationCredentialName string `gcfg:"application-credential-name" mapstructure:"application-credential-name" name:"os-applicationCredentialName" value:"optional"`
74-
ApplicationCredentialSecret string `gcfg:"application-credential-secret" mapstructure:"application-credential-secret" name:"os-applicationCredentialSecret" value:"optional"`
72+
ApplicationCredentialID string `gcfg:"application-credential-id" mapstructure:"application-credential-id" name:"os-applicationCredentialID" value:"optional" dependsOn:"os-applicationCredentialSecret"`
73+
ApplicationCredentialName string `gcfg:"application-credential-name" mapstructure:"application-credential-name" name:"os-applicationCredentialName" value:"optional" dependsOn:"os-applicationCredentialSecret"`
74+
ApplicationCredentialSecret string `gcfg:"application-credential-secret" mapstructure:"application-credential-secret" name:"os-applicationCredentialSecret" value:"optional" dependsOn:"os-applicationCredentialID|os-applicationCredentialName"`
7575
}
7676

7777
func LogCfg(authOpts AuthOpts) {

pkg/csi/cinder/driver.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,9 @@ var (
4848
Version = "2.0.0"
4949
)
5050

51-
//revive:disable:exported
5251
// Deprecated: use Driver instead
52+
//
53+
//revive:disable:exported
5354
type CinderDriver = Driver
5455

5556
//revive:enable:exported

pkg/csi/cinder/nodeserver_test.go

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ package cinder
1818

1919
import (
2020
"fmt"
21-
"io/ioutil"
2221
"os"
2322
"path/filepath"
2423
"testing"
@@ -379,13 +378,10 @@ func TestNodeGetVolumeStatsBlock(t *testing.T) {
379378
mmock.ExpectedCalls = nil
380379

381380
// setup for test
382-
tempDir, err := ioutil.TempDir("", "cpo-test")
383-
if err != nil {
384-
t.Fatalf("Failed to set up temp dir: %v", err)
385-
}
386-
defer os.RemoveAll(tempDir)
381+
tempDir := os.TempDir()
382+
defer os.Remove(tempDir)
387383
volumePath := filepath.Join(tempDir, FakeTargetPath)
388-
err = os.MkdirAll(volumePath, 0750)
384+
err := os.MkdirAll(volumePath, 0750)
389385
if err != nil {
390386
t.Fatalf("Failed to set up volumepath: %v", err)
391387
}
@@ -417,13 +413,10 @@ func TestNodeGetVolumeStatsFs(t *testing.T) {
417413
mmock.ExpectedCalls = nil
418414

419415
// setup for test
420-
tempDir, err := ioutil.TempDir("", "cpo-test")
421-
if err != nil {
422-
t.Fatalf("Failed to set up temp dir: %v", err)
423-
}
424-
defer os.RemoveAll(tempDir)
416+
tempDir := os.TempDir()
417+
defer os.Remove(tempDir)
425418
volumePath := filepath.Join(tempDir, FakeTargetPath)
426-
err = os.MkdirAll(volumePath, 0750)
419+
err := os.MkdirAll(volumePath, 0750)
427420
if err != nil {
428421
t.Fatalf("Failed to set up volumepath: %v", err)
429422
}

pkg/csi/cinder/openstack/openstack_snapshots.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ func (os *OpenStack) DeleteSnapshot(snapID string) error {
142142
return err
143143
}
144144

145-
//GetSnapshotByID returns snapshot details by id
145+
// GetSnapshotByID returns snapshot details by id
146146
func (os *OpenStack) GetSnapshotByID(snapshotID string) (*snapshots.Snapshot, error) {
147147
s, err := snapshots.Get(os.blockstorage, snapshotID).Extract()
148148
if err != nil {

pkg/csi/cinder/openstack/openstack_volumes.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ func (os *OpenStack) WaitDiskAttached(instanceID string, volumeID string) error
223223
return err
224224
}
225225

226-
//WaitVolumeTargetStatus waits for volume to be in target state
226+
// WaitVolumeTargetStatus waits for volume to be in target state
227227
func (os *OpenStack) WaitVolumeTargetStatus(volumeID string, tStatus []string) error {
228228
backoff := wait.Backoff{
229229
Duration: operationFinishInitDelay,
@@ -358,7 +358,7 @@ func (os *OpenStack) ExpandVolume(volumeID string, status string, newSize int) e
358358
return fmt.Errorf("volume cannot be resized, when status is %s", status)
359359
}
360360

361-
//GetMaxVolLimit returns max vol limit
361+
// GetMaxVolLimit returns max vol limit
362362
func (os *OpenStack) GetMaxVolLimit() int64 {
363363
if os.bsOpts.NodeVolumeAttachLimit > 0 && os.bsOpts.NodeVolumeAttachLimit <= 256 {
364364
return os.bsOpts.NodeVolumeAttachLimit

pkg/csi/manila/runtimeconfig/runtimeconfig.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ package runtimeconfig
1818

1919
import (
2020
"encoding/json"
21-
"io/ioutil"
2221
"os"
2322
)
2423

@@ -34,7 +33,7 @@ type RuntimeConfig struct {
3433
func Get() (*RuntimeConfig, error) {
3534
// File contents are deliberately not cached
3635
// as they may change over time.
37-
data, err := ioutil.ReadFile(RuntimeConfigFilename)
36+
data, err := os.ReadFile(RuntimeConfigFilename)
3837
if err != nil {
3938
if os.IsNotExist(err) {
4039
return nil, nil

0 commit comments

Comments
 (0)