Refactored test pipeline and manifest to fit new cluster
This commit is contained in:
27
.drone.yml
27
.drone.yml
@@ -3,7 +3,6 @@ kind: pipeline
|
|||||||
type: kubernetes
|
type: kubernetes
|
||||||
name: build
|
name: build
|
||||||
|
|
||||||
# disable built-in clone step
|
|
||||||
clone:
|
clone:
|
||||||
disable: true
|
disable: true
|
||||||
|
|
||||||
@@ -12,7 +11,7 @@ steps:
|
|||||||
- name: git clone
|
- name: git clone
|
||||||
image: drone/git
|
image: drone/git
|
||||||
commands:
|
commands:
|
||||||
- git clone http://gitea.main.k3s.lab.mngoma.africa/mngomalab/sampleapi.git .
|
- git clone https://gitea.apps.mngoma.lab/mngomalab/sampleapi.git .
|
||||||
- git checkout $DRONE_COMMIT
|
- git checkout $DRONE_COMMIT
|
||||||
|
|
||||||
# dotnet restore
|
# dotnet restore
|
||||||
@@ -33,14 +32,14 @@ steps:
|
|||||||
image: mcr.microsoft.com/dotnet/sdk:8.0
|
image: mcr.microsoft.com/dotnet/sdk:8.0
|
||||||
commands:
|
commands:
|
||||||
- dotnet test --configuration Release
|
- dotnet test --configuration Release
|
||||||
|
|
||||||
---
|
---
|
||||||
kind: pipeline
|
kind: pipeline
|
||||||
type: kubernetes
|
type: kubernetes
|
||||||
name: package
|
name: package
|
||||||
depends_on:
|
depends_on:
|
||||||
- build
|
- build
|
||||||
|
|
||||||
# disable built-in clone step
|
|
||||||
clone:
|
clone:
|
||||||
disable: true
|
disable: true
|
||||||
|
|
||||||
@@ -49,7 +48,7 @@ steps:
|
|||||||
- name: git clone
|
- name: git clone
|
||||||
image: drone/git
|
image: drone/git
|
||||||
commands:
|
commands:
|
||||||
- git clone http://gitea.main.k3s.lab.mngoma.africa/mngomalab/sampleapi.git .
|
- git clone https://gitea.apps.mngoma.lab/mngomalab/sampleapi.git .
|
||||||
- git checkout $DRONE_COMMIT
|
- git checkout $DRONE_COMMIT
|
||||||
|
|
||||||
# dotnet publish
|
# dotnet publish
|
||||||
@@ -59,26 +58,26 @@ steps:
|
|||||||
- dotnet publish --configuration Release
|
- dotnet publish --configuration Release
|
||||||
- ls ./SampleApi/bin/Release/net8.0/publish/
|
- ls ./SampleApi/bin/Release/net8.0/publish/
|
||||||
|
|
||||||
# build and push docker image
|
# build and push docker image to in-cluster registry
|
||||||
- name: docker build and push
|
- name: docker build and push
|
||||||
image: plugins/docker
|
image: plugins/docker
|
||||||
settings:
|
settings:
|
||||||
repo: khwezi/mngomalab
|
repo: registry.registry.svc.cluster.local:5000/experiments/sampleapi
|
||||||
auto_tag: true
|
auto_tag: true
|
||||||
username:
|
username:
|
||||||
from_secret: docker_username
|
from_secret: registry-username
|
||||||
password:
|
password:
|
||||||
from_secret: docker_password
|
from_secret: registry-password
|
||||||
dockerfile: Dockerfile
|
dockerfile: Dockerfile
|
||||||
context: ./SampleApi/bin/Release/net8.0/publish/
|
context: ./SampleApi/bin/Release/net8.0/publish/
|
||||||
|
|
||||||
---
|
---
|
||||||
kind: pipeline
|
kind: pipeline
|
||||||
type: kubernetes
|
type: kubernetes
|
||||||
name: deploy
|
name: deploy
|
||||||
depends_on:
|
depends_on:
|
||||||
- package
|
- package
|
||||||
|
|
||||||
# disable built-in clone step
|
|
||||||
clone:
|
clone:
|
||||||
disable: true
|
disable: true
|
||||||
|
|
||||||
@@ -87,15 +86,15 @@ steps:
|
|||||||
- name: git clone
|
- name: git clone
|
||||||
image: drone/git
|
image: drone/git
|
||||||
commands:
|
commands:
|
||||||
- git clone http://gitea.main.k3s.lab.mngoma.africa/mngomalab/sampleapi.git .
|
- git clone https://gitea.apps.mngoma.lab/mngomalab/sampleapi.git .
|
||||||
- git checkout $DRONE_COMMIT
|
- git checkout $DRONE_COMMIT
|
||||||
|
|
||||||
- name: deploy
|
- name: deploy
|
||||||
image: danielgormly/drone-plugin-kube:0.0.1
|
image: danielgormly/drone-plugin-kube:0.0.1
|
||||||
settings:
|
settings:
|
||||||
template: ./templates/deployment.yaml
|
template: ./manifests/deploy-app.yml
|
||||||
ca:
|
ca:
|
||||||
from_secret: kube_ca_cert
|
from_secret: kube_ca_cert
|
||||||
server: https://192.168.1.161:6443
|
server: https://lead:6443
|
||||||
token:
|
token:
|
||||||
from_secret: k3s_token
|
from_secret: k3s_token
|
||||||
92
manifests/deploy-app.yml
Normal file
92
manifests/deploy-app.yml
Normal file
@@ -0,0 +1,92 @@
|
|||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Namespace
|
||||||
|
metadata:
|
||||||
|
name: experiments
|
||||||
|
labels:
|
||||||
|
name: experiments
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: ConfigMap
|
||||||
|
metadata:
|
||||||
|
name: sampleapi-config
|
||||||
|
namespace: experiments
|
||||||
|
data:
|
||||||
|
appname: "SampleApi"
|
||||||
|
---
|
||||||
|
apiVersion: apps/v1
|
||||||
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
name: sampleapi
|
||||||
|
namespace: experiments
|
||||||
|
labels:
|
||||||
|
app: sampleapi
|
||||||
|
spec:
|
||||||
|
replicas: 1
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app: sampleapi
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app: sampleapi
|
||||||
|
spec:
|
||||||
|
containers:
|
||||||
|
- name: sampleapi
|
||||||
|
image: registry.registry.svc.cluster.local:5000/experiments/sampleapi:latest
|
||||||
|
imagePullPolicy: Always
|
||||||
|
ports:
|
||||||
|
- name: http
|
||||||
|
containerPort: 8080
|
||||||
|
- name: https
|
||||||
|
containerPort: 8081
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: sampleapi
|
||||||
|
namespace: experiments
|
||||||
|
spec:
|
||||||
|
type: ClusterIP
|
||||||
|
selector:
|
||||||
|
app: sampleapi
|
||||||
|
ports:
|
||||||
|
- name: http
|
||||||
|
port: 80
|
||||||
|
targetPort: 8080
|
||||||
|
- name: https
|
||||||
|
port: 443
|
||||||
|
targetPort: 8081
|
||||||
|
---
|
||||||
|
apiVersion: traefik.io/v1alpha1
|
||||||
|
kind: IngressRoute
|
||||||
|
metadata:
|
||||||
|
name: sampleapi-http
|
||||||
|
namespace: experiments
|
||||||
|
spec:
|
||||||
|
entryPoints:
|
||||||
|
- web
|
||||||
|
routes:
|
||||||
|
- match: Host(`sampleapi.apps.mngoma.lab`)
|
||||||
|
kind: Rule
|
||||||
|
services:
|
||||||
|
- name: sampleapi
|
||||||
|
port: 80
|
||||||
|
scheme: http
|
||||||
|
---
|
||||||
|
apiVersion: traefik.io/v1alpha1
|
||||||
|
kind: IngressRoute
|
||||||
|
metadata:
|
||||||
|
name: sampleapi-https
|
||||||
|
namespace: experiments
|
||||||
|
spec:
|
||||||
|
entryPoints:
|
||||||
|
- websecure
|
||||||
|
routes:
|
||||||
|
- match: Host(`sampleapi.apps.mngoma.lab`)
|
||||||
|
kind: Rule
|
||||||
|
services:
|
||||||
|
- name: sampleapi
|
||||||
|
port: 443
|
||||||
|
scheme: http
|
||||||
|
tls: {}
|
||||||
Reference in New Issue
Block a user