Skip to content

Commit

Permalink
added attribute terminationGracePeriodSeconds (#36)
Browse files Browse the repository at this point in the history
  • Loading branch information
hcsu authored Jul 6, 2021
1 parent b69d30d commit 82324bb
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions jsonnetlib/config.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ assert std.length(v) > 0 : 'version is empty';
successfulJobsHistoryLimit: 1,
projectRoot: '/go/src/github.com',
podSpec: {},
terminationGracePeriodSeconds: 30,

// config helper func
local root = self,
Expand Down
9 changes: 8 additions & 1 deletion jsonnetlib/k8s.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,7 @@ cfg {
env=[],
container={},
volumes=[],
terminationGracePeriodSeconds=root.terminationGracePeriodSeconds,
minReplicas=2,
maxReplicas=3,
targetCPUUtilizationPercentage=75,
Expand Down Expand Up @@ -341,6 +342,7 @@ cfg {
env=env,
container=container,
volumes=volumes,
terminationGracePeriodSeconds=terminationGracePeriodSeconds,
podSpec=podSpec,
),
root.svc(namespace, name, port, targetPort),
Expand Down Expand Up @@ -451,6 +453,7 @@ cfg {
maxSurge=root.maxSurge,
container={},
volumes=[],
terminationGracePeriodSeconds=root.terminationGracePeriodSeconds,
podSpec=root.podSpec,
):: {
local labels = { app: name },
Expand Down Expand Up @@ -480,6 +483,10 @@ cfg {
{
volumes: volumes,
} else {},
local graceShutdown = if std.length(std.toString(terminationGracePeriodSeconds)) > 0 then
{
terminationGracePeriodSeconds: terminationGracePeriodSeconds,
} else {},
local colocatedSelector = {
labelSelector: {
matchExpressions: [{
Expand Down Expand Up @@ -553,7 +560,7 @@ cfg {
},
} + probe + configmapref(configmap) + envRef(envmap, env) + container,
],
} + affinity + vols + imagePullSecretsRef(imagePullSecrets) + podSpec,
} + affinity + vols + imagePullSecretsRef(imagePullSecrets) + podSpec + graceShutdown,
},
},
},
Expand Down

0 comments on commit 82324bb

Please sign in to comment.