Skip to content

Commit

Permalink
Merge pull request #222 from wlan0/master
Browse files Browse the repository at this point in the history
use default mountPropagation of HostToContainer and support for MountPropagationNone
  • Loading branch information
wlan0 authored May 25, 2018
2 parents 1cf4f3c + ea84f00 commit bfbff4b
Show file tree
Hide file tree
Showing 9 changed files with 15 additions and 9 deletions.
10 changes: 6 additions & 4 deletions converter/converters/koki_pod_to_kube_v1_pod.go
Original file line number Diff line number Diff line change
Expand Up @@ -1546,14 +1546,16 @@ func revertVolumeMounts(mounts []types.VolumeMount) []v1.VolumeMount {
}

func revertMountPropagation(prop types.MountPropagation) *v1.MountPropagationMode {
var mode v1.MountPropagationMode
mode := v1.MountPropagationHostToContainer

if prop == types.MountPropagationHostToContainer {
mode = v1.MountPropagationHostToContainer
}
if prop == types.MountPropagationBidirectional {
mode = v1.MountPropagationBidirectional
}

if prop == types.MountPropagationNone {
mode = v1.MountPropagationNone
}

return &mode
}

Expand Down
2 changes: 2 additions & 0 deletions converter/converters/kube_v1_pod_to_koki.go
Original file line number Diff line number Diff line change
Expand Up @@ -1268,6 +1268,8 @@ func convertMountPropagation(p v1.MountPropagationMode) (types.MountPropagation,
return types.MountPropagationHostToContainer, nil
} else if p == v1.MountPropagationBidirectional {
return types.MountPropagationBidirectional, nil
} else if p == v1.MountPropagationNone {
return types.MountPropagationNone, nil
}
return "", serrors.InvalidInstanceError(p)
}
Expand Down
1 change: 1 addition & 0 deletions testdata/pod_preset/pod_preset.short.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ pod_preset:
mounts:
- mount: /cache
store: cache-volume
propagation: host-to-container
name: allow-database
selector:
role: frontend
Expand Down
2 changes: 1 addition & 1 deletion testdata/pod_preset/pod_preset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ spec:
role: frontend
volumeMounts:
- mountPath: /cache
mountPropagation: ""
mountPropagation: "HostToContainer"
name: cache-volume
volumes:
- emptyDir: {}
Expand Down
2 changes: 1 addition & 1 deletion testdata/stateful_sets/stateful_set.rekube.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ spec:
resources: {}
volumeMounts:
- mountPath: /usr/share/nginx/html
mountPropagation: ""
mountPropagation: "HostToContainer"
name: www
terminationGracePeriodSeconds: 10
updateStrategy:
Expand Down
2 changes: 1 addition & 1 deletion testdata/storage_class/storage_class.short.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ storage_class:
secretNamespace: ""
provisioner: kubernetes.io/glusterfs
version: storage.k8s.io/v1
binding_mode: wait-for-first-customer
binding_mode: wait-for-first-consumer

2 changes: 1 addition & 1 deletion testdata/storage_class/storage_class.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ parameters:
secretNamespace: ""
secretName: ""
allowVolumeExpansion: true
volumeBindingMode: WaitForFirstCustomer
volumeBindingMode: WaitForFirstConsumer
2 changes: 1 addition & 1 deletion tests/functional_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ func TestStatefulSets(t *testing.T) {
}

func TestStorageClass(t *testing.T) {
err := testResource("stateful_sets", testFuncGenerator(t))
err := testResource("storage_class", testFuncGenerator(t))
if err != nil {
t.Fatal(err)
}
Expand Down
1 change: 1 addition & 0 deletions types/container.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ type MountPropagation string
const (
MountPropagationHostToContainer MountPropagation = "host-to-container"
MountPropagationBidirectional MountPropagation = "bidirectional"
MountPropagationNone MountPropagation = "none"
)

type TerminationMessagePolicy string
Expand Down

0 comments on commit bfbff4b

Please sign in to comment.