diff --git a/cluster/website/deployment.yaml b/cluster/website/preview/deployment.yaml similarity index 64% rename from cluster/website/deployment.yaml rename to cluster/website/preview/deployment.yaml index 4676018..2046cb2 100644 --- a/cluster/website/deployment.yaml +++ b/cluster/website/preview/deployment.yaml @@ -2,14 +2,18 @@ apiVersion: apps/v1 kind: Deployment metadata: labels: - app: website - name: website + app: website-preview + name: website-preview namespace: website + annotations: + keel.sh/policy: force + keel.sh/trigger: poll + keel.sh/match-tag: "true" spec: replicas: 1 selector: matchLabels: - app: website + app: website-preview strategy: rollingUpdate: maxSurge: 25% @@ -18,12 +22,12 @@ spec: template: metadata: labels: - app: website + app: website-preview spec: containers: - - image: sgoudham/website:latest + - image: sgoudham/website:preview imagePullPolicy: IfNotPresent - name: website + name: website-preview ports: - containerPort: 3000 protocol: TCP @@ -33,4 +37,4 @@ spec: port: 3000 resources: {} dnsPolicy: ClusterFirst - restartPolicy: Always \ No newline at end of file + restartPolicy: Always diff --git a/cluster/website/preview/ingress.yaml b/cluster/website/preview/ingress.yaml new file mode 100644 index 0000000..b2a0efd --- /dev/null +++ b/cluster/website/preview/ingress.yaml @@ -0,0 +1,46 @@ +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + labels: + app: website-preview + name: website-preview + namespace: website + annotations: + traefik.ingress.kubernetes.io/router.entrypoints: web, websecure + traefik.ingress.kubernetes.io/router.middlewares: website-drop-www-redirect-preview@kubernetescrd +spec: + ingressClassName: traefik + rules: + - host: preview.goudham.com + http: + paths: + - backend: + service: + name: website-preview + port: + number: 3000 + path: / + pathType: Prefix + - host: www.preview.goudham.com + http: + paths: + - backend: + service: + name: website-preview + port: + number: 3000 + path: / + pathType: Prefix + tls: + - hosts: + - preview.goudham.com +--- +apiVersion: traefik.containo.us/v1alpha1 +kind: Middleware +metadata: + name: drop-www-redirect-preview + namespace: website +spec: + redirectRegex: + regex: ^https://www.preview.goudham.com/(.*) + replacement: https://preview.goudham.com/${1} diff --git a/cluster/website/preview/service.yaml b/cluster/website/preview/service.yaml new file mode 100644 index 0000000..82cf631 --- /dev/null +++ b/cluster/website/preview/service.yaml @@ -0,0 +1,20 @@ +apiVersion: v1 +kind: Service +metadata: + labels: + app: website-preview + name: website-preview + namespace: website +spec: + internalTrafficPolicy: Cluster + ipFamilies: + - IPv4 + ipFamilyPolicy: SingleStack + ports: + - port: 3000 + protocol: TCP + targetPort: 3000 + selector: + app: website-preview + sessionAffinity: None + type: ClusterIP \ No newline at end of file diff --git a/cluster/website/prod/deployment.yaml b/cluster/website/prod/deployment.yaml new file mode 100644 index 0000000..f76b968 --- /dev/null +++ b/cluster/website/prod/deployment.yaml @@ -0,0 +1,39 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + labels: + app: website + name: website + namespace: website + annotations: + keel.sh/policy: major + keel.sh/trigger: poll +spec: + replicas: 1 + selector: + matchLabels: + app: website + strategy: + rollingUpdate: + maxSurge: 25% + maxUnavailable: 25% + type: RollingUpdate + template: + metadata: + labels: + app: website + spec: + containers: + - image: sgoudham/website:1.0.1 + imagePullPolicy: IfNotPresent + name: website + ports: + - containerPort: 3000 + protocol: TCP + livenessProbe: + httpGet: + path: / + port: 3000 + resources: {} + dnsPolicy: ClusterFirst + restartPolicy: Always diff --git a/cluster/website/ingress.yaml b/cluster/website/prod/ingress.yaml similarity index 98% rename from cluster/website/ingress.yaml rename to cluster/website/prod/ingress.yaml index 2a8275f..0c0d434 100644 --- a/cluster/website/ingress.yaml +++ b/cluster/website/prod/ingress.yaml @@ -39,6 +39,7 @@ apiVersion: traefik.containo.us/v1alpha1 kind: Middleware metadata: name: drop-www-redirect + namespace: website spec: redirectRegex: regex: ^https://www.goudham.com/(.*) diff --git a/cluster/website/service.yaml b/cluster/website/prod/service.yaml similarity index 100% rename from cluster/website/service.yaml rename to cluster/website/prod/service.yaml