forked from clusterise/rollout-status
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(sts)+feat(retry-limit)+feat(pending-deadline)
- Loading branch information
Showing
14 changed files
with
182 additions
and
17 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
package config | ||
|
||
type Options struct { | ||
IgnoreSecretNotFound bool | ||
IgnoreSecretNotFound bool | ||
RetryLimit int32 | ||
PendingDeadLineSeconds int | ||
} |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package status | ||
|
||
type ResourceType int | ||
|
||
const ( | ||
ResourceTypeDeployment ResourceType = iota | ||
ResourceTypeStatefulSet | ||
ResourceTypeJob | ||
) |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: dep | ||
labels: | ||
type: dep | ||
spec: | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
app: test | ||
template: | ||
metadata: | ||
labels: | ||
app: test | ||
spec: | ||
containers: | ||
- name: dep-pi | ||
image: perl | ||
command: | ||
- /bin/bash | ||
- -c | ||
- | | ||
random() { | ||
min="$1" | ||
max="$2" | ||
range=$((max - min + 1)) | ||
rand=$((min + (RANDOM % range))) | ||
echo "$rand" | ||
} | ||
sleep 2 | ||
if [ "`random 0 2`" = "2" ]; then | ||
touch /tmp/success | ||
tail -f | ||
fi | ||
echo Failed!!! | ||
exit 1 | ||
readinessProbe: | ||
exec: | ||
command: | ||
- sh | ||
- -c | ||
- test -S /tmp/success |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
apiVersion: batch/v1 | ||
kind: Job | ||
metadata: | ||
name: job | ||
labels: | ||
type: job | ||
spec: | ||
backoffLimit: 2 | ||
template: | ||
spec: | ||
containers: | ||
- name: job-pi | ||
image: perl | ||
command: | ||
- /bin/bash | ||
- -c | ||
- | | ||
sleep 1 | ||
random() { | ||
min="$1" | ||
max="$2" | ||
range=$((max - min + 1)) | ||
rand=$((min + (RANDOM % range))) | ||
echo "$rand" | ||
} | ||
if [ "`random 1 5`" = "5" ]; then | ||
echo Success!!! | ||
exit 0 | ||
fi | ||
echo Failed!!! | ||
exit 1 | ||
restartPolicy: Never |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
apiVersion: apps/v1 | ||
kind: StatefulSet | ||
metadata: | ||
name: sts | ||
labels: | ||
type: sts | ||
spec: | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
app: nginx | ||
template: | ||
metadata: | ||
labels: | ||
app: nginx | ||
spec: | ||
containers: | ||
- name: sts-rand | ||
image: perl | ||
command: | ||
- /bin/bash | ||
- -c | ||
- | | ||
random() { | ||
min="$1" | ||
max="$2" | ||
range=$((max - min + 1)) | ||
rand=$((min + (RANDOM % range))) | ||
echo "$rand" | ||
} | ||
sleep 2 | ||
if [ "`random 0 2`" = "2" ]; then | ||
touch /tmp/success | ||
tail -f | ||
fi | ||
echo Failed!!! | ||
exit 1 | ||
readinessProbe: | ||
exec: | ||
command: | ||
- sh | ||
- -c | ||
- test -S /tmp/success | ||
restartPolicy: Always | ||
serviceName: nginx |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/bin/bash | ||
|
||
kubectl delete -f dep.yaml || true && kubectl apply -f dep.yaml | ||
sleep 5 | ||
../../rollout-status -selector type=dep -retry-limit 2 |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/bin/bash | ||
|
||
kubectl delete -f job.yaml || true && kubectl apply -f job.yaml | ||
sleep 5 | ||
../../rollout-status -selector type=job |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/bin/bash | ||
|
||
kubectl delete -f sts.yaml || true && kubectl apply -f sts.yaml | ||
sleep 5 | ||
../../rollout-status -selector type=sts -retry-limit 3 |