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

solution #34

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
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
8 changes: 8 additions & 0 deletions .infrastructure/confgiMap.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: app-config
namespace: todoapp
data:
PYTHONUNBUFFERED: "1"

10 changes: 9 additions & 1 deletion .infrastructure/deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,15 @@ spec:
cpu: "150m"
env:
- name: PYTHONUNBUFFERED
value: "1"
valueFrom:
configMapKeyRef:
name: app-config
key: PYTHONUNBUFFERED
- name: SECRET_KEY
valueFrom:
secretKeyRef:
name: app-secret
key: SECRET_KEY
ports:
- containerPort: 8080
livenessProbe:
Expand Down
8 changes: 8 additions & 0 deletions .infrastructure/secret.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
apiVersion: v1
kind: Secret
metadata:
name: app-secret
namespace: todoapp
type: Opaque
data:
SECRET_KEY: "TXlTdHJvbmdQYXNzd29yZA=="
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,23 @@ Create a kubernetes manifest for a pod which will containa ToDo app container:
1. `README.md` should have commands to apply all the changes
1. `README.md` should have instructuions on how to validate the changes
1. Create PR with your changes and attach it for validation on a platform.

### Commands to apply changes:
```
kubectl apply -f configMap.yml
```
```
kubectl apply -f secret.yml
```
```
kubectl apply -f deployment.yml
```

### Commands to validate changes:
```
kubectl get configmaps
```
```
kubectl get secrets
```

2 changes: 1 addition & 1 deletion src/todolist/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
# See https://docs.djangoproject.com/en/1.7/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = "@e2(yx)v&tgh3_s=0yja-i!dpebxsz^dg47x)-k&kq_3zf*9e*"
SECRET_KEY = os.getenv('SECRET_KEY', default="SECRET_KEY")

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
Expand Down