Skip to content

Commit

Permalink
feat:MB: add kub files
Browse files Browse the repository at this point in the history
add deployment and add service.yaml
  • Loading branch information
maurobernal committed May 11, 2024
1 parent 818acfa commit f60db83
Show file tree
Hide file tree
Showing 6 changed files with 94 additions and 7 deletions.
30 changes: 30 additions & 0 deletions .kube/api.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: deploy-caapi
namespace: maurobernal
spec:
selector:
matchLabels:
app: ca-caapi
replicas: 1
template:
metadata:
labels:
app: ca-caapi
spec:
imagePullSecrets:
- name: regcred
containers:
- name: container-caapi
image: maurobernal/ca:202405101923
imagePullPolicy: Always
resources:
limits:
memory: 500Mi
cpu: 500m
requests:
cpu: 100m
memory: 200Mi
ports:
- containerPort: 443
12 changes: 12 additions & 0 deletions .kube/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: v1
kind: Service
metadata:
name: service-ca
namespace: maurobernal
spec:
ports:
- port: 443
targetPort: 443
selector:
app: ca-caapi
type: LoadBalancer
10 changes: 4 additions & 6 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,8 @@ id=$(date +'%Y%m%d%H%M')
imagename=$image:$id
echo "========== Build image:$imagename=========="
docker.exe build -t $imagename .
echo "========== Creating container image:$imagename=========="
docker.exe run -p8443:443 -p8080:80 -d $imagename


#docker.exe push $imagename
#echo "========== Creating container image:$imagename=========="
#docker.exe run -p8443:443 -p8080:80 -d $imagename
docker.exe push $imagename
#echo "========== Deploy image:$imagename=========="

kubectl.exe set image deployment/deploy-caapi container-caapi=$imagename -n maurobernal
23 changes: 23 additions & 0 deletions src/Web/Endpoints/Test.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
using ca.Application.CQRS.Skills.Queries.GetSkillQueries;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http.HttpResults;

namespace ca.Web.Endpoints;

public class Test : EndpointGroupBase
{

public override void Map(WebApplication app)
{
app.MapGroup(this)
.MapGet(GetHostName);
}

[AllowAnonymous]
public IResult GetHostName()
=> Results.Ok(System.Net.Dns.GetHostName());




}
13 changes: 12 additions & 1 deletion src/Web/Properties/launchSettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,17 @@
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"Container (Dockerfile)": {
"commandName": "Docker",
"launchBrowser": true,
"launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}",
"environmentVariables": {
"ASPNETCORE_HTTPS_PORTS": "8081",
"ASPNETCORE_HTTP_PORTS": "8080"
},
"publishAllPorts": true,
"useSSL": true
}
},
"iisSettings": {
Expand All @@ -32,4 +43,4 @@
"sslPort": 44312
}
}
}
}
13 changes: 13 additions & 0 deletions src/Web/wwwroot/api/specification.json
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,19 @@
]
}
},
"/api/Test": {
"get": {
"tags": [
"Test"
],
"operationId": "GetHostName",
"responses": {
"200": {
"description": ""
}
}
}
},
"/api/TodoItems": {
"get": {
"tags": [
Expand Down

0 comments on commit f60db83

Please sign in to comment.