Skip to content

Commit

Permalink
feat(samples): add example configuration for lazy-gitlab-runner
Browse files Browse the repository at this point in the history
  • Loading branch information
MaciekLeks committed Oct 3, 2024
1 parent f28a72d commit 299ea2b
Show file tree
Hide file tree
Showing 2 changed files with 170 additions and 9 deletions.
15 changes: 6 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ GitLab has been systematically moving configuration attributes to TOML format. T

## Why "Lazy"?

I call this module "lazy" because it uses a simple approach, unlike the more complex solutions in the old project. Here's why:
We call this module "lazy" because it uses a simple approach, unlike the more complex solutions in the old project. Here's why:

1. **Easy Setup**: We keep things consistent between Terraform and GitLab. For example, if GitLab uses camelCase, we use it in Terraform too. This:
- Makes things simpler
Expand All @@ -29,20 +29,17 @@ This "lazy" way focuses on keeping things simple and clear. It makes the module
- Designed to be more adaptable to GitLab's evolving configuration standards

## Getting Started

**Please Note: This module is currently under active development and is not yet ready for production use.**

I'm working diligently to create a stable and feature-complete version of this module. While we're excited about its potential, we advise against using it in any critical or production environments at this time.
The first stable version of this module is now available (since v0.2.0)! You can find example configurations in the `samples` directory.

### Development Status

- [x] Core functionality implementation
- [ ] Testing and validation
- [x] Testing and validation
- [x] Documentation
- [ ] Example configurations
- [ ] First stable release
- [x] Example configurations
- [x] First stable release

I appreciate your interest in this project. If you'd like to contribute or stay updated on its progress, please:
We appreciate your interest in this project. If you'd like to contribute or stay updated on its progress, please:

1. Star this repository to show your support
2. Watch this repository for updates
Expand Down
164 changes: 164 additions & 0 deletions samples/sample.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,164 @@
module "gitlab_runner_test" {
source = "git::https://github.com/MaciekLeks/lazy-gitlab-runner-k8s-tf.git?ref=v0.2.0"
helm_settings = {
name = "gitlab-runner-lazy-test"
namespace = "my-gitlab-runner-namespace"
version = "0.68.1"
}

imagePullPolicy = "IfNotPresent"
//imagePullSecrets = [{ name = "regcred" }]

serviceAccount = {
create = false
name = "my-runner-sa-name"
}

automountServiceAccountToken = true //runner needs to access K8s API

runnerToken = "[redacted]"

checkInterval = 2
concurrent = 50
terminationGracePeriodSeconds = 36000
logLevel = "info"

shutdown_timeout = 30

livenessProbe = {
initialDelaySeconds = 60
timeoutSeconds = 3
periodSeconds = 20
failureThreshold = 15
}

readinessProbe = {
initialDelaySeconds = 60
timeoutSeconds = 3
periodSeconds = 20
failureThreshold = 15
}

gitlabUrl = "https://my-gitlab.my-domain.pl"

metrics = {
enabled = true
}


resources = {
requests = {
cpu = "100m"
memory = "128Mi"
}
}

podAnnotations = {
"cluster-autoscaler.kubernetes.io/safe-to-evict" = "false"
}

podLabels = {
"app.kubernetes.io/name" = "gitlab-runner"
"app.prometheus.io/scrape" = "true"
}


envVars = [{
name = "VAR1"
value = "value1"
}, {
name = "VAR2"
value = "value2"
}]

runners = {
name = "Kubernetes Runner - lazy-test"
config = [{
shell = "bash"
output_limit = 2600

unhealthy_request_count = 30
unhealthy_interval = "180s"

environment = ["ENV1=true", "ENV2=cat and dog"]

cache = {
Type = "gcs"
Path = "cache"
Shared = true
gcs = {
BucketName = "my-bucker-name"
}
}

kubernetes = {
namespace = "my-gitlab-runner-namespace"
pod_annotations = {
"cluster-autoscaler.kubernetes.io/safe-to-evict" = "false"
}
pod_labels = {
jobId = "$CI_JOB_ID"
jobName = "$CI_JOB_NAME"
pipelineId = "$CI_PIPELINE_ID"
gitUserLogin = "$GITLAB_USER_LOGIN"
commitShortSHA = "$CI_COMMIT_SHORT_SHA"
commitTag = "$CI_COMMIT_TAG"
project = "$CI_PROJECT_NAME"
}

image = "ubuntu:20.04"
helper_image = "gitlab-org/gitlab-runner/gitlab-runner-helper:alpine3.19-x86_64-v17.3.1"


poll_interval = 4
poll_timeout = 3600

service_account = "my-executor-sa-name"

volumes = {
empty_dir = [{
name = "docker-certs"
mount_path = "/certs/client"
medium = "Memory"
size_limit = "10Mi"
}]
}

cpu_request = "100m"
cpu_request_overwrite_max_allowed = "1400m"
memory_request = "256Mi"
memory_request_overwrite_max_allowed = "1Gi"

cpu_limit_overwrite_max_allowed = "3000m"
memory_limit_overwrite_max_allowed = "2Gi"

helper_cpu_request = "150m"
helper_memory_request = "256Mi"

service_cpu_request = "800m"
service_memory_request = "1Gi"
service_cpu_limit = "3000m"
service_memory_limit = "2Gi"

affinity = {
node_affinity = {
preferred_during_scheduling_ignored_during_execution = [
{
weight = 100
preference = {
match_expressions = [
{
key = "my-node-foo-label"
operator = "In"
values = ["bar"]
}
]
}
}
]
}
} //afinity
} //kubernetes
}] } //runners
}

0 comments on commit 299ea2b

Please sign in to comment.