Revert cache settings through Kubernetes secret in values yaml
What does this MR do?
In the MR !393 (merged) and !397 (merged) we remove the ability to set cache parameters through k8s secret.
With this MR, this functionality is brought back this ability.
Why was this MR needed?
To bring back ability to set cache parameters through k8s secret
What's the best way to test this MR?
In this test, I am used GCP
and GCS
.
Create gcsaccess
kubectl create secret generic gcsaccess --from-literal=gcs-access-id="__GCS_ACCESS_ID__" --from-literal=gcs-private-key="__GCS_PRIVATE_KEY__"
values.yaml
image:
registry: registry.gitlab.com
image: gitlab-org/gitlab-runner
# tag: ubuntu-bleeding
useTini: false
imagePullPolicy: IfNotPresent
replicas: 1
gitlabUrl: https://gitlab.com/
runnerToken: "__REDACTED__"
unregisterRunners: true
useJobNamespace: true
terminationGracePeriodSeconds: 0
concurrent: 1
checkInterval: 1
logLevel: "debug"
sessionServer:
enabled: false
annotations: {}
timeout: 1800
internalPort: 8093
externalPort: 9000
## For RBAC support:
rbac:
create: true
rules: []
clusterWideAccess: false
serviceAccountName: ""
serviceAccountAnnotations: {}
podSecurityPolicy:
enabled: false
resourceNames:
- gitlab-runner
metrics:
enabled: true
portName: metrics
port: 9252
serviceMonitor:
enabled: false
service:
enabled: false
type: ClusterIP
runners:
config: |
[[runners]]
[runners.cache]
Type = "gcs"
Path = ""
Shared = true
[runners.cache.gcs]
BucketName = "touni-test-bucket"
[runners.kubernetes]
image = "alpine"
[[runners.kubernetes.services]]
name = "alpine:latest"
alias = "alpine-service"
command = ["sleep 900s"]
entrypoint = ["/bin/sh", "-c"]
# node_selector_overwrite_allowed = ".*"
cache:
## Use this line for access using gcs-access-id and gcs-private-key
secretName: gcsaccess
builds: {}
services: {}
helpers: {}
securityContext:
allowPrivilegeEscalation: false
readOnlyRootFilesystem: false
runAsNonRoot: false
podSecurityContext:
runAsUser: 100
fsGroup: 65533
resources:
requests:
memory: 128Mi
cpu: 100m
affinity: {}
nodeSelector: {}
tolerations: []
hostAliases: []
podAnnotations: {}
podLabels: {}
hpa: {}
secrets: []
configMaps: {}
volumeMounts: []
volumes: []
gitlab-ci.yaml
variables:
CACHE_FALLBACK_KEY: fallback-keys
build1:
stage: build
script:
- ls -lah
- cat cached-file.txt || echo "No file found"
- echo "$(date)" > cached-file.txt
cache:
key: latest-cache-3
policy: pull-push
paths:
- cached-file.txt
fallback_keys:
- latest-cache-2
- latest-cache-1
The job succeeds and the cache is uploaded on GCS
.
What are the relevant issue numbers?
close #460 (closed) #459 (closed) #457 (closed) gitlab-org/gitlab-runner#31078 (closed)