Try setting config for dual deployment

This commit is contained in:
2024-12-17 13:32:41 +00:00
parent 32675c41bc
commit 36635224e8
7 changed files with 155 additions and 14 deletions

View File

@@ -43,6 +43,15 @@ stages:
PathtoPublish: 'WebDisplay/deploy/manifest.yaml'
ArtifactName: 'Manifest'
publishLocation: 'Container'
- task: Bash@3
inputs:
targetType: 'inline'
script: 'sed -i s/#BUILD_BUILDNUMBER#/$BUILD_BUILDNUMBER/ WebDisplay/deploy/manifest-internal.yaml'
- task: PublishBuildArtifacts@1
inputs:
PathtoPublish: 'WebDisplay/deploy/manifest-internal.yaml'
ArtifactName: 'Manifest-Internal'
publishLocation: 'Container'
- stage: Deploy
jobs:
@@ -66,3 +75,23 @@ stages:
configuration: '$(System.ArtifactsDirectory)/Manifest/manifest.yaml'
secretType: 'dockerRegistry'
containerRegistryType: 'Container Registry'
- job: Deploy Internal
pool:
vmImage: 'ubuntu-latest'
steps:
- task: DownloadBuildArtifacts@0
inputs:
artifactName: 'Manifest-Internal'
buildType: 'current'
downloadType: 'single'
downloadPath: '$(System.ArtifactsDirectory)'
- task: Kubernetes@1
inputs:
connectionType: 'Kubernetes Service Connection'
kubernetesServiceEndpoint: 'Kubernetes'
namespace: 'home-monitor'
command: 'apply'
useConfigurationFile: true
configuration: '$(System.ArtifactsDirectory)/Manifest/manifest-internal.yaml'
secretType: 'dockerRegistry'
containerRegistryType: 'Container Registry'

View File

@@ -0,0 +1,100 @@
---
kind: Deployment
apiVersion: apps/v1
metadata:
name: display-internal
namespace: home-monitor
labels:
app: display-internal
spec:
replicas: 1
selector:
matchLabels:
app: display-internal
template:
metadata:
labels:
app: display-internal
spec:
containers:
- name: display-internal
image: ckaczor/home-monitor-web-display:15
terminationMessagePath: "/dev/termination-log"
terminationMessagePolicy: File
imagePullPolicy: Always
securityContext:
privileged: true
env:
- name: API_PREFIX
value: http://172.23.10.3
- name: HOME_ASSISTANT_URL
valueFrom:
secretKeyRef:
name: display-internal-config
key: HOME_ASSISTANT_URL
- name: HOME_ASSISTANT_TOKEN
valueFrom:
secretKeyRef:
name: display-internal-config
key: HOME_ASSISTANT_TOKEN
- name: GARAGE_DEVICE
valueFrom:
secretKeyRef:
name: display-internal-config
key: GARAGE_DEVICE
- name: ALARM_DEVICE
valueFrom:
secretKeyRef:
name: display-internal-config
key: ALARM_DEVICE
restartPolicy: Always
terminationGracePeriodSeconds: 30
dnsPolicy: ClusterFirst
nodeSelector:
kubernetes.io/hostname: kubernetes
schedulerName: default-scheduler
---
kind: Service
apiVersion: v1
metadata:
name: display-internal
spec:
ports:
- name: client
port: 9001
targetPort: 80
selector:
app: display-internal
type: ClusterIP
---
apiVersion: traefik.containo.us/v1alpha1
kind: IngressRoute
metadata:
annotations:
kubernetes.io/ingress.class: traefik
creationTimestamp: null
name: display-internal
namespace: home-monitor
spec:
entryPoints:
- display
routes:
- kind: Rule
match: PathPrefix(`/`)
priority: 101
services:
- kind: Service
name: display-internal
namespace: home-monitor
port: 9001
---
apiVersion: traefik.containo.us/v1alpha1
kind: Middleware
metadata:
creationTimestamp: null
name: display-internal
namespace: home-monitor
spec:
stripPrefix:
prefixes:
- /

View File

@@ -24,6 +24,17 @@ spec:
imagePullPolicy: Always
securityContext:
privileged: true
env:
- name: API_PREFIX
value:
- name: HOME_ASSISTANT_URL
value:
- name: HOME_ASSISTANT_TOKEN
value:
- name: GARAGE_DEVICE
value:
- name: ALARM_DEVICE
value:
restartPolicy: Always
terminationGracePeriodSeconds: 30
dnsPolicy: ClusterFirst