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
You can fine tune the installation of the runner to better match your environment and cloud provider.
415
415
416
+
### Volume reusage policy
417
+
418
+
The behavior of how the volumes are reused depends on volume selector configuration.
419
+
`reuseVolumeSelector` option is configurable in runtime environment spec.
420
+
421
+
The following options are available:
422
+
423
+
- `reuseVolumeSelector: 'codefresh-app,io.codefresh.accountName'` - determined PV can be used by **ANY** pipeline of your account (it's a **default** volume selector).
424
+
425
+
- `reuseVolumeSelector: 'codefresh-app,io.codefresh.accountName,pipeline_id'` - determined PV can be used only by a **single pipeline**.
426
+
427
+
- `reuseVolumeSelector: 'codefresh-app,io.codefresh.accountName,pipeline_id,codefresh-app,io.codefresh.branch_name'` - determined PV can be used only by **single pipeline AND single branch**.
428
+
429
+
- `reuseVolumeSelector: 'codefresh-app,io.codefresh.accountName,pipeline_id,trigger'` - determined PV can be used only by **single pipeline AND single trigger**.
430
+
431
+
To change volume selector follow this procedure:
432
+
433
+
```shell
434
+
#get runtime environmet spec yaml
435
+
codefresh get re $RUNTIME_NAME -o yaml > runtime.yaml
436
+
```
437
+
Under `dockerDaemonScheduler.pvcs.dind` block specify `reuseVolumeSelector`:
You can add your own environment variables in the runtime environment, so that all pipeline steps have access to the same set of external files. A typical
@@ -1474,8 +1509,97 @@ For example, let's say Venona-zoneA is the default RE, then, that means that for
1474
1509
1475
1510
Regarding [Regional Persistent Disks](https://cloud.google.com/kubernetes-engine/docs/how-to/persistent-volumes/regional-pd), their support is not currently implemented in the Codefresh runner.
1476
1511
1512
+
## Runtime Cleaners
1513
+
1514
+
##### Key points:
1515
+
- Codefresh pipeline require disk space for:
1516
+
-[Pipeline Shared Volume](https://codefresh.io/docs/docs/yaml-examples/examples/shared-volumes-between-builds/) (`/codefresh/volume`, implemented as [docker volume](https://docs.docker.com/storage/volumes/))
1517
+
- Docker containers - running and stopped
1518
+
- Docker images and cached layers
1519
+
- To improve performance, `volume-provisioner` is able to provision previously used disk with docker images and pipeline volume from previously running builds. It improves performance by using docker cache and decreasing I/O rate.
1520
+
- Least recently docker images and volumes should be cleaned to avoid out-of-space errors.
1521
+
- There are several places where pipeline volume cleanup is required, so there are several kinds of cleaner.
1522
+
1523
+
##### Cleaners:
1524
+
-[IN-DIND cleaner](https://github.com/codefresh-io/dind/tree/master/cleaner) - deletes extra docker containers, volumes, images on dind pod
-[Local volumes cleaner](https://github.com/codefresh-io/dind-volume-utils/blob/master/local-volumes/lv-cleaner.sh) - deletes **local** volumes in case node disk space is close to the threshold
1527
+
1528
+
***
1529
+
1530
+
##### IN-DIND cleaner
1531
+
**Purpose:** removes unneeded *docker containers, images, volumes* inside kubernetes volume mounted to the dind pod
1532
+
1533
+
**Where it runs:** Running inside each dind pod as script
1534
+
1535
+
**Triggered by:** SIGTERM and also during the run when disk usage (cleaner-agent ) > 90% (configurable)
1536
+
1537
+
**Configured by:** Environment Variables which can be set in Runtime Environment configuration
Override `dockerDaemonScheduler.envVars` on Runtime Environment if necessary (the following are **defaults**):
1542
+
{% highlight yaml %}
1543
+
{% raw %}
1544
+
dockerDaemonScheduler:
1545
+
envVars:
1546
+
CLEAN_DOCKER: 'true'
1547
+
CLEAN_PERIOD_BUILDS: '5'
1548
+
IMAGE_RETAIN_PERIOD: '14400'
1549
+
VOLUMES_RETAIN_PERIOD: '14400'
1550
+
{% endraw %}
1551
+
{% endhighlight %}
1552
+
1553
+
***
1554
+
1555
+
##### External volumes cleaner
1556
+
**Purpose:** removes unused *kubernetes volumes and related backend volumes*
1557
+
1558
+
**Where it runs:** on Runtime Cluster as cron job
1559
+
(`kubectl get cronjobs -n codefresh -l app=dind-volume-cleanup`). Installed in case the Runner uses non-local volumes (`Storage.Backend != local`)
1560
+
1561
+
**Triggered by:** CronJob every 10min (configurable), part of [runtime-cluster-monitor](https://github.com/codefresh-io/runtime-cluster-monitor/blob/master/chart/templates/dind-volume-cleanup.yaml) and runner deployment
1562
+
1563
+
**Configuration:**
1564
+
1565
+
Set `codefresh.io/volume-retention` annotation on Runtime Environment:
Override environment variables for `dind-volume-cleanup` cronjob if necessary:
1580
+
-`RETENTION_DAYS` (defaults to 4)
1581
+
-`MOUNT_MIN` (defaults to 3)
1582
+
-`PROVISIONED_BY` (defaults to `codefresh.io/dind-volume-provisioner`)
1583
+
1584
+
About *optional*`-m` argument:
1585
+
-`dind-volume-cleanup` to clean volumes that were last used more than `RETENTION_DAYS` ago
1586
+
-`dind-volume-cleanup-m` to clean volumes that were used more than a day ago, but mounted less than `MOUNT_MIN` times
1587
+
1588
+
***
1589
+
1590
+
##### Local volumes cleaner
1591
+
**Purpose:** deletes local volumes in case node disk space is close to the threshold
1592
+
1593
+
**Where it runs:** on each node on runtime cluster as DaemonSet `dind-lv-monitor`. Installed in case the Runner use local volumes (`Storage.Backend == local`)
1594
+
1595
+
**Triggered by:** starts clean if disk space usage or inodes usage is more than thresholds (configurable)
1477
1596
1597
+
**Configuration:**
1478
1598
1599
+
Override environment variables for `dind-lv-monitor` daemonset if necessary:
0 commit comments