refine test environment sample data script, add k8s role and role binding for updating sample data
This commit is contained in:
parent
bd0b7b9dcd
commit
f3c294659a
@ -240,13 +240,11 @@ workflows:
|
|||||||
nightly:
|
nightly:
|
||||||
triggers:
|
triggers:
|
||||||
- schedule:
|
- schedule:
|
||||||
cron: "45 * * * *"
|
cron: "0 0 * * *"
|
||||||
# cron: "0 0 * * *"
|
|
||||||
filters:
|
filters:
|
||||||
branches:
|
branches:
|
||||||
only:
|
only:
|
||||||
- master
|
- master
|
||||||
- test-env
|
|
||||||
jobs:
|
jobs:
|
||||||
- app_setup
|
- app_setup
|
||||||
- test:
|
- test:
|
||||||
@ -259,7 +257,6 @@ workflows:
|
|||||||
branches:
|
branches:
|
||||||
only:
|
only:
|
||||||
- master
|
- master
|
||||||
- test-env
|
|
||||||
- deploy_test:
|
- deploy_test:
|
||||||
requires:
|
requires:
|
||||||
- build_and_push_image
|
- build_and_push_image
|
||||||
@ -267,4 +264,3 @@ workflows:
|
|||||||
branches:
|
branches:
|
||||||
only:
|
only:
|
||||||
- master
|
- master
|
||||||
- test-env
|
|
||||||
|
@ -17,11 +17,6 @@ else
|
|||||||
NAMESPACE=$1
|
NAMESPACE=$1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "${IMAGE_NAME}x" = "x" ]
|
|
||||||
then
|
|
||||||
IMAGE_NAME="${ATAT_DOCKER_REGISTRY_URL}/${PROD_IMAGE_NAME}:${GIT_SHA}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Remove the K8S CA file when the script exits
|
# Remove the K8S CA file when the script exits
|
||||||
function cleanup {
|
function cleanup {
|
||||||
printf "Cleaning up...\n"
|
printf "Cleaning up...\n"
|
||||||
@ -50,7 +45,10 @@ kubectl config use-context atst-deployer
|
|||||||
kubectl config current-context
|
kubectl config current-context
|
||||||
|
|
||||||
# we only need to run these commands against one existing pod
|
# we only need to run these commands against one existing pod
|
||||||
ATST_POD=$(kubectl -n ${NAMESPACE} get pods -l app=atst -o custom-columns=NAME:.metadata.name --no-headers)
|
ATST_POD=$(kubectl -n ${NAMESPACE} get pods -l app=atst -o custom-columns=NAME:.metadata.name --no-headers | sed -n 1p)
|
||||||
|
# echo "kubectl -n ${NAMESPACE} exec ${ATST_POD} -- pipenv run python script/remove_sample_data.py"
|
||||||
|
echo "removing sample data on pod ${ATST_POD}"
|
||||||
kubectl -n ${NAMESPACE} exec ${ATST_POD} -- pipenv run python script/remove_sample_data.py
|
kubectl -n ${NAMESPACE} exec ${ATST_POD} -- pipenv run python script/remove_sample_data.py
|
||||||
|
echo "seeding sample data on pod ${ATST_POD}"
|
||||||
kubectl -n ${NAMESPACE} exec ${ATST_POD} -- pipenv run python script/seed_sample.py
|
kubectl -n ${NAMESPACE} exec ${ATST_POD} -- pipenv run python script/seed_sample.py
|
||||||
|
|
||||||
|
@ -2,17 +2,25 @@ kind: Role
|
|||||||
apiVersion: rbac.authorization.k8s.io/v1beta1
|
apiVersion: rbac.authorization.k8s.io/v1beta1
|
||||||
metadata:
|
metadata:
|
||||||
namespace: atat-test
|
namespace: atat-test
|
||||||
name: atat-deploy-role
|
name: atat-sample-update
|
||||||
rules:
|
rules:
|
||||||
- apiGroups: ["extensions", "apps"]
|
|
||||||
resources: ["deployments"]
|
|
||||||
verbs: ["get", "watch", "create", "update", "patch"]
|
|
||||||
- apiGroups: [""]
|
- apiGroups: [""]
|
||||||
resources: ["services"]
|
resources: ["pods"]
|
||||||
verbs: ["get", "create", "update", "patch"]
|
verbs: ["get", "list"]
|
||||||
- apiGroups: [""]
|
- apiGroups: [""]
|
||||||
resources: ["configmaps"]
|
resources: ["pods/exec"]
|
||||||
verbs: ["get", "create", "update", "patch"]
|
verbs: ["create"]
|
||||||
- apiGroups: ["extensions", "apps"]
|
---
|
||||||
resources: ["ingresses"]
|
kind: RoleBinding
|
||||||
verbs: ["get", "create", "update", "patch"]
|
apiVersion: rbac.authorization.k8s.io/v1beta1
|
||||||
|
metadata:
|
||||||
|
name: atst-sample-role-binding
|
||||||
|
namespace: atat-test
|
||||||
|
subjects:
|
||||||
|
- kind: ServiceAccount
|
||||||
|
name: atat-deployer
|
||||||
|
namespace: atat
|
||||||
|
roleRef:
|
||||||
|
kind: Role
|
||||||
|
name: atat-sample-update
|
||||||
|
apiGroup: rbac.authorization.k8s.io
|
||||||
|
Loading…
x
Reference in New Issue
Block a user