-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathokteto.yaml
143 lines (122 loc) · 3.96 KB
/
okteto.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
icon: https://raw.githubusercontent.com/okteto/icons/main/oktaco.png
build:
menu:
context: menu
kitchen:
context: kitchen
kitchen-dev:
context: kitchen
target: dev
check:
context: check
e2e:
context: e2e
deploy:
image: hashicorp/terraform:1.4
commands:
- name: Create the AWS infrastructure
command: |
set -e
resourceName="${OKTETO_NAMESPACE}-oktacoshop"
region=$AWS_REGION
export KUBE_CONFIG_PATH="$KUBECONFIG"
export KUBE_NAMESPACE=$OKTETO_NAMESPACE
terraform init -input=false
terraform apply -input=false -var "bucket_name=$resourceName" -var "queue_name=$resourceName" -var "region=$region" -auto-approve
s3Dashboard="https://s3.console.aws.amazon.com/s3/buckets/${resourceName}"
queueDashboard="https://${region}.console.aws.amazon.com/sqs/v2/home?region=${region}#/queues"
queueUrl=$(terraform output -raw queue_url)
# make the values available to the following steps and the dashboard
{
echo "OKTETO_EXTERNAL_S3_ENDPOINTS_BUCKET_URL=$s3Dashboard"
echo "S3_BUCKET_NAME=$resourceName"
echo "OKTETO_EXTERNAL_SQS_ENDPOINTS_QUEUE_URL=$queueDashboard"
echo "SQS_QUEUE_URL=$queueUrl"
echo "SQS_QUEUE_NAME=$resourceName"
} >> "$OKTETO_ENV"
# only run this command if you are not using Roles
- name: Create the AWS secret
command: |
kubectl create secret generic aws-credentials --save-config --dry-run=client --from-literal=AWS_REGION=$AWS_REGION --from-literal=AWS_DEFAULT_REGION=$AWS_REGION --from-literal=AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY --from-literal=AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID -o yaml | kubectl apply -f -
- name: Deploy the Menu microservice
command: |
helm upgrade --install menu menu/chart --set image=$OKTETO_BUILD_MENU_IMAGE --set queue=$SQS_QUEUE_URL --set author="${OKTETO_NAMESPACE}-${OKTETO_USERNAME}"
- name: Deploy the Kitchen microservice
command: helm upgrade --install kitchen kitchen/chart --set image=$OKTETO_BUILD_KITCHEN_IMAGE --set queue=$SQS_QUEUE_NAME --set check=https://check-${OKTETO_NAMESPACE}.${OKTETO_DOMAIN}/checks
- name: Deploy the Check microservice
command: |
helm upgrade --install check check/chart --set image=${OKTETO_BUILD_CHECK_IMAGE} --set bucket="$S3_BUCKET_NAME"
echo "OKTETO_EXTERNAL_API_DOCS_ENDPOINTS_DOCS_URL=https://check-${OKTETO_NAMESPACE}.${OKTETO_DOMAIN}/docs" >> $OKTETO_ENV
destroy:
image: hashicorp/terraform:1.4
commands:
- name: Delete the AWS infrastructure
command: |
set -e
resourceName="${OKTETO_NAMESPACE}-oktacoshop"
region=$AWS_REGION
export KUBE_CONFIG_PATH="$KUBECONFIG"
export KUBE_NAMESPACE=$OKTETO_NAMESPACE
terraform init -input=false
terraform apply -input=false -var "bucket_name=$resourceName" -var "queue_name=$resourceName" -var "region=$region" -auto-approve --destroy
external:
readme:
icon: okteto
notes: README.md
endpoints:
- name: readme
url: https://github.com/okteto/external-resources-tf-aws
sqs:
icon: aws
notes: sqs/notes.md
endpoints:
- name: queue
s3:
icon: aws
notes: s3/notes.md
endpoints:
- name: bucket
api-docs:
icon: dashboard
notes: check/notes.md
endpoints:
- name: docs
dev:
menu:
command: bash
sync:
- menu:/usr/src/app
forward:
- 9229:9229
kitchen:
image: ${OKTETO_BUILD_KITCHEN_DEV_IMAGE}
command: bash
sync:
- kitchen:/usr/src/app
environment:
GIN_MODE: debug
securityContext:
capabilities:
add:
- SYS_PTRACE
forward:
- 2345:2345
check:
command: bash
sync:
- check:/usr/src/app
environment:
RELOAD: true
test:
e2e:
image: $OKTETO_BUILD_E2E_IMAGE
context: e2e
caches:
- yarn/.cache
- node_modules
commands:
- yarn install
- yarn test
artifacts:
- test-results
- playwright-report