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'
- 'staging'
schedule:
- cron: '0 0 1 * *'
- cron: '0 0 1 * *'
jobs:
create-kustomize-cluster:
@ -17,6 +17,8 @@ jobs:
uses: actions/checkout@v2
with:
submodules: recursive
- name: Lint
run: (cd Resources/k8s/kustomize && yamllint .)
- name: Create k8s Kind Cluster
uses: helm/kind-action@v1.1.0
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
image: gcr.io/google_containers/defaultbackend:1.4
ports:
- containerPort: 8080
- containerPort: 8080
resources:
limits:
memory: "64Mi"
cpu: "50m"
cpu: "50m"

View file

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

View file

@ -17,15 +17,18 @@ spec:
initContainers:
- name: postgres-connection-checker
image: postgres:13.3-alpine
command: ['sh', '-c',
'until pg_isready -h postgresql -p 5432;
do echo waiting for database; sleep 2; done;']
command: ['sh', '-c']
args:
- until pg_isready -h postgresql -p 5432; do
echo waiting for database;
sleep 2;
done;
containers:
- name: pokeapi
image: pokeapi/pokeapi:staging
ports:
- 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
runAsUser: 0
env:

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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