Compare commits

...

31 Commits
v0.9 ... v1.191

Author SHA1 Message Date
bamanker
a66c3341d8 传递环境变量16 2025-12-26 11:01:51 +08:00
bamanker
ade040c622 传递环境变量15
Some checks failed
Build Push and Deploy Image / build (push) Has been cancelled
2025-12-26 10:57:34 +08:00
bamanker
9384be3d8a 传递环境变量14
Some checks failed
Build Push and Deploy Image / build (push) Has been cancelled
2025-12-26 10:47:13 +08:00
bamanker
cb0355b2d3 传递环境变量13
Some checks failed
Build Push and Deploy Image / build (push) Has been cancelled
2025-12-26 10:45:29 +08:00
bamanker
a59bf54e56 传递环境变量12
Some checks failed
Build Push and Deploy Image / build (push) Has been cancelled
2025-12-26 10:20:13 +08:00
bamanker
a82e7e9c26 传递环境变量11
Some checks failed
Build Push and Deploy Image / build (push) Has been cancelled
2025-12-26 10:03:49 +08:00
bamanker
1e81261aef 传递环境变量10
Some checks failed
Build Push and Deploy Image / build (push) Failing after 2s
2025-12-26 10:02:07 +08:00
bamanker
c0975a75ed 传递环境变量9
Some checks failed
Build Push and Deploy Image / build (push) Has been cancelled
2025-12-26 09:57:51 +08:00
bamanker
10153898c2 传递环境变量8
Some checks failed
Build Push and Deploy Image / build (push) Failing after 2s
2025-12-26 09:56:48 +08:00
bamanker
8412554d26 传递环境变量7
Some checks failed
Build Push and Deploy Image / build (push) Has been cancelled
2025-12-26 09:51:14 +08:00
bamanker
8555ea3077 传递环境变量6
Some checks failed
Build Push and Deploy Image / build (push) Failing after 1s
2025-12-26 09:50:18 +08:00
bamanker
79471c11a5 传递环境变量5
Some checks failed
Build Push and Deploy Image / build (push) Failing after 1s
2025-12-26 09:46:29 +08:00
bamanker
11c1c2fa23 传递环境变量4 2025-12-26 09:43:54 +08:00
bamanker
90e4fb4e96 传递环境变量3 2025-12-26 09:42:31 +08:00
bamanker
3dab5fc361 传递环境变量2 2025-12-26 09:38:54 +08:00
bamanker
a2cea3ca9a 传递环境变量1
Some checks failed
Build Push and Deploy Image / build (push) Failing after 2s
2025-12-26 09:36:22 +08:00
bamanker
b37172331e 传递环境变量
Some checks failed
Build Push and Deploy Image / build (push) Failing after 6s
2025-12-26 09:31:29 +08:00
bamanker
6d9fba8ea8 环境变量传递
Some checks failed
Build Push and Deploy Image / build (push) Failing after 4s
2025-12-25 23:57:33 +08:00
bamanker
77a1f50115 完善了一些内容
Some checks failed
Build Push and Deploy Image / build (push) Failing after 3m59s
2025-12-25 17:43:30 +08:00
bamanker
1f7d5eb904 修改了deployment里的错别字 2025-12-25 17:42:28 +08:00
bamanker
9f4028e439 修改了deployment里的错别字
All checks were successful
Build Push and Deploy Image / build (push) Successful in 1m27s
2025-12-25 17:29:22 +08:00
bamanker
b7085d2765 修改了apply url的格式,以便访问原始文件代码
All checks were successful
Build Push and Deploy Image / build (push) Successful in 1m12s
2025-12-25 17:23:58 +08:00
bamanker
d2d3e9e3f5 修改deployment.yml文件格式,防止json转换错误1
Some checks failed
Build Push and Deploy Image / build (push) Failing after 1m29s
2025-12-25 17:01:00 +08:00
bamanker
95edbd85aa 修改deployment.yml文件格式,防止json转换错误
Some checks failed
Build Push and Deploy Image / build (push) Failing after 1m6s
2025-12-25 16:45:48 +08:00
bamanker
255baf2f3d 修改deployment.yml文件格式 2025-12-25 16:42:03 +08:00
bamanker
713a47c337 修改deployment.yml文件格式 2025-12-25 16:42:03 +08:00
bamanker
044ddf9ef1 远程k3s可以连接,测试apply指令-修改参数格式5
Some checks failed
Build Push and Deploy Image / build (push) Has been cancelled
2025-12-25 16:25:26 +08:00
bamanker
7d057843be Merge remote-tracking branch 'origin/master' into HEAD
# Conflicts:
#	.gitea/workflows/build.yml
2025-12-25 16:20:58 +08:00
bamanker
d837507f10 远程k3s可以连接,测试apply指令-修改参数格式4
Some checks failed
Build Push and Deploy Image / build (push) Failing after 1m16s
2025-12-25 16:19:03 +08:00
bamanker
9dd0d38cf8 远程k3s可以连接,测试apply指令-修改参数格式3
Some checks failed
Build Push and Deploy Image / build (push) Failing after 24s
2025-12-25 15:37:56 +08:00
bamanker
647ee0937e 远程k3s可以连接,测试apply指令-修改参数格式2
Some checks failed
Build Push and Deploy Image / build (push) Failing after 2m12s
2025-12-25 15:15:59 +08:00
3 changed files with 82 additions and 66 deletions

View File

@@ -13,15 +13,14 @@ on:
env:
PATH: /opt/node/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
REGISTRY: registry.cn-chengdu.aliyuncs.com
IMAGE_NAME: bamanker/myk3stest
CONTAINER_NAME: myk3stest
IMAGE_NAMESPACE: bamanker
IMAGE_NAME: myk3stest
APP_NAME: myk3s-test
jobs:
# 构建 Job
build:
runs-on: host
outputs: # 声明作业的输出变量,方便在其他 Job 引用
datetime: ${{ steps.datetime.outputs.datetime }}
steps:
# 下载仓库源码依赖java环境因此构建服务器本地需要下载安装java并设置环境变量
- name: Checkout repository code
@@ -38,10 +37,20 @@ jobs:
# e.g. refs/tags/v1.0.0
run: |
echo "version=${GITHUB_REF/refs\/tags\/v}" >> $GITHUB_OUTPUT
- name: Check java version
run: java -version
- name: Show now path
run: echo $(pwd);ls
# - name: Check java version
# run: java -version
|
echo "APP_TAG=${{ steps.get_version.outputs.version }}"
- name: Set Env Var
run: |
cat ./deployment.yml && export APP_TAG="${{ steps.get_version.outputs.version }}"
# export APP_TAG=$env.TAG
# echo APP_TAG=${{ env.TAG }} |
# export APP_NAME=${{ env.APP_NAME }} |
# echo APP_NAME=${{ env.APP_NAME }} |
- name: Inject Env Var
run: |
envsubst < ./deployment.yml
- name: Build with Maven
# 设置Maven执行权限使用maven绝对路径执行打包命令
run: /usr/local/maven/bin/mvn clean package -DskipTests -Pprod
@@ -71,19 +80,24 @@ jobs:
platforms: linux/amd64
file: Dockerfile
push: true
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.TAG }}
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAMESPPACE }}/${{ env.IMAGE_NAME }}:${{ env.TAG }}
- name: k8s Check and Apply New Deployment
uses: http://139.9.216.111:3000/bamanker/steevchen-kubectl@master
with:
config: ${{ secrets.KUBE_CONFIG }}
command: apply -f http://139.9.216.111:3000/bamanker/myk3sTest/raw/branch/master/.deploy/deployment.yml
- name: k8s Check Pods Health
uses: http://139.9.216.111:3000/bamanker/steevchen-kubectl@master
with:
config: ${{ secrets.KUBE_CONFIG }}
command: get pod -n default -l app=${{ env.APP_NAME }}
- name: k8s Update Deployment
uses: http://139.9.216.111:3000/bamanker/steevchen-kubectl@master
env:
KUBE_CONFIG: ${{ secrets.KUBE_CONFIG }}
with:
args: apply -f deployment.yml
# - name: k8s Update Deployment
# uses: http://139.9.216.111:3000/bamanker/kubectl@master
# env:
# KUBE_CONFIG: ${{ secrets.KUBE_CONFIG }}
# with:
# args: rollout restart deployment ${{ env.CONTAINER_NAME }}-${{ gitea.ref_name }}
command: rollout restart deployment ${{ env.APP_NAME }}-${{ gitea.ref_name }}

View File

@@ -1,79 +1,61 @@
---
## k8s默认是访问不了外部服务的需要代理,以mysql和redis为例代理myservice名称到192.168.0.100配置文件中对应的ip修改为myservice
#apiVersion: v1
#kind: Endpoints
#metadata:
# name: myservice
#subsets:
# - addresses:
# - ip: 192.168.0.100
# ports:
# - port: 6379
# protocol: TCP
# name: redis
# - port: 3306
# protocol: TCP
# name: mysql
#---
#apiVersion: v1
#kind: Service
#metadata:
# name: myservice
#spec:
# ports:
# - port: 6379
# targetPort: 6379
# protocol: TCP
# name: redis
# - port: 3306
# targetPort: 3306
# protocol: TCP
# name: mysql
#
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: myk3sTest
labels:
app: $APP_NAME
version: $APP_TAG
name: $APP_NAME
namespace: default
spec:
replicas: 2
revisionHistoryLimit: 3
progressDeadlineSeconds: 600
replicas: 1
revisionHistoryLimit: 2
selector:
matchLabels:
app: myk3sTest
app: $APP_NAME
strategy:
rollingUpdate:
maxSurge: 50%
maxUnavailable: 50%
type: RollingUpdate
template:
metadata:
labels:
app: myk3sTest
app: $APP_NAME
version: $APP_TAG
spec:
containers:
- image: ${env.REGISTRY}/${env.IMAGE_NAME}:${steps.datetime.outputs.datetime}
name: myk3sTest
- image: $REGISTRY/$IMAGE_NAMESPACE/$IMAGE_NAME:$APP_TAG
name: $APP_NAME
imagePullPolicy: Always
readinessProbe:
httpGet:
path: /actuator/health
port: 9090
initialDelaySeconds: 1
timeoutSeconds: 10
failureThreshold: 30
successThreshold: 5
ports:
- containerPort: 9090
imagePullSecrets:
- name: dockerhub-id
---
apiVersion: v1
kind: Service
metadata:
name: myk3sTest
labels:
app: $APP_NAME
name: $APP_NAME
namespace: default
spec:
type: NodePort
externalTrafficPolicy: Local
ports:
- name: http-8080
- name: http
protocol: TCP
port: 9090
nodePort: 30099
nodePort: 9090
selector:
app: myk3sTest
app: $APP_NAME

30
pom.xml
View File

@@ -8,9 +8,10 @@
<version>4.0.1</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.bamanker</groupId>
<artifactId>myk3sTest</artifactId>
<version>0.0.1</version>
<version>v1.1.9</version>
<name>myk3sTest</name>
<description>myk3sTest</description>
<url/>
@@ -28,11 +29,13 @@
</scm>
<properties>
<java.version>25</java.version>
<app.version>${version}</app.version>
<app.name>${artifactId}</app.name>
<maven.compiler.source>25</maven.compiler.source>
<maven.compiler.target>25</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
@@ -59,7 +62,27 @@
<build>
<finalName>myk3sTest</finalName>
<!--指定filtering=true.maven的占位符解析表达式就可以用于它里面的文件-->
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
<plugins>
<plugin>
<!--支持yaml读取pom的参数-->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>3.2.0</version>
<configuration>
<encoding>UTF-8</encoding>
<delimiters>
<delimiter>@</delimiter>
</delimiters>
<useDefaultDelimiters>false</useDefaultDelimiters>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
@@ -77,13 +100,11 @@
</path>
</annotationProcessorPaths>
</configuration>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<excludes>
<exclude>
<groupId>org.projectlombok</groupId>
@@ -94,5 +115,4 @@
</plugin>
</plugins>
</build>
</project>