Skip to content

Commit

Permalink
[YUNIKORN-2771] Optimization: Mark placeholder pods for non-graceful …
Browse files Browse the repository at this point in the history
…termination (apache#883)

Update the Kubernetes pod spec for placeholder pods to set
TerminationGracePeriodSeconds to 0. This allows the pods to be removed
immediately when terminated.

Closes: apache#883
  • Loading branch information
craigcondit committed Jul 26, 2024
1 parent b947dca commit 89b8304
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ linters-settings:
goimports:
local-prefixes: github.com/apache/yunikorn
govet:
check-shadowing: true
shadow: true
goconst:
min-occurrences: 5
funlen:
Expand Down
5 changes: 1 addition & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -288,10 +288,7 @@ $(GINKGO_BIN):
.PHONY: lint
lint: $(GOLANGCI_LINT_BIN)
@echo "running golangci-lint"
@git symbolic-ref -q HEAD && REV="origin/HEAD" || REV="HEAD^" ; \
headSHA=$$(git rev-parse --short=12 $${REV}) ; \
echo "checking against commit sha $${headSHA}" ; \
"${GOLANGCI_LINT_BIN}" run
@"${GOLANGCI_LINT_BIN}" run

# Check scripts
.PHONY: check_scripts
Expand Down
16 changes: 9 additions & 7 deletions pkg/cache/placeholder.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ func newPlaceholder(placeholderName string, app *Application, taskGroup TaskGrou

// prepare the resource lists
requests := GetPlaceholderResourceRequests(taskGroup.MinResource)
var zeroSeconds int64 = 0
placeholderPod := &v1.Pod{
ObjectMeta: metav1.ObjectMeta{
Name: placeholderName,
Expand Down Expand Up @@ -113,13 +114,14 @@ func newPlaceholder(placeholderName string, app *Application, taskGroup TaskGrou
},
},
},
RestartPolicy: constants.PlaceholderPodRestartPolicy,
SchedulerName: constants.SchedulerName,
NodeSelector: taskGroup.NodeSelector,
Tolerations: taskGroup.Tolerations,
Affinity: taskGroup.Affinity,
TopologySpreadConstraints: taskGroup.TopologySpreadConstraints,
PriorityClassName: priorityClassName,
RestartPolicy: constants.PlaceholderPodRestartPolicy,
SchedulerName: constants.SchedulerName,
NodeSelector: taskGroup.NodeSelector,
Tolerations: taskGroup.Tolerations,
Affinity: taskGroup.Affinity,
TopologySpreadConstraints: taskGroup.TopologySpreadConstraints,
PriorityClassName: priorityClassName,
TerminationGracePeriodSeconds: &zeroSeconds,
},
}

Expand Down

0 comments on commit 89b8304

Please sign in to comment.