Compare commits

..

135 Commits

Author SHA1 Message Date
e26c79a9d7 Removed pull event from build stage 2026-04-04 16:39:31 +02:00
ae1440fce3 Refactored uat to staging 2026-04-04 16:38:30 +02:00
b58b5777fd Refactored triggers 2026-04-04 16:38:02 +02:00
83dfdc2cc3 Removed promotion trigger 2026-04-04 16:35:19 +02:00
bbdb27b116 Removed promotion trigger 2026-04-04 16:34:41 +02:00
1da1328870 Removed build stage dependency 2026-04-04 16:29:17 +02:00
3b5ca4f5b0 Removed triggers on build stage 2026-04-04 16:25:09 +02:00
1526648d9a Light refactor 2026-04-04 16:24:12 +02:00
d1f723c135 Added pull_request trigger in build stage 2026-04-04 16:22:59 +02:00
423281d071 Removed push trigger from build branch 2026-04-04 16:19:44 +02:00
44fbc613a3 Enhanced triggers 2026-04-04 16:17:40 +02:00
a922531f50 Fixed pipeline stage naming 2026-04-04 16:13:03 +02:00
9acebb67fe Split deployment from main pipeline 2026-04-04 16:11:17 +02:00
e140319a05 Removed comments 2026-04-04 15:58:58 +02:00
3752da6ebe fixed dotnet step image 2026-04-04 15:58:12 +02:00
1937d2eaa1 Restored drone image detection 2026-04-04 15:56:51 +02:00
c2a8b5c797 removed tags 2026-04-04 15:54:19 +02:00
c584d39270 Applied nexus to all docker references including docker image 2026-04-04 15:51:52 +02:00
81e93b0e4e Refactored nexus trivy manifest 2026-04-04 15:41:54 +02:00
89f619eefa Pointing to the right .net10 image on nexus 2026-04-04 15:40:55 +02:00
b46848dd56 Refactored the pipeline to pull the trivy image from nexus as well 2026-04-04 15:33:03 +02:00
30e0bc2b87 Pulling .net docker image from nexus 2026-04-04 15:32:20 +02:00
903c17e7f8 Refactored the pipeline so that docker push happens before the trivy scan 2026-04-04 15:30:56 +02:00
bd3cba05cb Fixed docker steps to use local nexus properly 2026-04-04 15:24:06 +02:00
007f606bb6 Supplied full package source for nuget 2026-04-04 15:12:55 +02:00
ef6262282d Applied specific trivy version 2026-04-04 15:10:28 +02:00
502182a370 Using nexus for dotnet restore 2026-04-04 15:09:05 +02:00
c6799a146a Added publish step to dotnet 2026-04-04 15:06:32 +02:00
6bd60452f2 Ensured donet publish and release are not ignored 2026-04-04 15:02:08 +02:00
52e24bb8f2 Upgraded packages and refactored the pipeline 2026-04-04 14:53:33 +02:00
a8ad599af2 Removed dolive stage 2026-03-14 11:50:02 +02:00
5dff86c4fa SImplified prod docker step 2026-03-14 11:41:25 +02:00
6a29032748 Refactored prod step 2026-03-14 11:33:43 +02:00
634ad82d2c Unified docker commands 2026-03-14 11:23:44 +02:00
59c08d2314 Using temporary folder 2026-03-14 11:18:50 +02:00
496e6b653d Fixed docker config path error 2026-03-14 11:13:10 +02:00
4c86a810da fixed temp directory naming 2026-03-14 11:07:00 +02:00
1ee31554ce Fixed yaml syntax error 2026-03-14 11:01:07 +02:00
3d1e3f29df switched to powershell commands on prod step 2026-03-14 11:00:11 +02:00
c03dc29446 fixed yaml syntax error 2026-03-14 10:54:16 +02:00
24e439558f Refactored to fix yaml syntax error 2026-03-14 10:52:19 +02:00
1917a60867 Added measures to ignore docker credential store 2026-03-14 10:50:01 +02:00
c43ce20bbe Added silent removal of existing containers 2026-03-14 10:43:50 +02:00
26c90e1697 Fixed docker commands on prod step 2026-03-14 10:38:05 +02:00
a6a32817c5 Retrieving host from secrets 2026-03-14 10:32:23 +02:00
03574c720f Refactored container names 2026-03-14 10:31:41 +02:00
201850a3d4 Removed variable expansion because plugin doesnt support it 2026-03-14 10:25:15 +02:00
c8aef17e95 Added restart conditions 2026-03-14 10:15:35 +02:00
8c6b400a2d Refactored prod stage 2026-03-14 10:12:55 +02:00
324e25c24b Credential refactor 2026-03-10 19:28:58 +02:00
cdeae28f27 Refactored prod stage 2026-03-10 19:23:33 +02:00
671e8b986f Refactored prod step to target the correct docker folder for user 2026-03-10 19:19:49 +02:00
176fdb2930 Refactored prod step 2026-03-10 19:17:34 +02:00
a4822ec103 Refactored golive stage to use prod secrets 2026-03-10 19:02:42 +02:00
dc79c658dd Refactored golive stage to use prod host as a target for our deployment 2026-03-10 18:31:28 +02:00
c3c52965ed Added demo controller 2026-03-09 16:56:20 +02:00
0ded289b1f Fixed pipeline to support .net 10 2026-03-08 14:47:01 +02:00
83505ee117 Fixed SDK dockerfile reference 2026-03-08 14:45:16 +02:00
06ed9d2bad Upgraded Dockerfile image from .net 8 to 10 2026-03-08 14:42:33 +02:00
84d18a4745 Upgraded to .nwt 10 2026-03-08 14:41:44 +02:00
1fa3f6bb4b Light refactor 2026-03-08 14:25:53 +02:00
eb681300c2 Added container vulnerability scan 2026-03-08 14:24:11 +02:00
358d27464a Refactored pipeline to exlude the UAT stage from promotion events 2026-03-08 13:49:32 +02:00
49639fc1e2 Detached uat from prod 2026-03-08 13:45:10 +02:00
4b8bf81c05 Added healthchecks endpoint to app 2026-03-08 13:40:25 +02:00
d57b924425 Refactored Dockerfile 2026-03-08 13:32:46 +02:00
6843b105b8 Refactored application pipeline 2026-03-08 13:30:45 +02:00
e2d89c651a Put back checkout tep on package stage 2026-03-08 13:20:17 +02:00
abe5f37dc0 Moved back the package step to package stage 2026-03-08 13:18:11 +02:00
41d757a5e2 Specified environment arguments in deploy stage 2026-03-08 13:13:06 +02:00
46606e3350 MOved donet package step to build stage 2026-03-08 13:09:47 +02:00
3887cd4843 Refactored docker file 2026-03-08 13:05:19 +02:00
1babfacede Currected docker port 2026-03-08 12:58:27 +02:00
eeac0b1e83 Allowing for UAT deployment to happen automatically 2026-03-08 12:52:07 +02:00
7fd69b8265 Refactored pipeline to manage triggers better for promotion events 2026-03-08 12:48:02 +02:00
3f754b3614 Added staging behavior to the pipeline 2026-03-08 12:38:57 +02:00
3e590eed2c Refactored pipeline to separate build and test, package and deploy promostion stages 2026-03-08 12:34:17 +02:00
be8db08307 Brought back auto clone disable 2026-03-08 12:16:01 +02:00
2d4f851d23 Refactored step names 2026-03-08 12:14:45 +02:00
7ee42ef018 Refactored pipeline 2026-03-08 12:12:03 +02:00
f5d3146bed Using inline docker config for kaniko 2026-03-08 12:08:37 +02:00
00f7fa2d99 Refactored kaniko to use another config file path 2026-03-08 12:04:06 +02:00
1d3f833b92 Using CI/CD version of kaniko docker image 2026-03-08 12:01:01 +02:00
f77157498a Added kaniko secret specification 2026-03-08 11:54:31 +02:00
95faa86e6b Using kanino to build and push 2026-03-08 11:51:46 +02:00
1cb55e2eb9 ENabled priviledged mode on docker push step 2026-03-08 11:42:58 +02:00
077cdfd781 Using manual docker push 2026-03-08 11:39:27 +02:00
8f4ad5b421 Added docker login step 2026-03-08 11:34:28 +02:00
f4aa094a23 Refactored target repo 2026-03-08 11:29:11 +02:00
ce9646ec92 Removed debug flag from docker push, removed drone build number tag 2026-03-08 11:22:05 +02:00
beb3f0926e Using raw username 2026-03-08 11:15:26 +02:00
a2c75ad88d Added debug flag 2026-03-08 11:04:59 +02:00
a7fd41c852 Added tagging 2026-03-08 10:57:13 +02:00
64344f6142 Disabled broken automatic clone, added manual clone 2026-03-08 10:49:12 +02:00
55f20dd5c9 Light refactor 2026-03-08 08:52:15 +02:00
d56728ecb2 Refactored pipeline to use docker.io registry 2026-03-08 08:37:16 +02:00
a9a87fe163 Rfactored pipeline to use local gitea 2026-03-07 18:35:30 +02:00
7a65783b63 Reverted to registry proxy 2026-03-07 17:58:59 +02:00
114af926c8 talking to registry directly 2026-03-07 17:51:34 +02:00
88dc41052b Not ignoring bin folder 2026-03-07 17:13:12 +02:00
5a91bbc22b Allowing .net 8 publish files 2026-03-07 17:08:00 +02:00
3b637b3c76 Added dockerignore rule to allow all publish folders 2026-03-07 17:05:47 +02:00
48693e60c7 Rfactored dockerfile to reuse pipeline publish output 2026-03-07 17:00:57 +02:00
0874232e31 Refactored the source context in the package step 2026-03-07 16:55:20 +02:00
c78640247d Removed credentials from package operation 2026-03-07 16:49:59 +02:00
d33891ab03 Refactored pipeline to use private registry by dns name 2026-03-07 16:43:27 +02:00
8a467ecb51 Pointing to local docker registry 2026-03-07 16:36:26 +02:00
44ed625161 Changed to gitea-token 2026-03-07 11:35:01 +02:00
f043ed5520 Flattened pipeline stages 2026-03-07 11:23:22 +02:00
54909942a4 Changed pipeline type from kubernetes to docker 2026-03-07 11:18:51 +02:00
26ee7e85ff Refactored pipeline to use docker 2026-03-07 11:12:49 +02:00
8a11987b8e Removed deployment comments 2026-03-03 17:54:49 +02:00
ac224fd665 Refactored docker-compose.yml to expose ports and specify environment 2026-03-03 17:46:14 +02:00
36cab3f5ea Refactored dockerfile stage 2 ports exposure 2026-03-03 17:43:07 +02:00
bcffc53708 Exposed ports on dockerfile 2026-03-03 17:40:42 +02:00
0a0877dc4d Refactored dockerfile 2026-03-03 17:34:28 +02:00
4b71b16b78 Refactored docker file 2026-03-03 17:26:54 +02:00
331829b8e3 Refactored docker file 2026-03-03 15:05:57 +02:00
715bb919af Added debug lines 2026-03-03 14:57:13 +02:00
4ea9b98fd7 Refactored paths 2026-03-03 14:55:47 +02:00
c7936e9131 Refactored base image 2026-03-03 14:53:47 +02:00
d58caf67e3 Added publish binary copy 2026-03-03 14:52:18 +02:00
f3ac2cbdb0 Refactored dockerfile 2026-03-03 14:50:12 +02:00
4a53a5ab2d Fixed docker image typo 2026-03-03 14:43:55 +02:00
9d12eed43e Refactored docker file image to SDK 2026-03-03 13:37:23 +02:00
Khwezi Mngoma
310d0ac42d Added docker compose file 2026-03-03 13:21:07 +02:00
Khwezi
ef9a8224a3 Removed cert intervention 2025-10-18 14:41:39 +02:00
Khwezi
5f3a2a16b8 Replicated pipeline fix 2025-10-18 14:36:57 +02:00
Khwezi
2099acd066 Refactored pipeline to fix the ssl validation issue 2025-10-18 14:34:31 +02:00
Khwezi
d4b20fae41 Fixed yaml code paste error 2025-10-18 14:24:58 +02:00
Khwezi
1d4199c450 Restructured pipeline to better use ssh for deployment 2025-10-18 14:19:02 +02:00
Khwezi
31d4c4af55 Refactored the pipeline to deploy using SSH 2025-10-18 14:00:17 +02:00
Khwezi
fa7a755883 Refactored deploy step to use real secret for ca cert 2025-10-12 15:49:07 +02:00
Khwezi
744f8a2926 Simplified deployment process 2025-10-12 15:41:43 +02:00
Khwezi
829954d9a8 Added service account field to kubernetes steps 2025-10-12 15:09:48 +02:00
10 changed files with 186 additions and 295 deletions

View File

@@ -12,7 +12,6 @@
**/*.dbmdl **/*.dbmdl
**/*.jfm **/*.jfm
**/azds.yaml **/azds.yaml
**/bin
**/charts **/charts
**/docker-compose* **/docker-compose*
**/Dockerfile* **/Dockerfile*
@@ -28,3 +27,6 @@ README.md
!.git/config !.git/config
!.git/packed-refs !.git/packed-refs
!.git/refs/heads/** !.git/refs/heads/**
# Ensure the build output is NOT ignored
!**/bin/Release/**/publish/
!**/publish/

View File

@@ -1,108 +1,68 @@
--- ---
kind: pipeline kind: pipeline
type: kubernetes type: docker
name: build name: build-and-package
clone:
disable: true
steps: steps:
- name: git clone - name: build-test-publish
image: drone/git image: nexus.khongisa.co.za/sdk:10.0
environment:
REPO_URL: http://gitea-server.gitea.svc.cluster.local:3000/mngomalab/sampleapi.git
commands: commands:
- git clone $REPO_URL . - dotnet restore --source https://nexus.khongisa.co.za/repository/nuget-group/index.json --no-cache
- git checkout $DRONE_COMMIT - dotnet build --configuration Release --no-restore
- dotnet test --configuration Release --no-build
- dotnet publish --configuration Release --no-build
- name: dotnet restore - name: docker-build-and-push
image: mcr.microsoft.com/dotnet/sdk:8.0
commands:
- dotnet restore
- name: dotnet build
image: mcr.microsoft.com/dotnet/sdk:8.0
commands:
- dotnet build --configuration Release
- ls ./SampleApi/bin/Release/net8.0/
- name: dotnet test
image: mcr.microsoft.com/dotnet/sdk:8.0
commands:
- dotnet test --configuration Release
---
kind: pipeline
type: kubernetes
name: package
depends_on:
- build
clone:
disable: true
steps:
- name: git clone
image: drone/git
environment:
REPO_URL: http://gitea-server.gitea.svc.cluster.local:3000/mngomalab/sampleapi.git
commands:
- git clone $REPO_URL .
- git checkout $DRONE_COMMIT
- name: dotnet publish
image: mcr.microsoft.com/dotnet/sdk:8.0
commands:
- dotnet publish --configuration Release
- ls ./SampleApi/bin/Release/net8.0/publish/
- name: docker build and push
image: plugins/docker image: plugins/docker
settings: settings:
repo: registry-server.registry.svc.cluster.local:5000/sampleapi registry: nexus.khongisa.co.za
auto_tag: true repo: nexus.khongisa.co.za/webapitest
registry: registry-server.registry.svc.cluster.local:5000 tags: [ "${DRONE_BUILD_NUMBER}", "latest" ]
insecure: true username: { from_secret: docker_username }
username: password: { from_secret: docker_password }
from_secret: registry-username
password: - name: vulnerability-scan
from_secret: registry-password image: aquasec/trivy:0.50.1
dockerfile: Dockerfile environment:
context: ./SampleApi/bin/Release/net8.0/publish/ TRIVY_USERNAME: { from_secret: docker_username }
TRIVY_PASSWORD: { from_secret: docker_password }
commands:
- trivy image --image-src remote --exit-code 1 --severity CRITICAL nexus.khongisa.co.za/webapitest:${DRONE_BUILD_NUMBER}
trigger:
branch:
- main
event:
exclude:
- promote
--- ---
kind: pipeline kind: pipeline
type: kubernetes type: docker
name: deploy name: deploy-to-uat
depends_on: depends_on:
- package - build-and-package
clone:
disable: true
steps: steps:
- name: git clone - name: uat-deployment
image: drone/git image: appleboy/drone-ssh
environment:
REPO_URL: http://gitea-server.gitea.svc.cluster.local:3000/mngomalab/sampleapi.git
commands:
- git clone $REPO_URL .
- git checkout $DRONE_COMMIT
- name: ensure namespace
image: bitnami/kubectl:latest
commands:
- kubectl create namespace sampleapi --dry-run=client -o yaml | kubectl apply -f -
- name: deploy
image: danielgormly/drone-plugin-kube:0.0.1
settings: settings:
template: ./manifests/deploy.yml host: { from_secret: ssh_host }
namespace: sampleapi username: { from_secret: ssh_user }
ca: password: { from_secret: ssh_password }
from_secret: kube_ca_cert script:
server: https://lead:6443 - echo $DOCKER_PASSWORD | docker login nexus.khongisa.co.za -u $DOCKER_USERNAME --password-stdin
token: - docker pull nexus.khongisa.co.za/webapitest:latest
from_secret: k8s-token - docker stop webapi 2>/dev/null || true
- docker rm webapi 2>/dev/null || true
- docker run -d --name webapi --restart unless-stopped -e ASPNETCORE_ENVIRONMENT=Development -p 4000:8081 nexus.khongisa.co.za/webapitest:latest
environment:
DOCKER_USERNAME: { from_secret: docker_username }
DOCKER_PASSWORD: { from_secret: docker_password }
trigger:
event:
- promote
target:
- staging

View File

@@ -1,13 +1,11 @@
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base FROM nexus.khongisa.co.za/aspnet:10.0 AS final
WORKDIR /app
USER app USER app
WORKDIR /app
EXPOSE 8080 COPY --chown=app:app ./SampleApi/bin/Release/net10.0/publish/ .
EXPOSE 8081 EXPOSE 8081
ENV ASPNETCORE_HTTP_PORTS=8081
COPY . /app
FROM base AS final
WORKDIR /app
ENTRYPOINT ["dotnet", "SampleApi.dll"] ENTRYPOINT ["dotnet", "SampleApi.dll"]

View File

@@ -0,0 +1,43 @@
using Microsoft.AspNetCore.Mvc;
// For more information on enabling Web API for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
namespace SampleApi.Controllers
{
[Route("api/[controller]")]
[ApiController]
public class DemoController : ControllerBase
{
// GET: api/<DemoController>
[HttpGet]
public IEnumerable<string> Get()
{
return new string[] { "value1", "value2" };
}
// GET api/<DemoController>/5
[HttpGet("{id}")]
public string Get(int id)
{
return "value";
}
// POST api/<DemoController>
[HttpPost]
public void Post([FromBody] string value)
{
}
// PUT api/<DemoController>/5
[HttpPut("{id}")]
public void Put(int id, [FromBody] string value)
{
}
// DELETE api/<DemoController>/5
[HttpDelete("{id}")]
public void Delete(int id)
{
}
}
}

View File

@@ -1,25 +1,22 @@
var builder = WebApplication.CreateBuilder(args); var builder = WebApplication.CreateBuilder(args);
// Add services to the container.
builder.Services.AddControllers(); builder.Services.AddControllers();
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
builder.Services.AddEndpointsApiExplorer(); builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen(); builder.Services.AddSwaggerGen();
builder.Services.AddHealthChecks();
var app = builder.Build(); var app = builder.Build();
// Configure the HTTP request pipeline.
if (app.Environment.IsDevelopment()) if (app.Environment.IsDevelopment())
{ {
app.UseSwagger(); app.UseSwagger();
app.UseSwaggerUI(); app.UseSwaggerUI();
} }
app.MapHealthChecks("/health");
app.UseRouting();
app.UseHttpsRedirection(); app.UseHttpsRedirection();
app.UseAuthorization(); app.UseAuthorization();
app.MapControllers(); app.MapControllers();
app.Run(); app.Run();

View File

@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web"> <Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup> <PropertyGroup>
<TargetFramework>net8.0</TargetFramework> <TargetFramework>net10.0</TargetFramework>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
<UserSecretsId>cfe6b4ce-2d40-4273-b3a3-e4df67304fc5</UserSecretsId> <UserSecretsId>cfe6b4ce-2d40-4273-b3a3-e4df67304fc5</UserSecretsId>
@@ -9,8 +9,9 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.19.6" /> <PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.23.0" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.4.0" /> <PackageReference Include="Polly" Version="8.6.6" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="10.1.7" />
</ItemGroup> </ItemGroup>
</Project> </Project>

10
docker-compose.yml Normal file
View File

@@ -0,0 +1,10 @@
version: '3.8'
services:
web:
build:
context: .
dockerfile: Dockerfile
ports:
- "8081:8081"
environment:
- ASPNETCORE_ENVIRONMENT=Development

65
flows.md Normal file
View File

@@ -0,0 +1,65 @@
flowchart TD
%% Combined MVP + Future Features for Executive Slide
%% MVP Section
subgraph MVP["MVP Go-Live (Critical Path)"]
A[Define MVP Requirements & Roles] --> B[DB Schema: Polls, Users, Responses]
B --> C[Azure AD/B2C: Tenant + User Groups]
C --> D[Tenant + Entitlements API w/ cache]
D --> E[Frontend: Blazor/MudBlazor Login & Poll UI]
E --> F[Backend API: Poll CRUD, Subscriptions, Responses]
F --> G[APIM Gateway: x-tenantid validation]
G --> H[Storage: SQL, Blob, Table]
H --> I[Testing: Multi-Tenant Validation]
I --> J[Invite-first Onboarding & Mapping]
J --> K[JWT Tokens with Claims & Roles]
K --> L[Poll Lifecycle: Activate / Deactivate / Response Submission]
L --> M[Go-Live & Monitoring]
end
%% Future Features Section
subgraph Future["Future Enhancements (Optional / Roadmap)"]
R1[Advanced Reporting & Analytics] --> R2[Poll Scheduling / Recurring Polls]
R2 --> R3[Multi-language Support]
R3 --> R4[Deep-linking & Email Notifications]
R4 --> R5[Theme / Branding Per Tenant]
R5 --> R6[Custom Dashboard & Graphs]
R6 --> R7[Responsive / Mobile Enhancements]
R7 --> R8[Advanced RBAC & Entitlements Features]
R8 --> R9[Audit Logging & History]
R9 --> R10[Ban / Blacklist Improvements]
R10 --> R11[External API Hooks & Webhooks]
R11 --> R12[3rd Party Analytics Integration]
end
%% Dependencies
M --> R1
%% Styling
style MVP fill:#b3d9ff,stroke:#333,stroke-width:2px
style Future fill:#e6e6e6,stroke:#999,stroke-dasharray: 5 5,stroke-width:2px
style A fill:#cce5ff
style B fill:#cce5ff
style C fill:#cce5ff
style D fill:#cce5ff
style E fill:#cce5ff
style F fill:#cce5ff
style G fill:#cce5ff
style H fill:#cce5ff
style I fill:#cce5ff
style J fill:#cce5ff
style K fill:#cce5ff
style L fill:#cce5ff
style M fill:#80b3ff
style R1 fill:#f2f2f2
style R2 fill:#f2f2f2
style R3 fill:#f2f2f2
style R4 fill:#f2f2f2
style R5 fill:#f2f2f2
style R6 fill:#f2f2f2
style R7 fill:#f2f2f2
style R8 fill:#f2f2f2
style R9 fill:#f2f2f2
style R10 fill:#f2f2f2
style R11 fill:#f2f2f2
style R12 fill:#f2f2f2

View File

@@ -1,92 +0,0 @@
---
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: {}

View File

@@ -1,93 +0,0 @@
# namespace
apiVersion: v1
kind: Namespace
metadata:
name: experiments
labels:
name: experiments
---
# config map
apiVersion: v1
kind: ConfigMap
metadata:
name: sampleapi-configmap
namespace: experiments
data:
appname: "SampleApi"
---
# deployment
apiVersion: apps/v1
kind: Deployment
metadata:
name: sampleapi-deployment
namespace: experiments
labels:
app: sampleapi
spec:
replicas: 1
selector:
matchLabels:
app: sampleapi
template:
metadata:
labels:
app: sampleapi
spec:
containers:
- name: sampleapi
image: khwezi/mngomalab:latest
imagePullPolicy: IfNotPresent
ports:
- name: http
containerPort: 8080
protocol: TCP
- name: https
containerPort: 8081
protocol: TCP
---
# service
apiVersion: v1
kind: Service
metadata:
name: sampleapi-service
namespace: experiments
spec:
type: ClusterIP
selector:
app: sampleapi
app.kubernetes.io/instance: sampleapi
ports:
- port: 8080
targetPort: 80
- port: 8081
targetPort: 443
---
# ingress
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: sampleapi-ingress
namespace: experiments
annotations:
cert-manager.io/cluster-issuer: sampleapi-secret
nginx.ingress.kubernetes.io/rewrite-target: /$1
nginx.ingress.kubernetes.io/ssl-redirect: "false"
cert-manager.io/private-key-size: "4096"
spec:
ingressClassName: nginx
rules:
- host: sampleapi.main.k3s.lab.mngoma.africa
http:
paths:
- pathType: Prefix
path: /
backend:
service:
name: sampleapi-service
port:
number: 80
tls:
- hosts:
- sampleapi.main.k3s.lab.mngoma.africa
secretName: sampleapi-secret