Last active
November 10, 2022 10:47
-
-
Save jepio/6d9efc2a9b1501c1f8eb9da29cb2ded8 to your computer and use it in GitHub Desktop.
issue-847-reproducer
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
#!/bin/bash | |
curl -sfL https://get.k3s.io | sh - | |
while ! sudo kubectl get node ; do | |
sleep 1 | |
done | |
cat >manifest.yml <<EOF | |
apiVersion: apps/v1 | |
kind: Deployment | |
metadata: | |
name: io-test | |
labels: | |
app: io-test | |
spec: | |
replicas: 3 | |
selector: | |
matchLabels: | |
app: io-test | |
template: | |
metadata: | |
labels: | |
app: io-test | |
spec: | |
affinity: | |
nodeAffinity: | |
requiredDuringSchedulingIgnoredDuringExecution: | |
nodeSelectorTerms: | |
- matchExpressions: | |
- key: kubernetes.io/hostname | |
operator: In | |
values: | |
- $HOSTNAME | |
containers: | |
- name: io-test | |
image: golang:1.19.1 | |
command: | |
- bash | |
- -c | |
- | | |
apt update && apt install time -y | |
echo ' | |
package main | |
import ( | |
"fmt" | |
"log" | |
"os" | |
) | |
func main() { | |
suffix := "" | |
if len(os.Args) > 1 { | |
suffix = os.Args[1] | |
} | |
err := run(suffix) | |
if err != nil { | |
log.Fatal(err) | |
} | |
} | |
func run(suffix string) error { | |
for i := 0; i < 100_000; i++ { | |
if i%10_000 == 0 { | |
log.Printf("file #%d", i) | |
} | |
path := fmt.Sprintf("file_%d_%s", i, suffix) | |
content := path | |
err := os.WriteFile(path, []byte(content), 0644) | |
if err != nil { | |
return err | |
} | |
} | |
return nil | |
} | |
' >> /test/main.go | |
cd /test | |
go build main.go | |
while true | |
do | |
time ./main \$(date +%s) | |
done | |
volumeMounts: | |
- name: io-test | |
mountPath: "/test" | |
restartPolicy: Always | |
volumes: | |
- name: io-test | |
emptyDir: {} | |
EOF | |
sudo kubectl apply -f manifest.yml | |
sudo kubectl get pods -w |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment