Merge pull request #370 from Coding/master

Add Tencent Kubernetes Engine starter workflow
This commit is contained in:
Cameron Booth
2020-04-29 10:52:12 -07:00
committed by GitHub
3 changed files with 124 additions and 0 deletions
+6
View File
@@ -0,0 +1,6 @@
{
"name": "Tencent Kubernetes Engine",
"description": "This workflow will build a docker container, publish and deploy it to Tencent Kubernetes Engine (TKE).",
"iconName": "tencentcloud",
"categories": ["Dockerfile"]
}
+75
View File
@@ -0,0 +1,75 @@
# This workflow will build a docker container, publish and deploy it to Tencent Kubernetes Engine (TKE).
#
# To configure this workflow:
#
# 1. Ensure that your repository contains the necessary configuration for your Tencent Kubernetes Engine cluster,
# including deployment.yml, kustomization.yml, service.yml, etc.
#
# 2. Set up secrets in your workspace:
# - TENCENT_CLOUD_SECRET_ID with Tencent Cloud secret id
# - TENCENT_CLOUD_SECRET_KEY with Tencent Cloud secret key
# - TENCENT_CLOUD_ACCOUNT_ID with Tencent Cloud account id
# - TKE_REGISTRY_PASSWORD with TKE registry password
#
# 3. Change the values for the TKE_IMAGE_URL, TKE_REGION, TKE_CLUSTER_ID and DEPLOYMENT_NAME environment variables (below).
name: Tencent Kubernetes Engine
on:
release:
types: [created]
# Environment variables available to all jobs and steps in this workflow
env:
TKE_IMAGE_URL: ccr.ccs.tencentyun.com/demo/mywebapp
TKE_REGION: ap-guangzhou
TKE_CLUSTER_ID: cls-mywebapp
DEPLOYMENT_NAME: tke-test
jobs:
setup-build-publish-deploy:
name: Setup, Build, Publish, and Deploy
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
# Build
- name: Build Docker image
run: |
docker build -t ${TKE_IMAGE_URL}:${GITHUB_SHA} .
- name: Login TKE Registry
run: |
docker login -u ${{ secrets.TENCENT_CLOUD_ACCOUNT_ID }} -p ${{ secrets.TKE_REGISTRY_PASSWORD }} ${TKE_IMAGE_URL}
# Push the Docker image to TKE Registry
- name: Publish
run: |
docker push ${TKE_IMAGE_URL}:${GITHUB_SHA}
- name: Set up Kustomize
run: |
curl -o kustomize --location https://github.com/kubernetes-sigs/kustomize/releases/download/v3.1.0/kustomize_3.1.0_linux_amd64
chmod u+x ./kustomize
- name: Set up ~/.kube/config for connecting TKE cluster
uses: TencentCloud/tke-cluster-credential-action@v1
with:
secret_id: ${{ secrets.TENCENT_CLOUD_SECRET_ID }}
secret_key: ${{ secrets.TENCENT_CLOUD_SECRET_KEY }}
tke_region: ${{ env.TKE_REGION }}
cluster_id: ${{ env.TKE_CLUSTER_ID }}
- name: Switch to TKE context
run: |
kubectl config use-context ${TKE_CLUSTER_ID}-context-default
# Deploy the Docker image to the TKE cluster
- name: Deploy
run: |
./kustomize edit set image ${TKE_IMAGE_URL}:${GITHUB_SHA}
./kustomize build . | kubectl apply -f -
kubectl rollout status deployment/${DEPLOYMENT_NAME}
kubectl get services -o wide
+43
View File
@@ -0,0 +1,43 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 22.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="图层_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
width="78px" height="18px" viewBox="0 0 78 18" style="enable-background:new 0 0 78 18;" xml:space="preserve">
<style type="text/css">
.st0{fill:#FFFFFF;}
.st1{fill:#00A3FF;}
.st2{fill:#00C8DC;}
.st3{fill:#006EFF;}
</style>
<g id="XMLID_25_">
<path id="XMLID_38_" class="st0" d="M59.3,1.7h-8.9V3h2.7v4.8h-3.2v1.3h3.2V17h1.5V9.1H58v7.6h2.7v-1.3h-1.2V1.7H59.3z M54.5,7.6V3
H58v4.8h-3.4V7.6z"/>
<rect id="XMLID_14_" x="34.5" y="13.3" class="st0" width="7.1" height="1.3"/>
<path id="XMLID_33_" class="st0" d="M29.6,10.9c0,2.3-0.1,4.2-0.6,5.7c0,0.1,0,0.1,0.1,0.1c0,0,1.1,0,1.3,0c0.5-2.2,0.5-4,0.5-5.3
h1.8v4h-1.2c-0.1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-2-3.1h-1.5l-0.1,0.1C45.7,1.5,47.6,4.5,47.6,4.5z"/>
<rect id="XMLID_6_" x="63.6" y="2" class="st0" width="11.2" height="1.5"/>
<path id="XMLID_5_" class="st0" d="M67.7,8.9h8.8V7.4H62v1.5h4c-0.9,2.2-2.8,7.6-2.9,7.7c0,0.1,0,0.1,0.1,0.1h12.5
c0.1,0,0.1-0.1,0.1-0.1L74,11.7h-1.5c-0.1,0-0.1,0.1-0.1,0.1c0,0.1,1.3,3.5,1.3,3.5h-8.2L67.7,8.9z"/>
</g>
<g id="XMLID_19_">
<path id="XMLID_22_" class="st1" d="M21.5,14.7c-0.4,0.4-1.2,1-2.6,1c-0.6,0-1.3,0-1.6,0c-0.4,0-3.4,0-7,0c2.6-2.5,4.8-4.6,5-4.8
c0.2-0.2,0.7-0.7,1.2-1.1c1-0.9,1.8-1,2.5-1c1,0,1.8,0.4,2.5,1C22.9,11.1,22.9,13.4,21.5,14.7 M23.2,8.2c-1-1.1-2.5-1.8-4.1-1.8
c-1.4,0-2.6,0.5-3.7,1.3c-0.4,0.4-1,0.8-1.5,1.4c-0.4,0.4-9,8.8-9,8.8C5.4,18,6,18,6.5,18s10.5,0,10.9,0c0.8,0,1.4,0,2-0.1
c1.3-0.1,2.6-0.6,3.7-1.6C25.4,14.1,25.4,10.4,23.2,8.2z"/>
<path id="XMLID_2_" class="st2" d="M9.2,7.6C8.1,6.8,7,6.4,5.7,6.4c-1.6,0-3.1,0.7-4.1,1.8c-2.2,2.3-2.2,5.9,0.1,8.2
c1,0.9,2,1.4,3.2,1.5l2.3-2.2c-0.4,0-0.9,0-1.3,0c-1.3-0.1-2.1-0.5-2.6-1c-1.4-1.4-1.4-3.6-0.1-5c0.7-0.7,1.5-1,2.5-1
c0.6,0,1.5,0.1,2.4,1c0.4,0.4,1.5,1.2,1.9,1.6h0.1l1.5-1.5V9.7C10.9,9,9.8,8.1,9.2,7.6"/>
<path id="XMLID_1_" class="st3" d="M19.7,5.1c-1.1-3-4-5.1-7.3-5.1c-3.9,0-7,2.9-7.6,6.5c0.3,0,0.6-0.1,1-0.1s0.9,0.1,1.3,0.1l0,0
C7.6,4,9.8,2.2,12.4,2.2c2.2,0,4.1,1.3,5,3.2c0,0,0.1,0.1,0.1,0C18.2,5.3,19,5.1,19.7,5.1C19.7,5.2,19.7,5.2,19.7,5.1"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 3.4 KiB