diff --git a/api/v1/webspherelibertyapplication_types.go b/api/v1/webspherelibertyapplication_types.go index a3eb7551..7676e592 100644 --- a/api/v1/webspherelibertyapplication_types.go +++ b/api/v1/webspherelibertyapplication_types.go @@ -185,6 +185,10 @@ type WebSphereLibertyApplicationSpec struct { // DNS settings for the application pod. // +operator-sdk:csv:customresourcedefinitions:order=36,type=spec,displayName="DNS" DNS *WebSphereLibertyApplicationDNS `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=37,type=spec,displayName="Host Aliases" + HostAliases *[]corev1.HostAlias `json:"hostAliases,omitempty"` } // Defines the DNS @@ -1417,6 +1421,10 @@ func (d *WebSphereLibertyApplicationDNS) GetConfig() *corev1.PodDNSConfig { return d.PodDNSConfig } +func (cr *WebSphereLibertyApplication) GetHostAliases() *[]corev1.HostAlias { + return cr.Spec.HostAliases +} + // Initialize sets default values func (cr *WebSphereLibertyApplication) Initialize() { if cr.Spec.PullPolicy == nil { diff --git a/api/v1/zz_generated.deepcopy.go b/api/v1/zz_generated.deepcopy.go index 6d58e270..51139e67 100644 --- a/api/v1/zz_generated.deepcopy.go +++ b/api/v1/zz_generated.deepcopy.go @@ -1036,6 +1036,17 @@ func (in *WebSphereLibertyApplicationSpec) DeepCopyInto(out *WebSphereLibertyApp *out = new(WebSphereLibertyApplicationDNS) (*in).DeepCopyInto(*out) } + if in.HostAliases != nil { + in, out := &in.HostAliases, &out.HostAliases + *out = new([]corev1.HostAlias) + if **in != nil { + in, out := *in, *out + *out = make([]corev1.HostAlias, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WebSphereLibertyApplicationSpec. diff --git a/bundle/manifests/ibm-websphere-liberty.clusterserviceversion.yaml b/bundle/manifests/ibm-websphere-liberty.clusterserviceversion.yaml index 35759a40..47d32a9e 100644 --- a/bundle/manifests/ibm-websphere-liberty.clusterserviceversion.yaml +++ b/bundle/manifests/ibm-websphere-liberty.clusterserviceversion.yaml @@ -67,7 +67,7 @@ metadata: capabilities: Auto Pilot categories: Application Runtime containerImage: icr.io/cpopen/websphere-liberty-operator:daily - createdAt: "2025-12-03T04:52:57Z" + createdAt: "2025-12-04T21:43:47Z" description: Deploy and manage containerized Liberty applications features.operators.openshift.io/disconnected: "true" olm.skipRange: '>=1.0.0 <1.5.2' @@ -496,6 +496,10 @@ spec: path: affinity.nodeAffinity x-descriptors: - urn:alm:descriptor:com.tectonic.ui:nodeAffinity + - description: The list of hosts and IPs that will be inejcted into the application + pod's hosts file + displayName: Host Aliases + path: hostAliases - description: Controls the nodes the pod are scheduled to run on, based on labels on the pods that are already running on the node. displayName: Pod Affinity diff --git a/bundle/manifests/liberty.websphere.ibm.com_webspherelibertyapplications.yaml b/bundle/manifests/liberty.websphere.ibm.com_webspherelibertyapplications.yaml index f58e99f4..ea27ad02 100644 --- a/bundle/manifests/liberty.websphere.ibm.com_webspherelibertyapplications.yaml +++ b/bundle/manifests/liberty.websphere.ibm.com_webspherelibertyapplications.yaml @@ -1986,6 +1986,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. diff --git a/config/crd/bases/liberty.websphere.ibm.com_webspherelibertyapplications.yaml b/config/crd/bases/liberty.websphere.ibm.com_webspherelibertyapplications.yaml index 434ae40f..7e221918 100644 --- a/config/crd/bases/liberty.websphere.ibm.com_webspherelibertyapplications.yaml +++ b/config/crd/bases/liberty.websphere.ibm.com_webspherelibertyapplications.yaml @@ -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. diff --git a/config/manifests/bases/ibm-websphere-liberty.clusterserviceversion.yaml b/config/manifests/bases/ibm-websphere-liberty.clusterserviceversion.yaml index c99b2283..e48a65c0 100644 --- a/config/manifests/bases/ibm-websphere-liberty.clusterserviceversion.yaml +++ b/config/manifests/bases/ibm-websphere-liberty.clusterserviceversion.yaml @@ -432,6 +432,10 @@ spec: path: affinity.nodeAffinity x-descriptors: - urn:alm:descriptor:com.tectonic.ui:nodeAffinity + - description: The list of hosts and IPs that will be inejcted into the application + pod's hosts file + displayName: Host Aliases + path: hostAliases - description: Controls the nodes the pod are scheduled to run on, based on labels on the pods that are already running on the node. displayName: Pod Affinity diff --git a/go.mod b/go.mod index e6d9b528..18117b40 100644 --- a/go.mod +++ b/go.mod @@ -3,8 +3,8 @@ module github.com/WASdev/websphere-liberty-operator go 1.25 require ( - github.com/OpenLiberty/open-liberty-operator v0.8.1-0.20251124214343-4fee1b0d8d1e - github.com/application-stacks/runtime-component-operator v1.0.0-20220602-0850.0.20251120112423-05f65c81aa36 + github.com/OpenLiberty/open-liberty-operator v0.8.1-0.20251205192201-a970b41cd059 + github.com/application-stacks/runtime-component-operator v1.0.0-20220602-0850.0.20251205191742-7d2acc4b2262 github.com/cert-manager/cert-manager v1.16.5 github.com/go-logr/logr v1.4.3 github.com/openshift/api v0.0.0-20250710004639-926605d3338b diff --git a/go.sum b/go.sum index 3f989cd0..0955c0bd 100644 --- a/go.sum +++ b/go.sum @@ -4,10 +4,18 @@ github.com/MakeNowJust/heredoc v1.0.0 h1:cXCdzVdstXyiTqTvfqk9SDHpKNjxuom+DOlyEeQ github.com/MakeNowJust/heredoc v1.0.0/go.mod h1:mG5amYoWBHf8vpLOuehzbGGw0EHxpZZ6lCpQ4fNJ8LE= github.com/OpenLiberty/open-liberty-operator v0.8.1-0.20251124214343-4fee1b0d8d1e h1:7pCncY3KcsAge1E1E9tYo1ZM2bcfsg7dJ4XLKraVmkI= github.com/OpenLiberty/open-liberty-operator v0.8.1-0.20251124214343-4fee1b0d8d1e/go.mod h1:ghwA2Fvfq6YphR93lp8vKEJ7mLYT1+sEvI6re16Kn0c= +github.com/OpenLiberty/open-liberty-operator v0.8.1-0.20251204214137-5ca60f4cd9b2 h1:ilDDB59Pg5LbvCJie1ngYlA5b5E2rgvXUrqqxOj3Yxw= +github.com/OpenLiberty/open-liberty-operator v0.8.1-0.20251204214137-5ca60f4cd9b2/go.mod h1:EhcP2pLDj4DYAfmIkEbr58G8TWoMjjiGnym1SRWPjEo= +github.com/OpenLiberty/open-liberty-operator v0.8.1-0.20251205192201-a970b41cd059 h1:gOlnFOcC6kwV91hoUhYERYLF6o+pZd048WZgMvK05vc= +github.com/OpenLiberty/open-liberty-operator v0.8.1-0.20251205192201-a970b41cd059/go.mod h1:NSTbyXbAcZws1HiAaShAnJRhAkZeowXXXGZ6008GyRk= github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= github.com/application-stacks/runtime-component-operator v1.0.0-20220602-0850.0.20251120112423-05f65c81aa36 h1:fweyU4TX3vSrbWecLy6FYjIgnoybPdoJbOiZsoV+iDw= github.com/application-stacks/runtime-component-operator v1.0.0-20220602-0850.0.20251120112423-05f65c81aa36/go.mod h1:Hs5AbE9J+rLM34IAc75X7dtxnrzFg2AvG1XYLcX/ApU= +github.com/application-stacks/runtime-component-operator v1.0.0-20220602-0850.0.20251204180254-1ccb32f60589 h1:oURgG664at9aK0yhgarnQVWwo7Sw9uGjnoN9LsA9b2Y= +github.com/application-stacks/runtime-component-operator v1.0.0-20220602-0850.0.20251204180254-1ccb32f60589/go.mod h1:Hs5AbE9J+rLM34IAc75X7dtxnrzFg2AvG1XYLcX/ApU= +github.com/application-stacks/runtime-component-operator v1.0.0-20220602-0850.0.20251205191742-7d2acc4b2262 h1:EIG09vyeKaj4v3WjOvc+xRvvmeo4OLyWyOyYACT+oEE= +github.com/application-stacks/runtime-component-operator v1.0.0-20220602-0850.0.20251205191742-7d2acc4b2262/go.mod h1:Hs5AbE9J+rLM34IAc75X7dtxnrzFg2AvG1XYLcX/ApU= github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPdPJAN/hZIm0C4OItdklCFmMRWYpio= github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= diff --git a/internal/deploy/kubectl/websphereliberty-app-crd.yaml b/internal/deploy/kubectl/websphereliberty-app-crd.yaml index bebf6299..fd2ba4b6 100644 --- a/internal/deploy/kubectl/websphereliberty-app-crd.yaml +++ b/internal/deploy/kubectl/websphereliberty-app-crd.yaml @@ -1985,6 +1985,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. diff --git a/internal/deploy/kustomize/daily/base/websphere-liberty-crd.yaml b/internal/deploy/kustomize/daily/base/websphere-liberty-crd.yaml index bebf6299..fd2ba4b6 100644 --- a/internal/deploy/kustomize/daily/base/websphere-liberty-crd.yaml +++ b/internal/deploy/kustomize/daily/base/websphere-liberty-crd.yaml @@ -1985,6 +1985,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.