Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(deployment): create deployment tools for sequencer #1677

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading