Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kubernetes conf | CI refactor #61

Merged
merged 4 commits into from
Mar 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: tests
on:
pull_request:
push:
branches: [main]
branches: [2.x/main, 2.x/develop]

permissions:
contents: read
Expand Down Expand Up @@ -50,7 +50,7 @@ jobs:
pip install -e .[ci-tests]
- name: Test with pytest
run: |
pytest tests --cov="../src"
coverage run --source=src/ -m pytest
- name: Upload coverage reports to Codecov
uses: codecov/[email protected]
with:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,4 @@ dmypy.json
/pytest.ini
/docker-compose.yml
/keycloak/
/kubeconf/secrets.yml
12 changes: 12 additions & 0 deletions kubeconf/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: costy-config

data:
auth0_audience: "https://dev-66quvcmw46dh86sh.us.auth0.com/api/v2/"
auth0_authorize_url: "https://dev-66quvcmw46dh86sh.us.auth0.com/oauth/token"
auth0_connection: "Username-Password-Authentication"
auth0_issuer: "https://dev-66quvcmw46dh86sh.us.auth0.com/"
auth0_jwks_uri: "https://dev-66quvcmw46dh86sh.us.auth0.com/.well-known/jwks.json"
auth0_register_url: "https://dev-66quvcmw46dh86sh.us.auth0.com/dbconnections/signup"
95 changes: 95 additions & 0 deletions kubeconf/deployment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: costy-deployment
spec:
replicas: 2
selector:
matchLabels:
app: costy-app
template:
metadata:
labels:
app: costy-app
spec:
containers:
- name: app
image: sergienkoandrew/costy
ports:
- containerPort: 80
command: [ "/bin/sh","-c" ]
args: ["python -m uvicorn costy.main.web:init_app --reload --factory --host 0.0.0.0 --port 80"]
readinessProbe:
httpGet:
path: /schema/openapi.json
port: 80
periodSeconds: 5
failureThreshold: 5
successThreshold: 1
timeoutSeconds: 5
env:
- name: DB_NAME
valueFrom:
secretKeyRef:
name: costy-secrets
key: db_name
- name: DB_USER
valueFrom:
secretKeyRef:
name: costy-secrets
key: db_username
- name: DB_PASSWORD
valueFrom:
secretKeyRef:
name: costy-secrets
key: db_password
- name: DB_HOST
valueFrom:
secretKeyRef:
name: costy-secrets
key: db_host
- name: DB_PORT
valueFrom:
secretKeyRef:
name: costy-secrets
key: db_port
- name: AUTH0_CLIENT_ID
valueFrom:
secretKeyRef:
name: costy-secrets
key: auth0_client_id
- name: AUTH0_CLIENT_SECRET
valueFrom:
secretKeyRef:
name: costy-secrets
key: auth0_client_secret
- name: AUTH0_AUDIENCE
valueFrom:
configMapKeyRef:
name: costy-config
key: auth0_audience
- name: AUTH0_AUTHORIZE_URL
valueFrom:
configMapKeyRef:
name: costy-config
key: auth0_authorize_url
- name: AUTH0_CONNECTION
valueFrom:
configMapKeyRef:
name: costy-config
key: auth0_connection
- name: AUTH0_ISSUER
valueFrom:
configMapKeyRef:
name: costy-config
key: auth0_issuer
- name: AUTH0_JWKS_URI
valueFrom:
configMapKeyRef:
name: costy-config
key: auth0_jwks_uri
- name: AUTH0_REGISTER_URL
valueFrom:
configMapKeyRef:
name: costy-config
key: auth0_register_url
14 changes: 14 additions & 0 deletions kubeconf/secrets_template.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
apiVersion: v1
kind: Secret
metadata:
name: costy-secrets
type: Opaque

stringData:
db_name: ""
db_username: ""
db_password: ""
db_host: ""
db_port: ""
auth0_client_id: ""
auth0_client_secret: ""
11 changes: 11 additions & 0 deletions kubeconf/service.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
apiVersion: v1
kind: Service
metadata:
name: costy-service
spec:
type: LoadBalancer
ports:
- port: 80
targetPort: 80
selector:
app: costy-app
Loading