You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -66,6 +69,11 @@ Then run `go run examples/simple/env.go`
66
69
67
70
Now you have your environment running, you can [connect](#connect-to-environment) to it later
68
71
72
+
> [!NOTE]
73
+
> `chain.link/*` labels are used for internal reporting and cost allocation. They are strictly required and validated. You won't be able to create a new environment without them.
74
+
> In this tutorial we create almost all of them manually, but there are convenience functions to do it for you.
75
+
> You can read more about labels [here](./labels.md)
76
+
69
77
## Connect to environment
70
78
71
79
We've already created an environment [previously](#getting-started), now we can connect
@@ -84,7 +92,7 @@ You can get the namespace name from logs on creation time
84
92
85
93
## Debugging a new integration environment
86
94
87
-
You can spin up environment and block on forwarder if you'd like to run some other code
95
+
You can spin up environment and block on forwarder if you'd like to run some other code. Let's use convenience functions for creating `chain.link` labels.
EnvVarTeamDescription = "Team to, which owner of the environment belongs to"
473
+
EnvVarTeamExample = "BIX, CCIP, BCM"
474
+
430
475
EnvVarCLCommitSha = "CHAINLINK_COMMIT_SHA"
431
476
EnvVarCLCommitShaDescription = "The sha of the commit that you're running tests on. Mostly used for CI"
432
477
EnvVarCLCommitShaExample = "${{ github.sha }}"
@@ -466,22 +511,55 @@ type Config struct {
466
511
Namespacestring
467
512
// Labels is a set of labels applied to the namespace in a format of "key=value"
468
513
Labels []string
469
-
nsLabels *map[string]*string
470
-
// ReadyCheckData is settings for readiness probes checks for all deployment components
471
-
// checking that all pods are ready by default with 8 minutes timeout
472
-
// &client.ReadyCheckData{
473
-
// ReadinessProbeCheckSelector: "",
474
-
// Timeout: 15 * time.Minute,
475
-
// }
476
-
ReadyCheckData *client.ReadyCheckData
477
-
// DryRun if true, app will just generate a manifest in local dir
478
-
DryRunbool
479
-
// InsideK8s used for long-running soak tests where you connect to env from the inside
480
-
InsideK8sbool
481
-
// KeepConnection keeps connection until interrupted with a signal, useful when prototyping and debugging a new env
482
-
KeepConnectionbool
483
-
// RemoveOnInterrupt automatically removes an environment on interrupt
484
-
RemoveOnInterruptbool
514
+
// PodLabels is a set of labels applied to every pod in the namespace
515
+
PodLabelsmap[string]string
516
+
// WorkloadLabels is a set of labels applied to every workload in the namespace
517
+
WorkloadLabelsmap[string]string
518
+
// PreventPodEviction if true sets a k8s annotation safe-to-evict=false to prevent pods from being evicted
519
+
// Note: This should only be used if your test is completely incapable of handling things like K8s rebalances without failing.
520
+
// If that is the case, it's worth the effort to make your test fault-tolerant soon. The alternative is expensive and infuriating.
521
+
PreventPodEvictionbool
522
+
// Allow deployment to nodes with these tolerances
523
+
Tolerations []map[string]string
524
+
// Restrict deployment to only nodes matching a particular node role
525
+
NodeSelectormap[string]string
526
+
// ReadyCheckData is settings for readiness probes checks for all deployment components
527
+
// checking that all pods are ready by default with 8 minutes timeout
528
+
// &client.ReadyCheckData{
529
+
// ReadinessProbeCheckSelector: "",
530
+
// Timeout: 15 * time.Minute,
531
+
// }
532
+
ReadyCheckData *client.ReadyCheckData
533
+
// DryRun if true, app will just generate a manifest in local dir
534
+
DryRunbool
535
+
// InsideK8s used for long-running soak tests where you connect to env from the inside
536
+
InsideK8sbool
537
+
// SkipManifestUpdate will skip updating the manifest upon connecting to the environment. Should be true if you wish to update the manifest (e.g. upgrade pods)
538
+
SkipManifestUpdatebool
539
+
// KeepConnection keeps connection until interrupted with a signal, useful when prototyping and debugging a new env
540
+
KeepConnectionbool
541
+
// RemoveOnInterrupt automatically removes an environment on interrupt
542
+
RemoveOnInterruptbool
543
+
// UpdateWaitInterval an interval to wait for deployment update started
544
+
UpdateWaitInterval time.Duration
545
+
546
+
// Remote Runner Specific Variables //
547
+
// JobImage an image to run environment as a job inside k8s
548
+
JobImagestring
549
+
// Specify only if you want remote-runner to start with a specific name
550
+
RunnerNamestring
551
+
// Specify only if you want to mount reports from test run in remote runner
552
+
ReportPathstring
553
+
// JobLogFunction a function that will be run on each log
554
+
JobLogFunctionfunc(*Environment, string)
555
+
// Test the testing library current Test struct
556
+
Test *testing.T
557
+
// jobDeployed used to limit us to 1 remote runner deploy
558
+
jobDeployed bool
559
+
// detachRunner should we detach the remote runner after starting the test
Resource labeling has been introduced to better associate Kubernetes (k8s) costs with products and teams. This document describes the labels used in the k8s cluster.
5
+
6
+
## Required Labels
7
+
Labels should be applied to all resources in the k8s cluster at three levels:
8
+
-**Namespace**
9
+
-**Workload**
10
+
-**Pod**
11
+
12
+
All three levels should include the following labels:
13
+
-`chain.link/team` - Name of the team that owns the resource.
14
+
-`chain.link/product` - Product that the resource belongs to.
15
+
-`chain.link/cost-center` - Product and framework name.
16
+
17
+
Additionally, pods should include the following label:
18
+
-`chain.link/component` - Name of the component.
19
+
20
+
### `chain.link/team`
21
+
This label represents the team responsible for the resource, but it might not be the team of the individual who created the resource. It should reflect the team the environment is **created for**.
22
+
23
+
For example, if you are a member of the Test Tooling team, but someone from the BIX team requests load tests, the namespace should be labeled as: `chain.link/team: bix`.
24
+
25
+
### `chain.link/product`
26
+
This label specifies the product the resource belongs to. Internally, some products may have alternative names (e.g., OCR instead of Data Feeds). To standardize data analysis, use the following names:
27
+
28
+
```
29
+
automation
30
+
bcm
31
+
ccip
32
+
data-feedsv1.0
33
+
data-feedsv2.0
34
+
data-feedsv3.0
35
+
data-streamsv0.3
36
+
data-streamsv1.0
37
+
deco
38
+
functions
39
+
proof-of-reserve
40
+
scale
41
+
staking
42
+
vrf
43
+
```
44
+
45
+
For example:
46
+
- OCR version 1: `data-feedsv1.0`
47
+
- OCR version 2: `data-feedsv2.0`
48
+
49
+
### `chain.link/cost-center`
50
+
This label serves as an umbrella for specific test or environment types and should rarely change. For load or soak tests using solutions provided by the Test Tooling team, use the convention: `test-tooling-<test-type>-test`
51
+
52
+
For example: `test-tooling-load-test`.
53
+
54
+
This allows easy distinction from load tests run using other tools.
55
+
56
+
### `chain.link/component`
57
+
This label identifies different components within the same product. Examples include:
58
+
-`chainlink` - Chainlink node.
59
+
-`geth` - Go-Ethereum blockchain node.
60
+
-`test-runner` - Remote test runner.
61
+
62
+
## Adding Labels to New Components
63
+
Adding a new component to an existing framework is discouraged. The recommended approach is to add the component to CRIB and make these labels part of the deployment templates.
64
+
65
+
If you need to add a new component, refer to the following sections in the [k8s Tutorial](./TUTORIAL.md):
0 commit comments