Added support to enable and disable enableServiceLinks. (#628)

This option expose internally some `KUBERNETES_*` environment variables
that doesn't allow the runner to use KinD (Kubernetes in Docker) since it will
try to connect to the Kubernetes cluster where the runner it's running.

This option it's set by default to `true` in any Kubernetes deployment.

Signed-off-by: Jonathan Gonzalez V <jonathan.gonzalez@enterprisedb.com>
This commit is contained in:
Jonathan Gonzalez V 2021-06-22 04:27:26 -04:00 committed by GitHub
parent 1084a37174
commit a277489003
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 21 additions and 0 deletions

View File

@ -100,6 +100,9 @@ type RunnerPodSpec struct {
// +optional // +optional
Volumes []corev1.Volume `json:"volumes,omitempty"` Volumes []corev1.Volume `json:"volumes,omitempty"`
// +optional
EnableServiceLinks *bool `json:"enableServiceLinks,omitempty"`
// +optional // +optional
InitContainers []corev1.Container `json:"initContainers,omitempty"` InitContainers []corev1.Container `json:"initContainers,omitempty"`

View File

@ -624,6 +624,11 @@ func (in *RunnerPodSpec) DeepCopyInto(out *RunnerPodSpec) {
(*in)[i].DeepCopyInto(&(*out)[i]) (*in)[i].DeepCopyInto(&(*out)[i])
} }
} }
if in.EnableServiceLinks != nil {
in, out := &in.EnableServiceLinks, &out.EnableServiceLinks
*out = new(bool)
**out = **in
}
if in.InitContainers != nil { if in.InitContainers != nil {
in, out := &in.InitContainers, &out.InitContainers in, out := &in.InitContainers, &out.InitContainers
*out = make([]v1.Container, len(*in)) *out = make([]v1.Container, len(*in))

View File

@ -632,6 +632,8 @@ spec:
type: object type: object
dockerdWithinRunnerContainer: dockerdWithinRunnerContainer:
type: boolean type: boolean
enableServiceLinks:
type: boolean
enterprise: enterprise:
pattern: ^[^/]+$ pattern: ^[^/]+$
type: string type: string

View File

@ -629,6 +629,8 @@ spec:
type: object type: object
dockerdWithinRunnerContainer: dockerdWithinRunnerContainer:
type: boolean type: boolean
enableServiceLinks:
type: boolean
enterprise: enterprise:
pattern: ^[^/]+$ pattern: ^[^/]+$
type: string type: string

View File

@ -577,6 +577,8 @@ spec:
type: object type: object
dockerdWithinRunnerContainer: dockerdWithinRunnerContainer:
type: boolean type: boolean
enableServiceLinks:
type: boolean
enterprise: enterprise:
pattern: ^[^/]+$ pattern: ^[^/]+$
type: string type: string

View File

@ -632,6 +632,8 @@ spec:
type: object type: object
dockerdWithinRunnerContainer: dockerdWithinRunnerContainer:
type: boolean type: boolean
enableServiceLinks:
type: boolean
enterprise: enterprise:
pattern: ^[^/]+$ pattern: ^[^/]+$
type: string type: string

View File

@ -629,6 +629,8 @@ spec:
type: object type: object
dockerdWithinRunnerContainer: dockerdWithinRunnerContainer:
type: boolean type: boolean
enableServiceLinks:
type: boolean
enterprise: enterprise:
pattern: ^[^/]+$ pattern: ^[^/]+$
type: string type: string

View File

@ -577,6 +577,8 @@ spec:
type: object type: object
dockerdWithinRunnerContainer: dockerdWithinRunnerContainer:
type: boolean type: boolean
enableServiceLinks:
type: boolean
enterprise: enterprise:
pattern: ^[^/]+$ pattern: ^[^/]+$
type: string type: string

View File

@ -622,6 +622,7 @@ func (r *RunnerReconciler) newPod(runner v1alpha1.Runner) (corev1.Pod, error) {
} }
template.Spec.SecurityContext = runner.Spec.SecurityContext template.Spec.SecurityContext = runner.Spec.SecurityContext
template.Spec.EnableServiceLinks = runner.Spec.EnableServiceLinks
registrationOnly := metav1.HasAnnotation(runner.ObjectMeta, annotationKeyRegistrationOnly) registrationOnly := metav1.HasAnnotation(runner.ObjectMeta, annotationKeyRegistrationOnly)