Skip to content

Commit 018877e

Browse files
v2 manifest (#5)
* v2 manifest * rename * vscode launch * re kustomize * manifests, plural * removed go- prefix readded kustomize edit set image * image: ${OKTETO_BUILD_TODO_LIST_DEV_IMAGE} * okteto.dev/todo-list:001 -> okteto.dev/todo-list:1.0.0 * with all comments * with image in k8s deployment and image in okteto.yml build.todo-list * syntax fix
1 parent 7440a45 commit 018877e

File tree

8 files changed

+119
-82
lines changed

8 files changed

+119
-82
lines changed

.gitignore

+4-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
1-
/go-todo
1+
/go-todo
2+
3+
.DS_Store
4+
.idea/

.vscode/launch.json

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"version": "0.2.0",
3+
"configurations": [
4+
{
5+
"name": "Connect to okteto",
6+
"type": "go",
7+
"request": "attach",
8+
"mode": "remote",
9+
"remotePath": "/usr/src/app",
10+
"port": 2345,
11+
"host": "127.0.0.1"
12+
}
13+
]
14+
}

manifest/k8s.yaml

-45
This file was deleted.

manifests/k8s.yaml

+65
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: todo-list
5+
spec:
6+
replicas: 1
7+
selector:
8+
matchLabels:
9+
app: todo-list
10+
template:
11+
metadata:
12+
labels:
13+
app: todo-list
14+
spec:
15+
containers:
16+
- image: okteto.dev/todo-list:1.0.0
17+
name: todo-list
18+
env:
19+
- name: POSTGRESQL_HOST
20+
value: db
21+
- name: POSTGRESQL_USERNAME
22+
value: okteto
23+
- name: POSTGRESQL_PASSWORD
24+
value: okteto
25+
- name: POSTGRESQL_DATABASE
26+
value: okteto
27+
readinessProbe:
28+
periodSeconds: 1
29+
httpGet:
30+
path: /healthz
31+
port: 8080
32+
33+
---
34+
35+
apiVersion: v1
36+
kind: Service
37+
metadata:
38+
name: todo-list
39+
spec:
40+
type: LoadBalancer
41+
ports:
42+
- name: "todo-list"
43+
port: 8080
44+
selector:
45+
app: todo-list
46+
47+
---
48+
49+
apiVersion: networking.k8s.io/v1
50+
kind: Ingress
51+
metadata:
52+
name: todo-list
53+
annotations:
54+
dev.okteto.com/generate-host: todo-list
55+
spec:
56+
rules:
57+
- http:
58+
paths:
59+
- backend:
60+
service:
61+
name: todo-list
62+
port:
63+
number: 8080
64+
path: /
65+
pathType: ImplementationSpecific

manifest/kustomization.yaml manifests/kustomization.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ apiVersion: kustomize.config.k8s.io/v1beta1
22
kind: Kustomization
33
resources:
44
- k8s.yaml
5-
- postgres.yaml
5+
- postgres.yaml

manifest/postgres.yaml manifests/postgres.yaml

+19-19
Original file line numberDiff line numberDiff line change
@@ -19,27 +19,27 @@ spec:
1919
- image: postgres:9.4
2020
name: db
2121
env:
22-
- name: POSTGRES_USER
23-
value: okteto
24-
- name: POSTGRES_PASSWORD
25-
value: okteto
26-
- name: POSTGRES_DB
27-
value: okteto
22+
- name: POSTGRES_USER
23+
value: okteto
24+
- name: POSTGRES_PASSWORD
25+
value: okteto
26+
- name: POSTGRES_DB
27+
value: okteto
2828
volumeMounts:
2929
- mountPath: /var/lib/postgresql/data
3030
name: data
3131
subPath: data
3232
volumeClaimTemplates:
33-
- apiVersion: v1
34-
kind: PersistentVolumeClaim
35-
metadata:
36-
name: data
37-
spec:
38-
accessModes:
39-
- ReadWriteOnce
40-
resources:
41-
requests:
42-
storage: 1Gi
33+
- apiVersion: v1
34+
kind: PersistentVolumeClaim
35+
metadata:
36+
name: data
37+
spec:
38+
accessModes:
39+
- ReadWriteOnce
40+
resources:
41+
requests:
42+
storage: 1Gi
4343

4444
---
4545

@@ -50,7 +50,7 @@ metadata:
5050
spec:
5151
type: ClusterIP
5252
ports:
53-
- port: 5432
54-
targetPort: 5432
53+
- port: 5432
54+
targetPort: 5432
5555
selector:
56-
app: db
56+
app: db

okteto-pipeline.yml

-4
This file was deleted.

okteto.yml

+16-12
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,27 @@
11
build:
22
todo-list:
3-
image: okteto.dev/todo-list
4-
3+
image: okteto.dev/todo-list:1.0.0
4+
context: .
5+
todo-list-dev:
6+
context: .
7+
target: builder
8+
59
deploy:
6-
- cd manifest; kustomize edit set image okteto.dev/todo-list=${OKTETO_BUILD_TODO_LIST_IMAGE}
7-
- kubectl apply -k manifest
10+
- cd manifests; kustomize edit set image okteto.dev/todo-list=${OKTETO_BUILD_TODO_LIST_IMAGE}
11+
- kubectl apply -k manifests
12+
813
dev:
914
todo-list:
10-
image: okteto/golang:1
15+
image: ${OKTETO_BUILD_TODO_LIST_DEV_IMAGE}
1116
command: bash
12-
securityContext:
13-
capabilities:
14-
add:
15-
- SYS_PTRACE
17+
sync:
18+
- .:/app
1619
volumes:
1720
- /go/pkg/
1821
- /root/.cache/go-build/
19-
workdir: /app
20-
sync:
21-
- .:/app
22+
securityContext:
23+
capabilities:
24+
add:
25+
- SYS_PTRACE
2226
forward:
2327
- 2345:2345

0 commit comments

Comments
 (0)