Skip to content

Commit

Permalink
added base k8s deployment
Browse files Browse the repository at this point in the history
added pipeline
added brew.sh script
  • Loading branch information
rotarur committed Jul 11, 2023
1 parent 02fc06c commit 5ce6e43
Show file tree
Hide file tree
Showing 6 changed files with 181 additions and 0 deletions.
14 changes: 14 additions & 0 deletions .github/workflows/cd-testnet.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Testnet CD for graphix

on:
workflow_dispatch:
push:
pull_request:

jobs:
deploy:
uses: ./.github/workflows/template-deploy.yaml
with:
ENVIRONMENT: testnet
secrets:
GCP_SECRET: ${{ secrets.GCP_GRAPH_NETWORK }}
59 changes: 59 additions & 0 deletions .github/workflows/template-deploy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Template Deploy

on:
workflow_call:
inputs:
GCP_PROJECT_ID:
required: false
type: string
default: graph-mainnet
ENVIRONMENT:
required: false
type: string
default: testnet
ENABLE_DIFF:
required: false
type: boolean
default: true
ENABLE_APPLY:
required: false
type: boolean
default: false
secrets:
GCP_SECRET:
required: true
TRANSCRYPT:
required: true

jobs:
template-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout the repo
uses: actions/checkout@v3

- id: "auth"
uses: "google-github-actions/auth@v0"
with:
credentials_json: ${{ secrets.GCP_SECRET }}

- name: Set up Cloud SDK
uses: google-github-actions/setup-gcloud@v0
with:
project_id: ${{ inputs.GCP_PROJECT_ID }}

- name: Enable homebrew
uses: raviqqe/[email protected]

- name: Install infrastructure tools
run: ./brew.sh

- name: Diff ${{ inputs.ENVIRONMENT }}
if: inputs.ENABLE_DIFF
working-directory: k8s/${{ inputs.ENVIRONMENT }}
run: ./diff.sh

- name: Deploy to ${{ inputs.ENVIRONMENT }} cluster
if: inputs.ENABLE_APPLY
working-directory: k8s/${{ inputs.ENVIRONMENT }}
run: ./apply.sh
17 changes: 17 additions & 0 deletions brew.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash

# brew install transcrypt # encrypt/decrypt secrets
brew install jsonnet # jsonnet is a superset of json
brew install jsonnet-bundler # manage jsonnet packages with lock file
brew install helm
brew install jq

brew install cask google-cloud-sdk
gcloud components install gke-gcloud-auth-plugin

curl -fSL -o "/usr/local/bin/tk" "https://github.com/grafana/tanka/releases/download/v0.22.1/tk-linux-amd64"
chmod a+x "/usr/local/bin/tk"

curl -LO "https://dl.k8s.io/release/v1.24.1/bin/linux/amd64/kubectl"
chmod +x ./kubectl
mv ./kubectl /usr/local/bin/kubectl
73 changes: 73 additions & 0 deletions k8s/base/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: graphix
labels:
app: graphix
spec:
replicas: 1
selector:
matchLabels:
app: graphix
template:
metadata:
labels:
app: graphix
annotations:
prometheus.io/scrape: "true"
prometheus.io/path: "/metrics"
prometheus.io/port: "7300"
spec:
# tolerations:
# - key: "graphix"
# operator: "Exists"
# effect: "NoSchedule"
# affinity:
# nodeAffinity:
# requiredDuringSchedulingIgnoredDuringExecution:
# nodeSelectorTerms:
# - matchExpressions:
# - key: "graphix"
# operator: In
# values:
# - "1"
imagePullSecrets:
- name: docker-registry

volumes:
- name: graphix-config
secret:
secretName: graphix-config
- name: redpanda-certificates
secret:
secretName: redpanda-certificates

containers:
- name: graphix
image: graphix:to-be-replaced-by-kustomize
imagePullPolicy: IfNotPresent
ports:
- name: graphix
containerPort: 80
- name: metrics
containerPort: 7300
# readinessProbe:
# httpGet:
# path: /
# port: graphix
# timeoutSeconds: 5
# volumeMounts:
# - name: graphix-config
# mountPath: /opt/graphix/config
# readOnly: true
# - name: redpanda-certificates
# mountPath: /redpanda_config
# readOnly: true
# env:
# - name: RUST_LOG
# value: info,graph_graphix=debug,indexer_selection=debug
command:
- sleep
- infinte
# args:
# - "/opt/graphix/config/config"
13 changes: 13 additions & 0 deletions k8s/base/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

resources:
- deployment.yaml
# - service.yaml
# - ingress.yaml
# - servicemonitor.yaml

images:
- name: graphix
newName: edgeandnode/graphix-cross-checker
newTag: latest
5 changes: 5 additions & 0 deletions k8s/testnet/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

bases:
- ../base

0 comments on commit 5ce6e43

Please sign in to comment.