Skip to content

Commit 8468706

Browse files
jichenjckllex
andauthored
support mounting btrfs volumes by the cinder-csi-plugin (kubernetes#1941) (kubernetes#1944)
Co-authored-by: kllex <[email protected]>
1 parent dc1773f commit 8468706

File tree

11 files changed

+41
-39
lines changed

11 files changed

+41
-39
lines changed

cluster/images/cinder-csi-plugin/Dockerfile.build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ FROM k8s.gcr.io/build-image/debian-base-${DEBIAN_ARCH}:v2.1.3
44
ARG ARCH=amd64
55

66
# Install e4fsprogs for format
7-
RUN clean-install ca-certificates e2fsprogs mount xfsprogs udev
7+
RUN clean-install btrfs-progs ca-certificates e2fsprogs mount udev xfsprogs
88

99
ADD cinder-csi-plugin-${ARCH} /bin/cinder-csi-plugin

pkg/autohealing/cloudprovider/openstack/provider.go

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -251,10 +251,11 @@ func (provider OpenStackCloudProvider) waitForServerDetachVolumes(serverID strin
251251
}
252252

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

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

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/validator/validator.go

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -28,20 +28,20 @@ import (
2828
// By default, the input data has to contain a value for each struct field.
2929
//
3030
// Available tags:
31-
// * name:"FIELD-NAME" : key of the value in the input map
32-
// * value: modifies value requirements:
33-
// value:"required" : field is required
34-
// value:"optional" : field is optional
35-
// value:"requiredIf:FIELD-NAME=REGEXP-PATTERN" : field is required if the value of FIELD-NAME matches REGEXP-PATTERN
36-
// value:"optionalIf:FIELD-NAME=REGEXP-PATTERN" : field is optional if the value of FIELD-NAME matches REGEXP-PATTERN
37-
// value:"default:VALUE" : field value defaults to VALUE
38-
// * dependsOn:"FIELD-NAMES|,..." : if this field is not empty, the specified fields are required to be present
39-
// operator ',' acts as AND
40-
// operator '|' acts as XOR
41-
// e.g.: dependsOn:"f1|f2|f3,f4,f5" : if this field is not empty, exactly one of {f1,f2,f3} is required to be present,
42-
// and f4 and f5 is required to be present
43-
// * precludes:"FIELD-NAMES,..." : if this field is not empty, all specified fields are required to be empty
44-
// * matches:"REGEXP-PATTERN" : if this field is not empty, it's required to match REGEXP-PATTERN
31+
// - name:"FIELD-NAME" : key of the value in the input map
32+
// - value: modifies value requirements:
33+
// value:"required" : field is required
34+
// value:"optional" : field is optional
35+
// value:"requiredIf:FIELD-NAME=REGEXP-PATTERN" : field is required if the value of FIELD-NAME matches REGEXP-PATTERN
36+
// value:"optionalIf:FIELD-NAME=REGEXP-PATTERN" : field is optional if the value of FIELD-NAME matches REGEXP-PATTERN
37+
// value:"default:VALUE" : field value defaults to VALUE
38+
// - dependsOn:"FIELD-NAMES|,..." : if this field is not empty, the specified fields are required to be present
39+
// operator ',' acts as AND
40+
// operator '|' acts as XOR
41+
// e.g.: dependsOn:"f1|f2|f3,f4,f5" : if this field is not empty, exactly one of {f1,f2,f3} is required to be present,
42+
// and f4 and f5 is required to be present
43+
// - precludes:"FIELD-NAMES,..." : if this field is not empty, all specified fields are required to be empty
44+
// - matches:"REGEXP-PATTERN" : if this field is not empty, it's required to match REGEXP-PATTERN
4545
type Validator struct {
4646
t reflect.Type
4747

pkg/ingress/controller/controller.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1033,7 +1033,6 @@ func privateKeyFromPEM(pemData []byte) (crypto.PrivateKey, error) {
10331033

10341034
// parsePEMBundle parses a certificate bundle from top to bottom and returns
10351035
// a slice of x509 certificates. This function will error if no certificates are found.
1036-
//
10371036
func parsePEMBundle(bundle []byte) ([]*x509.Certificate, error) {
10381037
var certificates []*x509.Certificate
10391038
var certDERBlock *pem.Block

pkg/kms/barbican/barbican.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ type KMSOpts struct {
1515
KeyID string `gcfg:"key-id"`
1616
}
1717

18-
//Config to read config options
18+
// Config to read config options
1919
type Config struct {
2020
Global client.AuthOpts
2121
KeyManager KMSOpts

pkg/openstack/loadbalancer.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -743,7 +743,7 @@ func nodeAddressForLB(node *corev1.Node) (string, error) {
743743
return "", cpoerrors.ErrNoAddressFound
744744
}
745745

746-
//getStringFromServiceAnnotation searches a given v1.Service for a specific annotationKey and either returns the annotation's value or a specified defaultSetting
746+
// getStringFromServiceAnnotation searches a given v1.Service for a specific annotationKey and either returns the annotation's value or a specified defaultSetting
747747
func getStringFromServiceAnnotation(service *corev1.Service, annotationKey string, defaultSetting string) string {
748748
klog.V(4).Infof("getStringFromServiceAnnotation(%s/%s, %v, %v)", service.Namespace, service.Name, annotationKey, defaultSetting)
749749
if annotationValue, ok := service.Annotations[annotationKey]; ok {
@@ -760,7 +760,7 @@ func getStringFromServiceAnnotation(service *corev1.Service, annotationKey strin
760760
return defaultSetting
761761
}
762762

763-
//getIntFromServiceAnnotation searches a given v1.Service for a specific annotationKey and either returns the annotation's integer value or a specified defaultSetting
763+
// getIntFromServiceAnnotation searches a given v1.Service for a specific annotationKey and either returns the annotation's integer value or a specified defaultSetting
764764
func getIntFromServiceAnnotation(service *corev1.Service, annotationKey string, defaultSetting int) int {
765765
klog.V(4).Infof("getIntFromServiceAnnotation(%s/%s, %v, %v)", service.Namespace, service.Name, annotationKey, defaultSetting)
766766
if annotationValue, ok := service.Annotations[annotationKey]; ok {
@@ -777,7 +777,7 @@ func getIntFromServiceAnnotation(service *corev1.Service, annotationKey string,
777777
return defaultSetting
778778
}
779779

780-
//getBoolFromServiceAnnotation searches a given v1.Service for a specific annotationKey and either returns the annotation's boolean value or a specified defaultSetting
780+
// getBoolFromServiceAnnotation searches a given v1.Service for a specific annotationKey and either returns the annotation's boolean value or a specified defaultSetting
781781
func getBoolFromServiceAnnotation(service *corev1.Service, annotationKey string, defaultSetting bool) bool {
782782
klog.V(4).Infof("getBoolFromServiceAnnotation(%s/%s, %v, %v)", service.Namespace, service.Name, annotationKey, defaultSetting)
783783
if annotationValue, ok := service.Annotations[annotationKey]; ok {
@@ -1187,7 +1187,7 @@ func (lbaas *LbaasV2) ensureOctaviaHealthMonitor(lbID string, name string, pool
11871187
return nil
11881188
}
11891189

1190-
//buildMonitorCreateOpts returns a v2monitors.CreateOpts without PoolID for consumption of both, fully popuplated Loadbalancers and Monitors.
1190+
// buildMonitorCreateOpts returns a v2monitors.CreateOpts without PoolID for consumption of both, fully popuplated Loadbalancers and Monitors.
11911191
func (lbaas *LbaasV2) buildMonitorCreateOpts(svcConf *serviceConfig, port corev1.ServicePort) v2monitors.CreateOpts {
11921192
monitorProtocol := string(port.Protocol)
11931193
if port.Protocol == corev1.ProtocolUDP {
@@ -1301,7 +1301,7 @@ func (lbaas *LbaasV2) buildPoolCreateOpt(listenerProtocol string, service *corev
13011301
}
13021302
}
13031303

1304-
//buildBatchUpdateMemberOpts returns v2pools.BatchUpdateMemberOpts array for Services and Nodes alongside a list of member names
1304+
// buildBatchUpdateMemberOpts returns v2pools.BatchUpdateMemberOpts array for Services and Nodes alongside a list of member names
13051305
func (lbaas *LbaasV2) buildBatchUpdateMemberOpts(port corev1.ServicePort, nodes []*corev1.Node, svcConf *serviceConfig) ([]v2pools.BatchUpdateMemberOpts, sets.String, error) {
13061306
var members []v2pools.BatchUpdateMemberOpts
13071307
newMembers := sets.NewString()
@@ -1426,7 +1426,7 @@ func (lbaas *LbaasV2) ensureOctaviaListener(lbID string, name string, curListene
14261426
return listener, nil
14271427
}
14281428

1429-
//buildListenerCreateOpt returns listeners.CreateOpts for a specific Service port and configuration
1429+
// buildListenerCreateOpt returns listeners.CreateOpts for a specific Service port and configuration
14301430
func (lbaas *LbaasV2) buildListenerCreateOpt(port corev1.ServicePort, svcConf *serviceConfig) listeners.CreateOpts {
14311431
listenerProtocol := listeners.Protocol(port.Protocol)
14321432

pkg/util/errors/errors.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ var ErrNoAddressFound = errors.New("no address found for host")
3636
// IPv6 support is disabled by config
3737
var ErrIPv6SupportDisabled = errors.New("IPv6 support is disabled")
3838

39-
//ErrNoRouterID is used when router-id is not set
39+
// ErrNoRouterID is used when router-id is not set
4040
var ErrNoRouterID = errors.New("router-id not set in cloud provider config")
4141

4242
func IsNotFound(err error) bool {

pkg/util/mount/mount.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ func getBaseMounter() *mount.SafeFormatAndMount {
8181
}
8282
}
8383

84-
//GetMountProvider returns instance of Mounter
84+
// GetMountProvider returns instance of Mounter
8585
func GetMountProvider() IMount {
8686
if MInstance == nil {
8787
MInstance = &Mount{BaseMounter: getBaseMounter()}

0 commit comments

Comments
 (0)