1
0
mirror of https://github.com/openshift/installer.git synced 2026-02-06 09:47:02 +01:00
Commit Graph

97 Commits

Author SHA1 Message Date
dkokkino
c9bfb8533e Add unit tests for OpenStack platform defaults
Adds unit tests in platform_test.py to verify OpenStack platform defaults.
Covers cases such as:
- Assigning a default OpenShift-managed load balancer when none is specified
- Handling user-managed load balancers with and without VIPs
- Ensuring correct API and Ingress VIP assignments
2025-10-30 11:32:10 +00:00
dkokkino
8931ff740b Add default load balancer if none is specified
-If no load balancer is provided, a default OpenShift load balancer is
 now assigned automatically. This ensures proper handling and avoids
 misconfigurations.
2025-10-30 11:32:10 +00:00
dkokkino
e3d8c21eff Prevent default API and Ingress VIP generation for user-managed load balancers
- Previously, when API and Ingress VIPs were not specified, default values were automatically
 generated for user-managed load balancers.This was unintended behavior.
 Now, if the user does not explicitly provide API and Ingress VIPs, a fatal error is thrown instead.
2025-10-30 11:32:10 +00:00
Pierre Prinetti
d8f4b7e9db openstack: Validate controlPlanePort has subnet
Reject a controlPlanePort where the subnet filter is not set.

The rest of the code (both in pre-flight validation and in machine
generation) assumes that a subnet filter is set on the controlPlanePort.
2024-07-16 22:07:23 +02:00
Pierre Prinetti
42e471ee57 openstack: Update Gophercloud to v2 2024-06-18 10:39:56 +02:00
Maysa Macedo
3f8660f100 OpenStack: do not use trunk for the Machines by default
As Kuryr is removed the creation of trunks for the machines
is not a requirement anymore. To reduce the amount of
resources we manage by default, let's avoid creating it as is
not a requirement. This commit will disable trunk creation by default
and let the user enable trunk by modifying the generated Machine manifests.
Also, the terraform support for creation of Machines with Trunk is being
removed.
2024-05-29 13:27:58 -03:00
Maysa Macedo
0d91813e2a OSASINFRA-3237: move controlPlanePort API to GA
This API has not moved and there is no plan to make any changes that
would be backward incompatible in the future.
2023-11-07 17:05:42 -03:00
Stephen Finucane
a979a0edd1 openstack: Use centralised OpenStack client
Avoid the duplication of configuring the client in multiple locations.
It also gives us a single point to start configuring a user agent for
the installer.

Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2023-10-03 11:34:02 +01:00
Emilien Macchi
a1ea1c870e openstack: Variable Root volume types
Co-Authored-By: Emilien Macchi <emilien@redhat.com>
Co-Authored-By: Pierre Prinetti <pierreprinetti@redhat.com>
2023-07-18 10:40:25 -04:00
OpenShift Merge Robot
c2d7db9d4e Merge pull request #6797 from shiftstack/dualstack-support
OpenStack: Dual stack support with BYON
2023-07-16 11:25:51 +02:00
Emilien Macchi
f31a29b738 openstack: add root volume AZ validation
When a machine is created with a compute availability zone (defined via `mpool.zones`) and a storage root volume (defined as `mpool.rootVolume`) and that `rootVolume` has no specified `zones`, CAPO will use the compute AZ for the volume AZ.
This can be problematic if the AZ doesn't exist in Cinder.

Source:
9d183bd479/pkg/cloud/services/compute/instance.go (L439-L442)

```golang
func (s *Service) getOrCreateRootVolume(eventObject runtime.Object, instanceSpec *InstanceSpec, imageID string) (*volumes.Volume, error) {

(...)

        availabilityZone := instanceSpec.FailureDomain
        if rootVolume.AvailabilityZone != "" {
                availabilityZone = rootVolume.AvailabilityZone
        }

(...)
```

If a compute AZ is provided alongside with a root volume, we now require
the root volume to have an AZ, so we force the user to make a choice on
which AZ the root volume is deployed on.

We are also enforcing it via CEL validation in OpenShift API.

* Do nothing - at the risk of hitting this situation: a failure domain with a Compute AZ and a root volume with no AZ, CAPO using the compute AZ to create the volume but that AZ doesn't exist in Cinder, leading into Machine creation errors.
* Only do a validation in the CPMS - which will require CPMS manual
  edits from the user.
* Change logic in CAPO wrt how root volume AZ is picked - unlikely to happen
2023-07-14 15:25:36 -04:00
Maysa Macedo
6df11aa509 OpenStack: Dual stack support with BYON
This commit adds dual stack support with bring your own network
for OpenStack platform. The new ControlPlanePort field accepts IPv4/IPv6
subnets and the network in the install config, while the machinesSubnet
only supports IPv4 Subnets and is deprecated.
2023-07-11 14:36:16 -03:00
Pierre Prinetti
482a2fef7d OSASINFRA-3155 - OpenStack: Create ControlPlaneMachineSet CRDs
Co-Authored-By: Pierre Prinetti <pierreprinetti@redhat.com>
Co-Authored-By: Emilien Macchi <emilien@redhat.com>
2023-07-06 16:41:51 +02:00
Emilien Macchi
97e3019c03 openstack: remove portTargets
We introduced a TechPreview of OpenStack network failure domains in 4.13
that is now incompatible with the new control-plane-machine-set.

With this change, we remove the experimental implementation of network
failure domains to prepare for the control-plane-machine-set
implementation.

Co-Authored-By: Emilien Macchi <emilien@redhat.com>
Co-Authored-By: Pierre Prinetti <pierreprinetti@redhat.com>
2023-06-14 16:21:51 +02:00
OpenShift Merge Robot
15403a5ae7 Merge pull request #7133 from shiftstack/include-provided-port
OpenStack: support user provided dual-stack api and ingress Port
2023-06-12 14:30:49 -04:00
Maysa Macedo
229feb0e72 OpenStack: support user provided dual-stack api and ingress Port
When using dual-stack installations the user needs to pre-create
the api and ingress port given OpenStack does not allow direct
assignment of addresses when using slaac/stateless, consequently
the installer can't create those. This commit adds support to tag
those Ports, assign security groups to them, attach the Floating IP
when needed and allow clean up of resources.
2023-05-15 16:35:33 +02:00
Emilien Macchi
0321c41943 OSASINFRA-3153: move loadBalancer API to GA for OpenStack
This API has not moved and there is no plan to make any change that
would be backward incompatible in the future.

The feature was well tested (and automated) by our QE on this platform,
as well documented on OCP 4.13.

We think this API is ready to be GA'ed.
2023-04-25 09:44:34 -04:00
Pierre Prinetti
4c5b601e1f OpenStack: Add Failure domains
Distribute Control plane machines across user-defined failure domains.

This feature is being release under a TechPreviewNoUpgrade FeatureSet.

Failure domains can be defined in the `controlPlane` machine-pool of
`install-config.yaml` as follows:

```yaml
controlPlane:
  name: master
  platform:
    openstack:
      type: ${CONTROL_PLANE_FLAVOR}
      failureDomains:
      - computeAvailabilityZone: 'nova-1'
        storageAvailabilityZone: 'cinder-1'
        portTargets:
        - id: storage
          network:
            id: 8db6a48e-375b-4caa-b20b-5b9a7218bfe6
      - computeAvailabilityZone: 'nova-2'
        storageAvailabilityZone: 'cinder-2'
        portTargets:
        - id: storage
          network:
            id: 39a7b82a-a8a4-45a4-ba5a-288569a6edd1
      - computeAvailabilityZone: 'nova-3'
        storageAvailabilityZone: 'cinder-3'
        portTargets:
        - id: storage
          network:
            id: 8e4b4e0d-3865-4a9b-a769-559270271242
```

Each `failureDomains` entry can take an optional
`computeAvailabilityZone` string, an optional `storageAvailabilityZone`
string, and an optional `portTargets` array.

Each `portTargets` entry requires an arbirtary `id`, which must be unique per
`failureDomain`. If `id` is exactly `control-plane`, then that
`portTarget` is used instead of the default primary subnet (or instead
of `machinesSubnet` if defined) as the first machine network.

Each `portTargets` entry takes an optional `network` object and an
optional `fixedIPs` array (not represented in the example).

The `network` object taks an optional `name` string and an optional `id`
string. `name` is ignored if `id` is passed.

Each `fixedIPs` entry takes a `subnet` object which syntax is [defined
in the `machinev1alpha1` spec as
`SubnetFilter`](d170fcdc0f/machine/v1alpha1/types_openstack.go (L230-L281)).

Note that unless an external load balancer is used, `portTargets` with
id `control-plane` must all have one single subnet and must all refer to
the same OpenStack subnet. As a consequence, the result will be similar
as setting a `machinesSubnet`, except that Compute nodes will not
follow.
2023-03-04 08:03:20 +01:00
Pierre Prinetti
cd672bc948 openstack: consistent TechPreview-only feature validation
With this change, filling in TechPreview-only configuration flags in
OpenStack throws similar errors as to what happens on other platforms.
2023-03-02 14:12:17 +01:00
Emilien Macchi
625932f5c3 Support for External LB as Tech Preview 2023-02-21 09:29:03 -05:00
Rafael Fonseca
80e02a974d chore: fix import order 2022-12-13 15:40:58 +01:00
Rafael Fonseca
66953cee79 go-fmt: apply formatting with golang 1.19 2022-10-19 18:55:10 +02:00
Sandhya Dasu
7202c95d1d Fix go fmt errors after golang version upgrade to 1.19 2022-10-13 14:25:17 -04:00
Martin André
3b3f19f4d2 OCPBUGS-963: OpenStack: Lift validation for 14 chars cluster names
The validation is no longer necessary now that we stopped using mDNS.
Instead, rely on cluster name validation common to all platforms for
length check and the on-prem cluster name validation for names
containing dots.

This aligns with other on-prem platforms.
2022-09-07 10:27:05 +02:00
Christoph Stäbler
0d5ece990c Mark API and Ingress VIPs required on OpenStack
Signed-off-by: Christoph Stäbler <cstabler@redhat.com>
2022-08-26 12:08:44 -05:00
Christoph Stäbler
a58ac55e8a Add VIPs fields for API and Ingress
Signed-off-by: Christoph Stäbler <cstabler@redhat.com>
2022-08-26 12:08:39 -05:00
Jamo Luhrsen
74486c10c6 Change defaultNetworkType to ovn-kubernetes
In 4.12, the default CNI will be OVNKubernetes.
This change will deploy ovnk by default as well
as adjust tests, docs and comments to reflect
the same.

Signed-off-by: Jamo Luhrsen <jluhrsen@gmail.com>
2022-07-28 22:26:08 -07:00
Martin André
a53ddd5206 Validate OpenStack supports resource tagging
Networking resources tagging is a hard requirement for OpenShift on
OpenStack and we should refuse from running the installer when the
underlying OpenStack platform does not support it.

Also, the destroy script may delete unmanaged resources when network
tagging is not available. With this patch, the destroy script will
refuse to work when network tagging is not available.

Fixes Bug 2013877

Co-authored-by: Martin André <m.andre@redhat.com>
Co-authored-by: Pierre Prinetti <pierreprinetti@redhat.com>
2021-10-26 15:43:12 +02:00
Pierre Prinetti
f6dbeccc70 openstack: Expose worker server group policy
With this change, Compute nodes within each MachineSet are automatically
created in a Server group, with a default policy of
"soft-anti-affinity".

With this change, a "serverGroupPolicy" can be set in install-config, on
the worker MachinePool and/or in the platform default.

Implements OSASINFRA-2570

Co-Authored-By: Matthew Booth <mbooth@redhat.com>
2021-10-04 18:05:15 +02:00
Pierre Prinetti
4a5b29ced0 openstack: Expose master server group policy
Prior to this change, the Control plane nodes are created in a server
group with the hardcoded policy "soft-anti-affinity".

This change adds a new configuration knob in the OpenStack-specific
MachinePool configuration of `install-config.yaml`.

The new property `controlPlane.platform.openstack.serverGroupPolicy`
defines the policy that will be applied to the Control Plane server
group.

Acceptable values are:

* `affinity`
* `anti-affinity`
* `soft-affinity`
* `soft-anti-affinity`

Defaults to `soft-anti-affinity`, to match the previous hardcoded
behaviour.

Validation will fail if the property is set on the Compute MachinePool.
2021-06-28 15:02:30 +02:00
Mike Fedosin
81ffe6bb37 OpenStack: Add Volume AZs to MachineProviderSpec
This commit allows to generate OpenStack Machine and MachineSet
assets considering Root Volume zones parameter from the install
config.
2021-04-08 13:57:09 +02:00
Mike Fedosin
d1df8f262b OpenStack: Add Zones to Root Volume
This commit adds a new optional list of strings parameter called
Zones to OpenStack's Root Volume. When it's set, OpenShift will create
instance root volumes in the specified availability zones.
2021-04-08 13:37:15 +02:00
Mike Fedosin
05453ef0df Bug 1813949: ignore local env variables when we create a service client
This commit explicitly disables reading auth data from env variables
by setting an invalid EnvPrefix. By doing this, we make sure that the
data from clouds.yaml is enough to authenticate.

After this change we don't have to unset OS_CLOUD env variable explicitly
anymore.

Ref https://issues.redhat.com/browse/OSASINFRA-2152
2021-01-11 13:00:11 +01:00
OpenShift Merge Robot
8f859376c5 Merge pull request #4321 from Fedosin/deprecate_computeflavor
Deprecate computeFlavor in OpenStack platform
2020-12-06 16:59:27 -05:00
Mike Fedosin
7014333a1a Deprecate computeFlavor in OpenStack platform 2020-12-05 05:11:34 +01:00
Adolfo Duarte
efc5c80c88 Adds clusterOSImageProperties to install-config.yaml
ClusterOSImageProperties is a list properties to be added
to the installer-uploaded ClusterOSImage in Glance.

The default is to not set any properties.

Co-Authored-By: Martin André <m.andre@redhat.com>
2020-12-04 20:45:55 +01:00
Mike Fedosin
712799df0d Rename lbFloatingIP to apiFloatingIP 2020-10-07 18:15:48 +02:00
Mike Fedosin
956ce5747f Bug 1873123: omit deprecated parameters during config generation 2020-08-27 16:13:27 +02:00
OpenShift Merge Robot
169765e862 Merge pull request #4029 from Fedosin/optional_external_network
Bug 1867519: make externalNetwork optional
2020-08-12 05:49:04 -04:00
Mike Fedosin
b3404878a5 Bug 1867530: mark deprecated parameters as optional 2020-08-10 12:30:55 +02:00
Mike Fedosin
7f3044ddcd Bug 1867519: make externalNetwork optional
Despite the fact `externalNetwork` is considered as an
optional parameter, installations fails if it's not specified.

This commit makes this and related parameters truly optional.
2020-08-10 11:35:52 +02:00
Emilio Garcia
5f791b38a6 Fixes machinepools to add the correct number of machines to pool. Also updates code to handle empty zones more correctly. 2020-08-05 13:43:38 -04:00
Mike Fedosin
f6b076bd70 Bug 1864280: set AZs default for machine pool in the right place 2020-08-03 23:10:47 +02:00
Emilio Garcia
ee9535732a OpenStack Availibility Zones
Following suit with AWS, OpenStack is adding support for custom AZs
for installer machine pools. Users can pass a list of zones to use
and the nodes in that machine pool will be spread across them.
2020-07-31 16:31:29 -04:00
Mike Fedosin
09678f0cac Bug 1857158: OpenStack: validate there is no . in the cluster name 2020-07-21 15:58:12 +02:00
Adolfo Duarte
127f467a0d Make externalnetwork and lbfloating ip optional
- Removes floating ip binding from bootstrap server
if external network is not used
- Added documentation for optional externalNetwork
- Modifies gather to handle when floating ips are not used
2020-07-21 09:24:50 +02:00
OpenShift Merge Robot
23d73eb37d Merge pull request #3855 from iamemilio/ingress_fip
Option to pass floating IP to ingress port
2020-07-20 18:05:10 -04:00
Emilio Garcia
ecda20e348 Option to pass Floating IP for Ingress entrypoint
To make the user experience more cohesive, we are adding this feature to
allow users to pass a floating IP to be attached to the ingress port. This
mirrors the way users add the floating ip for the API port.
2020-07-16 09:56:02 -04:00
Mike Fedosin
6f9de8873b [OpenStack] get rid of valid values fetcher
This commit removes unnecessary ValidValuesFetcher interface and
all related implementations. Now we collect all required data before
the validation and pass cloud info values to the validation functions
after that. It simplifies the architecture and makes these functions
static.

Additionally, all validations that require calls to the OpenStack cloud
were moved from pkg/types/openstack to pkg/asset/installconfig/openstack.
2020-07-15 23:58:53 +02:00
Emilio Garcia
cfcb100c88 cleaning up the validations to improve readability and high level flow 2020-07-13 10:58:02 -04:00