-
Notifications
You must be signed in to change notification settings - Fork 33
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:1.0 #2
Open
cth-usq
wants to merge
10
commits into
mate-academy:main
Choose a base branch
from
cth-usq:develop
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Solution:1.0 #2
Changes from 6 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
00bbe6e
Solution
cth-usq e408d60
Solution:1.1
cth-usq 00f32a2
Solution:1.2
cth-usq 9bee561
Solution:1.3
cth-usq c584c8a
Solution:1.4
cth-usq d4d3f34
Solution:3.0
cth-usq c2bb6bc
Solution:4.0
cth-usq 120495f
add output.log
cth-usq 5e13a1f
output
cth-usq 3268fdb
output.log with changes in gitignore
cth-usq File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Patterns to ignore when building packages. | ||
# This supports shell glob matching, relative path matching, and | ||
# negation (prefixed with !). Only one pattern per line. | ||
.DS_Store | ||
# Common VCS dirs | ||
.git/ | ||
.gitignore | ||
.bzr/ | ||
.bzrignore | ||
.hg/ | ||
.hgignore | ||
.svn/ | ||
# Common backup files | ||
*.swp | ||
*.bak | ||
*.tmp | ||
*.orig | ||
*~ | ||
# Various IDEs | ||
.project | ||
.idea/ | ||
*.tmproj | ||
.vscode/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
apiVersion: v2 | ||
name: todoapp | ||
description: A Helm chart for Kubernetes | ||
|
||
type: application | ||
|
||
version: 0.1.0 | ||
|
||
appVersion: "1.16.0" | ||
|
||
dependencies: | ||
- name: mysql | ||
version: 0.1.0 | ||
repository: "file://charts/mysql" |
23 changes: 23 additions & 0 deletions
23
.infrastructure/helm-chart/todoapp/charts/mysql/.helmignore
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Patterns to ignore when building packages. | ||
# This supports shell glob matching, relative path matching, and | ||
# negation (prefixed with !). Only one pattern per line. | ||
.DS_Store | ||
# Common VCS dirs | ||
.git/ | ||
.gitignore | ||
.bzr/ | ||
.bzrignore | ||
.hg/ | ||
.hgignore | ||
.svn/ | ||
# Common backup files | ||
*.swp | ||
*.bak | ||
*.tmp | ||
*.orig | ||
*~ | ||
# Various IDEs | ||
.project | ||
.idea/ | ||
*.tmproj | ||
.vscode/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
apiVersion: v2 | ||
name: mysql | ||
description: A Helm chart for Kubernetes | ||
|
||
type: application | ||
|
||
version: 0.1.0 | ||
|
||
appVersion: "1.16.0" |
15 changes: 15 additions & 0 deletions
15
.infrastructure/helm-chart/todoapp/charts/mysql/templates/configMap.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: {{ .Chart.Name }}-configmap | ||
namespace: {{ .Values.global.namespace }} | ||
labels: | ||
app: {{ .Chart.Name }} | ||
data: | ||
init.sql: | | ||
GRANT ALL PRIVILEGES ON app_db.* TO 'app_user'@'%'; | ||
USE app_db; | ||
CREATE TABLE counter ( | ||
id INT AUTO_INCREMENT PRIMARY KEY, | ||
value INT | ||
); |
4 changes: 4 additions & 0 deletions
4
.infrastructure/helm-chart/todoapp/charts/mysql/templates/ns.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
apiVersion: v1 | ||
kind: Namespace | ||
metadata: | ||
name: {{ .Values.global.namespace }} |
10 changes: 10 additions & 0 deletions
10
.infrastructure/helm-chart/todoapp/charts/mysql/templates/secret.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
apiVersion: v1 | ||
kind: Secret | ||
metadata: | ||
name: {{ .Chart.Name }}-secrets | ||
namespace: {{ .Values.global.namespace }} | ||
type: Opaque | ||
data: | ||
{{- range $k, $v := .Values.mysql.secrets }} | ||
{{ $k | upper }}: {{ $v | b64enc | quote }} | ||
{{- end }} |
13 changes: 13 additions & 0 deletions
13
.infrastructure/helm-chart/todoapp/charts/mysql/templates/service.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# Headless service for stable DNS entries of StatefulSet members. | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: {{ .Chart.Name }}-clusterip | ||
namespace: {{ .Values.global.namespace }} | ||
spec: | ||
selector: | ||
app: {{ .Chart.Name }} | ||
ports: | ||
- name: {{ .Values.mysql.service.ports.name }} | ||
port: {{ .Values.mysql.service.ports.port }} | ||
clusterIP: {{ .Values.mysql.service.clusterIP }} |
62 changes: 62 additions & 0 deletions
62
.infrastructure/helm-chart/todoapp/charts/mysql/templates/statefulSet.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
apiVersion: apps/v1 | ||
kind: StatefulSet | ||
metadata: | ||
name: {{ .Chart.Name }}-statefulset | ||
namespace: {{ .Values.global.namespace }} | ||
spec: | ||
selector: | ||
matchLabels: | ||
app: {{ .Chart.Name }} | ||
replicas: {{ .Values.mysql.statefulSet.replicas }} | ||
serviceName: {{ .Chart.Name }} | ||
template: | ||
metadata: | ||
labels: | ||
app: {{ .Chart.Name }} | ||
spec: | ||
containers: | ||
- name: {{ .Values.mysql.statefulSet.name }} | ||
image: {{ .Values.mysql.statefulSet.repository }}:{{ .Values.mysql.statefulSet.version }} | ||
env: | ||
{{- range $k := .Values.mysql.secrets }} | ||
- name: {{ $k | upper }} | ||
valueFrom: | ||
secretKeyRef: | ||
name: mysql-secrets | ||
key: {{ $k | upper }} | ||
{{- end }} | ||
resources: | ||
requests: | ||
{{ .Values.mysql.statefulSet.resources.requests }} | ||
ports: | ||
- name: mysql | ||
containerPort: 3306 | ||
volumeMounts: | ||
- name: data | ||
mountPath: /var/lib/mysql | ||
subPath: mysql | ||
- name: config-map | ||
mountPath: /docker-entrypoint-initdb.d | ||
livenessProbe: | ||
{{ .Values.mysql.statefulSet.livenessProbe }} | ||
readinessProbe: | ||
{{ .Values.mysql.statefulSet.readinessProbe }} | ||
volumes: | ||
- name: config-map | ||
configMap: | ||
name: mysql | ||
tolerations: | ||
{{- range .Values.mysql.statefulSet.tolerations }} | ||
- key: "{{ .key }}" | ||
operator: "{{ .operator }}" | ||
value: "{{ .value }}" | ||
effect: "{{ .effect }}" | ||
{{- end }} | ||
volumeClaimTemplates: | ||
- metadata: | ||
name: data | ||
spec: | ||
accessModes: ["ReadWriteOnce"] | ||
resources: | ||
requests: | ||
storage: {{ .Values.mysql.statefulSet.storage }} |
62 changes: 62 additions & 0 deletions
62
.infrastructure/helm-chart/todoapp/charts/mysql/values.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
mysql: | ||
service: | ||
ports: | ||
name: mysql | ||
port: 3306 | ||
clusterIP: None | ||
|
||
secrets: | ||
MYSQL_ROOT_PASSWORD: "1234" | ||
MYSQL_USER: "app_user" | ||
MYSQL_PASSWORD: "1234" | ||
|
||
statefulSet: | ||
replicas: 2 | ||
name: mysql | ||
repository: mysql | ||
version: 8.0 | ||
storage: 2Gi | ||
|
||
resources: | ||
requests: | ||
memory: 1Gi | ||
cpu: 500m | ||
|
||
livenessProbe: | ||
exec: | ||
command: ["mysqladmin", "ping"] | ||
initialDelaySeconds: 30 | ||
periodSeconds: 10 | ||
timeoutSeconds: 5 | ||
|
||
readinessProbe: | ||
exec: | ||
command: ["mysqladmin", "ping"] | ||
initialDelaySeconds: 5 | ||
periodSeconds: 2 | ||
timeoutSeconds: 1 | ||
|
||
affinity: | ||
podAntiAffinity: | ||
requiredDuringSchedulingIgnoredDuringExecution: | ||
- labelSelector: | ||
matchExpressions: | ||
- key: "app" | ||
operator: In | ||
values: | ||
- mysql | ||
topologyKey: "kubernetes.io/hostname" | ||
nodeAffinity: | ||
requiredDuringSchedulingIgnoredDuringExecution: | ||
nodeSelectorTerms: | ||
- matchExpressions: | ||
- key: "app" | ||
operator: In | ||
values: | ||
- "mysql" | ||
|
||
tolerations: | ||
- key: "app" | ||
operator: "Equal" | ||
value: "mysql" | ||
effect: "NoSchedule" |
13 changes: 13 additions & 0 deletions
13
.infrastructure/helm-chart/todoapp/templates/clusterIp.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: {{ .Chart.Name }}-service | ||
namespace: {{ .Values.global.namespace }} | ||
spec: | ||
type: ClusterIP | ||
selector: | ||
app: {{ .Chart.Name }} | ||
ports: | ||
- protocol: TCP | ||
port: 80 | ||
targetPort: 8080 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: {{ .Chart.Name }}-config | ||
namespace: {{ .Values.global.namespace }} | ||
data: | ||
PYTHONUNBUFFERED: {{ .Values.todoapp.configs.PYTHONUNBUFFERED }} |
73 changes: 73 additions & 0 deletions
73
.infrastructure/helm-chart/todoapp/templates/deployment.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: {{ .Release.Name }}-{{ .Chart.Name }} | ||
namespace: {{ .Values.global.namespace }} | ||
spec: | ||
strategy: | ||
type: RollingUpdate | ||
rollingUpdate: | ||
maxSurge: {{ .Values.todoapp.rollingUpdate.maxSurge }} | ||
maxUnavailable: {{ .Values.todoapp.rollingUpdate.maxSurge }} | ||
selector: | ||
matchLabels: | ||
app: {{ .Chart.Name }} | ||
template: | ||
metadata: | ||
labels: | ||
app: {{ .Chart.Name }} | ||
spec: | ||
serviceAccountName: {{ .Chart.Name }}-secrets-reader | ||
containers: | ||
- name: {{ .Values.todoapp.image.name }} | ||
image: {{ .Values.todoapp.image.repository }}:{{ .Values.todoapp.image.version }} | ||
volumeMounts: | ||
- name: data | ||
mountPath: /app/data | ||
- name: app-secrets-volume | ||
mountPath: "/app/secrets" | ||
readOnly: true | ||
- name: app-config-volume | ||
mountPath: "/app/configs" | ||
readOnly: true | ||
resources: | ||
{{ .Values.todoapp.resources }} | ||
env: | ||
- name: PYTHONUNBUFFERED | ||
valueFrom: | ||
configMapKeyRef: | ||
name: {{ .Chart.Name }}-config | ||
key: PYTHONUNBUFFERED | ||
{{- range $k := .Values.todoapp.secrets }} | ||
- name: {{ $k | upper }} | ||
valueFrom: | ||
secretKeyRef: | ||
name: todoapp-secrets | ||
key: {{ $k | upper }} | ||
{{- end }} | ||
ports: | ||
- containerPort: 8080 | ||
livenessProbe: | ||
httpGet: | ||
path: api/health | ||
port: 8080 | ||
initialDelaySeconds: 60 | ||
periodSeconds: 5 | ||
readinessProbe: | ||
httpGet: | ||
path: api/ready | ||
port: 8080 | ||
initialDelaySeconds: 5 | ||
periodSeconds: 5 | ||
volumes: | ||
- name: data | ||
persistentVolumeClaim: | ||
claimName: pvc-data | ||
- name: app-secrets-volume | ||
secret: | ||
secretName: app-secret | ||
- name: app-config-volume | ||
configMap: | ||
name: app-config | ||
affinity: | ||
{{ .Values.todoapp.affinity }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
apiVersion: autoscaling/v2 | ||
kind: HorizontalPodAutoscaler | ||
metadata: | ||
name: {{ .Chart.Name }}-hpa | ||
namespace: {{ .Values.global.namespace }} | ||
spec: | ||
scaleTargetRef: | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
name: {{ .Release.Name }}-{{ .Chart.Name }} | ||
minReplicas: {{ .Values.todoapp.hpa.minReplicas }} | ||
maxReplicas: {{ .Values.todoapp.hpa.maxReplicas }} | ||
metrics: | ||
- type: Resource | ||
resource: | ||
name: cpu | ||
target: | ||
type: Utilization | ||
averageUtilization: {{ .Values.todoapp.hpa.cpu.averageUtilization }} | ||
- type: Resource | ||
resource: | ||
name: memory | ||
target: | ||
type: Utilization | ||
averageUtilization: {{ .Values.todoapp.hpa.memory.averageUtilization }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
apiVersion: networking.k8s.io/v1 | ||
kind: Ingress | ||
metadata: | ||
name: {{ .Chart.Name }}-ingress | ||
namespace: {{ .Values.global.namespace }} | ||
annotations: | ||
nginx.ingress.kubernetes.io/rewrite-target: /$2 | ||
spec: | ||
rules: | ||
- http: | ||
paths: | ||
- pathType: Prefix | ||
path: /(|$)(.*) | ||
backend: | ||
service: | ||
name: {{ .Chart.Name }}-service | ||
port: | ||
number: 80 |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
You could import the whole block from values. And same for other below