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

Remove fatal error from docker secrets #248

Merged
merged 3 commits into from
Dec 17, 2021
Merged

Conversation

IDevJoe
Copy link
Contributor

@IDevJoe IDevJoe commented Dec 6, 2021

This commit fixes #242 by catching the error thrown by getSecrets(). The underlying issue exists in docker-secret and has to do with the serviceAccount secret installed automatically by kubernetes.

This commit fixes pawelmalak#242 by catching the error thrown by getSecrets(). The underlying issue exists in docker-secret and has to do with the serviceAccount secret installed automatically by kubernetes.
@IDevJoe
Copy link
Contributor Author

IDevJoe commented Dec 6, 2021

This fix is meant to be temporary to allow people to continue to use the latest version of flame until docker-secret is updated. All it does is convert a fatal error into a regular error.

@pawelmalak
Copy link
Owner

Did you test it? Beacuse it is the exact same thing I did (wrapped initDockerSecrets function body with try catch block) when the bug was first reported and according to jojotastic777 who tested the image, nothing has changed.

@IDevJoe
Copy link
Contributor Author

IDevJoe commented Dec 7, 2021

I'm not gonna lie, the code was a tad rushed and I didn't have time to build and test it. The code I proposed here does not fix the issue unfortunately. I have opened hwkd/docker-secret#1, which has tested working code, and I was able to start Flame with it. I did post a temporary workaround in #242.

vmconnect_WWsSXm59wU

@pawelmalak
Copy link
Owner

It's still not working for me. I built new image from IDevJoe:master - pawelmalak/flame:dev-alpha1. I then tested it with normal Docker deployment - no surprises here, it works fine, same as latest and multiarch tags. Next I tried to run it on k3s cluster with:

# flame-k3s.yml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: flame
spec:
  selector:
    matchLabels:
      app: flame
  template:
    metadata:
      labels:
        app: flame
    spec:
      volumes:
        - name: flame-volume
          emptyDir: {}
      containers:
      - name: flame
        image: pawelmalak/flame:dev-alpha1
        ports:
        - containerPort: 5005
        volumeMounts:
        - mountPath: /app/data
          name: flame-volume
        env:
        - name: PASSWORD
          value: flame_password

But it's still the same error:

# start
kubectl create -f flame-k3s.yml

# get logs
kubectl logs flame-55469bd596-tkbf9
node:internal/fs/utils:344
    throw err;
    ^

Error: EISDIR: illegal operation on a directory, read
    at Object.readSync (node:fs:723:3)
    at tryReadSync (node:fs:433:20)
    at Object.readFileSync (node:fs:479:19)
    at /app/node_modules/docker-secret/dist/index.js:17:39
    at Array.forEach (<anonymous>)
    at getSecrets (/app/node_modules/docker-secret/dist/index.js:14:15)
    at Object.<anonymous> (/app/node_modules/docker-secret/dist/index.js:28:19)
    at Module._compile (node:internal/modules/cjs/loader:1101:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.<anonymous> (/app/utils/init/initDockerSecrets.js:1:24)
    at Module._compile (node:internal/modules/cjs/loader:1101:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10) {
  errno: -21,
  syscall: 'read',
  code: 'EISDIR'
}

# list pods
kubectl get pods
NAME                     READY   STATUS             RESTARTS   AGE
flame-55469bd596-tkbf9   0/1     CrashLoopBackOff   6          9m30s

@IDevJoe
Copy link
Contributor Author

IDevJoe commented Dec 7, 2021

@pawelmalak Try now

I forgot to push the new package.json to git

@pawelmalak
Copy link
Owner

Now it seems to be working fine.

@IDevJoe
Copy link
Contributor Author

IDevJoe commented Dec 8, 2021

Commit c8436aa references the fixed docker-secret. Although it's not entirely ideal, the container could be built off of this until the pull on docker-secret is merged. If it comes down to it, and docker-secret seems abandoned, I'll more than likely just republish it on npm.

@hwkd
Copy link

hwkd commented Dec 17, 2021

Sorry folks, I didn't notice the PR made by @IDevJoe. My mind was quite preoccupied with work. I've merged the PR on hwkd/docker-secret and published it to npm.

@pawelmalak pawelmalak changed the base branch from master to bug-k3s December 17, 2021 10:30
@pawelmalak pawelmalak merged commit 9dd3bd1 into pawelmalak:bug-k3s Dec 17, 2021
@IDevJoe
Copy link
Contributor Author

IDevJoe commented Dec 17, 2021

@pawelmalak The PR here references my repository. Since the root issue is now fixed, I'd recommend changing it back to the repository on npm.

Appreciate ya'll.

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

Successfully merging this pull request may close these issues.

[BUG] Flame crashes after updating to version 2.1.1 while running on k3s.
3 participants