Skip to content
GitLab
Next
Projects
Groups
Snippets
Help
Loading...
Help
What's new
6
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
GitLab Operator
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
28
Issues
28
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
6
Merge Requests
6
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Test Cases
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Package Registry
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issue
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
GitLab.org
OpenShift
GitLab Operator
Commits
f76c5cec
Commit
f76c5cec
authored
Oct 22, 2020
by
Edmund Ochieng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
expose adding Custom CA certs
parent
54f778cc
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
45 additions
and
9 deletions
+45
-9
api/v1beta1/runner_types.go
api/v1beta1/runner_types.go
+4
-0
bundle/manifests/apps.gitlab.com_runners.yaml
bundle/manifests/apps.gitlab.com_runners.yaml
+5
-4
config/crd/bases/apps.gitlab.com_runners.yaml
config/crd/bases/apps.gitlab.com_runners.yaml
+4
-0
config/deploy/apps.gitlab.com_runners.yaml
config/deploy/apps.gitlab.com_runners.yaml
+5
-4
controllers/runner/deployment.go
controllers/runner/deployment.go
+20
-0
hack/assets/templates/gitlab-runner/entrypoint.sh
hack/assets/templates/gitlab-runner/entrypoint.sh
+7
-1
No files found.
api/v1beta1/runner_types.go
View file @
f76c5cec
...
...
@@ -63,6 +63,10 @@ type RunnerSpec struct {
// Path defines the Runner Cache path
CachePath
string
`json:"cachePath,omitempty"`
// Name of tls secret containing the custom certificate
// authority (CA) certificates
CertificateAuthority
string
`json:"ca,omitempty"`
// Enable sharing of cache between Runners
CacheShared
bool
`json:"cacheShared,omitempty"`
...
...
bundle/manifests/apps.gitlab.com_runners.yaml
View file @
f76c5cec
...
...
@@ -47,6 +47,9 @@ spec:
buildImage
:
description
:
The name of the default image to use to run build jobs, when none is specified
type
:
string
ca
:
description
:
Name of tls secret containing the custom certificate authority (CA) certificates
type
:
string
cachePath
:
description
:
Path defines the Runner Cache path
type
:
string
...
...
@@ -70,13 +73,11 @@ spec:
description
:
Name of the bucket in which the cache will be stored
type
:
string
credentials
:
description
:
contains the GCS
accessID and privateKey
description
:
contains the GCS
'access-id' and 'private-key'
type
:
string
credentialsFile
:
description
:
Takes GCS credentials file, 'keys.json'
type
:
string
required
:
-
credentialsFile
type
:
object
gitlab
:
description
:
gitlab specifies the GitLab instance the GitLab Runner will register against
...
...
@@ -102,7 +103,7 @@ spec:
description
:
Name of the bucket in which the cache will be stored
type
:
string
credentials
:
description
:
Credentials is the n
ame of the secret containing the 'accesskey' and 'secretkey' used to access the object storage
description
:
N
ame of the secret containing the 'accesskey' and 'secretkey' used to access the object storage
type
:
string
insecure
:
description
:
Use insecure connections or HTTP
...
...
config/crd/bases/apps.gitlab.com_runners.yaml
View file @
f76c5cec
...
...
@@ -58,6 +58,10 @@ spec:
description
:
The name of the default image to use to run build jobs,
when none is specified
type
:
string
ca
:
description
:
Name of tls secret containing the custom certificate authority
(CA) certificates
type
:
string
cachePath
:
description
:
Path defines the Runner Cache path
type
:
string
...
...
config/deploy/apps.gitlab.com_runners.yaml
View file @
f76c5cec
...
...
@@ -47,6 +47,9 @@ spec:
buildImage
:
description
:
The name of the default image to use to run build jobs, when none is specified
type
:
string
ca
:
description
:
Name of tls secret containing the custom certificate authority (CA) certificates
type
:
string
cachePath
:
description
:
Path defines the Runner Cache path
type
:
string
...
...
@@ -70,13 +73,11 @@ spec:
description
:
Name of the bucket in which the cache will be stored
type
:
string
credentials
:
description
:
contains the GCS
accessID and privateKey
description
:
contains the GCS
'access-id' and 'private-key'
type
:
string
credentialsFile
:
description
:
Takes GCS credentials file, 'keys.json'
type
:
string
required
:
-
credentialsFile
type
:
object
gitlab
:
description
:
gitlab specifies the GitLab instance the GitLab Runner will register against
...
...
@@ -102,7 +103,7 @@ spec:
description
:
Name of the bucket in which the cache will be stored
type
:
string
credentials
:
description
:
Credentials is the n
ame of the secret containing the 'accesskey' and 'secretkey' used to access the object storage
description
:
N
ame of the secret containing the 'accesskey' and 'secretkey' used to access the object storage
type
:
string
insecure
:
description
:
Use insecure connections or HTTP
...
...
controllers/runner/deployment.go
View file @
f76c5cec
...
...
@@ -194,6 +194,10 @@ func runnerSecretsVolume(cr *gitlabv1beta1.Runner) []corev1.VolumeProjection {
secrets
=
append
(
secrets
,
gcsCredentialsSecretProjection
(
cr
))
}
if
cr
.
Spec
.
CertificateAuthority
!=
""
{
secrets
=
append
(
secrets
,
getCertificateAuthoritySecretProjection
(
cr
))
}
return
secrets
}
...
...
@@ -251,6 +255,22 @@ func gcsCredentialsSecretProjection(cr *gitlabv1beta1.Runner) corev1.VolumeProje
}
}
func
getCertificateAuthoritySecretProjection
(
cr
*
gitlabv1beta1
.
Runner
)
corev1
.
VolumeProjection
{
return
corev1
.
VolumeProjection
{
Secret
:
&
corev1
.
SecretProjection
{
LocalObjectReference
:
corev1
.
LocalObjectReference
{
Name
:
cr
.
Spec
.
CertificateAuthority
,
},
Items
:
[]
corev1
.
KeyToPath
{
{
Key
:
"tls.crt"
,
Path
:
"hostname.crt"
,
},
},
},
}
}
// isCacheS3 checks if the GitLab Runner Cache is of type S3
func
isCacheS3
(
cr
*
gitlabv1beta1
.
Runner
)
bool
{
return
cr
.
Spec
.
S3
!=
nil
&&
cr
.
Spec
.
S3
.
Credentials
!=
""
...
...
hack/assets/templates/gitlab-runner/entrypoint.sh
View file @
f76c5cec
#!/bin/bash
set
-e
mkdir
-p
~/.gitlab-runner/
mkdir
-p
~/.gitlab-runner/
certs
cp
/scripts/config.toml ~/.gitlab-runner/
# Add custom CA certificate if available
if
[[
-f
/secrets/custom-ca.crt
]]
then
cp
/secrets/hostname.crt ~/.gitlab-runner/certs/
fi
# Register the runner
if
[[
-f
/secrets/accesskey
&&
-f
/secrets/secretkey
]]
;
then
export
CACHE_S3_ACCESS_KEY
=
$(
cat
/secrets/accesskey
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment