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

illegal path parameter value: /path-not-on-host. it must be a directory #1015

Open
89yanyu opened this issue Mar 19, 2024 · 0 comments
Open

Comments

@89yanyu
Copy link

89yanyu commented Mar 19, 2024

Issue Description

Type: bug report

Describe what happened (or what feature you want)

I try to create the pod-disk fill injection using url and it is created failed.

curl -v http://11.140.167.216:9526/chaosblade?cmd=create%20k8s%20pod-disk%20fill%20--path%20/path-not-on-host%20--names%20chaos-test%20--namespace%20default%20--kubeconfig%20/root/.kube/config%20--percent%2020
{
    "code": 54000,
    "success": false,
    "error": "illegal `path` parameter value: `/path-not-on-host`. it must be a directory",
    "result": {
        "error": "illegal `path` parameter value: `/path-not-on-host`. it must be a directory",
        "statuses": [
            {
                "error": "illegal `path` parameter value: `/path-not-on-host`. it must be a directory",
                "identifier": "default/11.140.167.216/chaos-test/chaos-test/180df34b3c94/docker",
                "kind": "pod",
                "state": "Error",
                "success": false
            }
        ],
        "success": false,
        "uid": "56f1e63091f5ac86"
    }
}

and I checked path which I injected:

# kubectl exec -it chaos-test -- ls /
bin               lib64             path-not-on-host  sys
dev               linuxrc           proc              tmp
etc               media             root              usr
home              mnt               run               var
lib               opt               sbin

Describe what you expected to happen

Inject succeefully and disk will be filled to 20%

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

  1. prepare kubernetes enviroment
  2. install chaosblade-operator
  3. create a pod with volume and the mount path have to be not same as host path
apiVersion: v1
kind: Pod
metadata:
  name: chaos-test
  namespace: default
spec:
  restartPolicy: Never
  volumes:
  - name: vol
    hostPath:
      path: /data
  containers:
  - name: chaos-test
    image: "registry.k8s.io/busybox"
    command: ["/bin/sh", "-c", "while true; do sleep 1000; done"]
    volumeMounts:
    - name: vol
      mountPath: /path-not-on-host
  1. use the url above to inject and error will be got

Tell us your environment

CentOS8
chaosblade-operator 1.7.2

Anything else we need to know?

I checked source code with 1.7.2. I found that pod-disk fill will check whether the path is a directory out of namespace.
source code

@89yanyu 89yanyu changed the title illegal path parameter value: xxx. it must be a directory illegal path parameter value: /path-not-on-host. it must be a directory Mar 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant