-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #52 from udx/UDXI-427
* OS updates * added config for a cronjob to scheduled container rest…
- Loading branch information
Showing
4 changed files
with
87 additions
and
2 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
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,70 @@ | ||
--- | ||
# Service account the client will use to reset the deployment, | ||
# by default the pods running inside the cluster can do no such things. | ||
kind: ServiceAccount | ||
apiVersion: v1 | ||
metadata: | ||
name: sftp-deployment-restart | ||
namespace: CLUSTER_NAMESPACE_VALUE | ||
--- | ||
# allow getting status and patching only the one deployment you want | ||
# to restart | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: Role | ||
metadata: | ||
name: sftp-deployment-restart | ||
namespace: CLUSTER_NAMESPACE_VALUE | ||
rules: | ||
- apiGroups: ["apps", "extensions"] | ||
resources: ["deployments"] | ||
resourceNames: ["GITHUB_ORG-sftp-GITHUB_BRANCH"] | ||
verbs: ["get", "patch", "list", "watch"] # "list" and "watch" are only needed | ||
# if you want to use `rollout status` | ||
--- | ||
# bind the role to the service account | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: RoleBinding | ||
metadata: | ||
name: sftp-deployment-restart | ||
namespace: CLUSTER_NAMESPACE_VALUE | ||
roleRef: | ||
apiGroup: rbac.authorization.k8s.io | ||
kind: Role | ||
name: sftp-deployment-restart | ||
subjects: | ||
- kind: ServiceAccount | ||
name: sftp-deployment-restart | ||
namespace: CLUSTER_NAMESPACE_VALUE | ||
--- | ||
apiVersion: batch/v1 | ||
kind: CronJob | ||
metadata: | ||
name: sftp-deployment-restart | ||
namespace: CLUSTER_NAMESPACE_VALUE | ||
spec: | ||
concurrencyPolicy: Forbid | ||
schedule: '0 3 */3 * *' # cron spec of time | ||
jobTemplate: | ||
spec: | ||
backoffLimit: 2 # this has very low chance of failing, as all this does | ||
# is prompt kubernetes to schedule new replica set for | ||
# the deployment | ||
activeDeadlineSeconds: 600 # timeout, makes most sense with | ||
# "waiting for rollout" variant specified below | ||
template: | ||
spec: | ||
serviceAccountName: sftp-deployment-restart # name of the service | ||
# account configured above | ||
restartPolicy: Never | ||
containers: | ||
- name: kubectl | ||
image: bitnami/kubectl # probably any kubectl image will do, | ||
# optionaly specify version, but this | ||
# should not be necessary, as long the | ||
# version of kubectl is new enough to | ||
# have `rollout restart` | ||
command: | ||
- 'kubectl' | ||
- 'rollout' | ||
- 'restart' | ||
- 'deployment/GITHUB_ORG-sftp-GITHUB_BRANCH' |
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