Skip to content

Commit

Permalink
Remove CephFS volume support from the Kubernetes provider
Browse files Browse the repository at this point in the history
  • Loading branch information
JaylonmcShan03 committed Nov 1, 2024
1 parent a443c94 commit a9bdde1
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 115 deletions.
69 changes: 0 additions & 69 deletions kubernetes/structure_persistent_volume_spec.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,27 +67,6 @@ func flattenAzureFilePersistentVolumeSource(in *v1.AzureFilePersistentVolumeSour
return []interface{}{att}
}

func flattenCephFSVolumeSource(in *v1.CephFSVolumeSource) []interface{} {
att := make(map[string]interface{})
att["monitors"] = newStringSet(schema.HashString, in.Monitors)
if in.Path != "" {
att["path"] = in.Path
}
if in.User != "" {
att["user"] = in.User
}
if in.SecretFile != "" {
att["secret_file"] = in.SecretFile
}
if in.SecretRef != nil {
att["secret_ref"] = flattenLocalObjectReference(in.SecretRef)
}
if in.ReadOnly {
att["read_only"] = in.ReadOnly
}
return []interface{}{att}
}

func flattenCephFSPersistentVolumeSource(in *v1.CephFSPersistentVolumeSource) []interface{} {
att := make(map[string]interface{})
att["monitors"] = newStringSet(schema.HashString, in.Monitors)
Expand Down Expand Up @@ -625,32 +604,6 @@ func expandAzureFilePersistentVolumeSource(l []interface{}) *v1.AzureFilePersist
return obj
}

func expandCephFSVolumeSource(l []interface{}) *v1.CephFSVolumeSource {
if len(l) == 0 || l[0] == nil {
return &v1.CephFSVolumeSource{}
}
in := l[0].(map[string]interface{})
obj := &v1.CephFSVolumeSource{
Monitors: sliceOfString(in["monitors"].(*schema.Set).List()),
}
if v, ok := in["path"].(string); ok {
obj.Path = v
}
if v, ok := in["user"].(string); ok {
obj.User = v
}
if v, ok := in["secret_file"].(string); ok {
obj.SecretFile = v
}
if v, ok := in["secret_ref"].([]interface{}); ok && len(v) > 0 {
obj.SecretRef = expandLocalObjectReference(v)
}
if v, ok := in["read_only"].(bool); ok {
obj.ReadOnly = v
}
return obj
}

func expandCephFSPersistentVolumeSource(l []interface{}) *v1.CephFSPersistentVolumeSource {
if len(l) == 0 || l[0] == nil {
return &v1.CephFSPersistentVolumeSource{}
Expand Down Expand Up @@ -1522,28 +1475,6 @@ func patchPersistentVolumeSource(pathPrefix, prefix string, d *schema.ResourceDa
}
}

if d.HasChange(prefix + "ceph_fs") {
oldIn, newIn := d.GetChange(prefix + "ceph_fs")
oldV, oldOk := oldIn.([]interface{})
newV, newOk := newIn.([]interface{})

if newOk && len(newV) > 0 {
if oldOk && len(oldV) > 0 {
ops = append(ops, &ReplaceOperation{
Path: pathPrefix + "/cephfs",
Value: expandCephFSVolumeSource(newV),
})
} else {
ops = append(ops, &AddOperation{
Path: pathPrefix + "/cephfs",
Value: expandCephFSVolumeSource(newV),
})
}
} else if oldOk && len(oldV) > 0 {
ops = append(ops, &RemoveOperation{Path: pathPrefix + "/cephfs"})
}
}

if d.HasChange(prefix + "fc") {
oldIn, newIn := d.GetChange(prefix + "fc")
oldV, oldOk := oldIn.([]interface{})
Expand Down
6 changes: 0 additions & 6 deletions kubernetes/structures_pod.go
Original file line number Diff line number Diff line change
Expand Up @@ -410,9 +410,6 @@ func flattenVolumes(volumes []v1.Volume) []interface{} {
if v.Cinder != nil {
obj["cinder"] = flattenCinderVolumeSource(v.Cinder)
}
if v.CephFS != nil {
obj["ceph_fs"] = flattenCephFSVolumeSource(v.CephFS)
}
if v.CSI != nil {
obj["csi"] = flattenCSIVolumeSource(v.CSI)
}
Expand Down Expand Up @@ -1604,9 +1601,6 @@ func expandVolumes(volumes []interface{}) ([]v1.Volume, error) {
if v, ok := m["cinder"].([]interface{}); ok && len(v) > 0 {
vl[i].Cinder = expandCinderVolumeSource(v)
}
if v, ok := m["ceph_fs"].([]interface{}); ok && len(v) > 0 {
vl[i].CephFS = expandCephFSVolumeSource(v)
}
if v, ok := m["csi"].([]interface{}); ok && len(v) > 0 {
vl[i].CSI = expandCSIVolumeSource(v)
}
Expand Down
40 changes: 0 additions & 40 deletions manifest/openapi/testdata/k8s-swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -80318,42 +80318,6 @@
}
}
},
"io.k8s.api.core.v1.CephFSVolumeSource": {
"description": "Represents a Ceph Filesystem mount that lasts the lifetime of a pod Cephfs volumes do not support ownership management or SELinux relabeling.",
"type": "object",
"required": [
"monitors"
],
"properties": {
"monitors": {
"description": "Required: Monitors is a collection of Ceph monitors More info: https://examples.k8s.io/volumes/cephfs/README.md#how-to-use-it",
"type": "array",
"items": {
"type": "string"
}
},
"path": {
"description": "Optional: Used as the mounted root, rather than the full Ceph tree, default is /",
"type": "string"
},
"readOnly": {
"description": "Optional: Defaults to false (read/write). ReadOnly here will force the ReadOnly setting in VolumeMounts. More info: https://examples.k8s.io/volumes/cephfs/README.md#how-to-use-it",
"type": "boolean"
},
"secretFile": {
"description": "Optional: SecretFile is the path to key ring for User, default is /etc/ceph/user.secret More info: https://examples.k8s.io/volumes/cephfs/README.md#how-to-use-it",
"type": "string"
},
"secretRef": {
"description": "Optional: SecretRef is reference to the authentication secret for User, default is empty. More info: https://examples.k8s.io/volumes/cephfs/README.md#how-to-use-it",
"$ref": "#/definitions/io.k8s.api.core.v1.LocalObjectReference"
},
"user": {
"description": "Optional: User is the rados user name, default is admin More info: https://examples.k8s.io/volumes/cephfs/README.md#how-to-use-it",
"type": "string"
}
}
},
"io.k8s.api.core.v1.CinderPersistentVolumeSource": {
"description": "Represents a cinder volume resource in Openstack. A Cinder volume must exist before mounting to a container. The volume must also be in the same region as the kubelet. Cinder volumes support ownership management and SELinux relabeling.",
"type": "object",
Expand Down Expand Up @@ -85481,10 +85445,6 @@
"description": "AzureFile represents an Azure File Service mount on the host and bind mount to the pod.",
"$ref": "#/definitions/io.k8s.api.core.v1.AzureFileVolumeSource"
},
"cephfs": {
"description": "CephFS represents a Ceph FS mount on the host that shares a pod's lifetime",
"$ref": "#/definitions/io.k8s.api.core.v1.CephFSVolumeSource"
},
"cinder": {
"description": "Cinder represents a cinder volume attached and mounted on kubelets host machine. More info: https://examples.k8s.io/mysql-cinder-pd/README.md",
"$ref": "#/definitions/io.k8s.api.core.v1.CinderVolumeSource"
Expand Down

0 comments on commit a9bdde1

Please sign in to comment.