Skip to content

Commit

Permalink
Install/Uninstall Jobs (#51)
Browse files Browse the repository at this point in the history
* Install Script

* help menu

* dont need client node

* create

* Only add autoupdate if rr exists

* Only add ns to namespaced resources

* better name for function usage

* Update create.js

* Better code reuse

* Update create.js

* Update create.js

* Must specify zero now that we use common safeloadall function

* Create delete.js

* add job yaml

* Updated package lock

Co-authored-by: Alex Lewitt <[email protected]>
  • Loading branch information
mckaymic and alewitt2 authored Feb 24, 2020
1 parent 29b8cee commit ae03d34
Show file tree
Hide file tree
Showing 10 changed files with 821 additions and 343 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,4 @@ typings/

# next.js build output
.next
dev
14 changes: 4 additions & 10 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ script:
- if [ -n "${TRAVIS_TAG}" ]; then docker tag quay.io/razee/razeedeploy-delta:${TRAVIS_COMMIT} quay.io/razee/razeedeploy-delta:${TRAVIS_TAG}; fi
- docker images
- ./build/process-template.sh kubernetes/razeedeploy-delta/resource.yaml >/tmp/resource.yaml
- ./build/process-template.sh kubernetes/job/resource.yaml >/tmp/job.yaml

before_deploy:
- docker login -u="${QUAY_ID}" -p="${QUAY_TOKEN}" quay.io
Expand All @@ -26,15 +27,6 @@ deploy:
on:
tags: true
condition: ${TRAVIS_TAG} =~ ^[0-9]+\.[0-9]+\.[0-9]+_[0-9]{3}$
- provider: releases
file: /tmp/resource.yaml
skip_cleanup: true
draft: true
api_key:
secure: "${GITHUB_TOKEN}"
on:
tags: true
condition: ${TRAVIS_TAG} =~ ^[0-9]+\.[0-9]+\.[0-9]+_[0-9]{3}$

# Deploy released builds
- provider: script
Expand All @@ -44,7 +36,9 @@ deploy:
tags: true
condition: ${TRAVIS_TAG} =~ ^[0-9]+\.[0-9]+\.[0-9]+$
- provider: releases
file: /tmp/resource.yaml
file:
- "/tmp/resource.yaml"
- "/tmp/job.yaml"
skip_cleanup: true
api_key:
secure: "${GITHUB_TOKEN}"
Expand Down
72 changes: 72 additions & 0 deletions kubernetes/job/resource.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
################################################################################
# Copyright 2020 IBM Corp. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
################################################################################
apiVersion: v1
kind: Namespace
metadata:
name: razeedeploy-job
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: razeedeploy-job-sa
namespace: razeedeploy-job
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: razeedeploy-job-admin-cr
rules:
- apiGroups:
- '*'
resources:
- '*'
verbs:
- '*'
- nonResourceURLs:
- '*'
verbs:
- '*'
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: razeedeploy-job-rb
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: razeedeploy-job-admin-cr
subjects:
- kind: ServiceAccount
name: razeedeploy-job-sa
namespace: razeedeploy-job
---
apiVersion: batch/v1
kind: Job
metadata:
name: razeedeploy-job
namespace: razeedeploy-job
spec:
template:
spec:
serviceAccountName: razeedeploy-job-sa
containers:
- name: razeedeploy-job
image: "quay.io/razee/razeedeploy-delta:{{TRAVIS_TAG}}"
{{=<% %>=}}
command: ["node", {{ COMMAND }}]
<%={{ }}=%>
restartPolicy: Never
backoffLimit: 2
Loading

0 comments on commit ae03d34

Please sign in to comment.