Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows: subpath mount changes on a container restart if the environment variable changes #90336

Closed
claudiubelu opened this issue Apr 21, 2020 · 3 comments
Labels
kind/bug Categorizes issue or PR as related to a bug. kind/failing-test Categorizes issue or PR as related to a consistently or frequently failing test. priority/critical-urgent Highest priority. Must be actively worked on as someone's top priority right now. sig/windows Categorizes an issue or PR as relevant to SIG Windows.
Milestone

Comments

@claudiubelu
Copy link
Contributor

claudiubelu commented Apr 21, 2020

What happened:

The test [k8s.io] Variable Expansion should not change the subpath mount on a container restart if the environment variable changes [sig-storage][Slow] [Conformance] fails on Windows. On container restart, the subpath mount changes.

The test does the following:

  • spawns a Pod with an EmptyDir volume mounted in 2 locations: /volume_mount and subpath_mount (the 2nd one has a subpath expr set, taken from metadata.annotations['mysubpath'])
  • the pod has a liveness probe that checks for the file /subpath_mount/test.log
  • the test updates metadata.annotations['mysubpath'] to a different value.
  • the test then deletes the file /subpath_mount/test.log and then waits for the container restart because of the liveness probe.
  • the test recreates the /subpath_mount/test.log
  • the test asserts that /volume_mount/foo/test.log exists, and that /volume_mount/newsubpath/test.log does not.

The test fails on the assertions on Windows.

What you expected to happen:

The container volume subpath should not change on container restart.

How to reproduce it (as minimally and precisely as possible):

kubectl create -f liveness.yaml

# check that test.log exists.
kubectl exec -n subpath-test-ns subpath-test -- ls /subpath_mount

# create /volume_mount/bar/test.log and /volume_mount/bar/tender
kubectl exec -n subpath-test-ns subpath-test -- /bin/bash -c "mkdir -p /volume_mount/bar && touch /volume_mount/bar/test.log && touch /volume_mount/bar/tender"

# update the pod volume subpath.
kubectl patch pod -n subpath-test-ns subpath-test -p '{"metadata":{"annotations":{"mysubpath":"bar"}}}'

# trigger the restart by deleting the file checked by the liveness probe.
kubectl exec -n subpath-test-ns subpath-test -- rm /subpath_mount/test.log

# check the /subpath_mount contents. It shouldn't contain test.log or tender.
kubectl exec -n subpath-test-ns subpath-test -- ls /subpath_mount

liveness.yaml:

apiVersion: v1
items:
- apiVersion: v1
  kind: Namespace
  metadata:
    name: subpath-test-ns
- apiVersion: v1
  kind: Pod
  metadata:
    annotations:
      kubernetes.io/psp: e2e-test-privileged-psp
      mysubpath: foo
    name: subpath-test
    namespace: subpath-test-ns
  spec:
    containers:
    - command:
      - /bin/sh
      - -ec
      - 'sleep 100000'
      env:
      - name: POD_NAME
        valueFrom:
          fieldRef:
            apiVersion: v1
            fieldPath: metadata.annotations['mysubpath']
      image: claudiubelu/busybox:1.29
      imagePullPolicy: Always
      livenessProbe:
        exec:
          command:
          - /bin/sh
          - -c
          - 'cat /subpath_mount/test.log'
        failureThreshold: 1
        initialDelaySeconds: 10
        periodSeconds: 2
        successThreshold: 1
        timeoutSeconds: 1
      name: dapi-container
      volumeMounts:
      - mountPath: /subpath_mount
        name: workdir1
        subPathExpr: $(POD_NAME)
      - mountPath: /volume_mount
        name: workdir1
    initContainers:
    - command:
      - sh
      - -c
      - mkdir -p /volume_mount/foo; touch /volume_mount/foo/test.log
      image: claudiubelu/busybox:1.29
      imagePullPolicy: Always
      name: init-volume-50ab29f4
      volumeMounts:
      - mountPath: /subpath_mount
        name: workdir1
      - mountPath: /volume_mount
        name: workdir1
    volumes:
    - emptyDir: {}
      name: workdir1
kind: List

Anything else we need to know?:

/sig windows

Environment:

  • Kubernetes version (use kubectl version): v1.18
  • Cloud provider or hardware configuration: N/A
  • OS (e.g: cat /etc/os-release): Windows Server 2019
  • Kernel (e.g. uname -a): N/A
  • Install tools: N/A
  • Network plugin and version (if this is a network-related bug): N/A
  • Others: N/A
@claudiubelu claudiubelu added the kind/bug Categorizes issue or PR as related to a bug. label Apr 21, 2020
@k8s-ci-robot k8s-ci-robot added the needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. label Apr 21, 2020
@claudiubelu
Copy link
Contributor Author

/sig windows

@k8s-ci-robot k8s-ci-robot added sig/windows Categorizes an issue or PR as relevant to SIG Windows. and removed needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Apr 27, 2020
@marosset marosset added this to Backlog (v1.19) in SIG-Windows Jun 4, 2020
@marosset
Copy link
Contributor

/priority critical-urgent
/kind failing-test
/milestone v1.19

@k8s-ci-robot k8s-ci-robot added priority/critical-urgent Highest priority. Must be actively worked on as someone's top priority right now. kind/failing-test Categorizes issue or PR as related to a consistently or frequently failing test. labels Jun 26, 2020
@k8s-ci-robot k8s-ci-robot added this to the v1.19 milestone Jun 26, 2020
@craiglpeters
Copy link

Due to the discussion in #89629 this is no longer a priority

SIG-Windows automation moved this from Backlog (v1.19) to Done (v1.18) Jul 17, 2020
@marosset marosset moved this from Done (v1.18) to Done (v1.19) in SIG-Windows Aug 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug. kind/failing-test Categorizes issue or PR as related to a consistently or frequently failing test. priority/critical-urgent Highest priority. Must be actively worked on as someone's top priority right now. sig/windows Categorizes an issue or PR as relevant to SIG Windows.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants