refactor: lint and enable linting

This commit is contained in:
Alessandro Pezzè 2021-06-01 15:17:54 +02:00
parent 4a09cfb06a
commit d597679715
12 changed files with 76 additions and 61 deletions

View file

@ -7,7 +7,7 @@ on:
- 'master' - 'master'
- 'staging' - 'staging'
schedule: schedule:
- cron: '0 0 1 * *' - cron: '0 0 1 * *'
jobs: jobs:
create-kustomize-cluster: create-kustomize-cluster:
@ -17,6 +17,8 @@ jobs:
uses: actions/checkout@v2 uses: actions/checkout@v2
with: with:
submodules: recursive submodules: recursive
- name: Lint
run: (cd Resources/k8s/kustomize && yamllint .)
- name: Create k8s Kind Cluster - name: Create k8s Kind Cluster
uses: helm/kind-action@v1.1.0 uses: helm/kind-action@v1.1.0
with: with:

View file

@ -0,0 +1,7 @@
---
extends: default
rules:
document-start: disable
line-length: disable

View file

@ -18,8 +18,8 @@ spec:
- name: default-backend - name: default-backend
image: gcr.io/google_containers/defaultbackend:1.4 image: gcr.io/google_containers/defaultbackend:1.4
ports: ports:
- containerPort: 8080 - containerPort: 8080
resources: resources:
limits: limits:
memory: "64Mi" memory: "64Mi"
cpu: "50m" cpu: "50m"

View file

@ -17,9 +17,12 @@ spec:
initContainers: initContainers:
- name: pokeapi-connection-checker - name: pokeapi-connection-checker
image: curlimages/curl:latest image: curlimages/curl:latest
command: ['sh', '-c', command: ["sh", "-c"]
'until curl -f -s --output /dev/null http://pokeapi:80/api/v2/; args:
do echo waiting for pokeapi; sleep 2; done;'] - until curl -f -s --output /dev/null http://pokeapi:80/api/v2/; do
echo waiting for pokeapi;
sleep 2;
done;
containers: containers:
- name: graphql-engine - name: graphql-engine
image: hasura/graphql-engine:v2.0.0-alpha.5 image: hasura/graphql-engine:v2.0.0-alpha.5
@ -49,4 +52,3 @@ spec:
- name: HASURA_GRAPHQL_ENABLE_TELEMETRY - name: HASURA_GRAPHQL_ENABLE_TELEMETRY
value: "false" value: "false"
resources: {} resources: {}

View file

@ -17,15 +17,18 @@ spec:
initContainers: initContainers:
- name: postgres-connection-checker - name: postgres-connection-checker
image: postgres:13.3-alpine image: postgres:13.3-alpine
command: ['sh', '-c', command: ['sh', '-c']
'until pg_isready -h postgresql -p 5432; args:
do echo waiting for database; sleep 2; done;'] - until pg_isready -h postgresql -p 5432; do
echo waiting for database;
sleep 2;
done;
containers: containers:
- name: pokeapi - name: pokeapi
image: pokeapi/pokeapi:staging image: pokeapi/pokeapi:staging
ports: ports:
- containerPort: 8080 - containerPort: 8080
securityContext: # CI: Github Actions kills this container if not run with root. Otherwise, it's safe to use the default pokeapi/pokeapi user and remove these lines. securityContext: # CI: Github Actions kills this container if not run with root. Otherwise, it's safe to use the default pokeapi/pokeapi user and remove these lines.
allowPrivilegeEscalation: false allowPrivilegeEscalation: false
runAsUser: 0 runAsUser: 0
env: env:

View file

@ -10,25 +10,28 @@ spec:
initContainers: initContainers:
- name: pokeapi-last-built-resource-connection-checker - name: pokeapi-last-built-resource-connection-checker
image: curlimages/curl:latest image: curlimages/curl:latest
command: ['sh', '-c', command: ['sh', '-c']
'until curl -f -s --output /dev/null http://pokeapi:80/api/v2/pal-park-area/5/; args:
do echo waiting for pokeapi; sleep 2; done;'] - until curl -f -s --output /dev/null http://pokeapi:80/api/v2/pal-park-area/5/;
do echo waiting for pokeapi;
sleep 2;
done;
containers: containers:
- name: load-graphql - name: load-graphql
image: debian:buster image: debian:buster
env: env:
- name: HASURA_GRAPHQL_ADMIN_SECRET - name: HASURA_GRAPHQL_ADMIN_SECRET
valueFrom: valueFrom:
secretKeyRef: secretKeyRef:
name: graphql-env-secret name: graphql-env-secret
key: HASURA_GRAPHQL_ADMIN_SECRET key: HASURA_GRAPHQL_ADMIN_SECRET
command: ["sh", "-c"] command: ["sh", "-c"]
args: args:
- apt-get update && - apt-get update &&
apt-get install -y git curl && apt-get install -y git curl &&
curl -L https://github.com/hasura/graphql-engine/raw/stable/cli/get.sh | bash && curl -L https://github.com/hasura/graphql-engine/raw/stable/cli/get.sh | bash &&
hasura update-cli --version v2.0.0-alpha.5 && hasura update-cli --version v2.0.0-alpha.5 &&
git clone https://github.com/PokeAPI/pokeapi.git && git clone https://github.com/PokeAPI/pokeapi.git &&
cd pokeapi && cd pokeapi &&
git checkout staging && git checkout staging &&
hasura md apply --endpoint http://graphql:8080 --project graphql --admin-secret $(HASURA_GRAPHQL_ADMIN_SECRET) hasura md apply --endpoint http://graphql:8080 --project graphql --admin-secret $(HASURA_GRAPHQL_ADMIN_SECRET)

View file

@ -14,15 +14,15 @@ spec:
port: port:
number: 8080 number: 8080
rules: rules:
- http: - http:
paths: paths:
- path: /api/v2 - path: /api/v2
pathType: Prefix pathType: Prefix
backend: backend:
service: service:
name: pokeapi name: pokeapi
port: port:
number: 80 number: 80
--- ---
apiVersion: networking.k8s.io/v1 apiVersion: networking.k8s.io/v1
kind: Ingress kind: Ingress
@ -39,12 +39,12 @@ spec:
port: port:
number: 8080 number: 8080
rules: rules:
- http: - http:
paths: paths:
- path: /graphql - path: /graphql
pathType: Prefix pathType: Prefix
backend: backend:
service: service:
name: graphql name: graphql
port: port:
number: 8080 number: 8080

View file

@ -1,5 +1,5 @@
kind: Namespace
apiVersion: v1 apiVersion: v1
kind: Namespace
metadata: metadata:
name: pokeapi name: pokeapi
labels: labels:

View file

@ -1,11 +1,11 @@
kind: Service
apiVersion: v1 apiVersion: v1
kind: Service
metadata: metadata:
name: haproxy-ingress name: haproxy-ingress
labels: labels:
component: haproxy-ingress component: haproxy-ingress
spec: spec:
type: LoadBalancer # TODO: Change to `LoadBalancer` type: LoadBalancer # TODO: Change to `LoadBalancer`
externalTrafficPolicy: Local externalTrafficPolicy: Local
ports: ports:
- name: public-http - name: public-http
@ -19,5 +19,3 @@ spec:
targetPort: stat targetPort: stat
selector: selector:
component: haproxy-ingress component: haproxy-ingress
---

View file

@ -8,5 +8,5 @@ spec:
selector: selector:
component: default-backend component: default-backend
ports: ports:
- port: 8080 - port: 8080
targetPort: 8080 targetPort: 8080

View file

@ -1,5 +1,5 @@
kind: PersistentVolume
apiVersion: v1 apiVersion: v1
kind: PersistentVolume
metadata: metadata:
name: postgres-volume0 name: postgres-volume0
labels: labels:
@ -10,7 +10,7 @@ spec:
storage: 10Gi storage: 10Gi
accessModes: accessModes:
- ReadWriteOnce - ReadWriteOnce
hostPath: # TODO: change to a cloud-solution hostPath: # TODO: change to a cloud-solution
path: "/mnt/data" path: "/mnt/data"
--- ---
apiVersion: v1 apiVersion: v1

View file

@ -1,5 +1,5 @@
kind: PersistentVolume
apiVersion: v1 apiVersion: v1
kind: PersistentVolume
metadata: metadata:
name: redis-volume0 name: redis-volume0
labels: labels:
@ -10,7 +10,7 @@ spec:
storage: 2Gi storage: 2Gi
accessModes: accessModes:
- ReadWriteOnce - ReadWriteOnce
hostPath: # TODO: change to a cloud-solution hostPath: # TODO: change to a cloud-solution
path: "/mnt/data" path: "/mnt/data"
--- ---
apiVersion: v1 apiVersion: v1