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

Prep for CRIB #11418

Merged
merged 61 commits into from
Dec 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
f5ddf2e
Make CICD work with new ECRs (#495)
chainchad Nov 21, 2023
8f6e903
Fix ECR and publish on PRs (#496)
chainchad Nov 21, 2023
893cc49
Remove test file
chainchad Nov 22, 2023
3bd5f4e
Add mockserver to helm chart dependency
chainchad Nov 22, 2023
2e4f815
Add default values file
chainchad Nov 22, 2023
231be26
Add security contexts
chainchad Nov 22, 2023
92f4299
Fix ref to values
chainchad Nov 22, 2023
fef1623
Use head SHA instead of commit SHA for image tagging
chainchad Nov 24, 2023
81f94e3
Use emptyDir mount for postgres to resolve perm issues
chainchad Nov 24, 2023
54cadca
Fix volume mounts on postgres
chainchad Nov 24, 2023
3eadf88
Fix /tmp writes and mount /tmp emptyDir
chainchad Nov 24, 2023
3c45404
Remove custom uid
chainchad Nov 24, 2023
f0d60b9
Run as same uid as postgres
chainchad Nov 24, 2023
ee75fe9
Test DOCKER_METADATA_PR_HEAD_SHA disable for root image
chainchad Nov 24, 2023
03413ea
Upgrade docker metadata action
chainchad Nov 24, 2023
46bdcdf
Do a full clone
chainchad Nov 24, 2023
0a780db
Avoid emptyDir mounts and update gid
chainchad Nov 24, 2023
9c4c14a
Use head SHA when on a PR as default input
chainchad Nov 24, 2023
61aa60d
Downgrade metata action to latest on prev major
chainchad Nov 24, 2023
6584e12
Override sha tag with HEAD value
chainchad Nov 24, 2023
b09c959
Remove old sha tag default
chainchad Nov 24, 2023
f3442f2
Attempt to fix sha tag
chainchad Nov 24, 2023
08f7220
Fix syntax error
chainchad Nov 24, 2023
ab4a967
Remove DOCKER_METADATA_PR_HEAD_SHA env
chainchad Nov 24, 2023
ff0c733
Refactor shared var output
chainchad Nov 24, 2023
952eedd
Revert "Refactor shared var output"
chainchad Nov 24, 2023
de373f1
Revert "Remove DOCKER_METADATA_PR_HEAD_SHA env"
chainchad Nov 24, 2023
3488912
Try to make things work again
chainchad Nov 24, 2023
cac5bcb
Set the host to localhost for K8s
chainchad Nov 24, 2023
84f5e37
Add user to pg_isready
chainchad Nov 24, 2023
7cc3bdc
Make securityContext container specific
chainchad Nov 25, 2023
f6d73e2
Create init container to create /clroot
chainchad Nov 27, 2023
0fcdec2
Fix volumes
chainchad Nov 27, 2023
07b9111
Add security context to init container
chainchad Nov 27, 2023
bfc117c
Skip the chown
chainchad Nov 27, 2023
68260c0
Remove init container
chainchad Nov 27, 2023
d0596c9
Breakout DB into its own deployment and service
chainchad Nov 28, 2023
9e1cf8a
Fix typo
chainchad Nov 28, 2023
27788c4
Update localhost to db service dns
chainchad Nov 28, 2023
6ecba3c
Fix path to script
chainchad Nov 29, 2023
5266d66
Change geth /root path to /app
chainchad Nov 29, 2023
302cb0d
Create emptyDir volume for geth devchain dir
chainchad Nov 29, 2023
281eed5
Remove full clone
chainchad Nov 29, 2023
7a5239c
Add correct inputs to mockserver
chainchad Nov 29, 2023
4158a3d
merge with develop
skudasov Nov 30, 2023
e429fbb
cleanup & verify
skudasov Nov 30, 2023
782eb0f
Add fixes for /chainlink
chainchad Nov 30, 2023
7d7fdac
Merge branch 're-1994/crib-prep' of github.com:smartcontractkit/chain…
chainchad Nov 30, 2023
7d559ba
Remove unused env var
chainchad Nov 30, 2023
00eff9f
Set back to hardcoded repo name
chainchad Nov 30, 2023
4cd2fec
Reset values back to pre rebase changes
chainchad Dec 1, 2023
974250e
Remove mockserver templates in favor of subchart
chainchad Dec 1, 2023
bc2e552
fix connect.toml and rename mockserver connection
skudasov Dec 1, 2023
ecf66d7
Backout triggering on PR
chainchad Dec 1, 2023
efbd884
Create new build-publish workflow for chainlink-untrusted (from PR)
chainchad Dec 1, 2023
8668422
Merge branch 're-1994/crib-prep' of github.com:smartcontractkit/chain…
chainchad Dec 1, 2023
51ceaa6
Reset workflow back
chainchad Dec 1, 2023
658713f
Make step name accurate
chainchad Dec 1, 2023
b4e9be0
Merge branch 'develop' into re-1994/crib-prep
chainchad Dec 1, 2023
06d6003
Merge branch 'develop' into re-1994/crib-prep
chainchad Dec 1, 2023
bddf3db
Merge branch 'develop' into re-1994/crib-prep
chainchad Dec 1, 2023
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
12 changes: 8 additions & 4 deletions .github/actions/build-sign-publish-chainlink/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ inputs:
required: false
git-commit-sha:
description: Git commit SHA used as metadata when building the application (appears in logs)
default: ${{ github.sha }}
default: ${{ github.event.pull_request.head.sha || github.sha }}
required: false
aws-role-to-assume:
description: The AWS role to assume as the CD user, if any. Used in configuring the docker/login-action
Expand Down Expand Up @@ -73,7 +73,7 @@ runs:
using: composite
steps:
- name: Set shared variables
shell: sh
shell: bash
# See https://docs.github.com/en/actions/learn-github-actions/workflow-commands-for-github-actions#multiline-strings
run: |
SHARED_IMAGES=${{ inputs.ecr-hostname }}/${{ inputs.ecr-image-name }}
Expand Down Expand Up @@ -122,7 +122,9 @@ runs:

- name: Generate docker metadata for root image
id: meta-root
uses: docker/metadata-action@c4ee3adeed93b1fa6a762f209fb01608c1a22f1e # v4.4.4
uses: docker/metadata-action@2c0bd771b40637d97bf205cbccdd294a32112176 # v4.5.0
env:
DOCKER_METADATA_PR_HEAD_SHA: "true"
with:
# list of Docker images to use as base name for tags
images: ${{ env.shared-images }}
Expand Down Expand Up @@ -164,7 +166,9 @@ runs:

- name: Generate docker metadata for non-root image
id: meta-nonroot
uses: docker/metadata-action@c4ee3adeed93b1fa6a762f209fb01608c1a22f1e # v4.4.4
uses: docker/metadata-action@2c0bd771b40637d97bf205cbccdd294a32112176 # v4.5.0
env:
DOCKER_METADATA_PR_HEAD_SHA: "true"
with:
flavor: |
latest=auto
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/automation-ondemand-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ jobs:
pull-requests: write
id-token: write
contents: read
needs: [ build-chainlink, build-test-image ]
needs: [build-chainlink, build-test-image]
env:
CHAINLINK_COMMIT_SHA: ${{ github.sha }}
CHAINLINK_ENV_USER: ${{ github.actor }}
Expand Down
44 changes: 44 additions & 0 deletions .github/workflows/build-publish-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: "Build and Publish from PR"

##
# This workflow builds and publishes a Docker image for Chainlink from a PR.
# It doesn't use an environment, has its own special IAM role, does not sign
# the image, and publishes to a special ECR repo.
##

on:
pull_request:

jobs:
build-publish-untrusted:
if: ${{ ! startsWith(github.ref_name, 'release/') }}
runs-on: ubuntu-20.04
permissions:
id-token: write
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1

- name: Build and publish chainlink image
uses: ./.github/actions/build-sign-publish-chainlink
with:
publish: true
aws-role-to-assume: ${{ secrets.AWS_OIDC_IAM_ROLE_PUBLISH_PR_ARN }}
aws-role-duration-seconds: ${{ secrets.AWS_ROLE_DURATION_SECONDS_DEFAULT }}
aws-region: ${{ secrets.AWS_REGION }}
sign-images: false
ecr-hostname: ${{ secrets.AWS_SDLC_ECR_HOSTNAME }}
ecr-image-name: chainlink-untrusted
dockerhub_username: ${{ secrets.DOCKERHUB_READONLY_USERNAME }}
dockerhub_password: ${{ secrets.DOCKERHUB_READONLY_PASSWORD }}

- name: Collect Metrics
if: always()
id: collect-gha-metrics
uses: smartcontractkit/push-gha-metrics-action@d1618b772a97fd87e6505de97b872ee0b1f1729a # v2.0.2
with:
basic-auth: ${{ secrets.GRAFANA_CLOUD_BASIC_AUTH }}
hostname: ${{ secrets.GRAFANA_CLOUD_HOST }}
this-job-name: build-publish-untrusted
continue-on-error: true
7 changes: 6 additions & 1 deletion charts/chainlink-cluster/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,9 @@ apiVersion: v1
name: chainlink-cluster
description: Chainlink nodes cluster
version: 0.1.3
appVersion: '2.6.0'
appVersion: "2.6.0"
dependencies:
- name: mockserver
version: "5.14.0"
repository: "@mockserver"
condition: mockserver.enabled
6 changes: 3 additions & 3 deletions charts/chainlink-cluster/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,10 @@ After that all the changes will be synced automatically
Check `.profiles` to understand what is uploaded in profiles `runner` and `node`

# Helm
If you would like to use `helm` directly, please uncomment data in `values-raw-helm.yaml`
If you would like to use `helm` directly, please uncomment data in `values.yaml`
## Install from local files
```
helm install -f values-raw-helm.yaml cl-cluster .
helm install -f values.yaml cl-cluster .
```
Forward all apps (in another terminal)
```
Expand All @@ -99,7 +99,7 @@ kubectl config set-context --current --namespace cl-cluster

Install
```
helm install -f values-raw-helm.yaml cl-cluster chainlink-cluster/chainlink-cluster --version v0.1.2
helm install -f values.yaml cl-cluster .
```

## Create a new release
Expand Down
2 changes: 1 addition & 1 deletion charts/chainlink-cluster/connect.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ cl_node_url_template = "http://app-node-%d:6688"
cl_node_internal_dns_record_template = "app-node-%d"
cl_node_user = "[email protected]"
cl_node_password = "fj293fbBnlQ!f9vNs"
mockserver_url = "http://app-mockserver:1080"
mockserver_url = "http://mockserver:1080"
42 changes: 0 additions & 42 deletions charts/chainlink-cluster/dashboard/dashboard.go
Original file line number Diff line number Diff line change
Expand Up @@ -350,48 +350,6 @@ func (m *CLClusterDashboard) generate() error {
),
),
),
// logs
dashboard.Row(
"Logs",
row.Collapse(),
row.WithTimeSeries(
"Log Counters",
timeseries.Span(12),
timeseries.Height("200px"),
timeseries.DataSource(m.PrometheusDataSourceName),
timeseries.WithPrometheusTarget(
`log_panic_count{namespace="${namespace}"}`,
prometheus.Legend("{{pod}} - panic"),
),
timeseries.WithPrometheusTarget(
`log_fatal_count{namespace="${namespace}"}`,
prometheus.Legend("{{pod}} - fatal"),
),
timeseries.WithPrometheusTarget(
`log_critical_count{namespace="${namespace}"}`,
prometheus.Legend("{{pod}} - critical"),
),
timeseries.WithPrometheusTarget(
`log_warn_count{namespace="${namespace}"}`,
prometheus.Legend("{{pod}} - warn"),
),
timeseries.WithPrometheusTarget(
`log_error_count{namespace="${namespace}"}`,
prometheus.Legend("{{pod}} - error"),
),
),
m.logsRowOption("All errors", `
{namespace="${namespace}", app="app", container="node"}
| json
| level="error"
| line_format "{{ .instance }} {{ .level }} {{ .ts }} {{ .logger }} {{ .caller }} {{ .msg }} {{ .version }} {{ .nodeTier }} {{ .nodeName }} {{ .node }} {{ .evmChainID }} {{ .nodeOrder }} {{ .mode }} {{ .nodeState }} {{ .sentryEventID }} {{ .stacktrace }}"`),
m.logsRowOption("Node 1", `{namespace="${namespace}", app="app", instance="node-1", container="node"}`),
m.logsRowOption("Node 2", `{namespace="${namespace}", app="app", instance="node-2", container="node"}`),
m.logsRowOption("Node 3", `{namespace="${namespace}", app="app", instance="node-3", container="node"}`),
m.logsRowOption("Node 4", `{namespace="${namespace}", app="app", instance="node-4", container="node"}`),
m.logsRowOption("Node 5", `{namespace="${namespace}", app="app", instance="node-5", container="node"}`),
m.logsRowOption("Node 6", `{namespace="${namespace}", app="app", instance="node-6", container="node"}`),
),
// HeadTracker
dashboard.Row("Head tracker",
row.Collapse(),
Expand Down
180 changes: 162 additions & 18 deletions charts/chainlink-cluster/devspace.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,26 +40,56 @@ deployments:
# they can be defined the same way in values.yml
# devspace merging this "values" and "values.yml" before deploy
values:
runner:
image: ${DEVSPACE_IMAGE}
stateful: false
geth:
version: v1.12.0
wsrpc-port: 8546
httprpc-port: 8544
networkid: 1337
blocktime: 1
mockserver:
port: 1080
db:
stateful: false
podSecurityContext:
fsGroup: 999

chainlink:
securityContext:
capabilities:
drop:
- ALL
readOnlyRootFilesystem: false
runAsNonRoot: true
runAsUser: 14933
runAsGroup: 999
web_port: 6688
p2p_port: 6690
nodes:
- name: node-1
image: ${DEVSPACE_IMAGE}
version: latest
# override default config per node
# for example, use OCRv2 P2P setup, the whole config
# toml: |
# RootDir = './clroot'
# [Log]
# JSONConsole = true
# Level = 'debug'
# [WebServer]
# AllowOrigins = '*'
# SecureCookies = false
# SessionTimeout = '999h0m0s'
# [OCR2]
# Enabled = true
# [P2P]
# [P2P.V2]
# Enabled = false
# AnnounceAddresses = []
# DefaultBootstrappers = []
# DeltaDial = '15s'
# DeltaReconcile = '1m0s'
# ListenAddresses = []
# [[EVM]]
# ChainID = '1337'
# MinContractPayment = '0'
# [[EVM.Nodes]]
# Name = 'node-0'
# WSURL = 'ws://geth:8546'
# HTTPURL = 'http://geth:8544'
# [WebServer.TLS]
# HTTPSPort = 0
# or use overridesToml to override some part of configuration
# overridesToml: |
- name: node-2
image: ${DEVSPACE_IMAGE}
version: latest
Expand All @@ -75,11 +105,125 @@ deployments:
- name: node-6
image: ${DEVSPACE_IMAGE}
version: latest
prometheusMonitor: "true"
podAnnotations: { }
nodeSelector: { }
tolerations: [ ]
affinity: { }
resources:
requests:
cpu: 350m
memory: 1024Mi
limits:
cpu: 350m
memory: 1024Mi

# each CL node have a dedicated PostgreSQL 11.15
# use StatefulSet by setting:
#
# stateful: true
# capacity 10Gi
#
# if you are running long tests
db:
securityContext:
capabilities:
drop:
- ALL
readOnlyRootFilesystem: false
runAsNonRoot: true
runAsUser: 999
runAsGroup: 999
stateful: false
resources:
requests:
cpu: 1
memory: 1024Mi
limits:
cpu: 1
memory: 1024Mi
# default cluster shipped with latest Geth ( dev mode by default )
geth:
securityContext:
capabilities:
drop:
- ALL
readOnlyRootFilesystem: false
runAsNonRoot: true
runAsUser: 999
runAsGroup: 999
version: v1.12.0
wsrpc-port: 8546
httprpc-port: 8544
networkid: 1337
blocktime: 1
resources:
requests:
cpu: 1
memory: 1024Mi
limits:
cpu: 1
memory: 1024Mi
# mockserver is https://www.mock-server.com/where/kubernetes.html
# used to stub External Adapters
mockserver:
# image: "mockserver/mockserver"
# version: "mockserver-5.15.0"
securityContext:
capabilities:
drop:
- ALL
readOnlyRootFilesystem: false
runAsNonRoot: true
runAsUser: 999
runAsGroup: 999
enabled: true
releasenameOverride: mockserver
app:
runAsUser: 999
readOnlyRootFilesystem: false
port: 1080
resources:
requests:
cpu: 1
memory: 1024Mi
limits:
cpu: 1
memory: 1024Mi
runner:
securityContext:
capabilities:
drop:
- ALL
readOnlyRootFilesystem: false
runAsNonRoot: true
runAsUser: 999
runAsGroup: 999
stateful: false
resources:
requests:
cpu: 1
memory: 512Mi
limits:
cpu: 1
memory: 512Mi
affinity: { }
tolerations: [ ]
nodeSelector: { }
ingress:
enabled: false
className: ""
hosts: [ ]
tls: [ ]
annotations: { }
service:
type: NodePort
port: 8080


# monitoring.coreos.com/v1 PodMonitor for each node
prometheusMonitor: true

# deployment placement, standard helm stuff
podAnnotations:
nodeSelector:
tolerations:
affinity:

profiles:
# this replaces only "runner" pod, usable when you'd like to run some system level tests inside k8s
Expand Down
Loading
Loading