Skip to content

Commit 7a58fd7

Browse files
authored
Merge branch 'master' into update_new_mega_names
2 parents eaf3e85 + a683fc8 commit 7a58fd7

19 files changed

Lines changed: 750 additions & 540 deletions

.github/workflows/docker-k8s.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,11 @@ jobs:
6666
- name: Lint k8s
6767
run: (cd Resources/k8s/kustomize && yamllint .)
6868
- name: Create k8s Kind Cluster
69-
uses: helm/kind-action@v1.12.0
69+
uses: helm/kind-action@v1.13.0
7070
with:
7171
cluster_name: pokeapi
72-
version: v0.21.0
72+
config: Resources/kind/config-ga.yaml
73+
version: v0.31.0
7374
- name: Create deployment configuration
7475
run: |
7576
cp Resources/k8s/kustomize/base/secrets/postgres.env.sample Resources/k8s/kustomize/base/secrets/postgres.env
@@ -79,7 +80,7 @@ jobs:
7980
run: kind load docker-image pokeapi/pokeapi:local --name pokeapi
8081
- name: K8s Apply
8182
run: |
82-
make kustomize-local-apply
83+
make kustomize-ga-apply
8384
kubectl proxy &
8485
sleep 1
8586
bash Resources/scripts/wait.sh http://localhost:8001/api/v1/namespaces/pokeapi/services/pokeapi/proxy/api/v2/

Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,9 @@ kustomize-staging-apply: # (Kustomize) Run kubectl apply -k on the connected k8
133133
kustomize-local-apply: # (Kustomize) Run kubectl apply -k on the connected k8s cluster using the locally available pokeapi/pokeapi:local
134134
kubectl apply -k Resources/k8s/kustomize/local/
135135

136+
kustomize-ga-apply: # (Kustomize) Run kubectl apply -k on the connected k8s cluster using the Github Actions config (share host data with the cluster)
137+
kubectl apply -k Resources/k8s/kustomize/ga/
138+
136139
k8s-migrate: # (k8s) Run any pending migrations
137140
kubectl exec --namespace pokeapi deployment/pokeapi -- python manage.py migrate ${docker_config}
138141

Resources/k8s/kustomize/base/deployments/pokeapi-deployment.yaml

Lines changed: 7 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ metadata:
55
labels:
66
component: pokeapi
77
spec:
8-
replicas: 2
8+
replicas: 1
99
selector:
1010
matchLabels:
1111
component: pokeapi
@@ -29,17 +29,11 @@ spec:
2929
args:
3030
- apk add --update git &&
3131
git clone --depth=1 --single-branch --branch=master --recurse-submodules --shallow-submodules https://github.com/PokeAPI/pokeapi.git &&
32-
mv /code/pokeapi/data/v2/cries/* /tmp/cries/ &&
33-
mv /code/pokeapi/data/v2/csv/* /tmp/csv/ &&
34-
mv /code/pokeapi/data/v2/sprites/* /tmp/sprites/
32+
mv /code/pokeapi/data/v2/* /tmp/
3533
workingDir: /code
3634
volumeMounts:
37-
- mountPath: /tmp/cries
38-
name: cries-data-share
39-
- mountPath: /tmp/csv
40-
name: csv-data-share
41-
- mountPath: /tmp/sprites
42-
name: sprites-data-share
35+
- mountPath: /tmp/
36+
name: data-share
4337
containers:
4438
- name: pokeapi
4539
image: pokeapi/pokeapi:master
@@ -69,12 +63,8 @@ spec:
6963
- configMapRef:
7064
name: pokeapi-configmap
7165
volumeMounts:
72-
- mountPath: /code/data/v2/cries
73-
name: cries-data-share
74-
- mountPath: /code/data/v2/csv
75-
name: csv-data-share
76-
- mountPath: /code/data/v2/sprites
77-
name: sprites-data-share
66+
- mountPath: /code/data/v2/
67+
name: data-share
7868
resources: {}
7969
readinessProbe:
8070
periodSeconds: 5
@@ -89,9 +79,5 @@ spec:
8979
path: /api/v2/
9080
port: 8080
9181
volumes:
92-
- name: cries-data-share
93-
emptyDir: {}
94-
- name: csv-data-share
95-
emptyDir: {}
96-
- name: sprites-data-share
82+
- name: data-share
9783
emptyDir: {}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
apiVersion: kustomize.config.k8s.io/v1beta1
2+
kind: Kustomization
3+
4+
resources:
5+
- ../local
6+
7+
patches:
8+
- path: pokeapi-deployment-patch.yaml
9+
target:
10+
kind: Deployment
11+
labelSelector: component=pokeapi
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: pokeapi
5+
spec:
6+
template:
7+
spec:
8+
initContainers:
9+
- name: data-download
10+
image: alpine:3.21.2
11+
command: ['ls']
12+
args: ['/tmp/csv']
13+
containers:
14+
- name: pokeapi
15+
volumeMounts:
16+
- mountPath: /code/data/v2/
17+
name: data-share
18+
volumes:
19+
- name: data-share
20+
hostPath:
21+
path: /code/pokeapi/data/v2/
22+
emptyDir:
23+
$patch: delete

Resources/kind/config-ga.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
apiVersion: kind.x-k8s.io/v1alpha4
2+
kind: Cluster
3+
nodes:
4+
- role: control-plane
5+
extraMounts:
6+
- hostPath: /home/runner/work/pokeapi/pokeapi/data/v2/
7+
containerPath: /code/pokeapi/data/v2/

data/v2/build.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2102,8 +2102,13 @@ def csv_record_to_objects(info):
21022102
trade_species_id=int(info[17]) if info[17] != "" else None,
21032103
needs_overworld_rain=bool(int(info[18])),
21042104
turn_upside_down=bool(int(info[19])),
2105-
region_id=int(info[20]) if info[20] != "" else None,
2106-
base_form_id=int(info[21]) if info[21] != "" else None,
2105+
needs_multiplayer=bool(int(info[20])),
2106+
region_id=int(info[21]) if info[21] != "" else None,
2107+
base_form_id=int(info[22]) if info[22] != "" else None,
2108+
used_move_id=int(info[23]) if info[23] != "" else None,
2109+
min_move_count=int(info[24]) if info[24] != "" else None,
2110+
min_steps=int(info[25]) if info[25] != "" else None,
2111+
min_damage_taken=int(info[26]) if info[26] != "" else None,
21072112
)
21082113

21092114
build_generic((PokemonEvolution,), "pokemon_evolution.csv", csv_record_to_objects)

data/v2/csv/evolution_trigger_prose.csv

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,6 @@ evolution_trigger_id,local_language_id,name
1717
8,9,Land three critical hits in a battle
1818
9,9,Go somewhere after taking damage
1919
10,9,Other
20+
14,9,Use move
21+
15,9,Defeat three Bisharp that hold a Leader's Crest
22+
16,9,Collect 999 Gimmighoul Coins

data/v2/csv/evolution_triggers.csv

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,6 @@ id,identifier
1212
11,agile-style-move
1313
12,strong-style-move
1414
13,recoil-damage
15+
14,use-move
16+
15,three-defeated-bisharp
17+
16,gimmmighoul-coins

0 commit comments

Comments
 (0)