Repository navigation
fix: inlude symlinks in scanning for init scripts - #11077
Merged
Merged
Conversation
When the `/container-init.d` directory is mounted from a secret in k8s, the file type could be a symbolic link not a regular file.
Steps to reproduce:
Create init file
```bash
mkdir ipfs-container-init-d
echo "ipfs config Routing.Type dhtserver" > ipfs-container-init-d/01_init.sh
```
Create this kustomization.yaml file:
```yaml
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
configMapGenerator:
- name: ipfs-container-init-d
files:
- ipfs-container-init-d/01_init.sh
resources:
- k8s.yaml
```
Create a StatefulSet with the secret volume mount:
```yaml
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: ipfs
spec:
selector:
matchLabels:
app: ipfs
replicas: 1
template:
metadata:
labels:
app: ipfs
spec:
containers:
- name: kubo
image: ipfs/kubo:v0.38.2 # https://github.com/ipfs/kubo/releases/tag/v0.38.2
ports:
- containerPort: 4001
protocol: TCP
- containerPort: 4001
protocol: UDP
- containerPort: 5001
- containerPort: 8080
volumeMounts:
- name: ipfs-container-init-d
mountPath: /container-init.d
volumes:
- name: ipfs-container-init-d
configMap:
name: ipfs-container-init-d
```
Apply with `kubectl apply -k .`
Using `kubectl logs` observe the init script is NOT loaded unless this fix is applied.
lidel
approved these changes
Nov 26, 2025
lidel
pushed a commit
that referenced
this pull request
Nov 26, 2025
(cherry picked from commit 72f4c6f)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When the
/container-init.ddirectory is mounted from a ConfigMap in k8s, the file type of init script could be a symbolic link not a regular file.Steps to reproduce:
Create init file
Create this kustomization.yaml file:
Create a StatefulSet with the secret volume mount:
Apply with
kubectl apply -k .Using
kubectl logsobserve the init script is NOT loaded unless this fix is applied.