This repository has been archived by the owner on Feb 18, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3e14ba2
commit 3e3fdbd
Showing
2 changed files
with
136 additions
and
0 deletions.
There are no files selected for viewing
111 changes: 111 additions & 0 deletions
111
.github/workflows/module_controller_ci_build_batch_deploy_to_aliyun.yml
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,111 @@ | ||
name: Module Controller Integration Test | ||
run-name: ${{ github.actor }} pushed module-controller code | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
paths: | ||
- 'module-controller/**' | ||
|
||
pull_request: | ||
branches: | ||
- master | ||
paths: | ||
- 'module-controller/**' | ||
|
||
# enable manually running the workflow | ||
workflow_dispatch: | ||
|
||
env: | ||
CGO_ENABLED: 0 | ||
GOOS: linux | ||
WORK_DIR: module-controller | ||
TAG: ci-test-master-latest | ||
DOCKERHUB_REGISTRY: serverless-registry.cn-shanghai.cr.aliyuncs.com | ||
MODULE_CONTROLLER_IMAGE_PATH: opensource/test/module-controller | ||
INTEGRATION_TESTS_IMAGE_PATH: opensource/test/module-controller-integration-tests | ||
POD_NAMESPACE: default | ||
|
||
defaults: | ||
run: | ||
working-directory: module-controller | ||
|
||
jobs: | ||
unit-test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Docker login | ||
uses: docker/[email protected] | ||
with: | ||
registry: ${{ env.DOCKERHUB_REGISTRY }} | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_PASSWORD }} | ||
logout: false | ||
|
||
- name: Set up Docker buildx | ||
uses: docker/setup-buildx-action@v2 | ||
|
||
- name: Cache Docker layers | ||
uses: actions/cache@v2 | ||
with: | ||
path: /tmp/.buildx-cache | ||
key: ${{ runner.os }}-buildx-${{ hashFiles('${{ env.WORK_DIR }}/*Dockerfile') }} | ||
|
||
- name: Build and push module-controller Docker images | ||
uses: docker/[email protected] | ||
with: | ||
context: ${{ env.WORK_DIR }} | ||
cache-from: type=local,src=/tmp/.buildx-cache | ||
cache-to: type=local,dest=/tmp/.buildx-cache | ||
file: ${{ env.WORK_DIR }}/Dockerfile | ||
platforms: linux/amd64 | ||
push: true | ||
tags: ${{ env.DOCKERHUB_REGISTRY }}/${{ env.MODULE_CONTROLLER_IMAGE_PATH }}:${{ env.TAG }} | ||
|
||
- run: sleep 30 | ||
|
||
- name: Set up Minikube | ||
run: | | ||
curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64 | ||
sudo install minikube-linux-amd64 /usr/local/bin/minikube | ||
- name: Start Minikube | ||
run: minikube start | ||
|
||
- name: Prepare development env | ||
run: | | ||
kubectl apply -f config/crd/bases/serverless.alipay.com_moduledeployments.yaml | ||
kubectl apply -f config/crd/bases/serverless.alipay.com_modulereplicasets.yaml | ||
kubectl apply -f config/crd/bases/serverless.alipay.com_modules.yaml | ||
kubectl apply -f config/crd/bases/serverless.alipay.com_moduletemplates.yaml | ||
kubectl apply -f config/rbac/role.yaml | ||
kubectl apply -f config/rbac/role_binding.yaml | ||
kubectl apply -f config/rbac/service_account.yaml | ||
kubectl apply -f config/samples/ci/dynamic-stock-batch-deployment.yaml | ||
kubectl apply -f config/samples/ci/module-deployment-controller.yaml | ||
kubectl apply -f config/samples/ci/dynamic-stock-service.yaml | ||
- run: sleep 60 | ||
|
||
- name: minikube logs | ||
run: minikube logs | ||
|
||
- name: get pod | ||
run: | | ||
kubectl get pod | ||
- name: describe pod | ||
run: | | ||
kubectl describe pod | ||
- name: wait base pod available | ||
run: | | ||
kubectl wait --for=condition=available deployment/dynamic-stock-deployment --timeout=300s | ||
- name: get module controller pod available | ||
run: | | ||
kubectl wait --for=condition=available deployment/module-controller --timeout=300s |
25 changes: 25 additions & 0 deletions
25
module-controller/config/samples/ci/dynamic-stock-batch-deployment.yaml
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,25 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: dynamic-stock-deployment | ||
spec: | ||
replicas: 3 | ||
selector: | ||
matchLabels: | ||
app: dynamic-stock | ||
template: | ||
metadata: | ||
labels: | ||
app: dynamic-stock | ||
maxModuleCount: "10" | ||
spec: | ||
containers: | ||
- name: dynamic-stock-container | ||
image: serverless-registry.cn-shanghai.cr.aliyuncs.com/opensource/test/dynamic-stock-mng:v0.6 | ||
ports: | ||
- containerPort: 8080 | ||
- containerPort: 1238 | ||
resources: | ||
limits: | ||
cpu: "500m" | ||
memory: "1Gi" |