chore: rename prj

This commit is contained in:
2026-01-18 20:18:51 +08:00
parent 6843ce2f56
commit 4afe3b0100
5 changed files with 16 additions and 16 deletions

View File

@@ -49,14 +49,14 @@ jobs:
- name: Build Docker image - name: Build Docker image
run: | run: |
cd ${{ gitea.workspace }} cd ${{ gitea.workspace }}
docker build -t localhost:8180/k8s-example/k8s-example:${{ gitea.sha }} . docker build -t localhost:8180/go-example/go-example:${{ gitea.sha }} .
- name: Push Docker image to local registry - name: Push Docker image to local registry
run: | run: |
docker push localhost:8180/k8s-example/k8s-example:${{ gitea.sha }} docker push localhost:8180/go-example/go-example:${{ gitea.sha }}
- name: Update manifest and Push to Git - name: Update manifest and Push to Git
run: | run: |
# 使用 kustomize 或 sed 修改镜像版本 # 使用 kustomize 或 sed 修改镜像版本
sed -i "s|image: .*:.*|image: localhost:8180/k8s-example/k8s-example:${{ gitea.sha }}|g" deployment.yaml sed -i "s|image: .*:.*|image: localhost:8180/go-example/go-example:${{ gitea.sha }}|g" deployment.yaml
# 配置 Git 并提交回仓库 # 配置 Git 并提交回仓库
git config --global user.name "Gitea Action" git config --global user.name "Gitea Action"

View File

@@ -1,11 +1,11 @@
apiVersion: v1 apiVersion: v1
kind: Service kind: Service
metadata: metadata:
name: k8s-example name: go-example
namespace: helloapp namespace: helloapp
spec: spec:
selector: selector:
app: k8s-example app: go-example
ports: ports:
- port: 8800 - port: 8800
targetPort: 8800 targetPort: 8800
@@ -14,21 +14,21 @@ spec:
apiVersion: apps/v1 apiVersion: apps/v1
kind: Deployment kind: Deployment
metadata: metadata:
name: k8s-example name: go-example
namespace: helloapp namespace: helloapp
spec: spec:
selector: selector:
matchLabels: matchLabels:
app: k8s-example app: go-example
replicas: 3 replicas: 3
template: template:
metadata: metadata:
labels: labels:
app: k8s-example app: go-example
spec: spec:
containers: containers:
- name: k8s-example - name: go-example
image: localhost:8180/k8s-example/k8s-example:0b2c48ee261873d5a5b2146f424e2a68ce33d4da image: localhost:8180/go-example/go-example:0b2c48ee261873d5a5b2146f424e2a68ce33d4da
imagePullPolicy: IfNotPresent imagePullPolicy: IfNotPresent
resources: resources:
requests: requests:
@@ -49,7 +49,7 @@ spec:
volumes: volumes:
- name: config-volume - name: config-volume
configMap: configMap:
name: k8s-example-config name: go-example-config
- name: helloapp-test-key - name: helloapp-test-key
secret: secret:
secretName: helloapp-test-key secretName: helloapp-test-key
@@ -57,7 +57,7 @@ spec:
apiVersion: v1 apiVersion: v1
kind: ConfigMap kind: ConfigMap
metadata: metadata:
name: k8s-example-config name: go-example-config
namespace: helloapp namespace: helloapp
data: data:
.linux-config.yaml: | .linux-config.yaml: |

2
go.mod
View File

@@ -1,4 +1,4 @@
module k8s-example module go-example
go 1.25.5 go 1.25.5

View File

@@ -3,7 +3,7 @@ package hello
import ( import (
"encoding/base64" "encoding/base64"
"fmt" "fmt"
"k8s-example/cmn/utils" "go-example/cmn/utils"
"net/http" "net/http"
"github.com/spf13/viper" "github.com/spf13/viper"

View File

@@ -3,8 +3,8 @@ package main
import ( import (
"flag" "flag"
"fmt" "fmt"
"k8s-example/cmn/conf" "go-example/cmn/conf"
"k8s-example/hello" "go-example/hello"
"net/http" "net/http"
"github.com/spf13/viper" "github.com/spf13/viper"