Skip to content

Commit

Permalink
ci/workaround: force k8s api host in hosts file
Browse files Browse the repository at this point in the history
  • Loading branch information
kaplan-michael committed Nov 27, 2024
1 parent f0c3148 commit 954e8f3
Showing 1 changed file with 103 additions and 92 deletions.
195 changes: 103 additions & 92 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
@@ -1,124 +1,135 @@
# .github/workflows/deploy.yml
name: Deploy to Kubernetes
on:
name: Deploy to Kubernetes
on:
workflow_call:
inputs:
envName:
description: 'Environment to deploy to'
description: "Environment to deploy to"
required: true
type: string
default: staging

envUrl:
description: 'URL of the environment'
description: "URL of the environment"
required: true
type: string
default: 'https://staging.kissj.net'
default: "https://staging.kissj.net"

secrets:
KUBECONFIG:
description: 'KUBECONFIG for the cluster'
description: "KUBECONFIG for the cluster"
required: true

workflow_dispatch:
inputs:
envName:
description: 'Environment to deploy to'
description: "Environment to deploy to"
required: true
type: string
default: staging
envUrl:
description: 'URL of the environment'
description: "URL of the environment"
required: true
type: string
default: 'https://staging.kissj.net'
default: "https://staging.kissj.net"

jobs:
deploy:
name: Deploy to Kubernetes
runs-on: 'ubuntu-latest'
environment:
runs-on: "ubuntu-latest"
environment:
name: ${{ inputs.envName }}
url: ${{ inputs.envUrl }}

steps:
- name: split url
uses: bhowell2/github-substring-action@v1
id: url
with:
value: ${{ inputs.envUrl }}
index_of_str: "https://"

- uses: actions/checkout@v4

- name: "workaround k8s api"
run: |
sudo echo "5.39.70.22 k8s-api.skaut.k8s.sl.zone" | sudo tee -a /etc/hosts
- name: "check hosts"
run: |
sudo cat /etc/hosts
- name: "test dns resolution"
run: |
nslookup k8s-api.skaut.k8s.sl.zone
ping -c 4 k8s-api.skaut.k8s.sl.zone
- name: "Deploy"
uses: "vimeda/[email protected]"
with:
release: kissj-${{ inputs.envName }}
namespace: "kissj-${{ inputs.envName }}"
chart: "deploy/helm/charts/kissj"
helm: "helm3"
atomic: true
token: "${{ github.token }}"
values: |
postgres:
username: ${{ secrets.POSTGRES_USERNAME }}
password: ${{ secrets.POSTGRES_PASSWORD }}
host: ${{ secrets.POSTGRES_HOST }}
dbname: ${{ secrets.POSTGRES_DBNAME }}
caddy:
replicas: 2
hpa:
enabled: false
image:
name: quay.io/kissj/caddy-ubi
tag: ${{ inputs.envName}}-${{ github.sha }}
tls:
enabled: true
issuer: ${{ secrets.CERT_ISSUER}}
php:
replicas: 3
hpa:
enabled: false
maxReplicas: 3
minReplicas: 3
image:
name: quay.io/kissj/php-ubi
tag: ${{ inputs.envName}}-${{ github.sha }}
app:
url: ${{ steps.url.outputs.substring }}
s3:
bucket: ${{ secrets.S3_BUCKET }}
region: ${{ secrets.S3_REGION }}
endpoint: ${{ secrets.S3_ENDPOINT }}
key: ${{ secrets.S3_KEY }}
secret: ${{ secrets.S3_SECRET }}
mail:
server: ${{ secrets.MAIL_SERVER }}
username: ${{ secrets.MAIL_USERNAME }}
password: ${{ secrets.MAIL_PASSWORD }}
port: ${{ secrets.MAIL_PORT }}
dsn: ${{ secrets.MAIL_DSN }}
sentry:
dsn: ${{ secrets.SENTRY_DSN }}
- name: split url
uses: bhowell2/github-substring-action@v1
id: url
with:
value: ${{ inputs.envUrl }}
index_of_str: 'https://'

- uses: actions/checkout@v4

- name: 'Deploy'
uses: 'vimeda/[email protected]'
with:
release: kissj-${{ inputs.envName }}
namespace: 'kissj-${{ inputs.envName }}'
chart: 'deploy/helm/charts/kissj'
helm: 'helm3'
atomic: true
token: '${{ github.token }}'
values: |
postgres:
username: ${{ secrets.POSTGRES_USERNAME }}
password: ${{ secrets.POSTGRES_PASSWORD }}
host: ${{ secrets.POSTGRES_HOST }}
dbname: ${{ secrets.POSTGRES_DBNAME }}
caddy:
replicas: 2
hpa:
enabled: false
image:
name: quay.io/kissj/caddy-ubi
tag: ${{ inputs.envName}}-${{ github.sha }}
tls:
enabled: true
issuer: ${{ secrets.CERT_ISSUER}}
php:
replicas: 3
hpa:
enabled: false
maxReplicas: 3
minReplicas: 3
image:
name: quay.io/kissj/php-ubi
tag: ${{ inputs.envName}}-${{ github.sha }}
app:
url: ${{ steps.url.outputs.substring }}
s3:
bucket: ${{ secrets.S3_BUCKET }}
region: ${{ secrets.S3_REGION }}
endpoint: ${{ secrets.S3_ENDPOINT }}
key: ${{ secrets.S3_KEY }}
secret: ${{ secrets.S3_SECRET }}
mail:
server: ${{ secrets.MAIL_SERVER }}
username: ${{ secrets.MAIL_USERNAME }}
password: ${{ secrets.MAIL_PASSWORD }}
port: ${{ secrets.MAIL_PORT }}
dsn: ${{ secrets.MAIL_DSN }}
sentry:
dsn: ${{ secrets.SENTRY_DSN }}
skautis:
appId: ${{ secrets.SKAUTIS_APP_ID }}
useTest: ${{ secrets.SKAUTIS_USE_TEST }}
redis:
host: ${{ secrets.REDIS_HOST }}
password: ${{ secrets.REDIS_PASSWORD }}
env:
KUBECONFIG_FILE: ${{ secrets.KUBECONFIG }}
skautis:
appId: ${{ secrets.SKAUTIS_APP_ID }}
useTest: ${{ secrets.SKAUTIS_USE_TEST }}
redis:
host: ${{ secrets.REDIS_HOST }}
password: ${{ secrets.REDIS_PASSWORD }}
env:
KUBECONFIG_FILE: ${{ secrets.KUBECONFIG }}

0 comments on commit 954e8f3

Please sign in to comment.