Skip to content

Commit

Permalink
working
Browse files Browse the repository at this point in the history
  • Loading branch information
emmanuel-knafo committed Dec 2, 2024
1 parent f43cf29 commit 6f36ec8
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 2 deletions.
3 changes: 2 additions & 1 deletion infra/k8s-cluster/deployK8sManifests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ foreach ($manifestFile in $manifestFiles) {
# replace #{host}# with the value of the environment variable HOST
$manifestFileContent = $manifestFileContent -replace "#\{host\}#", $HOSTURL
# create a new file with the same name but without the .template extension
$newManifestFile = $manifestFile.FullName -replace ".template", ""
$newEnvironmentSuffix = $environmentSuffix -replace "-", "."
$newManifestFile = $manifestFile.FullName -replace ".template", $newEnvironmentSuffix
Write-Output "Writing processed manifest file $newManifestFile"
Set-Content -Path $newManifestFile -Value $manifestFileContent
# apply the manifest file
Expand Down
21 changes: 21 additions & 0 deletions infra/k8s-cluster/manifests/k8s-deployment.test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: pygoat-app
labels:
app: pygoat-app
spec:
replicas: 1
selector:
matchLabels:
app: pygoat-app
template:
metadata:
labels:
app: pygoat-app
spec:
containers:
- image: devopsshield/devsecops-pygoat:latest
name: pygoat-app
ports:
- containerPort: 8000
17 changes: 17 additions & 0 deletions infra/k8s-cluster/manifests/k8s-ingress.test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: pygoat-ingress
spec:
ingressClassName: nginx
rules:
- host: pygoat-test.cad4devops.com
http:
paths:
- backend:
service:
name: pygoat-svc
port:
number: 80
path: /
pathType: Prefix
2 changes: 1 addition & 1 deletion infra/k8s-cluster/manifests/k8s-ingress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ metadata:
spec:
ingressClassName: nginx
rules:
- host: pygoat-test.cad4devops.com
- host: pygoat.cad4devops.com
http:
paths:
- backend:
Expand Down
13 changes: 13 additions & 0 deletions infra/k8s-cluster/manifests/k8s-service.test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: v1
kind: Service
metadata:
name: pygoat-svc
labels:
app: pygoat-svc
spec:
type: LoadBalancer # ClusterIP
selector:
app: pygoat-app
ports:
- port: 80
targetPort: 8000

0 comments on commit 6f36ec8

Please sign in to comment.