Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions api/v1/runtimecomponent_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,10 @@ type RuntimeComponentSpec struct {
// DNS settings for the pod.
// +operator-sdk:csv:customresourcedefinitions:order=29,type=spec,displayName="DNS"
DNS *RuntimeComponentDNS `json:"dns,omitempty"`

// The list of hosts and IPs that will be inejcted into the application pod's hosts file
// +operator-sdk:csv:customresourcedefinitions:order=30,type=spec,displayName="Host Aliases"
HostAliases *[]corev1.HostAlias `json:"hostAliases,omitempty"`
}

// Defines the DNS
Expand Down Expand Up @@ -1072,6 +1076,10 @@ func (cr *RuntimeComponentTopologySpreadConstraints) GetDisableOperatorDefaults(
return cr.DisableOperatorDefaults
}

func (cr *RuntimeComponent) GetHostAliases() *[]corev1.HostAlias {
return cr.Spec.HostAliases
}

// Initialize the RuntimeComponent instance
func (cr *RuntimeComponent) Initialize() {
if cr.Spec.PullPolicy == nil {
Expand Down
11 changes: 11 additions & 0 deletions api/v1/zz_generated.deepcopy.go

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

21 changes: 21 additions & 0 deletions bundle/manifests/rc.app.stacks_runtimecomponents.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1983,6 +1983,27 @@ spec:
description: Expose the application externally via a Route, a Knative
Route or an Ingress resource.
type: boolean
hostAliases:
description: The list of hosts and IPs that will be inejcted into
the application pod's hosts file
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
x-kubernetes-list-type: atomic
ip:
description: IP address of the host file entry.
type: string
required:
- ip
type: object
type: array
initContainers:
description: List of containers to run before other containers in
a pod.
Expand Down
4 changes: 4 additions & 0 deletions bundle/manifests/runtime-component.clusterserviceversion.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,10 @@ spec:
- description: DNS settings for the pod.
displayName: DNS
path: dns
- description: The list of hosts and IPs that will be inejcted into the application
pod's hosts file
displayName: Host Aliases
path: hostAliases
- description: Labels to set on ServiceMonitor.
displayName: Monitoring Labels
path: monitoring.labels
Expand Down
1 change: 1 addition & 0 deletions common/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -260,4 +260,5 @@ type BaseComponent interface {
GetDisableServiceLinks() *bool
GetTolerations() []corev1.Toleration
GetDNS() BaseComponentDNS
GetHostAliases() *[]corev1.HostAlias
}
21 changes: 21 additions & 0 deletions config/crd/bases/rc.app.stacks_runtimecomponents.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1979,6 +1979,27 @@ spec:
description: Expose the application externally via a Route, a Knative
Route or an Ingress resource.
type: boolean
hostAliases:
description: The list of hosts and IPs that will be inejcted into
the application pod's hosts file
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
x-kubernetes-list-type: atomic
ip:
description: IP address of the host file entry.
type: string
required:
- ip
type: object
type: array
initContainers:
description: List of containers to run before other containers in
a pod.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,10 @@ spec:
- description: DNS settings for the pod.
displayName: DNS
path: dns
- description: The list of hosts and IPs that will be inejcted into the application
pod's hosts file
displayName: Host Aliases
path: hostAliases
- description: Labels to set on ServiceMonitor.
displayName: Monitoring Labels
path: monitoring.labels
Expand Down
21 changes: 21 additions & 0 deletions internal/deploy/kubectl/runtime-component-crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1982,6 +1982,27 @@ spec:
description: Expose the application externally via a Route, a Knative
Route or an Ingress resource.
type: boolean
hostAliases:
description: The list of hosts and IPs that will be inejcted into
the application pod's hosts file
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
x-kubernetes-list-type: atomic
ip:
description: IP address of the host file entry.
type: string
required:
- ip
type: object
type: array
initContainers:
description: List of containers to run before other containers in
a pod.
Expand Down
21 changes: 21 additions & 0 deletions internal/deploy/kustomize/daily/base/runtime-component-crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1982,6 +1982,27 @@ spec:
description: Expose the application externally via a Route, a Knative
Route or an Ingress resource.
type: boolean
hostAliases:
description: The list of hosts and IPs that will be inejcted into
the application pod's hosts file
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
x-kubernetes-list-type: atomic
ip:
description: IP address of the host file entry.
type: string
required:
- ip
type: object
type: array
initContainers:
description: List of containers to run before other containers in
a pod.
Expand Down
4 changes: 4 additions & 0 deletions utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -702,6 +702,10 @@ func CustomizePodSpec(pts *corev1.PodTemplateSpec, ba common.BaseComponent) {
appContainer.Env = ba.GetEnv()
appContainer.EnvFrom = ba.GetEnvFrom()

if ba.GetHostAliases() != nil {
pts.Spec.HostAliases = *ba.GetHostAliases()
}

pts.Spec.InitContainers = ba.GetInitContainers()

appContainer.VolumeMounts = ba.GetVolumeMounts()
Expand Down