mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-27 05:27:21 +00:00
Merge pull request #40726 from humblec/gluster-provclean
Automatic merge from submit-queue (batch tested with PRs 40505, 34664, 37036, 40726, 41595) Rename provisioner config struct
This commit is contained in:
commit
34ffba6cd2
@ -368,7 +368,7 @@ func (plugin *glusterfsPlugin) newProvisionerInternal(options volume.VolumeOptio
|
|||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
type provisioningConfig struct {
|
type provisionerConfig struct {
|
||||||
url string
|
url string
|
||||||
user string
|
user string
|
||||||
userKey string
|
userKey string
|
||||||
@ -383,7 +383,7 @@ type provisioningConfig struct {
|
|||||||
|
|
||||||
type glusterfsVolumeProvisioner struct {
|
type glusterfsVolumeProvisioner struct {
|
||||||
*glusterfsMounter
|
*glusterfsMounter
|
||||||
provisioningConfig
|
provisionerConfig
|
||||||
options volume.VolumeOptions
|
options volume.VolumeOptions
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -438,7 +438,7 @@ func (plugin *glusterfsPlugin) newDeleterInternal(spec *volume.Spec) (volume.Del
|
|||||||
|
|
||||||
type glusterfsVolumeDeleter struct {
|
type glusterfsVolumeDeleter struct {
|
||||||
*glusterfsMounter
|
*glusterfsMounter
|
||||||
provisioningConfig
|
provisionerConfig
|
||||||
spec *v1.PersistentVolume
|
spec *v1.PersistentVolume
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -579,9 +579,9 @@ func (d *glusterfsVolumeDeleter) Delete() error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
d.provisioningConfig = *cfg
|
d.provisionerConfig = *cfg
|
||||||
|
|
||||||
glog.V(4).Infof("glusterfs: deleting volume %q with configuration %+v", volumeId, d.provisioningConfig)
|
glog.V(4).Infof("glusterfs: deleting volume %q with configuration %+v", volumeId, d.provisionerConfig)
|
||||||
|
|
||||||
gid, exists, err := d.getGid()
|
gid, exists, err := d.getGid()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -647,9 +647,9 @@ func (r *glusterfsVolumeProvisioner) Provision() (*v1.PersistentVolume, error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
r.provisioningConfig = *cfg
|
r.provisionerConfig = *cfg
|
||||||
|
|
||||||
glog.V(4).Infof("glusterfs: creating volume with configuration %+v", r.provisioningConfig)
|
glog.V(4).Infof("glusterfs: creating volume with configuration %+v", r.provisionerConfig)
|
||||||
|
|
||||||
gidTable, err := r.plugin.getGidTable(scName, cfg.gidMin, cfg.gidMax)
|
gidTable, err := r.plugin.getGidTable(scName, cfg.gidMin, cfg.gidMax)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -695,7 +695,7 @@ func (p *glusterfsVolumeProvisioner) CreateVolume(gid int) (r *v1.GlusterfsVolum
|
|||||||
capacity := p.options.PVC.Spec.Resources.Requests[v1.ResourceName(v1.ResourceStorage)]
|
capacity := p.options.PVC.Spec.Resources.Requests[v1.ResourceName(v1.ResourceStorage)]
|
||||||
volSizeBytes := capacity.Value()
|
volSizeBytes := capacity.Value()
|
||||||
sz := int(volume.RoundUpSize(volSizeBytes, 1024*1024*1024))
|
sz := int(volume.RoundUpSize(volSizeBytes, 1024*1024*1024))
|
||||||
glog.V(2).Infof("glusterfs: create volume of size: %d bytes and configuration %+v", volSizeBytes, p.provisioningConfig)
|
glog.V(2).Infof("glusterfs: create volume of size: %d bytes and configuration %+v", volSizeBytes, p.provisionerConfig)
|
||||||
if p.url == "" {
|
if p.url == "" {
|
||||||
glog.Errorf("glusterfs : rest server endpoint is empty")
|
glog.Errorf("glusterfs : rest server endpoint is empty")
|
||||||
return nil, 0, fmt.Errorf("failed to create glusterfs REST client, REST URL is empty")
|
return nil, 0, fmt.Errorf("failed to create glusterfs REST client, REST URL is empty")
|
||||||
@ -705,7 +705,7 @@ func (p *glusterfsVolumeProvisioner) CreateVolume(gid int) (r *v1.GlusterfsVolum
|
|||||||
glog.Errorf("glusterfs: failed to create glusterfs rest client")
|
glog.Errorf("glusterfs: failed to create glusterfs rest client")
|
||||||
return nil, 0, fmt.Errorf("failed to create glusterfs REST client, REST server authentication failed")
|
return nil, 0, fmt.Errorf("failed to create glusterfs REST client, REST server authentication failed")
|
||||||
}
|
}
|
||||||
if p.provisioningConfig.clusterId != "" {
|
if p.provisionerConfig.clusterId != "" {
|
||||||
clusterIds = dstrings.Split(p.clusterId, ",")
|
clusterIds = dstrings.Split(p.clusterId, ",")
|
||||||
glog.V(4).Infof("glusterfs: provided clusterids: %v", clusterIds)
|
glog.V(4).Infof("glusterfs: provided clusterids: %v", clusterIds)
|
||||||
}
|
}
|
||||||
@ -855,8 +855,8 @@ func parseSecret(namespace, secretName string, kubeClient clientset.Interface) (
|
|||||||
}
|
}
|
||||||
|
|
||||||
// parseClassParameters parses StorageClass.Parameters
|
// parseClassParameters parses StorageClass.Parameters
|
||||||
func parseClassParameters(params map[string]string, kubeClient clientset.Interface) (*provisioningConfig, error) {
|
func parseClassParameters(params map[string]string, kubeClient clientset.Interface) (*provisionerConfig, error) {
|
||||||
var cfg provisioningConfig
|
var cfg provisionerConfig
|
||||||
var err error
|
var err error
|
||||||
|
|
||||||
cfg.gidMin = defaultGidMin
|
cfg.gidMin = defaultGidMin
|
||||||
|
@ -254,7 +254,7 @@ func TestParseClassParameters(t *testing.T) {
|
|||||||
parameters map[string]string
|
parameters map[string]string
|
||||||
secret *v1.Secret
|
secret *v1.Secret
|
||||||
expectError bool
|
expectError bool
|
||||||
expectConfig *provisioningConfig
|
expectConfig *provisionerConfig
|
||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
"password",
|
"password",
|
||||||
@ -265,7 +265,7 @@ func TestParseClassParameters(t *testing.T) {
|
|||||||
},
|
},
|
||||||
nil, // secret
|
nil, // secret
|
||||||
false, // expect error
|
false, // expect error
|
||||||
&provisioningConfig{
|
&provisionerConfig{
|
||||||
url: "https://localhost:8080",
|
url: "https://localhost:8080",
|
||||||
user: "admin",
|
user: "admin",
|
||||||
userKey: "password",
|
userKey: "password",
|
||||||
@ -285,7 +285,7 @@ func TestParseClassParameters(t *testing.T) {
|
|||||||
},
|
},
|
||||||
&secret,
|
&secret,
|
||||||
false, // expect error
|
false, // expect error
|
||||||
&provisioningConfig{
|
&provisionerConfig{
|
||||||
url: "https://localhost:8080",
|
url: "https://localhost:8080",
|
||||||
user: "admin",
|
user: "admin",
|
||||||
secretName: "mysecret",
|
secretName: "mysecret",
|
||||||
@ -304,7 +304,7 @@ func TestParseClassParameters(t *testing.T) {
|
|||||||
},
|
},
|
||||||
&secret,
|
&secret,
|
||||||
false, // expect error
|
false, // expect error
|
||||||
&provisioningConfig{
|
&provisionerConfig{
|
||||||
url: "https://localhost:8080",
|
url: "https://localhost:8080",
|
||||||
gidMin: 2000,
|
gidMin: 2000,
|
||||||
gidMax: 2147483647,
|
gidMax: 2147483647,
|
||||||
@ -441,7 +441,7 @@ func TestParseClassParameters(t *testing.T) {
|
|||||||
},
|
},
|
||||||
&secret,
|
&secret,
|
||||||
false, // expect error
|
false, // expect error
|
||||||
&provisioningConfig{
|
&provisionerConfig{
|
||||||
url: "https://localhost:8080",
|
url: "https://localhost:8080",
|
||||||
gidMin: 4000,
|
gidMin: 4000,
|
||||||
gidMax: 2147483647,
|
gidMax: 2147483647,
|
||||||
@ -457,7 +457,7 @@ func TestParseClassParameters(t *testing.T) {
|
|||||||
},
|
},
|
||||||
&secret,
|
&secret,
|
||||||
false, // expect error
|
false, // expect error
|
||||||
&provisioningConfig{
|
&provisionerConfig{
|
||||||
url: "https://localhost:8080",
|
url: "https://localhost:8080",
|
||||||
gidMin: 2000,
|
gidMin: 2000,
|
||||||
gidMax: 5000,
|
gidMax: 5000,
|
||||||
@ -474,7 +474,7 @@ func TestParseClassParameters(t *testing.T) {
|
|||||||
},
|
},
|
||||||
&secret,
|
&secret,
|
||||||
false, // expect error
|
false, // expect error
|
||||||
&provisioningConfig{
|
&provisionerConfig{
|
||||||
url: "https://localhost:8080",
|
url: "https://localhost:8080",
|
||||||
gidMin: 4000,
|
gidMin: 4000,
|
||||||
gidMax: 5000,
|
gidMax: 5000,
|
||||||
@ -493,7 +493,7 @@ func TestParseClassParameters(t *testing.T) {
|
|||||||
},
|
},
|
||||||
&secret,
|
&secret,
|
||||||
false, // expect error
|
false, // expect error
|
||||||
&provisioningConfig{
|
&provisionerConfig{
|
||||||
url: "https://localhost:8080",
|
url: "https://localhost:8080",
|
||||||
gidMin: 4000,
|
gidMin: 4000,
|
||||||
gidMax: 5000,
|
gidMax: 5000,
|
||||||
@ -512,7 +512,7 @@ func TestParseClassParameters(t *testing.T) {
|
|||||||
},
|
},
|
||||||
&secret,
|
&secret,
|
||||||
false, // expect error
|
false, // expect error
|
||||||
&provisioningConfig{
|
&provisionerConfig{
|
||||||
url: "https://localhost:8080",
|
url: "https://localhost:8080",
|
||||||
gidMin: 4000,
|
gidMin: 4000,
|
||||||
gidMax: 5000,
|
gidMax: 5000,
|
||||||
|
Loading…
Reference in New Issue
Block a user