Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OSASINFRA-3437: Rebase on CAPO v0.10 #305

Merged
merged 339 commits into from
Apr 26, 2024
Merged
Changes from 1 commit
Commits
Show all changes
339 commits
Select commit Hold shift + click to select a range
8fe1c8f
Adds Kind to ipaddress pool name index
bilbobrovall Feb 6, 2024
3f806e0
fix: fix the block device type name in doc
okozachenko1203 Feb 6, 2024
cca2213
Make sure to keep availableIPs and is in sync
bilbobrovall Feb 6, 2024
77d1ad0
Merge pull request #1858 from tormath1/tormath1/flatcar-update
k8s-ci-robot Feb 7, 2024
f128d15
Merge pull request #1865 from okozachenko1203/doc/fix-block-device-vo…
k8s-ci-robot Feb 7, 2024
2c8a1a6
add TLS configuration flags support
tuminoid Feb 7, 2024
e6092b8
api: openstackcluster.status default to false
EmilienM Jan 24, 2024
20f2a3c
Prevent the bastion to be removed before it's been disabled
EmilienM Feb 6, 2024
c9b628f
Merge pull request #1842 from shiftstack/issue_1841
k8s-ci-robot Feb 9, 2024
4d81532
Merge pull request #1864 from elastx/fix_pool_name_index
k8s-ci-robot Feb 9, 2024
7622602
Merge pull request #1867 from Nordix/tuomo/tls-configuration-flags
k8s-ci-robot Feb 9, 2024
ca15733
Merge pull request #1870 from elastx/ip_pool_duplicate_addresses
k8s-ci-robot Feb 9, 2024
622defd
Merge pull request #1854 from elastx/compare-cidr-fix
k8s-ci-robot Feb 9, 2024
b319893
loadbalancer: resolve ControlPlaneEndpoint.Host when needed
EmilienM Oct 30, 2023
42c0ef9
Adds MaxIPs to OpenstackFloatingIPPool
bilbobrovall Feb 6, 2024
8ca470a
Merge pull request #1866 from shiftstack/issue_1855
k8s-ci-robot Feb 14, 2024
12a7b72
Move subnet options to SubnetSpec
dulek Feb 2, 2024
3c07a7b
Merge pull request #1856 from shiftstack/subnet-spec
k8s-ci-robot Feb 14, 2024
a68d946
Bump Go to 1.22.0
EmilienM Feb 14, 2024
bd0c05c
Merge pull request #1877 from shiftstack/go1.22
k8s-ci-robot Feb 15, 2024
2f3e5f4
Fix cluster network cleanup
dulek Feb 15, 2024
88dcecf
Merge pull request #1880 from shiftstack/cluster-network-cleanup
k8s-ci-robot Feb 15, 2024
23e30c7
provider: Ignore environment variables
stephenfin Feb 15, 2024
d33c1bc
Stop serving v1alpha5
mdbooth Feb 15, 2024
522ed82
Merge pull request #1883 from shiftstack/issues-1881
k8s-ci-robot Feb 16, 2024
05abe55
Merge pull request #1888 from shiftstack/deprecations
k8s-ci-robot Feb 16, 2024
4eec0e7
Fix doc references to NodeCIDR in v1alpha8
mdbooth Feb 16, 2024
1b320cb
Merge pull request #1889 from shiftstack/nodecidr-docs
k8s-ci-robot Feb 19, 2024
c51197e
CI/e2e: stop testing upgrades from v1alpha5 (v0.6)
EmilienM Feb 19, 2024
ce11691
E2E: Add clusterctl upgrade test for v0.9 -> main
lentzi90 Feb 20, 2024
c6ab0a3
Merge pull request #1893 from shiftstack/issue_1885
k8s-ci-robot Feb 20, 2024
3121d3a
⚠ Enforce restricted pod security standards
lentzi90 Feb 20, 2024
5f5f1af
Merge pull request #1895 from Nordix/lentzi90/restricted-pod-security…
k8s-ci-robot Feb 20, 2024
d189b1b
Merge pull request #1862 from elastx/floating_pool_max_ips
k8s-ci-robot Feb 20, 2024
5b2cc5b
Merge pull request #1894 from Nordix/lentzi90/add-0.9-upgrade
k8s-ci-robot Feb 20, 2024
418ce3d
AllNodes security groups API
EmilienM Jan 15, 2024
82b3122
Merge pull request #1738 from shiftstack/issue_1714
k8s-ci-robot Feb 20, 2024
fc47622
Merge pull request #1826 from shiftstack/secGroup-v1beta1
k8s-ci-robot Feb 21, 2024
c1e0f50
Add emilienm to CAPO reviewers
EmilienM Feb 21, 2024
a559017
api/additionalPorts: don't create UDP rules
EmilienM Feb 21, 2024
350b7e6
Move spec.allowAllInClusterTraffic to spec.managedSecurityGroups
EmilienM Feb 19, 2024
2382d56
Merge pull request #1898 from shiftstack/EmilienMreviewer
k8s-ci-robot Feb 21, 2024
2e4ca73
Modify `OpenStackCluster.Spec.Network` API
MaysaMacedo Jan 19, 2024
05537fb
Deprecate v1alpha6
EmilienM Feb 21, 2024
029d643
Merge pull request #1836 from shiftstack/find-network-by-subnet
k8s-ci-robot Feb 21, 2024
8801eda
Merge pull request #1900 from shiftstack/issue_1886
k8s-ci-robot Feb 22, 2024
5cfeccc
Merge pull request #1892 from shiftstack/issue_1878
k8s-ci-robot Feb 22, 2024
4ff2cf8
e2e: bastion tests
EmilienM Jan 11, 2024
fc810d8
Remove `IdentityRef.Kind`
EmilienM Feb 21, 2024
fd64e36
Merge pull request #1822 from shiftstack/issue_1821
k8s-ci-robot Feb 26, 2024
dd85470
Merge pull request #1903 from shiftstack/issue_1882
k8s-ci-robot Feb 26, 2024
ccfcb59
Add support to set `allocation_pools` for subnet
dulek Jan 30, 2024
7ec4c14
Move ports management outside of instances
EmilienM Dec 11, 2023
3ba8082
Allow running individual generate targets
mdbooth Feb 26, 2024
4bb8966
conversion-gen: Fix package name generation
mdbooth Feb 27, 2024
5a1e175
Remove logger from scope
mdbooth Feb 27, 2024
fd37971
Merge pull request #1788 from shiftstack/ports
k8s-ci-robot Feb 27, 2024
1b0f1ea
Merge pull request #1847 from shiftstack/allocation-pools
k8s-ci-robot Feb 27, 2024
e9fb53c
Rename `v1alpha8` to `v1beta1`
EmilienM Feb 21, 2024
634ccc7
Merge pull request #1902 from shiftstack/issue_1901
k8s-ci-robot Feb 27, 2024
e8ccd21
Reduce cyclomatic complexity of ReconcileLoadBalancer
mdbooth Feb 22, 2024
c0b54d0
Merge pull request #1911 from shiftstack/conversion-gen
k8s-ci-robot Feb 27, 2024
05d4e9b
Merge pull request #1904 from shiftstack/ReconcileLoadBalancer
k8s-ci-robot Feb 28, 2024
0c5f230
Merge pull request #1913 from shiftstack/issue1840
k8s-ci-robot Feb 28, 2024
268645a
Reduce cyclomatic complexity of reconcileNetworkComponents
mdbooth Feb 26, 2024
a405eeb
Merge pull request #1905 from shiftstack/reconcileNetworkComponents
k8s-ci-robot Feb 28, 2024
af5545c
Add API reference documentation generation
alexandrevilain Oct 2, 2023
36e94d9
Merge pull request #1702 from alexandrevilain/docs/add-api-reference
k8s-ci-robot Feb 28, 2024
7b202d1
Merge pull request #1899 from shiftstack/issue_1704
k8s-ci-robot Feb 28, 2024
4c01e65
API cleanup of PortOpts
mdbooth Feb 27, 2024
9e00969
Merge pull request #1914 from shiftstack/portOptsCleanup
k8s-ci-robot Feb 29, 2024
564b6bd
Move CloudName into IdentityRef and make cluster IdentityRef required
mdbooth Feb 19, 2024
c4fe920
Merge pull request #1915 from shiftstack/cloudName
k8s-ci-robot Feb 29, 2024
7927f65
Transform neutron filter tags into slices
EmilienM Feb 26, 2024
412cae3
ci: fix upgrades by dropping cloudName
EmilienM Mar 1, 2024
c2e8b49
Update ginkgo to 2.15.0
mdbooth Feb 29, 2024
120bc68
ManagedSecurityGroups: fix missing omitemptys on optional fields
mdbooth Mar 1, 2024
a4e2079
tests: Add TEST_PATHS target for make test
mdbooth Mar 1, 2024
645741c
Merge pull request #1916 from shiftstack/fixCloudname
k8s-ci-robot Mar 1, 2024
8533ef5
Make sure that additional ports security groups are dynamic and canno…
huxcrux Mar 1, 2024
0f02b30
Merge pull request #1909 from shiftstack/tags
k8s-ci-robot Mar 1, 2024
4d3e79c
Add framework for api validation tests using envtest
mdbooth Mar 1, 2024
1cb5d53
Merge pull request #1918 from elastx/fix-crash-additonal-ports
k8s-ci-robot Mar 1, 2024
750b84d
Move webhooks into pkg/webhooks
mdbooth Mar 1, 2024
13e95db
Register API versions with test scheme in validation tests
mdbooth Mar 2, 2024
cb09d5f
Implement convertible for OpenStackClusterTemplateList
mdbooth Mar 2, 2024
23b9f34
Merge pull request #1919 from shiftstack/apivalidationtests
k8s-ci-robot Mar 4, 2024
1eca090
Split v1alpha6&v1alpha7 conversion into multiple files
mdbooth Mar 5, 2024
e6bb34f
Merge pull request #1920 from shiftstack/webhooks
k8s-ci-robot Mar 5, 2024
392edfd
v1alpha7 restorev1beta1ClusterSpec should not restore Bastion
mdbooth Mar 5, 2024
a81ef96
v1alpha6: Simplify v1alpha6 cluster restorer
mdbooth Mar 5, 2024
af6dbae
Merge pull request #1923 from shiftstack/conversion_cleanup
k8s-ci-robot Mar 5, 2024
d76b07d
Merge pull request #1925 from shiftstack/simple_cluster_restore
k8s-ci-robot Mar 6, 2024
30ba121
Fix CRD generation
mdbooth Mar 6, 2024
9fb6072
Merge pull request #1928 from shiftstack/crdgen
k8s-ci-robot Mar 6, 2024
d33fee8
Move filter conversions out of /api
mdbooth Mar 1, 2024
1734ebb
Allow generating api-docs for individual versions
mdbooth Mar 6, 2024
b4670cb
Merge pull request #1929 from shiftstack/apidoc-gen
k8s-ci-robot Mar 6, 2024
c7c5baf
Rename fields to correctly do uppercase acronyms
dulek Mar 7, 2024
968df70
CI: Specify external network by name
mdbooth Mar 7, 2024
47f0c1b
Merge pull request #1934 from shiftstack/fix-serializations
k8s-ci-robot Mar 7, 2024
381263d
Merge pull request #1932 from shiftstack/externalnet
k8s-ci-robot Mar 8, 2024
000b67d
Add junit output to e2e tests
mdbooth Mar 8, 2024
4ece380
Merge pull request #1935 from shiftstack/junit
k8s-ci-robot Mar 8, 2024
300c45c
Merge pull request #1924 from shiftstack/filter_convert
k8s-ci-robot Mar 8, 2024
0caecf4
Add optional.Int, optional.Bool, and optional.Restore*
mdbooth Mar 6, 2024
cc32a8a
PortOpts: Use RestoreString optional.String fields
mdbooth Mar 6, 2024
7a0e942
make nil resource filters ToListOpts() return empty ListOpts
mdbooth Mar 7, 2024
cdc16d2
Make NetworkFilter.IsEmpty() return true on nil receiver
mdbooth Mar 7, 2024
2d96db6
OpenStackCluster: Add explicit optional tags
mdbooth Mar 6, 2024
75079c7
OpenStackCluster: Set explicit listType=atomic
mdbooth Mar 6, 2024
ffbfd40
OpenStackClusterSpec: Network->pointer
mdbooth Feb 19, 2024
e39c730
OpenStackClusterSpec: ExternalNetwork->pointer
mdbooth Feb 19, 2024
e5d9630
OpenStackClusterSpec: ApiServerLoadBalancer->pointer
mdbooth Feb 19, 2024
2c7b44b
OpenStackClusterSpec: APIServerFloatingIP, APIServerFixedIP, APIServe…
mdbooth Feb 21, 2024
9223883
OpenStackClusterSpec: scalar fields to optional types
mdbooth Mar 6, 2024
70bfdaf
OpenStackClusterSpec: ControlPlaneEndpoint->pointer
mdbooth Mar 6, 2024
e6a194b
OpenStackCluster: improve doctext
mdbooth Mar 6, 2024
8d70c19
Merge pull request #1930 from shiftstack/openstackcluster_apicleanup
k8s-ci-robot Mar 11, 2024
44d4732
Move misplaced sections in v1alpha7 to v1beta changes doc
mdbooth Mar 11, 2024
470d30b
Cleanup APILoadBalancer
mdbooth Mar 11, 2024
2074438
Merge pull request #1937 from shiftstack/openstackcluster_apicleanup
k8s-ci-robot Mar 12, 2024
4afdb80
Rename Ports fields in status
mdbooth Mar 12, 2024
7dce82c
Get floating IP for openstack machine from IPAM provider
bilbobrovall Jan 24, 2024
654d714
Merge pull request #1938 from shiftstack/openstackcluster_apicleanup
k8s-ci-robot Mar 12, 2024
a00fa80
ImageFilter - add validations, switch to pointers
dulek Mar 12, 2024
dc3959e
Add ImageFilter API validations
dulek Mar 12, 2024
f79fdf8
test: bump Flatcar version
tormath1 Mar 11, 2024
957c9fc
Templates: Set provider ID directly via kubelet
lentzi90 May 25, 2023
559cbf2
v1alpha5: Fix panic in conversion when port has no binding profile
mdbooth Mar 14, 2024
4ab8b3a
Merge pull request #1949 from shiftstack/issue1948
k8s-ci-robot Mar 15, 2024
e7d0e19
Merge pull request #1939 from shiftstack/filters-pointers
k8s-ci-robot Mar 15, 2024
f6fb753
Merge pull request #1762 from elastx/floating_ip_from_pool
k8s-ci-robot Mar 15, 2024
cc78607
Fix port name after port creation failure
mdbooth Mar 12, 2024
801f5ef
Simplify bastion resource initialisation
mdbooth Mar 15, 2024
0aa2205
Merge pull request #1936 from tormath1/tormath1/flatcar
k8s-ci-robot Mar 15, 2024
6b87daf
Merge pull request #1941 from shiftstack/issue1940
k8s-ci-robot Mar 16, 2024
acd9297
Fix accidental parsing of password
JanGutter Mar 17, 2024
c1fc60d
Merge pull request #1953 from JanGutter/fix-env-rc-password-quoting
k8s-ci-robot Mar 18, 2024
6f8ac4f
Fix a race when updating status before reconcile completes
mdbooth Mar 18, 2024
67fa7b7
Merge pull request #1955 from shiftstack/issue1954
k8s-ci-robot Mar 18, 2024
567469e
Deduplicate AdoptMachinePorts and AdoptBastionPorts
mdbooth Mar 12, 2024
ad00c64
Don't re-reconcile when adopting resources
mdbooth Mar 16, 2024
750af59
Fix premature attempt to resolve machine resources
mdbooth Mar 16, 2024
27b3cef
Merge pull request #1944 from shiftstack/issue1942
k8s-ci-robot Mar 19, 2024
c4e5c2a
Remove security group rules from status
mdbooth Mar 19, 2024
24b7961
Update FloatingIPPool to use v1beta1
mdbooth Mar 20, 2024
4cd4e9f
Add .gitattributes to identify generated files to GitHub
mdbooth Mar 20, 2024
10b1ff4
Merge pull request #1957 from shiftstack/securitygrouprules
k8s-ci-robot Mar 20, 2024
ffa82b3
API: Cleanup Bastion
dulek Mar 14, 2024
c321574
Rename Bastion.Instance to Bastion.Spec
dulek Mar 19, 2024
66d93db
Merge pull request #1963 from shiftstack/gitattributes
k8s-ci-robot Mar 20, 2024
ad3fd18
Fix server metadata length validation
mdbooth Mar 20, 2024
99f3a60
Merge pull request #1962 from shiftstack/floatingipv1beta1
k8s-ci-robot Mar 20, 2024
9809a60
Merge pull request #1964 from shiftstack/servermetadata
k8s-ci-robot Mar 20, 2024
c6efdea
Merge pull request #1959 from shiftstack/bastion-cleanup
k8s-ci-robot Mar 20, 2024
61b0560
Revert accidental update to previous API templates
mdbooth Mar 21, 2024
2b03429
Merge pull request #1966 from shiftstack/upgradefix
k8s-ci-robot Mar 21, 2024
8017c89
Store []ResolvedPortSpec in ReferencedMachineResources
mdbooth Mar 15, 2024
b6d7748
Rename ClusterName to ClusterResourceName
mdbooth Mar 22, 2024
cb99e17
Merge pull request #1951 from shiftstack/issue1943
k8s-ci-robot Mar 22, 2024
5f09ba2
Rename DependentResources to Resources
mdbooth Mar 21, 2024
5d11950
Rename ReferencedResources to Resolved
mdbooth Mar 21, 2024
59689c9
Merge pull request #1965 from shiftstack/machineresources
k8s-ci-robot Mar 22, 2024
2758a6d
Resolved and Resources become pointers in machine status
mdbooth Mar 21, 2024
ec77c18
Merge pull request #1967 from shiftstack/machineresourcespointers
k8s-ci-robot Mar 26, 2024
26e8c07
Consolidate and fix v1beta1 fuzzer funcs
mdbooth Mar 28, 2024
eace85b
Merge pull request #1981 from shiftstack/issue1980
k8s-ci-robot Mar 28, 2024
73c81de
NetworkFilter to NetworkParam
mdbooth Mar 26, 2024
4d85f6f
SubnetFilter to SubnetParam
mdbooth Mar 26, 2024
1d5d2d5
Merge pull request #1972 from shiftstack/networkparam
k8s-ci-robot Mar 28, 2024
de29a18
Merge pull request #1971 from shiftstack/subnetparam
k8s-ci-robot Mar 28, 2024
3cea05d
Add fuzz tests for v1alpha5 conversion
mdbooth Mar 28, 2024
4a5cd42
Merge pull request #1984 from shiftstack/v1alpha5panics
k8s-ci-robot Mar 29, 2024
865933d
SecurityGroupFilter to SecurityGroupParam
mdbooth Mar 27, 2024
91669cf
make generate generates templates
mdbooth Mar 27, 2024
44be48e
ImageFilter to ImageParam
mdbooth Mar 25, 2024
5c3fe97
RouterFilter to RouterParam
mdbooth Mar 27, 2024
52652d3
Merge pull request #1974 from shiftstack/securitygroupparam
k8s-ci-robot Mar 29, 2024
e32bcc2
Merge pull request #1970 from shiftstack/imageparam
k8s-ci-robot Mar 29, 2024
4e2150f
Merge pull request #1978 from shiftstack/routerparam
k8s-ci-robot Mar 29, 2024
a2ba9c5
Fix v1alpha7 machine restorer and test
mdbooth Apr 1, 2024
5c1ad44
Move InstanceID from spec to status
mdbooth Apr 1, 2024
85ed836
Merge pull request #1987 from shiftstack/issue1986
k8s-ci-robot Apr 1, 2024
7dd2c35
Bastion is enabled by default if specified
mdbooth Apr 1, 2024
a6732bc
Merge pull request #1990 from shiftstack/bastionenabled
k8s-ci-robot Apr 2, 2024
4c162b6
Merge pull request #1988 from shiftstack/instanceidstatus2
k8s-ci-robot Apr 2, 2024
8ea3ccf
ServerGroupFilter to ServerGroupParam
mdbooth Apr 2, 2024
de0dffa
Fuzz test conversion restore functions
mdbooth Apr 1, 2024
2901efe
Document changes of Filters to Params
mdbooth Mar 28, 2024
f5b0181
Merge pull request #1989 from shiftstack/morefuzz
k8s-ci-robot Apr 2, 2024
7c0d741
Remove legacy v1alpha7 filterconvert utils
mdbooth Apr 2, 2024
e636957
Merge pull request #1991 from shiftstack/servergroupparam
k8s-ci-robot Apr 2, 2024
0990569
Merge pull request #1982 from shiftstack/filterparamdocs
k8s-ci-robot Apr 2, 2024
8fe2114
Add API docs for v1alpha1
mdbooth Apr 2, 2024
ed829b3
Bump version artifacts for release-0.10
mdbooth Apr 2, 2024
17daeca
Merge pull request #1993 from shiftstack/v1alpha1docs
k8s-ci-robot Apr 2, 2024
79fcb6a
Merge pull request #1994 from shiftstack/v10-metadata
k8s-ci-robot Apr 2, 2024
acc680d
Merge pull request #1992 from shiftstack/v1alpha7cruft
k8s-ci-robot Apr 2, 2024
9c66684
make floatingIPNetwork a pointer and if there's only one external
bilbobrovall Apr 3, 2024
df19807
Looks for more device_owners when looking for a port for external
bilbobrovall Apr 3, 2024
f747456
Rules are optional in security group rules before v1beta1
mdbooth Apr 4, 2024
78f7b3f
Merge pull request #2000 from shiftstack/issue1999
k8s-ci-robot Apr 4, 2024
55918b1
Tidy up makefile rules for KUBEBUILDER_ASSETS
mdbooth Apr 4, 2024
038c11f
API validations: cleanup objects after creation
mdbooth Apr 4, 2024
c59ee80
Fix API conversion webhooks in the apivalidation tests
mdbooth Apr 4, 2024
d2d1cb2
Merge pull request #1998 from elastx/issue#1997
k8s-ci-robot Apr 4, 2024
fe80a3f
docs: Document the change of instanceID in v1beta1
pierreprinetti Apr 5, 2024
b7a6685
Merge pull request #2001 from shiftstack/validationtestcleanups
k8s-ci-robot Apr 5, 2024
e2897fb
feat: add configurable loadbalancer network
oblazek Mar 4, 2024
6c83bc4
Merge pull request #2003 from shiftstack/docs_migration_instanceid
k8s-ci-robot Apr 8, 2024
9ebb706
Don't try to resolve machine on delete if cluster not ready
mdbooth Apr 9, 2024
9aaf481
Merge pull request #1922 from oblazek/ob-loadbalancer-network
k8s-ci-robot Apr 9, 2024
626738a
Merge pull request #1996 from elastx/issue#1985
k8s-ci-robot Apr 9, 2024
6d74e98
Add opt to use AZ for APISeverLoadBalancer
nguyenhuukhoi Mar 28, 2024
43d2499
Cleanup security group created by e2e test
mdbooth Apr 10, 2024
4ce032d
Fix idempotent restore when setting ControlPlaneEndpoint
mdbooth Apr 11, 2024
c834e9c
Merge pull request #2010 from shiftstack/cleanuptestsg
k8s-ci-robot Apr 11, 2024
7925a4b
Merge pull request #2006 from shiftstack/issue1792
k8s-ci-robot Apr 11, 2024
d04c4d5
Bump k8s dep to 0.29.3
mdbooth Apr 11, 2024
7e34a22
Merge pull request #2004 from shiftstack/apiserver-lb-azs
k8s-ci-robot Apr 11, 2024
9aa449c
Allow explicitly empty volume AZ
mdbooth Apr 10, 2024
639ca12
Merge pull request #2014 from shiftstack/pointer-to-ptr
k8s-ci-robot Apr 12, 2024
8c7e661
Merge pull request #2008 from shiftstack/volumeaz
k8s-ci-robot Apr 12, 2024
4cf3c1b
Merge pull request #2011 from shiftstack/issue2009
k8s-ci-robot Apr 12, 2024
2837b29
Add a No Bastion e2e test
mdbooth Apr 12, 2024
118f715
Fix crash on delete with no bastion
mdbooth Apr 12, 2024
f4e5bdf
Merge pull request #2017 from shiftstack/issue2016
k8s-ci-robot Apr 12, 2024
b5f1e0a
Fix v1alpha7 e2e tests
mdbooth Apr 17, 2024
b1771d5
Merge pull request #2031 from k8s-infra-cherrypick-robot/cherry-pick-…
k8s-ci-robot Apr 18, 2024
bd3ddfa
CARRY: Downstream OWNERS
pierreprinetti Apr 4, 2022
93b0178
CARRY: Add Snyk security scan config
racheljpg Dec 18, 2023
716c732
CARRY: Add OCP CI config
mdbooth Oct 2, 2023
42ff4ae
CARRY: Mark CAPO as second level operator
mdbooth Oct 5, 2023
18ec0e0
CARRY: Don't ignore vendor directories
mdbooth Oct 3, 2023
ca97c8d
CARRY: Add verify-vendoring make target
mdbooth Oct 4, 2023
f063ac1
Add cluster-capi-operator integration
mdbooth Nov 22, 2023
5843167
openshift: Add make verify and test
mdbooth Nov 28, 2023
d7f0091
openshift: Fix label of cluster-capi infrastructure CM
mdbooth Nov 30, 2023
f499165
openshift: Add (stub) make e2e
stephenfin Dec 1, 2023
73a9562
vendoring: add cluster-capi-operator && go mod vendor
EmilienM Nov 23, 2023
ebfa202
Add cluster-capi-operator-specific e2e tests
EmilienM Nov 23, 2023
e6d3cb9
openshift/manifests: Drop single-node-developer profile
wking Jan 3, 2024
4e7fd29
openshift/manifests: CloudCredential capability for CredentialsRequest
wking Jan 3, 2024
fe2962b
CARRY: Revert to Go v1.21
pierreprinetti Mar 4, 2024
91e4dcf
Updating openstack-cluster-api-controllers-container image to be cons…
Mar 21, 2024
20811e4
openshift: Bump to CAPO v0.10.0
mdbooth Apr 23, 2024
9753c5c
CARRY: vendoring
mdbooth Apr 25, 2024
49c1705
CHERRY-PICK: Refactoring: never assign unacceptable TLS versions
pierreprinetti Apr 25, 2024
0a9e144
Merge remote-tracking branch 'openshift/main' into rebase-capo-v0.10
mdbooth Apr 25, 2024
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
Prev Previous commit
Next Next commit
Reduce cyclomatic complexity of reconcileNetworkComponents
This change refactors reconcileNetworkComponents into several smaller
logical functions which are easier to read and reason about.

It also makes the gocyclo linter happy when making new changes to this
code.

Co-Authored-By: Emilien Macchi <emacchi@redhat.com>
  • Loading branch information
mdbooth and EmilienM committed Feb 28, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit 268645a3bee5e88344c78c6965db8f7b099773b9
299 changes: 160 additions & 139 deletions controllers/openstackcluster_controller.go
Original file line number Diff line number Diff line change
@@ -602,81 +602,123 @@ func reconcileNetworkComponents(scope *scope.WithLogger, cluster *clusterv1.Clus
}

if len(openStackCluster.Spec.ManagedSubnets) == 0 {
scope.Logger().V(4).Info("No need to reconcile network, searching network and subnet instead")

if openStackCluster.Status.Network == nil {
openStackCluster.Status.Network = &infrav1.NetworkStatusWithSubnets{}
}

err := getCAPONetwork(openStackCluster, networkingService)
if err != nil {
if err := reconcilePreExistingNetworkComponents(scope, networkingService, openStackCluster); err != nil {
return err
}

filteredSubnets, err := filterSubnets(networkingService, openStackCluster)
if err != nil {
} else if len(openStackCluster.Spec.ManagedSubnets) == 1 {
if err := reconcileProvisionedNetworkComponents(networkingService, openStackCluster, clusterName); err != nil {
return err
}
} else {
return fmt.Errorf("failed to reconcile network: ManagedSubnets only supports one element, %d provided", len(openStackCluster.Spec.ManagedSubnets))
}

var subnets []infrav1.Subnet
for subnet := range filteredSubnets {
filterSubnet := &filteredSubnets[subnet]
subnets = append(subnets, infrav1.Subnet{
ID: filterSubnet.ID,
Name: filterSubnet.Name,
CIDR: filterSubnet.CIDR,
Tags: filterSubnet.Tags,
})
}
err = networkingService.ReconcileSecurityGroups(openStackCluster, clusterName)
if err != nil {
handleUpdateOSCError(openStackCluster, fmt.Errorf("failed to reconcile security groups: %w", err))
return fmt.Errorf("failed to reconcile security groups: %w", err)
}

if err := utils.ValidateSubnets(subnets); err != nil {
return err
}
openStackCluster.Status.Network.Subnets = subnets
return reconcileControlPlaneEndpoint(scope, networkingService, openStackCluster, clusterName)
}

// If network is not yet populated on the Status, use networkID defined in the filtered subnets to get the Network.
err = populateCAPONetworkFromSubnet(networkingService, filteredSubnets, openStackCluster)
// reconcilePreExistingNetworkComponents reconciles the cluster network status when the cluster is
// using pre-existing networks and subnets which are not provisioned by the
// cluster controller.
func reconcilePreExistingNetworkComponents(scope *scope.WithLogger, networkingService *networking.Service, openStackCluster *infrav1.OpenStackCluster) error {
scope.Logger().V(4).Info("No need to reconcile network, searching network and subnet instead")

if openStackCluster.Status.Network == nil {
openStackCluster.Status.Network = &infrav1.NetworkStatusWithSubnets{}
}

emptyNetwork := infrav1.NetworkFilter{}
if openStackCluster.Spec.Network != emptyNetwork {
netOpts := openStackCluster.Spec.Network.ToListOpt()
networkList, err := networkingService.GetNetworksByFilter(&netOpts)
if err != nil {
return err
handleUpdateOSCError(openStackCluster, fmt.Errorf("failed to find network: %w", err))
return fmt.Errorf("error fetching networks: %w", err)
}
} else if len(openStackCluster.Spec.ManagedSubnets) == 1 {
err := networkingService.ReconcileNetwork(openStackCluster, clusterName)
if err != nil {
handleUpdateOSCError(openStackCluster, fmt.Errorf("failed to reconcile network: %w", err))
return fmt.Errorf("failed to reconcile network: %w", err)
if len(networkList) == 0 {
handleUpdateOSCError(openStackCluster, fmt.Errorf("failed to find any network"))
return fmt.Errorf("failed to find any network")
}
err = networkingService.ReconcileSubnet(openStackCluster, clusterName)
if err != nil {
handleUpdateOSCError(openStackCluster, fmt.Errorf("failed to reconcile subnets: %w", err))
return fmt.Errorf("failed to reconcile subnets: %w", err)
if len(networkList) == 1 {
setClusterNetwork(openStackCluster, &networkList[0])
}
}

subnets, err := getClusterSubnets(networkingService, openStackCluster)
if err != nil {
return err
}

// Populate the cluster status with the cluster subnets
capoSubnets := make([]infrav1.Subnet, len(subnets))
for i := range subnets {
subnet := &subnets[i]
capoSubnets[i] = infrav1.Subnet{
ID: subnet.ID,
Name: subnet.Name,
CIDR: subnet.CIDR,
Tags: subnet.Tags,
}
err = networkingService.ReconcileRouter(openStackCluster, clusterName)
}
if err := utils.ValidateSubnets(capoSubnets); err != nil {
return err
}
openStackCluster.Status.Network.Subnets = capoSubnets

// If network is not yet populated, use networkID defined on the first
// cluster subnet to get the Network. Cluster subnets are constrained to
// be in the same network.
if openStackCluster.Status.Network.ID == "" && len(subnets) > 0 {
network, err := networkingService.GetNetworkByID(subnets[0].NetworkID)
if err != nil {
handleUpdateOSCError(openStackCluster, fmt.Errorf("failed to reconcile router: %w", err))
return fmt.Errorf("failed to reconcile router: %w", err)
return err
}
} else {
return fmt.Errorf("failed to reconcile network: ManagedSubnets only supports one element, %d provided", len(openStackCluster.Spec.ManagedSubnets))
setClusterNetwork(openStackCluster, network)
}

err = networkingService.ReconcileSecurityGroups(openStackCluster, clusterName)
return nil
}

func reconcileProvisionedNetworkComponents(networkingService *networking.Service, openStackCluster *infrav1.OpenStackCluster, clusterName string) error {
err := networkingService.ReconcileNetwork(openStackCluster, clusterName)
if err != nil {
handleUpdateOSCError(openStackCluster, fmt.Errorf("failed to reconcile security groups: %w", err))
return fmt.Errorf("failed to reconcile security groups: %w", err)
handleUpdateOSCError(openStackCluster, fmt.Errorf("failed to reconcile network: %w", err))
return fmt.Errorf("failed to reconcile network: %w", err)
}
err = networkingService.ReconcileSubnet(openStackCluster, clusterName)
if err != nil {
handleUpdateOSCError(openStackCluster, fmt.Errorf("failed to reconcile subnets: %w", err))
return fmt.Errorf("failed to reconcile subnets: %w", err)
}
err = networkingService.ReconcileRouter(openStackCluster, clusterName)
if err != nil {
handleUpdateOSCError(openStackCluster, fmt.Errorf("failed to reconcile router: %w", err))
return fmt.Errorf("failed to reconcile router: %w", err)
}

return nil
}

// reconcileControlPlaneEndpoint configures the control plane endpoint for the
// cluster, creating it if necessary, and updates ControlPlaneEndpoint in the
// cluster spec.
func reconcileControlPlaneEndpoint(scope *scope.WithLogger, networkingService *networking.Service, openStackCluster *infrav1.OpenStackCluster, clusterName string) error {
// Calculate the port that we will use for the API server
var apiServerPort int
switch {
case openStackCluster.Spec.ControlPlaneEndpoint.IsValid():
apiServerPort = int(openStackCluster.Spec.ControlPlaneEndpoint.Port)
case openStackCluster.Spec.APIServerPort != 0:
apiServerPort = openStackCluster.Spec.APIServerPort
default:
apiServerPort = 6443
}
apiServerPort := getAPIServerPort(openStackCluster)

if openStackCluster.Spec.APIServerLoadBalancer.Enabled {
// host must be set by a matching control plane endpoint provider below
var host string

switch {
// API server load balancer is enabled. Create an Octavia load balancer.
// Note that we reconcile the load balancer even if the control plane
// endpoint is already set.
case openStackCluster.Spec.APIServerLoadBalancer.Enabled:
loadBalancerService, err := loadbalancer.NewService(scope)
if err != nil {
return err
@@ -690,49 +732,63 @@ func reconcileNetworkComponents(scope *scope.WithLogger, cluster *clusterv1.Clus
}
return fmt.Errorf("failed to reconcile load balancer: %w", err)
}
}

if !openStackCluster.Spec.ControlPlaneEndpoint.IsValid() {
var host string
// If there is a load balancer use the floating IP for it if set, falling back to the internal IP
switch {
case openStackCluster.Spec.APIServerLoadBalancer.Enabled:
if openStackCluster.Status.APIServerLoadBalancer.IP != "" {
host = openStackCluster.Status.APIServerLoadBalancer.IP
} else {
host = openStackCluster.Status.APIServerLoadBalancer.InternalIP
}
case !openStackCluster.Spec.DisableAPIServerFloatingIP:
// If floating IPs are not disabled, get one to use as the VIP for the control plane
fp, err := networkingService.GetOrCreateFloatingIP(openStackCluster, openStackCluster, clusterName, openStackCluster.Spec.APIServerFloatingIP)
if err != nil {
handleUpdateOSCError(openStackCluster, fmt.Errorf("floating IP cannot be got or created: %w", err))
return fmt.Errorf("floating IP cannot be got or created: %w", err)
}
host = fp.FloatingIP
case openStackCluster.Spec.APIServerFixedIP != "":
// If a fixed IP was specified, assume that the user is providing the extra configuration
// to use that IP as the VIP for the API server, e.g. using keepalived or kube-vip
host = openStackCluster.Spec.APIServerFixedIP
default:
// For now, we do not provide a managed VIP without either a load balancer or a floating IP
// In the future, we could manage a VIP port on the cluster network and set allowedAddressPairs
// accordingly when creating control plane machines
// However this would require us to deploy software on the control plane hosts to manage the
// VIP (e.g. keepalived/kube-vip)
return fmt.Errorf("unable to determine VIP for API server")
// Control plane endpoint is the floating IP if one was defined, otherwise the VIP address
if openStackCluster.Status.APIServerLoadBalancer.IP != "" {
host = openStackCluster.Status.APIServerLoadBalancer.IP
} else {
host = openStackCluster.Status.APIServerLoadBalancer.InternalIP
}

// Set APIEndpoints so the Cluster API Cluster Controller can pull them
openStackCluster.Spec.ControlPlaneEndpoint = clusterv1.APIEndpoint{
Host: host,
Port: int32(apiServerPort),
// Control plane endpoint is already set
// Note that checking this here means that we don't re-execute any of
// the branches below if the control plane endpoint is already set.
case openStackCluster.Spec.ControlPlaneEndpoint.IsValid():
host = openStackCluster.Spec.ControlPlaneEndpoint.Host

// API server load balancer is disabled, but floating IP is not. Create
// a floating IP to be attached directly to a control plane host.
case !openStackCluster.Spec.DisableAPIServerFloatingIP:
fp, err := networkingService.GetOrCreateFloatingIP(openStackCluster, openStackCluster, clusterName, openStackCluster.Spec.APIServerFloatingIP)
if err != nil {
handleUpdateOSCError(openStackCluster, fmt.Errorf("floating IP cannot be got or created: %w", err))
return fmt.Errorf("floating IP cannot be got or created: %w", err)
}
host = fp.FloatingIP

// API server load balancer is disabled and we aren't using a control
// plane floating IP. In this case we configure APIServerFixedIP as the
// control plane endpoint and leave it to the user to configure load
// balancing.
case openStackCluster.Spec.APIServerFixedIP != "":
host = openStackCluster.Spec.APIServerFixedIP

// Control plane endpoint is not set, and none can be created
default:
err := fmt.Errorf("unable to determine control plane endpoint")
handleUpdateOSCError(openStackCluster, err)
return err
}

openStackCluster.Spec.ControlPlaneEndpoint = clusterv1.APIEndpoint{
Host: host,
Port: int32(apiServerPort),
}

return nil
}

// getAPIServerPort returns the port to use for the API server based on the cluster spec.
func getAPIServerPort(openStackCluster *infrav1.OpenStackCluster) int {
switch {
case openStackCluster.Spec.ControlPlaneEndpoint.IsValid():
return int(openStackCluster.Spec.ControlPlaneEndpoint.Port)
case openStackCluster.Spec.APIServerPort != 0:
return openStackCluster.Spec.APIServerPort
}
return 6443
}

func (r *OpenStackClusterReconciler) SetupWithManager(ctx context.Context, mgr ctrl.Manager, options controller.Options) error {
clusterToInfraFn := util.ClusterToInfrastructureMapFunc(ctx, infrav1.GroupVersion.WithKind("OpenStackCluster"), mgr.GetClient(), &infrav1.OpenStackCluster{})
log := ctrl.LoggerFrom(ctx)
@@ -788,9 +844,9 @@ func handleUpdateOSCError(openstackCluster *infrav1.OpenStackCluster, message er
openstackCluster.Status.FailureMessage = pointer.String(message.Error())
}

// filterSubnets retrieves the subnets based on the Subnet filters specified on OpenstackCluster.
func filterSubnets(networkingService *networking.Service, openStackCluster *infrav1.OpenStackCluster) ([]subnets.Subnet, error) {
var filteredSubnets []subnets.Subnet
// getClusterSubnets retrieves the subnets based on the Subnet filters specified on OpenstackCluster.
func getClusterSubnets(networkingService *networking.Service, openStackCluster *infrav1.OpenStackCluster) ([]subnets.Subnet, error) {
var clusterSubnets []subnets.Subnet
var err error
openStackClusterSubnets := openStackCluster.Spec.Subnets
networkID := ""
@@ -800,20 +856,22 @@ func filterSubnets(networkingService *networking.Service, openStackCluster *infr

if len(openStackClusterSubnets) == 0 {
if networkID == "" {
return nil, nil
// This should be a validation error
return nil, fmt.Errorf("no network or subnets specified in OpenStackCluster spec")
}

empty := &infrav1.SubnetFilter{}
listOpt := empty.ToListOpt()
listOpt.NetworkID = networkID
filteredSubnets, err = networkingService.GetSubnetsByFilter(listOpt)
clusterSubnets, err = networkingService.GetSubnetsByFilter(listOpt)
if err != nil {
err = fmt.Errorf("failed to find subnets: %w", err)
if errors.Is(err, networking.ErrFilterMatch) {
handleUpdateOSCError(openStackCluster, err)
}
return nil, err
}
if len(filteredSubnets) > 2 {
if len(clusterSubnets) > 2 {
return nil, fmt.Errorf("more than two subnets found in the Network. Specify the subnets in the OpenStackCluster.Spec instead")
}
} else {
@@ -826,55 +884,18 @@ func filterSubnets(networkingService *networking.Service, openStackCluster *infr
}
return nil, err
}
filteredSubnets = append(filteredSubnets, *filteredSubnet)
clusterSubnets = append(clusterSubnets, *filteredSubnet)

// Constrain the next search to the network of the first subnet
networkID = filteredSubnet.NetworkID
}
}
return filteredSubnets, nil
return clusterSubnets, nil
}

// convertOpenStackNetworkToCAPONetwork converts an OpenStack network to a capo network.
// It returns the converted subnet.
func convertOpenStackNetworkToCAPONetwork(openStackCluster *infrav1.OpenStackCluster, network *networks.Network) {
// setClusterNetwork sets network information in the cluster status from an OpenStack network.
func setClusterNetwork(openStackCluster *infrav1.OpenStackCluster, network *networks.Network) {
openStackCluster.Status.Network.ID = network.ID
openStackCluster.Status.Network.Name = network.Name
openStackCluster.Status.Network.Tags = network.Tags
}

// populateCAPONetworkFromSubnet gets a network based on the networkID of the subnets and converts it to the CAPO format.
// It returns an error in case it failed to retrieve the network.
func populateCAPONetworkFromSubnet(networkingService *networking.Service, subnets []subnets.Subnet, openStackCluster *infrav1.OpenStackCluster) error {
if openStackCluster.Status.Network.ID == "" && len(subnets) > 0 {
if len(subnets) > 1 && subnets[0].NetworkID != subnets[1].NetworkID {
return fmt.Errorf("unable to identify the network to use. NetworkID %s from subnet %s does not match NetworkID %s from subnet %s", subnets[0].NetworkID, subnets[0].ID, subnets[1].NetworkID, subnets[1].ID)
}

network, err := networkingService.GetNetworkByID(subnets[0].NetworkID)
if err != nil {
return err
}
convertOpenStackNetworkToCAPONetwork(openStackCluster, network)
}
return nil
}

// getCAPONetwork gets a network based on a filter, if defined, and convert the network to the CAPO format.
// It returns an error in case it failed to retrieve the network.
func getCAPONetwork(openStackCluster *infrav1.OpenStackCluster, networkingService *networking.Service) error {
emptyNetwork := infrav1.NetworkFilter{}
if openStackCluster.Spec.Network != emptyNetwork {
netOpts := openStackCluster.Spec.Network.ToListOpt()
networkList, err := networkingService.GetNetworksByFilter(&netOpts)
if err != nil {
handleUpdateOSCError(openStackCluster, fmt.Errorf("failed to find network: %w", err))
return fmt.Errorf("failed to find network: %w", err)
}
if len(networkList) == 0 {
handleUpdateOSCError(openStackCluster, fmt.Errorf("failed to find any network"))
return fmt.Errorf("failed to find any network")
}
if len(networkList) == 1 {
convertOpenStackNetworkToCAPONetwork(openStackCluster, &networkList[0])
}
}
return nil
}
Loading