Skip to content

Commit

Permalink
Add hostAliases to the runner spec (actions#456)
Browse files Browse the repository at this point in the history
  • Loading branch information
reallydontask authored Apr 17, 2021
1 parent 7b44454 commit 2e551c9
Show file tree
Hide file tree
Showing 9 changed files with 97 additions and 0 deletions.
2 changes: 2 additions & 0 deletions api/v1alpha1/runner_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ type RunnerSpec struct {
DockerEnabled *bool `json:"dockerEnabled,omitempty"`
// +optional
DockerMTU *int64 `json:"dockerMTU,omitempty"`
// +optional
HostAliases []corev1.HostAlias `json:"hostAliases,omitempty"`
}

// ValidateRepository validates repository field.
Expand Down
7 changes: 7 additions & 0 deletions api/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -607,6 +607,20 @@ spec:
type: array
group:
type: string
hostAliases:
items:
description: HostAlias holds the mapping between IP and hostnames that will be injected as an entry in the pod's hosts file.
properties:
hostnames:
description: Hostnames for the above IP address.
items:
type: string
type: array
ip:
description: IP address of the host file entry.
type: string
type: object
type: array
image:
type: string
imagePullPolicy:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -607,6 +607,20 @@ spec:
type: array
group:
type: string
hostAliases:
items:
description: HostAlias holds the mapping between IP and hostnames that will be injected as an entry in the pod's hosts file.
properties:
hostnames:
description: Hostnames for the above IP address.
items:
type: string
type: array
ip:
description: IP address of the host file entry.
type: string
type: object
type: array
image:
type: string
imagePullPolicy:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -572,6 +572,20 @@ spec:
type: array
group:
type: string
hostAliases:
items:
description: HostAlias holds the mapping between IP and hostnames that will be injected as an entry in the pod's hosts file.
properties:
hostnames:
description: Hostnames for the above IP address.
items:
type: string
type: array
ip:
description: IP address of the host file entry.
type: string
type: object
type: array
image:
type: string
imagePullPolicy:
Expand Down
14 changes: 14 additions & 0 deletions config/crd/bases/actions.summerwind.dev_runnerdeployments.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -607,6 +607,20 @@ spec:
type: array
group:
type: string
hostAliases:
items:
description: HostAlias holds the mapping between IP and hostnames that will be injected as an entry in the pod's hosts file.
properties:
hostnames:
description: Hostnames for the above IP address.
items:
type: string
type: array
ip:
description: IP address of the host file entry.
type: string
type: object
type: array
image:
type: string
imagePullPolicy:
Expand Down
14 changes: 14 additions & 0 deletions config/crd/bases/actions.summerwind.dev_runnerreplicasets.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -607,6 +607,20 @@ spec:
type: array
group:
type: string
hostAliases:
items:
description: HostAlias holds the mapping between IP and hostnames that will be injected as an entry in the pod's hosts file.
properties:
hostnames:
description: Hostnames for the above IP address.
items:
type: string
type: array
ip:
description: IP address of the host file entry.
type: string
type: object
type: array
image:
type: string
imagePullPolicy:
Expand Down
14 changes: 14 additions & 0 deletions config/crd/bases/actions.summerwind.dev_runners.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -572,6 +572,20 @@ spec:
type: array
group:
type: string
hostAliases:
items:
description: HostAlias holds the mapping between IP and hostnames that will be injected as an entry in the pod's hosts file.
properties:
hostnames:
description: Hostnames for the above IP address.
items:
type: string
type: array
ip:
description: IP address of the host file entry.
type: string
type: object
type: array
image:
type: string
imagePullPolicy:
Expand Down
4 changes: 4 additions & 0 deletions controllers/runner_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -813,6 +813,10 @@ func (r *RunnerReconciler) newPod(runner v1alpha1.Runner) (corev1.Pod, error) {
pod.Spec.TerminationGracePeriodSeconds = runner.Spec.TerminationGracePeriodSeconds
}

if len(runner.Spec.HostAliases) != 0 {
pod.Spec.HostAliases = runner.Spec.HostAliases
}

if err := ctrl.SetControllerReference(&runner, &pod, r.Scheme); err != nil {
return pod, err
}
Expand Down

0 comments on commit 2e551c9

Please sign in to comment.