Skip to content

Commit dce369b

Browse files
author
Chanwit Kaewkasi
authored
Merge pull request #633 from weaveworks/host-alias-runner-pod
add host aliases to the runner pod template
2 parents d8b8c2d + c24d513 commit dce369b

9 files changed

+57
-2
lines changed

api/v1alpha2/reference_types.go

+4
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,10 @@ type RunnerPodSpec struct {
202202
// Set up Init Containers for the Runner
203203
// +optional
204204
InitContainers []corev1.Container `json:"initContainers,omitempty"`
205+
206+
// Set host aliases for the Runner Pod
207+
// +optional
208+
HostAliases []corev1.HostAlias `json:"hostAliases,omitempty"`
205209
}
206210

207211
func (in HealthCheck) GetTimeout() time.Duration {

api/v1alpha2/zz_generated.deepcopy.go

+7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

charts/tf-controller/Chart.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ apiVersion: v2
22
name: tf-controller
33
description: The Helm chart for Weave GitOps Terraform Controller
44
type: application
5-
version: 0.14.0
5+
version: 0.15.0
66
appVersion: "v0.15.0-rc.1"

charts/tf-controller/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Weave GitOps Terraform Controller
22

3-
![Version: 0.14.0](https://img.shields.io/badge/Version-0.14.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: v0.15.0-rc.1](https://img.shields.io/badge/AppVersion-v0.15.0--rc.1-informational?style=flat-square)
3+
![Version: 0.15.0](https://img.shields.io/badge/Version-0.15.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: v0.15.0-rc.1](https://img.shields.io/badge/AppVersion-v0.15.0--rc.1-informational?style=flat-square)
44

55
The Helm chart for Weave GitOps Terraform Controller
66

charts/tf-controller/templates/crds.yaml

+17
Original file line numberDiff line numberDiff line change
@@ -6307,6 +6307,23 @@ spec:
63076307
x-kubernetes-map-type: atomic
63086308
type: object
63096309
type: array
6310+
hostAliases:
6311+
description: Set host aliases for the Runner Pod
6312+
items:
6313+
description: HostAlias holds the mapping between IP and
6314+
hostnames that will be injected as an entry in the pod's
6315+
hosts file.
6316+
properties:
6317+
hostnames:
6318+
description: Hostnames for the above IP address.
6319+
items:
6320+
type: string
6321+
type: array
6322+
ip:
6323+
description: IP address of the host file entry.
6324+
type: string
6325+
type: object
6326+
type: array
63106327
image:
63116328
description: Runner pod image to use other than default
63126329
type: string

config/crd/bases/infra.contrib.fluxcd.io_terraforms.yaml

+17
Original file line numberDiff line numberDiff line change
@@ -6305,6 +6305,23 @@ spec:
63056305
x-kubernetes-map-type: atomic
63066306
type: object
63076307
type: array
6308+
hostAliases:
6309+
description: Set host aliases for the Runner Pod
6310+
items:
6311+
description: HostAlias holds the mapping between IP and
6312+
hostnames that will be injected as an entry in the pod's
6313+
hosts file.
6314+
properties:
6315+
hostnames:
6316+
description: Hostnames for the above IP address.
6317+
items:
6318+
type: string
6319+
type: array
6320+
ip:
6321+
description: IP address of the host file entry.
6322+
type: string
6323+
type: object
6324+
type: array
63086325
image:
63096326
description: Runner pod image to use other than default
63106327
type: string

config/tilt/test/tf-dev-subject.yaml

+3
Original file line numberDiff line numberDiff line change
@@ -44,3 +44,6 @@ spec:
4444
instance: helloworld-tf # This is the name of the Terraform resource
4545
spec:
4646
image: localhost:5000/weaveworks/tf-runner
47+
hostAliases:
48+
- hostnames:
49+
- host.docker.internal

controllers/tc000260_runner_pod_test.go

+6
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,11 @@ func Test_000260_runner_pod_test(t *testing.T) {
6060
},
6161
Spec: infrav1.RunnerPodSpec{
6262
Image: runnerPodImage,
63+
HostAliases: []corev1.HostAlias{
64+
{
65+
Hostnames: []string{"foo", "bar"},
66+
},
67+
},
6368
},
6469
},
6570
},
@@ -68,6 +73,7 @@ func Test_000260_runner_pod_test(t *testing.T) {
6873
spec := reconciler.runnerPodSpec(helloWorldTF, "runner.tls-123")
6974
g.Expect(spec.ServiceAccountName).To(Equal(serviceAccountName))
7075
g.Expect(spec.Containers[0].Image).To(Equal(runnerPodImage))
76+
g.Expect(spec.HostAliases[0].Hostnames).To(Equal([]string{"foo", "bar"}))
7177

7278
podTemplate, err := runnerPodTemplate(helloWorldTF, "runner.tls-123", revision)
7379
g.Expect(err).ToNot(HaveOccurred())

controllers/tf_controller_runner.go

+1
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,7 @@ func (r *TerraformReconciler) runnerPodSpec(terraform infrav1.Terraform, tlsSecr
276276
NodeSelector: terraform.Spec.RunnerPodTemplate.Spec.NodeSelector,
277277
Affinity: terraform.Spec.RunnerPodTemplate.Spec.Affinity,
278278
Tolerations: terraform.Spec.RunnerPodTemplate.Spec.Tolerations,
279+
HostAliases: terraform.Spec.RunnerPodTemplate.Spec.HostAliases,
279280
}
280281
}
281282

0 commit comments

Comments
 (0)