Skip to content

Commit

Permalink
chore(deployment): create deployment tools for sequencer (#1677)
Browse files Browse the repository at this point in the history
  • Loading branch information
alon-dotan-starkware authored Nov 4, 2024
1 parent b04f2e0 commit 1c8556c
Show file tree
Hide file tree
Showing 19 changed files with 57,679 additions and 0 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/deployment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Sequencer Deployment Test
on:
push:
branches:
- main
- main-v[0-9].**
tags:
- v[0-9].**
# TODO(Dori, 1/9/2024): Decide when exactly native-blockifier artifacts will be built. Until
# then, keep the 'paths' key empty and build on every push to a release branch / tag.

pull_request:
types:
- opened
- reopened
- synchronize
- auto_merge_enabled
- edited
paths:
- 'deployments/sequencer/*'


jobs:
deployment:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: |
# Install deps.
npm install -g cdk8s-cli
python3 -m pip install pipenv
# Synthesize the CDK8s Sequencer app.
cd deployments/sequencer
cdk8s synth
diff -au references/sequencer-system.k8s.yaml dist/sequencer-system.k8s.yaml
14 changes: 14 additions & 0 deletions deployments/sequencer/Pipfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[[source]]
name = "pypi"
url = "https://pypi.org/simple"
verify_ssl = true

[dev-packages]

[packages]
cdk8s = "~=2.66.2"
constructs = "~=10.2.70"
jsonschema = "~=4.23.0"

[requires]
python_version = "3.10"
252 changes: 252 additions & 0 deletions deployments/sequencer/Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions deployments/sequencer/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# CRD

Example usage of [`Custom Resources Definitions`](https://cdk8s.io/docs/latest/cli/import/#crds) construct and to define them within a cdk8s application:

- `App` (Core)
- `Chart` (Core)
- `Certificate` (CRD)
5 changes: 5 additions & 0 deletions deployments/sequencer/cdk8s.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
language: python
app: pipenv install && pipenv run python ./main.py
imports:
- k8s@1.26.0
- resources/crds/backendconfigs_cloud_google_com.yaml
30 changes: 30 additions & 0 deletions deployments/sequencer/config/sequencer.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
from typing import Dict, Any
import os
import json
import jsonschema

ROOT_DIR = os.path.join(os.path.dirname(os.path.abspath(__file__)), '../../../')
CONFIG_DIR = os.path.join(ROOT_DIR, 'config/papyrus/')


class Config():
def __init__(self, schema: Dict[Any, Any], config: Dict[Any, Any]):
self.schema = schema
self.config = config

def get(self):
return self.config

def validate(self):
pass


class SequencerDevConfig(Config):
def __init__(self):
super().__init__(
schema=json.loads(open(os.path.join(CONFIG_DIR, 'default_config.json'), 'r').read()),
config=json.loads(open(os.path.join(CONFIG_DIR, 'presets', 'sepolia_testnet.json'), 'r').read())
)

def validate(self):
jsonschema.validate(self.config, schema=self.schema)
Loading

0 comments on commit 1c8556c

Please sign in to comment.