-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
Improve the k8s manifest and other minor details #98
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"ExpandedNodes": [ | ||
"" | ||
], | ||
"SelectedNode": "\\C:\\Users\\jlecadou\\Source\\Repos\\azure-voting-app-redis", | ||
"PreviewInSolutionExplorer": false | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
[[source]] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If the images aren't reading from this Pipfile, it can be removed |
||
url = "https://pypi.org/simple" | ||
verify_ssl = true | ||
name = "pypi" | ||
|
||
[packages] | ||
|
||
[dev-packages] | ||
|
||
[requires] | ||
python_version = "3.11" | ||
python_full_version = "3.11.2" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,13 @@ | ||
FROM tiangolo/uwsgi-nginx-flask:python3.6 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. please remove the commented lines and the comment. The git history is sufficient to explain the change |
||
# FROM tiangolo/uwsgi-nginx-flask:python3.6 | ||
|
||
# Update the base image to use Python 3.11 | ||
FROM tiangolo/uwsgi-nginx:python3.11 | ||
LABEL maintainer="Sebastian Ramirez <[email protected]>" | ||
# Make /app/* available to be imported by Python globally to better support several use cases like Alembic migrations. | ||
|
||
ENV PYTHONPATH=/app | ||
|
||
|
||
|
||
RUN pip install redis | ||
ADD /azure-vote /app |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,7 @@ | ||
FROM tiangolo/uwsgi-nginx-flask:python3.6 | ||
# FROM tiangolo/uwsgi-nginx-flask:python3.6 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove the commented line |
||
FROM tiangolo/uwsgi-nginx:python3.11 | ||
LABEL maintainer="Sebastian Ramirez <[email protected]>" | ||
ENV PYTHONPATH=/app | ||
|
||
COPY sshd_config /etc/ssh/ | ||
COPY app_init.supervisord.conf /etc/supervisor/conf.d | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please remove this from the branch and copy the contents into the PR description |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,130 @@ | ||
# Improvements to azure-vote-all-in-one-redis.yaml | ||
|
||
1. Use resource requests and limits for both azure-vote-back and azure-vote-front containers to ensure they have predictable resource usage and prevent resource starvation. | ||
|
||
2. Set up liveness and readiness probes for both containers to improve the self-healing capabilities of your deployments and ensure the availability of your services. | ||
|
||
```yml | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: azure-vote-back | ||
spec: | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
app: azure-vote-back | ||
template: | ||
metadata: | ||
labels: | ||
app: azure-vote-back | ||
spec: | ||
nodeSelector: | ||
"kubernetes.io/os": linux | ||
containers: | ||
- name: azure-vote-back | ||
image: mcr.microsoft.com/oss/bitnami/redis:6.0.8 | ||
env: | ||
- name: ALLOW_EMPTY_PASSWORD | ||
value: "yes" | ||
ports: | ||
- containerPort: 6379 | ||
name: redis | ||
resources: | ||
requests: | ||
cpu: 100m | ||
memory: 100Mi | ||
limits: | ||
cpu: 200m | ||
memory: 200Mi | ||
livenessProbe: | ||
exec: | ||
command: | ||
- redis-cli | ||
- ping | ||
initialDelaySeconds: 15 | ||
periodSeconds: 10 | ||
readinessProbe: | ||
exec: | ||
command: | ||
- redis-cli | ||
- ping | ||
initialDelaySeconds: 5 | ||
periodSeconds: 10 | ||
--- | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: azure-vote-back | ||
spec: | ||
ports: | ||
- port: 6379 | ||
selector: | ||
app: azure-vote-back | ||
--- | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: azure-vote-front | ||
spec: | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
app: azure-vote-front | ||
strategy: | ||
rollingUpdate: | ||
maxSurge: 1 | ||
maxUnavailable: 1 | ||
minReadySeconds: 5 | ||
template: | ||
metadata: | ||
labels: | ||
app: azure-vote-front | ||
spec: | ||
nodeSelector: | ||
"kubernetes.io/os": linux | ||
containers: | ||
- name: azure-vote-front | ||
image: mcr.microsoft.com/azuredocs/azure-vote-front:v1 | ||
ports: | ||
- containerPort: 80 | ||
resources: | ||
requests: | ||
cpu: 250m | ||
memory: 128Mi | ||
limits: | ||
cpu: 500m | ||
memory: 256Mi | ||
env: | ||
- name: REDIS | ||
value: "azure-vote-back" | ||
livenessProbe: | ||
httpGet: | ||
path: / | ||
port: 80 | ||
initialDelaySeconds: 15 | ||
periodSeconds: 10 | ||
readinessProbe: | ||
httpGet: | ||
path: / | ||
port: 80 | ||
initialDelaySeconds: 5 | ||
periodSeconds: 10 | ||
--- | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: azure-vote-front | ||
spec: | ||
type: LoadBalancer | ||
ports: | ||
- port: 80 | ||
selector: | ||
app: azure-vote-front | ||
``` | ||
|
||
## Changes made | ||
|
||
1. Added memory requests and limits to both `azure-vote-back` and `azure-vote-front` containers. | ||
2. Changed nodeSelector key from `beta.kubernetes.io/os` to `kubernetes.io/os` as the beta label has been deprecated. | ||
3. Added liveness |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove the
.vs/
folder from this PRgit rm -r .vs --cached
or something similar would work