From 504bf71a121b9e90548d981e1f3043a236596d8d Mon Sep 17 00:00:00 2001 From: "Songyang.Huo" Date: Tue, 3 Dec 2024 10:04:43 +0800 Subject: [PATCH 1/5] Update and rename pod.yaml to server-full.yaml --- pod.yaml => server-full.yaml | 68 ++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) rename pod.yaml => server-full.yaml (53%) diff --git a/pod.yaml b/server-full.yaml similarity index 53% rename from pod.yaml rename to server-full.yaml index 696da3a..bbad280 100644 --- a/pod.yaml +++ b/server-full.yaml @@ -61,3 +61,71 @@ spec: path: /mnt/raid1-pool1/amiya-bot/RatingServer/Assets imagePullSecrets: - name: harbor.hsyhhssyy.net + +--- + +apiVersion: v1 +kind: Service +metadata: + name: amiya-bot-player-rating-server-service + namespace: amiya-bot +spec: + selector: + app: amiya-bot-player-rating-server + ports: + - name: port-80 + protocol: TCP + port: 80 + targetPort: 80 + +--- + +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: amiya-bot-rating-server-ingress + namespace: amiya-bot + annotations: + kubernetes.io/ingress.class: nginx + nginx.ingress.kubernetes.io/proxy-body-size: 50m + cert-manager.io/cluster-issuer: letsencrypt-prod + nginx.ingress.kubernetes.io/affinity: "cookie" + nginx.ingress.kubernetes.io/session-cookie-name: "route" + nginx.ingress.kubernetes.io/session-cookie-hash: "sha1" +spec: + tls: + - hosts: + - amiya-bot-service.hsyhhssyy.net + secretName: amiya-bot-service.hsyhhssyy.net.tls + rules: + - host: amiya-bot-service.hsyhhssyy.net + http: + paths: + - path: / + pathType: Prefix + backend: + service: + name: amiya-bot-player-rating-server-service-website + port: + number: 80 + - path: /api/ + pathType: Prefix + backend: + service: + name: amiya-bot-player-rating-server-service + port: + number: 80 + - path: /gamehub + pathType: Prefix + backend: + service: + name: amiya-bot-player-rating-server-service + port: + number: 80 + - path: /connect/ + pathType: Prefix + backend: + service: + name: amiya-bot-player-rating-server-service + port: + number: 80 From b8002f026618746f7b714bccddfec4df519d6cd5 Mon Sep 17 00:00:00 2001 From: "Songyang.Huo" Date: Tue, 3 Dec 2024 10:05:26 +0800 Subject: [PATCH 2/5] Update dotnet.yml --- .github/workflows/dotnet.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index f512d69..98a666b 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -1,4 +1,4 @@ -# This workflow will build a .NET project +er-full# This workflow will build a .NET project # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net name: .NET @@ -55,7 +55,7 @@ jobs: uses: Azure/k8s-deploy@v4 with: namespace: amiya-bot - manifests: pod.yaml + manifests: server-full.yaml images: | harbor.hsyhhssyy.net/home-esxi/amiya-bot-player-rating-server:${{ github.sha }} imagepullsecrets: harbor.hsyhhssyy.net From 7618fc6b5cac7b663dffb158f4112bf7a7a70047 Mon Sep 17 00:00:00 2001 From: "Songyang.Huo" Date: Tue, 3 Dec 2024 10:06:48 +0800 Subject: [PATCH 3/5] Update dotnet.yml --- .github/workflows/dotnet.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index 98a666b..1c92743 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -1,4 +1,4 @@ -er-full# This workflow will build a .NET project +# This workflow will build a .NET project # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net name: .NET From 67b634108296235a329b4afd7b29657a7c4125b6 Mon Sep 17 00:00:00 2001 From: "Songyang.Huo" Date: Tue, 3 Dec 2024 10:07:43 +0800 Subject: [PATCH 4/5] Delete pod-release.yaml --- pod-release.yaml | 65 ------------------------------------------------ 1 file changed, 65 deletions(-) delete mode 100644 pod-release.yaml diff --git a/pod-release.yaml b/pod-release.yaml deleted file mode 100644 index 8101c3e..0000000 --- a/pod-release.yaml +++ /dev/null @@ -1,65 +0,0 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - name: amiyabot-minigame-api - namespace: amiya-bot -spec: - replicas: 1 - selector: - matchLabels: - app: amiyabot-minigame-api - template: - metadata: - labels: - app: amiyabot-minigame-api - spec: - # 仅允许在位于阿里云的节点执行,保证对外IP不变 - affinity: - nodeAffinity: - requiredDuringSchedulingIgnoredDuringExecution: - nodeSelectorTerms: - - matchExpressions: - - key: location - operator: In - values: - - aliyun - containers: - - command: - - dotnet - - AmiyaBotPlayerRatingServer.dll - env: - - name: DOTNET_RUNNING_IN_CONTAINER - value: 'true' - - name: DOTNET_USE_POLLING_FILE_WATCHER - value: 'true' - - name: NUGET_XMLDOC_MODE - value: skip - - name: POWERSHELL_DISTRIBUTION_CHANNEL - value: PSDocker-DotnetSDK-Debian-10 - - name: TZ - value: Asia/Shanghai - image: harbor.hsyhhssyy.net/home-esxi/amiya-bot-player-rating-server:1 - imagePullPolicy: Always - name: amiya-bot-player-rating-server - ports: - - containerPort: 80 - name: http - protocol: TCP - readinessProbe: - failureThreshold: 3 - httpGet: - path: Blank - port: 80 - scheme: HTTP - initialDelaySeconds: 3 - periodSeconds: 10 - successThreshold: 1 - timeoutSeconds: 1 - resources: - requests: - cpu: 250m - memory: 512Mi - terminationMessagePath: /dev/termination-log - terminationMessagePolicy: File - imagePullSecrets: - - name: harbor.hsyhhssyy.net From 3b9033a67ec75adb84facf606750a279b42e721c Mon Sep 17 00:00:00 2001 From: "Songyang.Huo" Date: Tue, 3 Dec 2024 10:07:55 +0800 Subject: [PATCH 5/5] Delete .github/workflows/dotnet-release.yml --- .github/workflows/dotnet-release.yml | 62 ---------------------------- 1 file changed, 62 deletions(-) delete mode 100644 .github/workflows/dotnet-release.yml diff --git a/.github/workflows/dotnet-release.yml b/.github/workflows/dotnet-release.yml deleted file mode 100644 index 3299bc6..0000000 --- a/.github/workflows/dotnet-release.yml +++ /dev/null @@ -1,62 +0,0 @@ -# This workflow will build a .NET project -# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net - -name: .NET Release - -on: - release: - types: [published] - - -jobs: - build: - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v3 - - name: Setup .NET - uses: actions/setup-dotnet@v3 - with: - dotnet-version: 6.0.x - - name: Restore dependencies - run: dotnet restore - - name: Write the secret to file - # use https://base64.us/ to encode json file - run: | - echo "${{ secrets.ASPNET_SETTINGS_LIVE }}" | base64 -d > AmiyaBotPlayerRatingServer/appsettings.Production.json - - name: Build - run: | - cd AmiyaBotPlayerRatingServer - dotnet publish -c Release -o ../publish - ls -ltr ../ - ls -ltr - - name: Login to Private Harbor - uses: docker/login-action@v2 - with: - registry: harbor.hsyhhssyy.net - username: hsyhhssyy@example.com - password: ${{ secrets.HARBOR_PUSH_KEY }} - - name: Build and push Docker images - uses: docker/build-push-action@v4.1.1 - with: - context: . - push: true - tags: harbor.hsyhhssyy.net/home-esxi/amiya-bot-player-rating-server:${{ github.sha }} - - name: Setup kubectl - uses: azure/setup-kubectl@v3 - id: install - - name: Write Context - uses: azure/k8s-set-context@v1 - with: - method: kubeconfig - kubeconfig: ${{ secrets.ALIYUN_KUBECONFIG }} - id: setcontext - - name: Push to k8s - uses: Azure/k8s-deploy@v4 - with: - namespace: amiya-bot - manifests: pod-release.yaml - images: | - harbor.hsyhhssyy.net/home-esxi/amiya-bot-player-rating-server:${{ github.sha }} - imagepullsecrets: harbor.hsyhhssyy.net \ No newline at end of file