├── .dockerignore ├── .gitattributes ├── .github ├── ISSUE_TEMPLATE │ ├── bug_report.md │ └── feature_request.md ├── PULL_REQUEST_TEMPLATE.md ├── dependabot.yml └── workflows │ ├── pr-dependabot.yaml │ ├── release.yaml │ ├── security-scan.yaml │ └── update-golangci-lint.yaml ├── .gitignore ├── .golangci.yml ├── CONTRIBUTING.md ├── Dockerfile ├── LICENSE ├── Makefile ├── OWNERS ├── OWNERS_ALIASES ├── PROJECT ├── README.md ├── RELEASE.md ├── SECURITY_CONTACTS ├── api ├── v1alpha1 │ ├── conditions_consts.go │ ├── doc.go │ ├── groupversion_info.go │ ├── openstackfloatingippool_types.go │ ├── openstackserver_types.go │ ├── types.go │ └── zz_generated.deepcopy.go └── v1beta1 │ ├── conditions_consts.go │ ├── conversion.go │ ├── doc.go │ ├── groupversion_info.go │ ├── identity_types.go │ ├── openstackcluster_types.go │ ├── openstackclustertemplate_types.go │ ├── openstackmachine_types.go │ ├── openstackmachinetemplate_types.go │ ├── types.go │ └── zz_generated.deepcopy.go ├── api_violations.report ├── cloudbuild-nightly.yaml ├── cloudbuild.yaml ├── clusterctl-settings.json ├── cmd └── models-schema │ ├── main.go │ └── zz_generated.openapi.go ├── code-of-conduct.md ├── common.mk ├── config ├── certmanager │ ├── certificate.yaml │ ├── kustomization.yaml │ └── kustomizeconfig.yaml ├── crd │ ├── bases │ │ ├── infrastructure.cluster.x-k8s.io_openstackclusters.yaml │ │ ├── infrastructure.cluster.x-k8s.io_openstackclustertemplates.yaml │ │ ├── infrastructure.cluster.x-k8s.io_openstackfloatingippools.yaml │ │ ├── infrastructure.cluster.x-k8s.io_openstackmachines.yaml │ │ ├── infrastructure.cluster.x-k8s.io_openstackmachinetemplates.yaml │ │ └── infrastructure.cluster.x-k8s.io_openstackservers.yaml │ ├── kustomization.yaml │ ├── kustomizeconfig.yaml │ └── patches │ │ ├── cainjection_in_openstackfloatingippools.yaml │ │ ├── webhook_in_openstackclusters.yaml │ │ ├── webhook_in_openstackclustertemplates.yaml │ │ ├── webhook_in_openstackfloatingippools.yaml │ │ ├── webhook_in_openstackmachines.yaml │ │ └── webhook_in_openstackmachinetemplates.yaml ├── default │ ├── kustomization.yaml │ ├── kustomizeconfig.yaml │ ├── manager_image_patch.yaml │ ├── manager_pull_policy.yaml │ ├── manager_webhook_patch.yaml │ └── namespace.yaml ├── manager │ ├── kustomization.yaml │ └── manager.yaml ├── rbac │ ├── kustomization.yaml │ ├── leader_election_role.yaml │ ├── leader_election_role_binding.yaml │ ├── openstackfloatingippool_editor_role.yaml │ ├── openstackfloatingippool_viewer_role.yaml │ ├── role.yaml │ ├── role_binding.yaml │ └── service_account.yaml └── webhook │ ├── kustomization.yaml │ ├── kustomizeconfig.yaml │ ├── manifests.yaml │ └── service.yaml ├── controllers ├── openstackcluster_controller.go ├── openstackcluster_controller_test.go ├── openstackfloatingippool_controller.go ├── openstackmachine_controller.go ├── openstackmachine_controller_test.go ├── openstackserver_controller.go ├── openstackserver_controller_test.go └── suite_test.go ├── design └── proposed │ └── 2020-openstackserver-controller.md ├── docs ├── Makefile ├── book │ ├── .gitignore │ ├── Makefile │ ├── book.toml │ ├── gen-crd-api-reference-docs │ │ ├── config.json │ │ └── template │ │ │ ├── members.tpl │ │ │ ├── pkg.tpl │ │ │ └── type.tpl │ ├── src │ │ ├── SUMMARY.md │ │ ├── api │ │ │ ├── index.md │ │ │ ├── v1alpha1 │ │ │ │ └── api.md │ │ │ └── v1beta1 │ │ │ │ └── api.md │ │ ├── clusteropenstack │ │ │ └── configuration.md │ │ ├── development │ │ │ ├── ci.md │ │ │ └── development.md │ │ ├── getting-started.md │ │ ├── images │ │ │ └── social-card-logo.xcf │ │ ├── introduction.md │ │ └── topics │ │ │ ├── crd-changes │ │ │ ├── index.md │ │ │ ├── v1alpha4-to-v1alpha5.md │ │ │ ├── v1alpha5-to-v1alpha6.md │ │ │ ├── v1alpha6-to-v1alpha7.md │ │ │ └── v1alpha7-to-v1beta1.md │ │ │ ├── external-cloud-provider.md │ │ │ ├── index.md │ │ │ ├── mover.md │ │ │ └── troubleshooting.md │ └── theme │ │ ├── css │ │ └── general.css │ │ ├── favicon.png │ │ └── head.hbs └── proposals │ └── 20230525-openstack-microversion-support.md ├── go.mod ├── go.sum ├── hack ├── .golint_failures ├── boilerplate.go.txt ├── boilerplate │ ├── boilerplate.Dockerfile.txt │ ├── boilerplate.Makefile.txt │ ├── boilerplate.generatego.txt │ ├── boilerplate.go.txt │ ├── boilerplate.py │ ├── boilerplate.py.txt │ └── boilerplate.sh.txt ├── boskos.py ├── ci │ ├── aws-project.sh │ ├── cloud-init │ │ ├── common.yaml.tpl │ │ ├── controller.yaml.tpl │ │ └── worker.yaml.tpl │ ├── common.sh │ ├── create_devstack.sh │ ├── gce-project.sh │ ├── libvirt.sh │ └── openstack.sh ├── ensure-go.sh ├── ensure-kubectl.sh ├── ensure-kustomize.sh ├── ensure-trivy.sh ├── image-patch │ ├── kustomization.yaml │ └── pull-policy-patch.yaml ├── tools │ ├── .gitignore │ ├── Makefile │ ├── ensure-golangci-lint.sh │ ├── go.mod │ ├── go.sum │ ├── plantuml.Dockerfile │ └── tools.go ├── update-codegen.sh ├── verify-boilerplate.sh ├── verify-container-images.sh └── version.sh ├── internal └── util │ └── ssa │ └── applyconfigpatch.go ├── kustomize └── v1beta1 │ ├── default │ ├── cluster-template.yaml │ └── kustomization.yaml │ ├── flatcar-sysext │ ├── kustomization.yaml │ └── patch-flatcar.yaml │ ├── flatcar │ ├── kustomization.yaml │ └── patch-flatcar.yaml │ └── without-lb │ ├── kustomization.yaml │ └── patch-without-lb.yaml ├── main.go ├── metadata.yaml ├── netlify.toml ├── pkg ├── clients │ ├── compute.go │ ├── image.go │ ├── loadbalancer.go │ ├── mock │ │ ├── compute.go │ │ ├── doc.go │ │ ├── image.go │ │ ├── loadbalancer.go │ │ ├── network.go │ │ └── volume.go │ ├── networking.go │ └── volume.go ├── cloud │ └── services │ │ ├── compute │ │ ├── availabilityzone.go │ │ ├── instance.go │ │ ├── instance_test.go │ │ ├── instance_types.go │ │ ├── instance_types_test.go │ │ ├── referenced_resources.go │ │ ├── referenced_resources_test.go │ │ ├── server_resources.go │ │ ├── servergroup.go │ │ ├── servergroup_test.go │ │ └── service.go │ │ ├── loadbalancer │ │ ├── loadbalancer.go │ │ ├── loadbalancer_test.go │ │ └── service.go │ │ └── networking │ │ ├── floatingip.go │ │ ├── floatingip_test.go │ │ ├── network.go │ │ ├── network_test.go │ │ ├── port.go │ │ ├── port_test.go │ │ ├── router.go │ │ ├── router_test.go │ │ ├── securitygroups.go │ │ ├── securitygroups_rules.go │ │ ├── securitygroups_test.go │ │ ├── service.go │ │ ├── trunk.go │ │ └── trunk_test.go ├── generated │ ├── applyconfiguration │ │ ├── api │ │ │ ├── v1alpha1 │ │ │ │ ├── openstackserver.go │ │ │ │ ├── openstackserverspec.go │ │ │ │ ├── openstackserverstatus.go │ │ │ │ ├── resolvedserverspec.go │ │ │ │ └── serverresources.go │ │ │ └── v1beta1 │ │ │ │ ├── additionalblockdevice.go │ │ │ │ ├── addresspair.go │ │ │ │ ├── allocationpool.go │ │ │ │ ├── apiserverloadbalancer.go │ │ │ │ ├── bastion.go │ │ │ │ ├── bastionstatus.go │ │ │ │ ├── bindingprofile.go │ │ │ │ ├── blockdevicestorage.go │ │ │ │ ├── blockdevicevolume.go │ │ │ │ ├── externalrouteripparam.go │ │ │ │ ├── filterbyneutrontags.go │ │ │ │ ├── fixedip.go │ │ │ │ ├── imagefilter.go │ │ │ │ ├── imageparam.go │ │ │ │ ├── loadbalancer.go │ │ │ │ ├── machineresources.go │ │ │ │ ├── managedsecuritygroups.go │ │ │ │ ├── networkfilter.go │ │ │ │ ├── networkparam.go │ │ │ │ ├── networkstatus.go │ │ │ │ ├── networkstatuswithsubnets.go │ │ │ │ ├── openstackcluster.go │ │ │ │ ├── openstackclusterspec.go │ │ │ │ ├── openstackclusterstatus.go │ │ │ │ ├── openstackclustertemplate.go │ │ │ │ ├── openstackclustertemplateresource.go │ │ │ │ ├── openstackclustertemplatespec.go │ │ │ │ ├── openstackidentityreference.go │ │ │ │ ├── openstackmachine.go │ │ │ │ ├── openstackmachinespec.go │ │ │ │ ├── openstackmachinestatus.go │ │ │ │ ├── openstackmachinetemplate.go │ │ │ │ ├── openstackmachinetemplateresource.go │ │ │ │ ├── openstackmachinetemplatespec.go │ │ │ │ ├── portopts.go │ │ │ │ ├── portstatus.go │ │ │ │ ├── resolvedfixedip.go │ │ │ │ ├── resolvedmachinespec.go │ │ │ │ ├── resolvedportspec.go │ │ │ │ ├── resolvedportspecfields.go │ │ │ │ ├── resourcereference.go │ │ │ │ ├── rootvolume.go │ │ │ │ ├── router.go │ │ │ │ ├── routerfilter.go │ │ │ │ ├── routerparam.go │ │ │ │ ├── schedulerhintadditionalproperty.go │ │ │ │ ├── schedulerhintadditionalvalue.go │ │ │ │ ├── securitygroupfilter.go │ │ │ │ ├── securitygroupparam.go │ │ │ │ ├── securitygrouprulespec.go │ │ │ │ ├── securitygroupstatus.go │ │ │ │ ├── servergroupfilter.go │ │ │ │ ├── servergroupparam.go │ │ │ │ ├── servermetadata.go │ │ │ │ ├── subnet.go │ │ │ │ ├── subnetfilter.go │ │ │ │ ├── subnetparam.go │ │ │ │ ├── subnetspec.go │ │ │ │ ├── valuespec.go │ │ │ │ └── volumeavailabilityzone.go │ │ ├── internal │ │ │ └── internal.go │ │ └── utils.go │ ├── clientset │ │ └── clientset │ │ │ ├── clientset.go │ │ │ ├── fake │ │ │ ├── clientset_generated.go │ │ │ ├── doc.go │ │ │ └── register.go │ │ │ ├── scheme │ │ │ ├── doc.go │ │ │ └── register.go │ │ │ └── typed │ │ │ └── api │ │ │ ├── v1alpha1 │ │ │ ├── api_client.go │ │ │ ├── doc.go │ │ │ ├── fake │ │ │ │ ├── doc.go │ │ │ │ ├── fake_api_client.go │ │ │ │ └── fake_openstackserver.go │ │ │ ├── generated_expansion.go │ │ │ └── openstackserver.go │ │ │ └── v1beta1 │ │ │ ├── api_client.go │ │ │ ├── doc.go │ │ │ ├── fake │ │ │ ├── doc.go │ │ │ ├── fake_api_client.go │ │ │ ├── fake_openstackcluster.go │ │ │ ├── fake_openstackclustertemplate.go │ │ │ ├── fake_openstackmachine.go │ │ │ └── fake_openstackmachinetemplate.go │ │ │ ├── generated_expansion.go │ │ │ ├── openstackcluster.go │ │ │ ├── openstackclustertemplate.go │ │ │ ├── openstackmachine.go │ │ │ └── openstackmachinetemplate.go │ ├── informers │ │ └── externalversions │ │ │ ├── api │ │ │ ├── interface.go │ │ │ ├── v1alpha1 │ │ │ │ ├── interface.go │ │ │ │ └── openstackserver.go │ │ │ └── v1beta1 │ │ │ │ ├── interface.go │ │ │ │ ├── openstackcluster.go │ │ │ │ ├── openstackclustertemplate.go │ │ │ │ ├── openstackmachine.go │ │ │ │ └── openstackmachinetemplate.go │ │ │ ├── factory.go │ │ │ ├── generic.go │ │ │ └── internalinterfaces │ │ │ └── factory_interfaces.go │ └── listers │ │ └── api │ │ ├── v1alpha1 │ │ ├── expansion_generated.go │ │ └── openstackserver.go │ │ └── v1beta1 │ │ ├── expansion_generated.go │ │ ├── openstackcluster.go │ │ ├── openstackclustertemplate.go │ │ ├── openstackmachine.go │ │ └── openstackmachinetemplate.go ├── metrics │ └── metrics.go ├── record │ └── recorder.go ├── scope │ ├── hash.go │ ├── mock.go │ ├── provider.go │ └── scope.go ├── utils │ ├── controllers │ │ ├── controllers.go │ │ ├── controllers_test.go │ │ └── interface.go │ ├── conversion │ │ └── restore.go │ ├── conversioncommon │ │ └── volumeavailabilityzone.go │ ├── errors │ │ ├── errors.go │ │ └── terminal.go │ ├── filterconvert │ │ └── convert.go │ ├── ipam │ │ └── predicates.go │ ├── names │ │ └── names.go │ ├── objects │ │ └── gvk.go │ ├── openstack │ │ ├── loadbalancer.go │ │ ├── microversion.go │ │ └── microversion_test.go │ ├── optional │ │ ├── conversion.go │ │ └── types.go │ ├── orc │ │ └── identity_ref.go │ └── strings │ │ ├── strings.go │ │ └── strings_test.go └── webhooks │ ├── errors.go │ ├── fuzz_test.go │ ├── openstackcluster_webhook.go │ ├── openstackcluster_webhook_test.go │ ├── openstackclustertemplate_webhook.go │ ├── openstackmachine_webhook.go │ ├── openstackmachinetemplate_webhook.go │ ├── openstackmachinetemplate_webhook_test.go │ ├── openstackserver_webhook.go │ ├── openstackserver_webhook_test.go │ └── register.go ├── scripts ├── ci-apidiff.sh ├── ci-build.sh ├── ci-conformance.sh ├── ci-e2e.sh ├── ci-test.sh └── go_install.sh ├── templates ├── README.txt ├── cluster-template-development.yaml ├── cluster-template-flatcar-sysext.yaml ├── cluster-template-flatcar.yaml ├── cluster-template-without-lb.yaml ├── cluster-template.yaml ├── clusterclass-dev-test.yaml ├── create_cloud_conf.sh ├── env.rc ├── image-template-bastion.yaml └── image-template-node.yaml ├── test ├── e2e │ ├── data │ │ ├── ccm │ │ │ └── cloud-controller-manager.yaml │ │ ├── ci-artifacts-platform-kustomization.yaml │ │ ├── cni │ │ │ └── calico.yaml │ │ ├── e2e_conf.yaml │ │ ├── infrastructure-openstack-no-artifact │ │ │ └── .gitignore │ │ ├── infrastructure-openstack │ │ │ └── .gitignore │ │ ├── kubetest │ │ │ ├── conformance-fast.yaml │ │ │ └── conformance.yaml │ │ ├── kustomize │ │ │ ├── common-patches │ │ │ │ ├── ccm │ │ │ │ │ ├── ccm.yaml │ │ │ │ │ ├── kustomization.yaml │ │ │ │ │ ├── patch-ccm-cloud-config.yaml │ │ │ │ │ └── patch-ccm.yaml │ │ │ │ ├── cluster-prev1beta1 │ │ │ │ │ ├── kustomization.yaml │ │ │ │ │ └── patch-cluster.yaml │ │ │ │ ├── cluster │ │ │ │ │ ├── kustomization.yaml │ │ │ │ │ └── patch-cluster.yaml │ │ │ │ ├── cni │ │ │ │ │ ├── cni.yaml │ │ │ │ │ ├── kustomization.yaml │ │ │ │ │ └── patch-cni.yaml │ │ │ │ ├── externalNetworkByName │ │ │ │ │ └── kustomization.yaml │ │ │ │ ├── images-without-ref │ │ │ │ │ ├── images.yaml │ │ │ │ │ └── kustomization.yaml │ │ │ │ └── images │ │ │ │ │ ├── images.yaml │ │ │ │ │ └── kustomization.yaml │ │ │ ├── default │ │ │ │ └── kustomization.yaml │ │ │ ├── flatcar-sysext │ │ │ │ └── kustomization.yaml │ │ │ ├── flatcar │ │ │ │ └── kustomization.yaml │ │ │ ├── k8s-upgrade │ │ │ │ ├── kcp-patch.yaml │ │ │ │ ├── kustomization.yaml │ │ │ │ ├── md-patch.yaml │ │ │ │ ├── upgrade-from-template.yaml │ │ │ │ └── upgrade-to-template.yaml │ │ │ ├── kcp-remediation │ │ │ │ ├── kustomization.yaml │ │ │ │ └── mhc.yaml │ │ │ ├── md-remediation │ │ │ │ ├── kustomization.yaml │ │ │ │ ├── md.yaml │ │ │ │ └── mhc.yaml │ │ │ ├── multi-az │ │ │ │ ├── kustomization.yaml │ │ │ │ ├── patch-control-plane.yaml │ │ │ │ ├── patch-machine-deployment.yaml │ │ │ │ ├── patch-machine-template-control-plane.yaml │ │ │ │ └── patch-machine-template-worker.yaml │ │ │ ├── multi-network │ │ │ │ ├── kustomization.yaml │ │ │ │ └── patch-machine-template-networks.yaml │ │ │ ├── no-bastion │ │ │ │ ├── kustomization.yaml │ │ │ │ └── patch-no-bastion.yaml │ │ │ ├── upgrade-patches │ │ │ │ ├── ci-hack-kcp.yaml │ │ │ │ ├── ci-hack-kct.yaml │ │ │ │ └── kustomization.yaml │ │ │ ├── with-tags │ │ │ │ ├── kustomization.yaml │ │ │ │ ├── patch-cluster.yaml │ │ │ │ ├── patch-machine-template-control-plane.yaml │ │ │ │ └── patch-machine-template-worker.yaml │ │ │ └── without-lb │ │ │ │ └── kustomization.yaml │ │ └── shared │ │ │ ├── openstack-resource-controller │ │ │ └── metadata.yaml │ │ │ ├── v1beta1 │ │ │ └── metadata.yaml │ │ │ └── v1beta1_provider │ │ │ └── metadata.yaml │ ├── shared │ │ ├── cluster.go │ │ ├── common.go │ │ ├── context.go │ │ ├── defaults.go │ │ ├── exec.go │ │ ├── exec_test.go │ │ ├── images.go │ │ ├── openstack.go │ │ ├── openstack_test.go │ │ └── suite.go │ └── suites │ │ ├── apivalidations │ │ ├── filters_test.go │ │ ├── openstackcluster_test.go │ │ ├── openstackmachine_test.go │ │ ├── openstackserver_test.go │ │ └── suite_test.go │ │ ├── conformance │ │ ├── conformance_suite_test.go │ │ └── conformance_test.go │ │ └── e2e │ │ ├── clusterctl_upgrade_test.go │ │ ├── e2e_suite_test.go │ │ ├── e2e_test.go │ │ ├── idmatcher_test.go │ │ ├── remediations_test.go │ │ └── self_hosted_test.go ├── helpers │ ├── external │ │ └── cluster.go │ ├── fuzz_mutate.go │ ├── fuzz_restorer.go │ └── fuzzerfuncs.go └── infrastructure │ └── openstack-resource-controller │ └── config │ └── default │ └── kustomization.yaml ├── tilt-provider.json ├── version └── version.go └── versions.mk /.dockerignore: -------------------------------------------------------------------------------- 1 | .git 2 | .github 3 | .vscode 4 | _artifacts 5 | bin/ 6 | config/ 7 | docs/ 8 | hack/ 9 | out/ 10 | scripts/ 11 | templates/ 12 | tmp/ 13 | **/.md 14 | tilt-provider.json 15 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Tell GitHub about generated files 2 | 3 | # deepcopy and conversion-gen 4 | zz_generated.* linguist-generated=true 5 | 6 | # Generated parts of manifests 7 | /config/crd/bases/infrastructure.cluster.x-k8s.io_*.yaml linguist-generated=true 8 | /config/webhook/manifests.yaml linguist-generated=true 9 | /config/rbac/role.yaml linguist-generated=true 10 | 11 | # Generated API docs 12 | /docs/book/src/api/*/** linguist-generated=true 13 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Tell us about a problem you are experiencing 4 | 5 | --- 6 | 7 | /kind bug 8 | 9 | **What steps did you take and what happened:** 10 | [A clear and concise description of what the bug is.] 11 | 12 | 13 | **What did you expect to happen:** 14 | 15 | 16 | **Anything else you would like to add:** 17 | [Miscellaneous information that will assist in solving the issue.] 18 | 19 | 20 | **Environment:** 21 | 22 | - Cluster API Provider OpenStack version (Or `git rev-parse HEAD` if manually built): 23 | - Cluster-API version: 24 | - OpenStack version: 25 | - Minikube/KIND version: 26 | - Kubernetes version (use `kubectl version`): 27 | - OS (e.g. from `/etc/os-release`): 28 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature enhancement request 3 | about: Suggest an idea for this project 4 | 5 | --- 6 | 7 | /kind feature 8 | 9 | **Describe the solution you'd like** 10 | [A clear and concise description of what you want to happen.] 11 | 12 | 13 | **Anything else you would like to add:** 14 | [Miscellaneous information that will assist in solving the issue.] 15 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | **What this PR does / why we need it**: 5 | 6 | **Which issue(s) this PR fixes** *(optional, in `fixes #(, fixes #, ...)` format, will close the issue(s) when PR gets merged)*: 7 | Fixes # 8 | 9 | **Special notes for your reviewer**: 10 | 11 | 1. Please confirm that if this PR changes any image versions, then that's the sole change this PR makes. 12 | 13 | **TODOs**: 14 | 15 | 16 | - [ ] squashed commits 17 | - if necessary: 18 | - [ ] includes documentation 19 | - [ ] adds unit tests 20 | 21 | /hold 22 | -------------------------------------------------------------------------------- /.github/workflows/pr-dependabot.yaml: -------------------------------------------------------------------------------- 1 | name: PR dependabot code generation and go modules fix 2 | 3 | # This action runs on other PRs opened by dependabot. It updates modules and generated code on PRs opened by dependabot. 4 | on: 5 | pull_request: 6 | branches: 7 | - dependabot/** 8 | push: 9 | branches: 10 | - dependabot/** 11 | workflow_dispatch: 12 | 13 | permissions: 14 | contents: write # Allow to update the PR. 15 | 16 | jobs: 17 | build: 18 | name: Build 19 | runs-on: ubuntu-latest 20 | steps: 21 | - name: Check out code into the Go module directory 22 | uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # tag=v4.2.2 23 | - name: Calculate go version 24 | id: vars 25 | run: echo "go_version=$(make go-version)" >> $GITHUB_OUTPUT 26 | - name: Set up Go 27 | uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # tag=v5.5.0 28 | with: 29 | go-version: ${{ steps.vars.outputs.go_version }} 30 | - uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # tag=v4.2.3 31 | name: Restore go cache 32 | with: 33 | path: | 34 | ~/.cache/go-build 35 | ~/go/pkg/mod 36 | key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} 37 | restore-keys: | 38 | ${{ runner.os }}-go- 39 | - name: Update all modules 40 | run: make modules 41 | - name: Update generated code 42 | run: make generate 43 | - uses: EndBug/add-and-commit@a94899bca583c204427a224a7af87c02f9b325d5 # tag=v9.1.4 44 | name: Commit changes 45 | with: 46 | author_name: dependabot[bot] 47 | author_email: 49699333+dependabot[bot]@users.noreply.github.com 48 | default_author: github_actor 49 | message: 'Update generated code' -------------------------------------------------------------------------------- /.github/workflows/release.yaml: -------------------------------------------------------------------------------- 1 | name: release 2 | 3 | on: 4 | push: 5 | # Sequence of patterns matched against refs/tags 6 | tags: 7 | - 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10 8 | 9 | permissions: 10 | contents: write # Allow to create a release. 11 | 12 | jobs: 13 | build: 14 | name: create draft release 15 | runs-on: ubuntu-latest 16 | steps: 17 | - name: Set env 18 | run: echo "RELEASE_TAG=${GITHUB_REF:10}" >> $GITHUB_ENV 19 | - name: checkout code 20 | uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # tag=v4.2.2 21 | with: 22 | fetch-depth: 0 23 | - name: Calculate go version 24 | run: echo "go_version=$(make go-version)" >> $GITHUB_ENV 25 | - name: Set up Go 26 | uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # tag=v5.5.0 27 | with: 28 | go-version: ${{ env.go_version }} 29 | - name: generate release artifacts 30 | run: | 31 | make release 32 | - name: generate release notes 33 | # Ignore failures for release-notes generation so they could still get 34 | # generated manually before publishing. 35 | run: | 36 | make generate-release-notes || echo "Failed to generate release notes" >> _releasenotes/${{ env.RELEASE_TAG }}.md 37 | env: 38 | GH_TOKEN: ${{ github.token }} 39 | - name: Release 40 | uses: softprops/action-gh-release@da05d552573ad5aba039eaac05058a918a7bf631 # tag=v2.2.2 41 | with: 42 | draft: true 43 | files: out/* 44 | body_path: _releasenotes/${{ env.RELEASE_TAG }}.md 45 | -------------------------------------------------------------------------------- /.github/workflows/security-scan.yaml: -------------------------------------------------------------------------------- 1 | name: Weekly security scan 2 | 3 | on: 4 | schedule: 5 | # Cron for every Monday at 9:12 UTC. 6 | - cron: "12 9 * * 1" 7 | 8 | # Remove all permissions from GITHUB_TOKEN except metadata. 9 | permissions: {} 10 | 11 | jobs: 12 | scan: 13 | strategy: 14 | fail-fast: false 15 | matrix: 16 | branch: [main, release-0.12, release-0.11] 17 | name: Trivy 18 | runs-on: ubuntu-latest 19 | steps: 20 | - name: Check out code 21 | uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # tag=v4.2.2 22 | with: 23 | ref: ${{ matrix.branch }} 24 | - name: Calculate go version 25 | id: vars 26 | run: echo "go_version=$(make go-version)" >> $GITHUB_OUTPUT 27 | - name: Set up Go 28 | uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # tag=v5.5.0 29 | with: 30 | go-version: ${{ steps.vars.outputs.go_version }} 31 | - name: Run verify security target 32 | run: make verify-security 33 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | # Copyright 2023 The Kubernetes Authors. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | # Build the manager binary 16 | ARG GO_VERSION 17 | FROM golang:${GO_VERSION} AS builder 18 | WORKDIR /workspace 19 | 20 | # Run this with docker build --build_arg goproxy=$(go env GOPROXY) to override the goproxy 21 | ARG goproxy=https://proxy.golang.org 22 | ENV GOPROXY=$goproxy 23 | 24 | # Copy the Go Modules manifests 25 | COPY go.mod go.mod 26 | COPY go.sum go.sum 27 | 28 | # Cache deps before building and copying source so that we don't need to re-download as much 29 | # and so that source changes don't invalidate our downloaded layer 30 | RUN --mount=type=cache,target=/go/pkg/mod \ 31 | go mod download 32 | 33 | # Copy the sources 34 | COPY ./ ./ 35 | 36 | # Build 37 | ARG package=. 38 | ARG ARCH 39 | ARG ldflags 40 | 41 | # Do not force rebuild of up-to-date packages (do not use -a) and use the compiler cache folder 42 | RUN --mount=type=cache,target=/root/.cache/go-build \ 43 | --mount=type=cache,target=/go/pkg/mod \ 44 | CGO_ENABLED=0 GOOS=linux GOARCH=${ARCH} \ 45 | go build -ldflags "${ldflags} -extldflags '-static'" \ 46 | -o manager ${package} 47 | 48 | # Production image 49 | FROM gcr.io/distroless/static:nonroot 50 | WORKDIR / 51 | COPY --from=builder /workspace/manager . 52 | # Use uid of nonroot user (65532) because kubernetes expects numeric user when applying pod security policies 53 | USER 65532 54 | ENTRYPOINT ["/manager"] 55 | -------------------------------------------------------------------------------- /OWNERS: -------------------------------------------------------------------------------- 1 | # See the OWNERS docs: https://git.k8s.io/community/contributors/guide/owners.md 2 | 3 | approvers: 4 | - sig-cluster-lifecycle-leads 5 | - cluster-api-openstack-maintainers 6 | 7 | reviewers: 8 | - cluster-api-openstack-maintainers 9 | - cluster-api-openstack-reviewers 10 | 11 | emeritus_approvers: 12 | - ncdc 13 | - chaosaffe 14 | - chrigl 15 | - dims 16 | - gyliu513 17 | - Lion-Wei 18 | - m1093782566 19 | - sbueringer 20 | - hidekazuna 21 | - chrischdi 22 | - tobiasgiese 23 | - seanschneeweiss 24 | -------------------------------------------------------------------------------- /OWNERS_ALIASES: -------------------------------------------------------------------------------- 1 | # See the OWNERS docs: https://git.k8s.io/community/contributors/guide/owners.md 2 | # 3 | # When making changes to this file, also consider if you need to update: 4 | # - https://github.com/kubernetes/org/blob/main/config/kubernetes-sigs/sig-cluster-lifecycle/teams.yaml 5 | # - https://github.com/kubernetes/test-infra/blob/master/OWNERS_ALIASES 6 | # - https://github.com/kubernetes/k8s.io/blob/main/groups/sig-architecture/groups.yaml 7 | # - https://github.com/kubernetes/k8s.io/blob/main/groups/sig-cluster-lifecycle/groups.yaml 8 | 9 | aliases: 10 | # sig-cluster-lifecycle-leads are included as approvers in case it's ever 11 | # operationally expedient: 12 | # Source: 13 | # https://github.com/kubernetes/org/blob/main/config/kubernetes/sig-cluster-lifecycle/teams.yaml 14 | # correct as of 2023/05/10 15 | sig-cluster-lifecycle-leads: 16 | - CecileRobertMichon 17 | - fabriziopandini 18 | - justinsb 19 | - neolit123 20 | - vincepri 21 | cluster-api-openstack-maintainers: 22 | - emilienm 23 | - lentzi90 24 | - mdbooth 25 | cluster-api-openstack-reviewers: 26 | cluster-api-openstack-emeritus-maintainers: 27 | - jichenjc 28 | -------------------------------------------------------------------------------- /PROJECT: -------------------------------------------------------------------------------- 1 | # Code generated by tool. DO NOT EDIT. 2 | # This file is used to track the info used to scaffold your project 3 | # and allow the plugins properly work. 4 | # More info: https://book.kubebuilder.io/reference/project-config.html 5 | domain: cluster.x-k8s.io 6 | repo: sigs.k8s.io/cluster-api-provider-openstack 7 | resources: 8 | - group: infrastructure 9 | kind: OpenStackCluster 10 | version: v1beta1 11 | - group: infrastructure 12 | kind: OpenStackMachine 13 | version: v1beta1 14 | - group: infrastructure 15 | kind: OpenStackMachineTemplate 16 | version: v1beta1 17 | - group: infrastructure 18 | kind: OpenStackClusterTemplate 19 | version: v1beta1 20 | - group: infrastructure 21 | kind: OpenStackFloatingIPPool 22 | version: v1alpha1 23 | - group: infrastructure 24 | kind: OpenStackServer 25 | version: v1alpha1 26 | - group: infrastructure 27 | version: "2" 28 | -------------------------------------------------------------------------------- /SECURITY_CONTACTS: -------------------------------------------------------------------------------- 1 | # Defined below are the security contacts for this repo. 2 | # 3 | # They are the contact point for the Product Security Committee to reach out 4 | # to for triaging and handling of incoming issues. 5 | # 6 | # The below names agree to abide by the 7 | # [Embargo Policy](https://git.k8s.io/security/private-distributors-list.md#embargo-policy) 8 | # and will be removed and replaced if they violate that agreement. 9 | # 10 | # DO NOT REPORT SECURITY VULNERABILITIES DIRECTLY TO THESE NAMES, FOLLOW THE 11 | # INSTRUCTIONS AT https://kubernetes.io/security/ 12 | 13 | justinsb 14 | luxas 15 | timothysc 16 | -------------------------------------------------------------------------------- /api/v1alpha1/conditions_consts.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2023 The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package v1alpha1 18 | 19 | type ServerStatusError string 20 | 21 | const ( 22 | // OpenstackFloatingIPPoolReadyCondition reports on the current status of the floating ip pool. Ready indicates that the pool is ready to be used. 23 | OpenstackFloatingIPPoolReadyCondition = "OpenstackFloatingIPPoolReadyCondition" 24 | 25 | // MaxIPsReachedReason is set when the maximum number of floating IPs has been reached. 26 | MaxIPsReachedReason = "MaxIPsReached" 27 | 28 | // UnableToFindFloatingIPNetworkReason is used when the floating ip network is not found. 29 | UnableToFindNetwork = "UnableToFindNetwork" 30 | 31 | CreateServerError ServerStatusError = "CreateError" 32 | ) 33 | -------------------------------------------------------------------------------- /api/v1alpha1/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2023 The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // package v1alpha1 contains API Schema definitions for the infrastructure v1alpha1 API group 18 | // +kubebuilder:object:generate=true 19 | // +groupName=infrastructure.cluster.x-k8s.io 20 | // +k8s:openapi-gen=true 21 | package v1alpha1 22 | -------------------------------------------------------------------------------- /api/v1alpha1/groupversion_info.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2023 The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // package v1alpha1 contains API Schema definitions for the infrastructure v1alpha1 API group 18 | // +kubebuilder:object:generate=true 19 | // +groupName=infrastructure.cluster.x-k8s.io 20 | package v1alpha1 21 | 22 | import ( 23 | "k8s.io/apimachinery/pkg/runtime/schema" 24 | "sigs.k8s.io/controller-runtime/pkg/scheme" 25 | ) 26 | 27 | // GroupName is the group name use in this package. 28 | const GroupName = "infrastructure.cluster.x-k8s.io" 29 | 30 | // SchemeGroupVersion is group version used to register these objects. 31 | var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1alpha1"} 32 | 33 | // Resource takes an unqualified resource and returns a Group qualified GroupResource. 34 | func Resource(resource string) schema.GroupResource { 35 | return SchemeGroupVersion.WithResource(resource).GroupResource() 36 | } 37 | 38 | var ( 39 | // SchemeBuilder is used to add go types to the GroupVersionKind scheme. 40 | SchemeBuilder = &scheme.Builder{GroupVersion: SchemeGroupVersion} 41 | 42 | // AddToScheme adds the types in this group-version to the given scheme. 43 | AddToScheme = SchemeBuilder.AddToScheme 44 | ) 45 | -------------------------------------------------------------------------------- /api/v1alpha1/types.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2024 The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package v1alpha1 18 | 19 | import ( 20 | infrav1 "sigs.k8s.io/cluster-api-provider-openstack/api/v1beta1" 21 | ) 22 | 23 | // ResolvedServerSpec contains resolved references to resources required by the server. 24 | type ResolvedServerSpec struct { 25 | // ServerGroupID is the ID of the server group the server should be added to and is calculated based on ServerGroupFilter. 26 | // +optional 27 | ServerGroupID string `json:"serverGroupID,omitempty"` 28 | 29 | // ImageID is the ID of the image to use for the server and is calculated based on ImageFilter. 30 | // +optional 31 | ImageID string `json:"imageID,omitempty"` 32 | 33 | // FlavorID is the ID of the flavor to use. 34 | // +optional 35 | FlavorID string `json:"flavorID,omitempty"` 36 | 37 | // Ports is the fully resolved list of ports to create for the server. 38 | // +optional 39 | Ports []infrav1.ResolvedPortSpec `json:"ports,omitempty"` 40 | } 41 | 42 | // ServerResources contains references to OpenStack resources created for the server. 43 | type ServerResources struct { 44 | // Ports is the status of the ports created for the server. 45 | // +optional 46 | Ports []infrav1.PortStatus `json:"ports,omitempty"` 47 | } 48 | -------------------------------------------------------------------------------- /api/v1beta1/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2023 The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Package v1beta1 contains API Schema definitions for the infrastructure v1beta1 API group. 18 | // +kubebuilder:object:generate=true 19 | // +groupName=infrastructure.cluster.x-k8s.io 20 | // +k8s:openapi-gen=true 21 | package v1beta1 22 | -------------------------------------------------------------------------------- /api/v1beta1/groupversion_info.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2023 The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // package v1beta1 contains API Schema definitions for the infrastructure v1beta1 API group 18 | // +kubebuilder:object:generate=true 19 | // +groupName=infrastructure.cluster.x-k8s.io 20 | package v1beta1 21 | 22 | import ( 23 | metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" 24 | "k8s.io/apimachinery/pkg/runtime" 25 | "k8s.io/apimachinery/pkg/runtime/schema" 26 | ) 27 | 28 | // GroupName is the group name use in this package. 29 | const GroupName = "infrastructure.cluster.x-k8s.io" 30 | 31 | // SchemeGroupVersion is group version used to register these objects. 32 | var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1beta1"} 33 | 34 | // Resource takes an unqualified resource and returns a Group qualified GroupResource. 35 | func Resource(resource string) schema.GroupResource { 36 | return SchemeGroupVersion.WithResource(resource).GroupResource() 37 | } 38 | 39 | var ( 40 | // schemeBuilder is used to add go types to the GroupVersionKind scheme. 41 | schemeBuilder = runtime.NewSchemeBuilder(addKnownTypes) 42 | 43 | // AddToScheme adds the types in this group-version to the given scheme. 44 | AddToScheme = schemeBuilder.AddToScheme 45 | 46 | objectTypes = []runtime.Object{} 47 | ) 48 | 49 | func addKnownTypes(scheme *runtime.Scheme) error { 50 | scheme.AddKnownTypes(SchemeGroupVersion, objectTypes...) 51 | metav1.AddToGroupVersion(scheme, SchemeGroupVersion) 52 | return nil 53 | } 54 | -------------------------------------------------------------------------------- /api/v1beta1/identity_types.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2023 The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package v1beta1 18 | 19 | // OpenStackIdentityReference is a reference to an infrastructure 20 | // provider identity to be used to provision cluster resources. 21 | // +kubebuilder:validation:XValidation:rule="(!has(self.region) && !has(oldSelf.region)) || self.region == oldSelf.region",message="region is immutable" 22 | type OpenStackIdentityReference struct { 23 | // Name is the name of a secret in the same namespace as the resource being provisioned. 24 | // The secret must contain a key named `clouds.yaml` which contains an OpenStack clouds.yaml file. 25 | // The secret may optionally contain a key named `cacert` containing a PEM-encoded CA certificate. 26 | // +kubebuilder:validation:Required 27 | Name string `json:"name"` 28 | 29 | // CloudName specifies the name of the entry in the clouds.yaml file to use. 30 | // +kubebuilder:validation:Required 31 | CloudName string `json:"cloudName"` 32 | 33 | // Region specifies an OpenStack region to use. If specified, it overrides 34 | // any value in clouds.yaml. If specified for an OpenStackMachine, its 35 | // value will be included in providerID. 36 | // +optional 37 | Region string `json:"region,omitempty"` 38 | } 39 | 40 | // IdentityRefProvider is an interface for obtaining OpenStack credentials from an API object 41 | // +kubebuilder:object:generate:=false 42 | type IdentityRefProvider interface { 43 | // GetIdentifyRef returns the object's namespace and IdentityRef if it has an IdentityRef, or nulls if it does not 44 | GetIdentityRef() (*string, *OpenStackIdentityReference) 45 | } 46 | -------------------------------------------------------------------------------- /api/v1beta1/openstackclustertemplate_types.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2023 The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package v1beta1 18 | 19 | import ( 20 | metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" 21 | ) 22 | 23 | // OpenStackClusterTemplateResource describes the data needed to create a OpenStackCluster from a template. 24 | type OpenStackClusterTemplateResource struct { 25 | Spec OpenStackClusterSpec `json:"spec"` 26 | } 27 | 28 | // OpenStackClusterTemplateSpec defines the desired state of OpenStackClusterTemplate. 29 | type OpenStackClusterTemplateSpec struct { 30 | Template OpenStackClusterTemplateResource `json:"template"` 31 | } 32 | 33 | // +genclient 34 | // +kubebuilder:object:root=true 35 | // +kubebuilder:storageversion 36 | // +kubebuilder:resource:path=openstackclustertemplates,scope=Namespaced,categories=cluster-api,shortName=osct 37 | 38 | // OpenStackClusterTemplate is the Schema for the openstackclustertemplates API. 39 | type OpenStackClusterTemplate struct { 40 | metav1.TypeMeta `json:",inline"` 41 | metav1.ObjectMeta `json:"metadata,omitempty"` 42 | 43 | Spec OpenStackClusterTemplateSpec `json:"spec,omitempty"` 44 | } 45 | 46 | //+kubebuilder:object:root=true 47 | 48 | // OpenStackClusterTemplateList contains a list of OpenStackClusterTemplate. 49 | type OpenStackClusterTemplateList struct { 50 | metav1.TypeMeta `json:",inline"` 51 | metav1.ListMeta `json:"metadata,omitempty"` 52 | Items []OpenStackClusterTemplate `json:"items"` 53 | } 54 | 55 | func init() { 56 | objectTypes = append(objectTypes, &OpenStackClusterTemplate{}, &OpenStackClusterTemplateList{}) 57 | } 58 | -------------------------------------------------------------------------------- /api/v1beta1/openstackmachinetemplate_types.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2023 The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package v1beta1 18 | 19 | import ( 20 | metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" 21 | ) 22 | 23 | // OpenStackMachineTemplateSpec defines the desired state of OpenStackMachineTemplate. 24 | type OpenStackMachineTemplateSpec struct { 25 | Template OpenStackMachineTemplateResource `json:"template"` 26 | } 27 | 28 | // +genclient 29 | // +kubebuilder:object:root=true 30 | // +kubebuilder:storageversion 31 | // +kubebuilder:resource:path=openstackmachinetemplates,scope=Namespaced,categories=cluster-api,shortName=osmt 32 | 33 | // OpenStackMachineTemplate is the Schema for the openstackmachinetemplates API. 34 | type OpenStackMachineTemplate struct { 35 | metav1.TypeMeta `json:",inline"` 36 | metav1.ObjectMeta `json:"metadata,omitempty"` 37 | 38 | Spec OpenStackMachineTemplateSpec `json:"spec,omitempty"` 39 | } 40 | 41 | // +kubebuilder:object:root=true 42 | 43 | // OpenStackMachineTemplateList contains a list of OpenStackMachineTemplate. 44 | type OpenStackMachineTemplateList struct { 45 | metav1.TypeMeta `json:",inline"` 46 | metav1.ListMeta `json:"metadata,omitempty"` 47 | Items []OpenStackMachineTemplate `json:"items"` 48 | } 49 | 50 | func init() { 51 | objectTypes = append(objectTypes, &OpenStackMachineTemplate{}, &OpenStackMachineTemplateList{}) 52 | } 53 | -------------------------------------------------------------------------------- /cloudbuild-nightly.yaml: -------------------------------------------------------------------------------- 1 | # See https://cloud.google.com/cloud-build/docs/build-config 2 | timeout: 1800s 3 | options: 4 | substitution_option: ALLOW_LOOSE 5 | machineType: 'N1_HIGHCPU_8' 6 | steps: 7 | - name: 'gcr.io/k8s-staging-test-infra/gcb-docker-gcloud:v20241229-5dc092c636' 8 | entrypoint: make 9 | env: 10 | - DOCKER_CLI_EXPERIMENTAL=enabled 11 | - TAG=$_GIT_TAG 12 | - PULL_BASE_REF=$_PULL_BASE_REF 13 | - DOCKER_BUILDKIT=1 14 | args: 15 | - release-staging-nightly 16 | substitutions: 17 | # _GIT_TAG will be filled with a git-based tag for the image, of the form vYYYYMMDD-hash, and 18 | # can be used as a substitution 19 | _GIT_TAG: '12345' 20 | _PULL_BASE_REF: 'dev' 21 | -------------------------------------------------------------------------------- /cloudbuild.yaml: -------------------------------------------------------------------------------- 1 | # See https://cloud.google.com/cloud-build/docs/build-config 2 | timeout: 1800s 3 | options: 4 | substitution_option: ALLOW_LOOSE 5 | machineType: 'N1_HIGHCPU_8' 6 | steps: 7 | # To check if the image can handle the build, you can try it like this: 8 | # docker run --rm -it -v $(pwd):/workspace gcr.io/k8s-staging-test-infra/gcb-docker-gcloud:${TAG} 9 | # make clean # make sure we have something to build 10 | # make staging-manifests 11 | - name: 'gcr.io/k8s-staging-test-infra/gcb-docker-gcloud:v20250116-2a05ea7e3d' 12 | entrypoint: make 13 | env: 14 | - DOCKER_CLI_EXPERIMENTAL=enabled 15 | - TAG=$_GIT_TAG 16 | - PULL_BASE_REF=$_PULL_BASE_REF 17 | - DOCKER_BUILDKIT=1 18 | args: 19 | - release-staging 20 | substitutions: 21 | # _GIT_TAG will be filled with a git-based tag for the image, of the form vYYYYMMDD-hash, and 22 | # can be used as a substitution 23 | _GIT_TAG: '12345' 24 | _PULL_BASE_REF: 'dev' 25 | -------------------------------------------------------------------------------- /clusterctl-settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "infrastructure-openstack", 3 | "config": { 4 | "componentsFile": "infrastructure-components.yaml", 5 | "nextVersion": "v1.0.0" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /code-of-conduct.md: -------------------------------------------------------------------------------- 1 | # Kubernetes Community Code of Conduct 2 | 3 | Please refer to our [Kubernetes Community Code of Conduct](https://git.k8s.io/community/code-of-conduct.md) 4 | -------------------------------------------------------------------------------- /common.mk: -------------------------------------------------------------------------------- 1 | # Copyright 2020 The Kubernetes Authors. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | include $(ROOT_DIR_RELATIVE)/versions.mk 16 | 17 | # Ensure Make is run with bash shell as some syntax below is bash-specific 18 | SHELL:=bash 19 | .ONESHELL: 20 | .SHELLFLAGS := -eu -o pipefail -c 21 | .DELETE_ON_ERROR: 22 | MAKEFLAGS += --no-builtin-rules 23 | 24 | TOOLS_DIR := $(ROOT_DIR_RELATIVE)/hack/tools 25 | TOOLS_DIR_DEPS := $(TOOLS_DIR)/go.sum $(TOOLS_DIR)/go.mod $(TOOLS_DIR)/Makefile 26 | TOOLS_BIN_DIR := $(TOOLS_DIR)/bin 27 | UID := $(shell id -u) 28 | GID := $(shell id -g) 29 | 30 | rwildcard=$(foreach d,$(wildcard $(1:=/*)),$(call rwildcard,$d,$2) $(filter $(subst *,%,$2),$d)) 31 | 32 | # Hosts running SELinux need :z added to volume mounts 33 | SELINUX_ENABLED := $(shell cat /sys/fs/selinux/enforce 2> /dev/null || echo 0) 34 | 35 | ifeq ($(SELINUX_ENABLED),1) 36 | DOCKER_VOL_OPTS?=:z 37 | endif 38 | 39 | .DEFAULT_GOAL:=help 40 | 41 | # Use GOPROXY environment variable if set 42 | GOPROXY := $(shell go env GOPROXY) 43 | ifeq ($(GOPROXY),) 44 | GOPROXY := https://proxy.golang.org 45 | endif 46 | export GOPROXY 47 | 48 | $(TOOLS_BIN_DIR)/%: $(TOOLS_DIR_DEPS) 49 | $(MAKE) -C $(TOOLS_DIR) $(subst $(TOOLS_DIR)/,,$@) 50 | 51 | ## -------------------------------------- 52 | ##@ Help 53 | ## -------------------------------------- 54 | 55 | help: ## Display this help 56 | @awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m\033[0m\n"} /^[a-zA-Z0-9_-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST) 57 | -------------------------------------------------------------------------------- /config/certmanager/certificate.yaml: -------------------------------------------------------------------------------- 1 | # The following manifests contain a self-signed issuer CR and a certificate CR. 2 | # More document can be found at https://docs.cert-manager.io 3 | apiVersion: cert-manager.io/v1 4 | kind: Issuer 5 | metadata: 6 | name: selfsigned-issuer 7 | namespace: system 8 | spec: 9 | selfSigned: {} 10 | --- 11 | apiVersion: cert-manager.io/v1 12 | kind: Certificate 13 | metadata: 14 | name: serving-cert # this name should match the one appeared in kustomizeconfig.yaml 15 | namespace: system 16 | spec: 17 | # SERVICE_NAME and SERVICE_NAMESPACE will be substituted by kustomize 18 | dnsNames: 19 | - SERVICE_NAME.SERVICE_NAMESPACE.svc 20 | - SERVICE_NAME.SERVICE_NAMESPACE.svc.cluster.local 21 | issuerRef: 22 | kind: Issuer 23 | name: selfsigned-issuer 24 | secretName: SERVICE_NAME-cert # this secret will not be prefixed, since it's not managed by kustomize 25 | -------------------------------------------------------------------------------- /config/certmanager/kustomization.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: kustomize.config.k8s.io/v1beta1 2 | kind: Kustomization 3 | resources: 4 | - certificate.yaml 5 | 6 | configurations: 7 | - kustomizeconfig.yaml 8 | -------------------------------------------------------------------------------- /config/certmanager/kustomizeconfig.yaml: -------------------------------------------------------------------------------- 1 | # This configuration is for teaching kustomize how to update name ref and var substitution 2 | nameReference: 3 | - kind: Issuer 4 | group: cert-manager.io 5 | fieldSpecs: 6 | - kind: Certificate 7 | group: cert-manager.io 8 | path: spec/issuerRef/name 9 | 10 | varReference: 11 | - kind: Certificate 12 | group: cert-manager.io 13 | path: spec/commonName 14 | - kind: Certificate 15 | group: cert-manager.io 16 | path: spec/dnsNames 17 | - kind: Certificate 18 | group: cert-manager.io 19 | path: spec/secretName 20 | -------------------------------------------------------------------------------- /config/crd/kustomization.yaml: -------------------------------------------------------------------------------- 1 | commonLabels: 2 | cluster.x-k8s.io/v1beta1: v1beta1 3 | 4 | # This kustomization.yaml is not intended to be run by itself, 5 | # since it depends on service name and namespace that are out of this kustomize package. 6 | # It should be run by config/ 7 | resources: 8 | - bases/infrastructure.cluster.x-k8s.io_openstackclusters.yaml 9 | - bases/infrastructure.cluster.x-k8s.io_openstackmachines.yaml 10 | - bases/infrastructure.cluster.x-k8s.io_openstackmachinetemplates.yaml 11 | - bases/infrastructure.cluster.x-k8s.io_openstackclustertemplates.yaml 12 | - bases/infrastructure.cluster.x-k8s.io_openstackfloatingippools.yaml 13 | - bases/infrastructure.cluster.x-k8s.io_openstackservers.yaml 14 | # +kubebuilder:scaffold:crdkustomizeresource 15 | 16 | patches: 17 | # [WEBHOOK] To enable webhook, uncomment all the sections with [WEBHOOK] prefix. 18 | # patches here are for enabling the conversion webhook for each CRD 19 | - path: patches/webhook_in_openstackclusters.yaml 20 | - path: patches/webhook_in_openstackmachines.yaml 21 | - path: patches/webhook_in_openstackmachinetemplates.yaml 22 | - path: patches/webhook_in_openstackclustertemplates.yaml 23 | #- patches/webhook_in_openstackfloatingippools.yaml 24 | # +kubebuilder:scaffold:crdkustomizewebhookpatch 25 | 26 | # the following config is for teaching kustomize how to do kustomization for CRDs. 27 | configurations: 28 | - kustomizeconfig.yaml 29 | -------------------------------------------------------------------------------- /config/crd/kustomizeconfig.yaml: -------------------------------------------------------------------------------- 1 | # This file is for teaching kustomize how to substitute name and namespace reference in CRD 2 | nameReference: 3 | - kind: Service 4 | version: v1 5 | fieldSpecs: 6 | - kind: CustomResourceDefinition 7 | group: apiextensions.k8s.io 8 | path: spec/conversion/webhook/clientConfig/service/name 9 | 10 | namespace: 11 | - kind: CustomResourceDefinition 12 | group: apiextensions.k8s.io 13 | path: spec/conversion/webhook/clientConfig/service/namespace 14 | create: false 15 | 16 | varReference: 17 | - path: metadata/annotations 18 | -------------------------------------------------------------------------------- /config/crd/patches/cainjection_in_openstackfloatingippools.yaml: -------------------------------------------------------------------------------- 1 | # The following patch adds a directive for certmanager to inject CA into the CRD 2 | # CRD conversion requires k8s 1.13 or later. 3 | apiVersion: apiextensions.k8s.io/v1beta1 4 | kind: CustomResourceDefinition 5 | metadata: 6 | annotations: 7 | cert-manager.io/inject-ca-from: $(CERTIFICATE_NAMESPACE)/$(CERTIFICATE_NAME) 8 | name: openstackfloatingippools.infrastructure.cluster.x-k8s.io 9 | -------------------------------------------------------------------------------- /config/crd/patches/webhook_in_openstackclusters.yaml: -------------------------------------------------------------------------------- 1 | # The following patch enables conversion webhook for CRD 2 | # CRD conversion requires k8s 1.13 or later. 3 | apiVersion: apiextensions.k8s.io/v1 4 | kind: CustomResourceDefinition 5 | metadata: 6 | name: openstackclusters.infrastructure.cluster.x-k8s.io 7 | spec: 8 | conversion: 9 | strategy: Webhook 10 | webhook: 11 | conversionReviewVersions: ["v1", "v1beta1"] 12 | clientConfig: 13 | service: 14 | namespace: system 15 | name: webhook-service 16 | path: /convert 17 | -------------------------------------------------------------------------------- /config/crd/patches/webhook_in_openstackclustertemplates.yaml: -------------------------------------------------------------------------------- 1 | # The following patch enables conversion webhook for CRD 2 | # CRD conversion requires k8s 1.13 or later. 3 | apiVersion: apiextensions.k8s.io/v1 4 | kind: CustomResourceDefinition 5 | metadata: 6 | name: openstackclustertemplates.infrastructure.cluster.x-k8s.io 7 | spec: 8 | conversion: 9 | strategy: Webhook 10 | webhook: 11 | conversionReviewVersions: ["v1", "v1beta1"] 12 | clientConfig: 13 | service: 14 | namespace: system 15 | name: webhook-service 16 | path: /convert 17 | -------------------------------------------------------------------------------- /config/crd/patches/webhook_in_openstackfloatingippools.yaml: -------------------------------------------------------------------------------- 1 | # The following patch enables conversion webhook for CRD 2 | # CRD conversion requires k8s 1.13 or later. 3 | apiVersion: apiextensions.k8s.io/v1beta1 4 | kind: CustomResourceDefinition 5 | metadata: 6 | name: openstackfloatingippools.infrastructure.cluster.x-k8s.io 7 | spec: 8 | conversion: 9 | strategy: Webhook 10 | webhookClientConfig: 11 | service: 12 | namespace: system 13 | name: webhook-service 14 | path: /convert 15 | -------------------------------------------------------------------------------- /config/crd/patches/webhook_in_openstackmachines.yaml: -------------------------------------------------------------------------------- 1 | # The following patch enables conversion webhook for CRD 2 | # CRD conversion requires k8s 1.13 or later. 3 | apiVersion: apiextensions.k8s.io/v1 4 | kind: CustomResourceDefinition 5 | metadata: 6 | name: openstackmachines.infrastructure.cluster.x-k8s.io 7 | spec: 8 | conversion: 9 | strategy: Webhook 10 | webhook: 11 | conversionReviewVersions: ["v1", "v1beta1"] 12 | clientConfig: 13 | service: 14 | namespace: system 15 | name: webhook-service 16 | path: /convert 17 | -------------------------------------------------------------------------------- /config/crd/patches/webhook_in_openstackmachinetemplates.yaml: -------------------------------------------------------------------------------- 1 | # The following patch enables conversion webhook for CRD 2 | # CRD conversion requires k8s 1.13 or later. 3 | apiVersion: apiextensions.k8s.io/v1 4 | kind: CustomResourceDefinition 5 | metadata: 6 | name: openstackmachinetemplates.infrastructure.cluster.x-k8s.io 7 | spec: 8 | conversion: 9 | strategy: Webhook 10 | webhook: 11 | conversionReviewVersions: ["v1", "v1beta1"] 12 | clientConfig: 13 | service: 14 | namespace: system 15 | name: webhook-service 16 | path: /convert 17 | -------------------------------------------------------------------------------- /config/default/kustomizeconfig.yaml: -------------------------------------------------------------------------------- 1 | # This configuration is for teaching kustomize how to update name ref and var substitution 2 | varReference: 3 | - kind: Deployment 4 | path: spec/template/spec/volumes/secret/secretName 5 | -------------------------------------------------------------------------------- /config/default/manager_image_patch.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1 2 | kind: Deployment 3 | metadata: 4 | name: controller-manager 5 | namespace: system 6 | spec: 7 | template: 8 | spec: 9 | containers: 10 | # Change the value of image field below to your controller image URL 11 | - image: gcr.io/k8s-staging-capi-openstack/capi-openstack-controller:dev 12 | name: manager 13 | -------------------------------------------------------------------------------- /config/default/manager_pull_policy.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1 2 | kind: Deployment 3 | metadata: 4 | name: controller-manager 5 | namespace: system 6 | spec: 7 | template: 8 | spec: 9 | containers: 10 | - name: manager 11 | imagePullPolicy: Always 12 | -------------------------------------------------------------------------------- /config/default/manager_webhook_patch.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1 2 | kind: Deployment 3 | metadata: 4 | name: controller-manager 5 | namespace: system 6 | spec: 7 | template: 8 | spec: 9 | containers: 10 | - name: manager 11 | ports: 12 | - containerPort: 9443 13 | name: webhook-server 14 | protocol: TCP 15 | volumeMounts: 16 | - mountPath: /tmp/k8s-webhook-server/serving-certs 17 | name: cert 18 | readOnly: true 19 | volumes: 20 | - name: cert 21 | secret: 22 | defaultMode: 420 23 | # kustomize will populate this from the Certificate secretName 24 | secretName: CERT_SECRET_NAME 25 | -------------------------------------------------------------------------------- /config/default/namespace.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Namespace 3 | metadata: 4 | name: system 5 | labels: 6 | pod-security.kubernetes.io/enforce: restricted 7 | pod-security.kubernetes.io/warn: restricted 8 | pod-security.kubernetes.io/audit: restricted 9 | -------------------------------------------------------------------------------- /config/manager/kustomization.yaml: -------------------------------------------------------------------------------- 1 | resources: 2 | - manager.yaml 3 | -------------------------------------------------------------------------------- /config/manager/manager.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: apps/v1 3 | kind: Deployment 4 | metadata: 5 | name: controller-manager 6 | namespace: system 7 | labels: 8 | control-plane: capo-controller-manager 9 | spec: 10 | selector: 11 | matchLabels: 12 | control-plane: capo-controller-manager 13 | replicas: 1 14 | template: 15 | metadata: 16 | labels: 17 | control-plane: capo-controller-manager 18 | spec: 19 | containers: 20 | - command: 21 | - /manager 22 | args: 23 | - "--leader-elect" 24 | - "--v=2" 25 | - "--diagnostics-address=127.0.0.1:8080" 26 | - "--insecure-diagnostics=true" 27 | image: controller:latest 28 | imagePullPolicy: Always 29 | name: manager 30 | ports: 31 | - containerPort: 9440 32 | name: healthz 33 | protocol: TCP 34 | readinessProbe: 35 | httpGet: 36 | path: /readyz 37 | port: healthz 38 | livenessProbe: 39 | httpGet: 40 | path: /healthz 41 | port: healthz 42 | securityContext: 43 | allowPrivilegeEscalation: false 44 | capabilities: 45 | drop: 46 | - ALL 47 | privileged: false 48 | runAsUser: 65532 49 | runAsGroup: 65532 50 | terminationMessagePolicy: FallbackToLogsOnError 51 | terminationGracePeriodSeconds: 10 52 | securityContext: 53 | runAsNonRoot: true 54 | seccompProfile: 55 | type: RuntimeDefault 56 | serviceAccountName: manager 57 | tolerations: 58 | - effect: NoSchedule 59 | key: node-role.kubernetes.io/master 60 | - effect: NoSchedule 61 | key: node-role.kubernetes.io/control-plane 62 | -------------------------------------------------------------------------------- /config/rbac/kustomization.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: kustomize.config.k8s.io/v1beta1 2 | kind: Kustomization 3 | resources: 4 | - role_binding.yaml 5 | - role.yaml 6 | - service_account.yaml 7 | - leader_election_role.yaml 8 | - leader_election_role_binding.yaml 9 | -------------------------------------------------------------------------------- /config/rbac/leader_election_role.yaml: -------------------------------------------------------------------------------- 1 | # permissions to do leader election. 2 | apiVersion: rbac.authorization.k8s.io/v1 3 | kind: Role 4 | metadata: 5 | name: leader-election-role 6 | rules: 7 | - apiGroups: 8 | - "" 9 | resources: 10 | - configmaps 11 | verbs: 12 | - get 13 | - list 14 | - watch 15 | - create 16 | - update 17 | - patch 18 | - delete 19 | - apiGroups: 20 | - "" 21 | resources: 22 | - configmaps/status 23 | verbs: 24 | - get 25 | - update 26 | - patch 27 | - apiGroups: 28 | - "" 29 | resources: 30 | - events 31 | verbs: 32 | - create 33 | - apiGroups: 34 | - "coordination.k8s.io" 35 | resources: 36 | - leases 37 | verbs: 38 | - get 39 | - list 40 | - watch 41 | - create 42 | - update 43 | - patch 44 | - delete 45 | -------------------------------------------------------------------------------- /config/rbac/leader_election_role_binding.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: rbac.authorization.k8s.io/v1 2 | kind: RoleBinding 3 | metadata: 4 | name: leader-election-rolebinding 5 | roleRef: 6 | apiGroup: rbac.authorization.k8s.io 7 | kind: Role 8 | name: leader-election-role 9 | subjects: 10 | - kind: ServiceAccount 11 | name: manager 12 | namespace: system 13 | -------------------------------------------------------------------------------- /config/rbac/openstackfloatingippool_editor_role.yaml: -------------------------------------------------------------------------------- 1 | # permissions for end users to edit openstackfloatingippools. 2 | apiVersion: rbac.authorization.k8s.io/v1 3 | kind: ClusterRole 4 | metadata: 5 | name: openstackfloatingippool-editor-role 6 | rules: 7 | - apiGroups: 8 | - infrastructure.cluster.x-k8s.io 9 | resources: 10 | - openstackfloatingippools 11 | verbs: 12 | - create 13 | - delete 14 | - get 15 | - list 16 | - patch 17 | - update 18 | - watch 19 | - apiGroups: 20 | - infrastructure.cluster.x-k8s.io 21 | resources: 22 | - openstackfloatingippools/status 23 | verbs: 24 | - get 25 | -------------------------------------------------------------------------------- /config/rbac/openstackfloatingippool_viewer_role.yaml: -------------------------------------------------------------------------------- 1 | # permissions for end users to view openstackfloatingippools. 2 | apiVersion: rbac.authorization.k8s.io/v1 3 | kind: ClusterRole 4 | metadata: 5 | name: openstackfloatingippool-viewer-role 6 | rules: 7 | - apiGroups: 8 | - infrastructure.cluster.x-k8s.io 9 | resources: 10 | - openstackfloatingippools 11 | verbs: 12 | - get 13 | - list 14 | - watch 15 | - apiGroups: 16 | - infrastructure.cluster.x-k8s.io 17 | resources: 18 | - openstackfloatingippools/status 19 | verbs: 20 | - get 21 | -------------------------------------------------------------------------------- /config/rbac/role.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: rbac.authorization.k8s.io/v1 3 | kind: ClusterRole 4 | metadata: 5 | name: manager-role 6 | rules: 7 | - apiGroups: 8 | - "" 9 | resources: 10 | - events 11 | verbs: 12 | - create 13 | - get 14 | - list 15 | - patch 16 | - update 17 | - watch 18 | - apiGroups: 19 | - "" 20 | resources: 21 | - secrets 22 | verbs: 23 | - get 24 | - list 25 | - watch 26 | - apiGroups: 27 | - authentication.k8s.io 28 | resources: 29 | - tokenreviews 30 | verbs: 31 | - create 32 | - apiGroups: 33 | - authorization.k8s.io 34 | resources: 35 | - subjectaccessreviews 36 | verbs: 37 | - create 38 | - apiGroups: 39 | - cluster.x-k8s.io 40 | resources: 41 | - clusters 42 | - clusters/status 43 | - machines 44 | - machines/status 45 | verbs: 46 | - get 47 | - list 48 | - watch 49 | - apiGroups: 50 | - infrastructure.cluster.x-k8s.io 51 | resources: 52 | - openstackclusters 53 | - openstackfloatingippools 54 | - openstackmachines 55 | - openstackservers 56 | verbs: 57 | - create 58 | - delete 59 | - get 60 | - list 61 | - patch 62 | - update 63 | - watch 64 | - apiGroups: 65 | - infrastructure.cluster.x-k8s.io 66 | resources: 67 | - openstackclusters/status 68 | - openstackfloatingippools/status 69 | - openstackmachines/status 70 | - openstackservers/status 71 | verbs: 72 | - get 73 | - patch 74 | - update 75 | - apiGroups: 76 | - ipam.cluster.x-k8s.io 77 | resources: 78 | - ipaddressclaims 79 | - ipaddressclaims/status 80 | verbs: 81 | - create 82 | - delete 83 | - get 84 | - list 85 | - patch 86 | - update 87 | - watch 88 | - apiGroups: 89 | - ipam.cluster.x-k8s.io 90 | resources: 91 | - ipaddresses 92 | - ipaddresses/status 93 | verbs: 94 | - create 95 | - delete 96 | - get 97 | - list 98 | - update 99 | - watch 100 | - apiGroups: 101 | - openstack.k-orc.cloud 102 | resources: 103 | - images 104 | verbs: 105 | - get 106 | - list 107 | - watch 108 | -------------------------------------------------------------------------------- /config/rbac/role_binding.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: rbac.authorization.k8s.io/v1 2 | kind: ClusterRoleBinding 3 | metadata: 4 | name: manager-rolebinding 5 | roleRef: 6 | apiGroup: rbac.authorization.k8s.io 7 | kind: ClusterRole 8 | name: manager-role 9 | subjects: 10 | - kind: ServiceAccount 11 | name: manager 12 | namespace: system 13 | -------------------------------------------------------------------------------- /config/rbac/service_account.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: ServiceAccount 3 | metadata: 4 | name: manager 5 | namespace: system 6 | -------------------------------------------------------------------------------- /config/webhook/kustomization.yaml: -------------------------------------------------------------------------------- 1 | resources: 2 | - manifests.yaml 3 | - service.yaml 4 | 5 | configurations: 6 | - kustomizeconfig.yaml 7 | -------------------------------------------------------------------------------- /config/webhook/kustomizeconfig.yaml: -------------------------------------------------------------------------------- 1 | # the following config is for teaching kustomize where to look at when substituting vars. 2 | # It requires kustomize v2.1.0 or newer to work properly. 3 | nameReference: 4 | - kind: Service 5 | version: v1 6 | fieldSpecs: 7 | - kind: MutatingWebhookConfiguration 8 | group: admissionregistration.k8s.io 9 | path: webhooks/clientConfig/service/name 10 | - kind: ValidatingWebhookConfiguration 11 | group: admissionregistration.k8s.io 12 | path: webhooks/clientConfig/service/name 13 | 14 | namespace: 15 | - kind: MutatingWebhookConfiguration 16 | group: admissionregistration.k8s.io 17 | path: webhooks/clientConfig/service/namespace 18 | create: true 19 | - kind: ValidatingWebhookConfiguration 20 | group: admissionregistration.k8s.io 21 | path: webhooks/clientConfig/service/namespace 22 | create: true 23 | 24 | varReference: 25 | - path: metadata/annotations 26 | -------------------------------------------------------------------------------- /config/webhook/service.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | name: webhook-service 5 | namespace: system 6 | spec: 7 | ports: 8 | - port: 443 9 | targetPort: webhook-server 10 | -------------------------------------------------------------------------------- /docs/Makefile: -------------------------------------------------------------------------------- 1 | # Copyright 2018 The Kubernetes Authors. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | # If you update this file, please follow 16 | # https://suva.sh/posts/well-documented-makefiles 17 | 18 | ROOT_DIR_RELATIVE := .. 19 | include $(ROOT_DIR_RELATIVE)/common.mk 20 | 21 | DIAGRAM_SRCS := $(call rwildcard,.,*.md,*.plantuml) 22 | 23 | diagrams: $(TOOLS_BIN_DIR)/plantuml-sentinal ## Generate plantuml diagrams 24 | -docker run -u $(UID):$(GID) -v $(abspath .):/docs$(DOCKER_VOL_OPTS) plantuml-builder -tsvg /docs/**/*.md 25 | -docker run -u $(UID):$(GID) -v $(abspath .):/docs$(DOCKER_VOL_OPTS) plantuml-builder -tsvg /docs/**/*.plantuml 26 | -------------------------------------------------------------------------------- /docs/book/.gitignore: -------------------------------------------------------------------------------- 1 | # book file 2 | book 3 | -------------------------------------------------------------------------------- /docs/book/Makefile: -------------------------------------------------------------------------------- 1 | # Copyright 2020 The Kubernetes Authors. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | ROOT_DIR_RELATIVE := ../.. 16 | include $(ROOT_DIR_RELATIVE)/common.mk 17 | 18 | # Directories. 19 | MDBOOK := $(TOOLS_BIN_DIR)/mdbook 20 | MDBOOK_EMBED := $(TOOLS_BIN_DIR)/mdbook-embed 21 | MDBOOK_RELEASELINK := $(TOOLS_BIN_DIR)/mdbook-releaselink 22 | MDBOOK_TABULATE := $(TOOLS_BIN_DIR)/mdbook-tabulate 23 | BOOK_SRCS := $(call rwildcard,.,*.*) 24 | 25 | OS := $(shell go env GOOS) 26 | ARCH := $(shell go env GOARCH) 27 | PATH := $(abspath $(TOOLS_BIN_DIR)):$(PATH) 28 | export PATH 29 | 30 | .PHONY: generate 31 | generate: ## Generate any dependent files outside of a build 32 | $(MAKE) -C ../ diagrams 33 | 34 | verify: generate ## Verify that dependent artifacts are up to date 35 | @if !(git diff --quiet HEAD); then \ 36 | git diff; \ 37 | echo "generated files are out of date, run make generate"; exit 1; \ 38 | fi 39 | 40 | .PHONY: build 41 | build: $(BOOK_SRCS) $(MDBOOK) $(MDBOOK_EMBED) $(MDBOOK_RELEASELINK) $(MDBOOK_TABULATE) ## Build the book 42 | $(MDBOOK) build 43 | 44 | .PHONY: serve 45 | serve: $(MDBOOK) $(MDBOOK_EMBED) $(MDBOOK_RELEASELINK) $(MDBOOK_TABULATE) ## Run a local webserver with the compiled book 46 | $(MDBOOK) serve 47 | 48 | .PHONY: clean 49 | clean: 50 | rm -rf book 51 | -------------------------------------------------------------------------------- /docs/book/book.toml: -------------------------------------------------------------------------------- 1 | [book] 2 | authors = ["The Cluster API Provider OpenStack Maintainers"] 3 | language = "en" 4 | multilingual = false 5 | src = "src" 6 | title = "Kubernetes Cluster API Provider OpenStack" 7 | 8 | [output.html] 9 | curly-quotes = true 10 | git-repository-url = "https://sigs.k8s.io/cluster-api-provider-openstack" 11 | 12 | [output.html.redirect] 13 | "/agenda.html" = "/agenda/2024.html" 14 | "/agenda/2024.html" = "https://docs.google.com/document/d/1hzi6nr04mhQYBKrwL2NDTNPvgI4RgO9a-gqmk31kXMA" 15 | "/agenda/2023.html" = "https://docs.google.com/document/d/1ySIt17XYOJvpt6eJfIcenzWAKX4OSgQLdocRXNSd-ag" 16 | "/agenda/2022.html" = "https://docs.google.com/document/d/1l0DilYJYuBkPZPVrIeGIVFzWBHZjuiNRaJiQnpCU1U" 17 | 18 | [preprocessor.tabulate] 19 | command = "mdbook-tabulate" 20 | 21 | [preprocessor.embed] 22 | command = "mdbook-embed" 23 | 24 | [preprocessor.releaselink] 25 | command = "mdbook-releaselink" 26 | -------------------------------------------------------------------------------- /docs/book/gen-crd-api-reference-docs/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "hideMemberFields": [ 3 | "TypeMeta" 4 | ], 5 | "hideTypePatterns": [ 6 | "ParseError$", 7 | "List$" 8 | ], 9 | "externalPackages": [ 10 | { 11 | "typeMatchPrefix": "^k8s\\.io/apimachinery/pkg/apis/meta/v1\\.Duration$", 12 | "docsURLTemplate": "https://pkg.go.dev/k8s.io/apimachinery/pkg/apis/meta/v1#Duration" 13 | }, 14 | { 15 | "typeMatchPrefix": "^k8s\\.io/apimachinery/pkg/apis/meta/v1\\.Condition$", 16 | "docsURLTemplate": "https://pkg.go.dev/k8s.io/apimachinery/pkg/apis/meta/v1#Condition" 17 | }, 18 | { 19 | "typeMatchPrefix": "^sigs\\.k8s\\.io/cluster-api/api/v1beta1", 20 | "docsURLTemplate": "https://doc.crds.dev/github.com/kubernetes-sigs/cluster-api@v1.6.0" 21 | }, 22 | { 23 | "typeMatchPrefix": "^sigs\\.k8s\\.io/cluster-api/errors", 24 | "docsURLTemplate": "https://pkg.go.dev/sigs.k8s.io/cluster-api@v1.5.1/errors#{{.TypeIdentifier}}" 25 | }, 26 | { 27 | "typeMatchPrefix": "^sigs\\.k8s\\.io/cluster-api-provider-openstack/api/v1beta1", 28 | "docsURLTemplate": "https://cluster-api-openstack.sigs.k8s.io/api/v1beta1/api#infrastructure.cluster.x-k8s.io/v1beta1.{{.TypeIdentifier}}" 29 | } 30 | ], 31 | "typeDisplayNamePrefixOverrides": { 32 | "k8s.io/api/": "Kubernetes ", 33 | "k8s.io/apimachinery/pkg/apis/": "Kubernetes " 34 | }, 35 | "markdownDisabled": false 36 | } 37 | -------------------------------------------------------------------------------- /docs/book/gen-crd-api-reference-docs/template/members.tpl: -------------------------------------------------------------------------------- 1 | {{ define "members" }} 2 | 3 | {{ range .Members }} 4 | {{ if not (hiddenMember .)}} 5 | 6 | 7 | {{ fieldName . }}
8 | 9 | {{ if linkForType .Type }} 10 | 11 | {{ typeDisplayName .Type }} 12 | 13 | {{ else }} 14 | {{ typeDisplayName .Type }} 15 | {{ end }} 16 | 17 | 18 | 19 | {{ if fieldEmbedded . }} 20 |

21 | (Members of {{ fieldName . }} are embedded into this type.) 22 |

23 | {{ end}} 24 | 25 | {{ if isOptionalMember .}} 26 | (Optional) 27 | {{ end }} 28 | 29 | {{ safe (renderComments .CommentLines) }} 30 | 31 | {{ if and (eq (.Type.Name.Name) "ObjectMeta") }} 32 | Refer to the Kubernetes API documentation for the fields of the 33 | metadata field. 34 | {{ end }} 35 | 36 | {{ if or (eq (fieldName .) "spec") }} 37 |
38 |
39 | 40 | {{ template "members" .Type }} 41 |
42 | {{ end }} 43 | 44 | 45 | {{ end }} 46 | {{ end }} 47 | 48 | {{ end }} -------------------------------------------------------------------------------- /docs/book/gen-crd-api-reference-docs/template/pkg.tpl: -------------------------------------------------------------------------------- 1 | {{ define "packages" }} 2 | 3 | {{ range .packages }} 4 |

5 | {{- packageDisplayName . -}} 6 |

7 | 8 | {{ with (index .GoPackages 0 )}} 9 | {{ with .DocComments }} 10 |

11 | {{ safe (renderComments .) }} 12 |

13 | {{ end }} 14 | {{ end }} 15 | 16 | Resource Types: 17 |
    18 | {{- range (visibleTypes (sortedTypes .Types)) -}} 19 | {{ if isExportedType . -}} 20 |
  • 21 | {{ typeDisplayName . }} 22 |
  • 23 | {{- end }} 24 | {{- end -}} 25 |
26 | 27 | {{ range (visibleTypes (sortedTypes .Types))}} 28 | {{ template "type" . }} 29 | {{ end }} 30 |
31 | {{ end }} 32 | 33 |

34 | Generated with gen-crd-api-reference-docs. 35 |

36 | 37 | {{ end }} -------------------------------------------------------------------------------- /docs/book/gen-crd-api-reference-docs/template/type.tpl: -------------------------------------------------------------------------------- 1 | {{ define "type" }} 2 | 3 |

4 | {{- .Name.Name }} 5 | {{ if eq .Kind "Alias" }}({{.Underlying}} alias)

{{ end -}} 6 |

7 | {{ with (typeReferences .) }} 8 |

9 | (Appears on: 10 | {{- $prev := "" -}} 11 | {{- range . -}} 12 | {{- if $prev -}}, {{ end -}} 13 | {{ $prev = . }} 14 | {{ typeDisplayName . }} 15 | {{- end -}} 16 | ) 17 |

18 | {{ end }} 19 | 20 |

21 | {{ safe (renderComments .CommentLines) }} 22 |

23 | 24 | {{ with (constantsOfType .) }} 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | {{- range . -}} 34 | 35 | {{- /* 36 | renderComments implicitly creates a

element, so we 37 | add one to the display name as well to make the contents 38 | of the two cells align evenly. 39 | */ -}} 40 |

41 | 42 | 43 | {{- end -}} 44 | 45 |
ValueDescription

{{ typeDisplayName . }}

{{ safe (renderComments .CommentLines) }}
46 | {{ end }} 47 | 48 | {{ if .Members }} 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | {{ if isExportedType . }} 58 | 59 | 62 | 67 | 68 | 69 | 73 | 74 | 75 | {{ end }} 76 | {{ template "members" .}} 77 | 78 |
FieldDescription
60 | apiVersion
61 | string
63 | 64 | {{apiGroup .}} 65 | 66 |
70 | kind
71 | string 72 |
{{.Name.Name}}
79 | {{ end }} 80 | 81 | {{ end }} -------------------------------------------------------------------------------- /docs/book/src/SUMMARY.md: -------------------------------------------------------------------------------- 1 | # Summary 2 | 3 | - [Introduction](./introduction.md) 4 | - [Getting Started](getting-started.md) 5 | - [Configuration](clusteropenstack/configuration.md) 6 | - [Topics](./topics/index.md) 7 | - [external cloud provider](./topics/external-cloud-provider.md) 8 | - [move from bootstrap](./topics/mover.md) 9 | - [trouble shooting](./topics/troubleshooting.md) 10 | - [CRD Changes](./topics/crd-changes/index.md) 11 | - [v1alpha4 to v1alpha5](./topics/crd-changes/v1alpha4-to-v1alpha5.md) 12 | - [v1alpha5 to v1alpha6](./topics/crd-changes/v1alpha5-to-v1alpha6.md) 13 | - [v1alpha6 to v1alpha7](./topics/crd-changes/v1alpha6-to-v1alpha7.md) 14 | - [v1alpha7 to v1beta1](./topics/crd-changes/v1alpha7-to-v1beta1.md) 15 | - [API reference](./api/index.md) 16 | - [v1alpha1](./api/v1alpha1/api.md) 17 | - [v1beta1](./api/v1beta1/api.md) 18 | - [Development](./development/development.md) 19 | - [Hacking CI](./development/ci.md) 20 | -------------------------------------------------------------------------------- /docs/book/src/api/index.md: -------------------------------------------------------------------------------- 1 | # API reference -------------------------------------------------------------------------------- /docs/book/src/getting-started.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | **Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* 4 | 5 | - [Getting Started](#getting-started) 6 | 7 | 8 | 9 | # Getting Started 10 | 11 | {{#embed-github repo:"kubernetes-sigs/cluster-api" path:"docs/book/src/user/quick-start.md"}} 12 | -------------------------------------------------------------------------------- /docs/book/src/images/social-card-logo.xcf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kubernetes-sigs/cluster-api-provider-openstack/6b204a8de9b20bd62fe499444a7e88fcc8ec2492/docs/book/src/images/social-card-logo.xcf -------------------------------------------------------------------------------- /docs/book/src/introduction.md: -------------------------------------------------------------------------------- 1 | {{#include ../../../README.md:2:}} 2 | -------------------------------------------------------------------------------- /docs/book/src/topics/crd-changes/index.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | **Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* 4 | 5 | - [CRD Changes](#crd-changes) 6 | - [Conversions](#conversions) 7 | 8 | 9 | 10 | # CRD Changes 11 | 12 | ### Conversions 13 | 14 | CAPO is able to automatically convert your old resources into new API versions. 15 | -------------------------------------------------------------------------------- /docs/book/src/topics/crd-changes/v1alpha5-to-v1alpha6.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | **Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* 4 | 5 | - [v1alpha5 compared to v1alpha6](#v1alpha5-compared-to-v1alpha6) 6 | - [Migration](#migration) 7 | - [API Changes](#api-changes) 8 | - [`OpenStackCluster`](#openstackcluster) 9 | - [`OpenStackMachine`](#openstackmachine) 10 | 11 | 12 | 13 | # v1alpha5 compared to v1alpha6 14 | 15 | ## Migration 16 | 17 | All users are encouraged to migrate their usage of the CAPO CRDs from older versions to `v1alpha6`. This includes yaml files and source code. As CAPO implements automatic conversions between the CRD versions, this migration can happen after installing the new CAPO release. 18 | 19 | ## API Changes 20 | 21 | This only documents backwards incompatible changes. Fields that were added to v1alpha6 are not listed here. 22 | 23 | ### `OpenStackCluster` 24 | 25 | ### `OpenStackMachine` 26 | -------------------------------------------------------------------------------- /docs/book/src/topics/index.md: -------------------------------------------------------------------------------- 1 | # Topics 2 | -------------------------------------------------------------------------------- /docs/book/theme/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kubernetes-sigs/cluster-api-provider-openstack/6b204a8de9b20bd62fe499444a7e88fcc8ec2492/docs/book/theme/favicon.png -------------------------------------------------------------------------------- /docs/book/theme/head.hbs: -------------------------------------------------------------------------------- 1 | 4 | -------------------------------------------------------------------------------- /hack/.golint_failures: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kubernetes-sigs/cluster-api-provider-openstack/6b204a8de9b20bd62fe499444a7e88fcc8ec2492/hack/.golint_failures -------------------------------------------------------------------------------- /hack/boilerplate.go.txt: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2024 The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | -------------------------------------------------------------------------------- /hack/boilerplate/boilerplate.Dockerfile.txt: -------------------------------------------------------------------------------- 1 | # Copyright YEAR The Kubernetes Authors. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | -------------------------------------------------------------------------------- /hack/boilerplate/boilerplate.Makefile.txt: -------------------------------------------------------------------------------- 1 | # Copyright YEAR The Kubernetes Authors. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | -------------------------------------------------------------------------------- /hack/boilerplate/boilerplate.generatego.txt: -------------------------------------------------------------------------------- 1 | ../boilerplate.go.txt -------------------------------------------------------------------------------- /hack/boilerplate/boilerplate.go.txt: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright YEAR The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | -------------------------------------------------------------------------------- /hack/boilerplate/boilerplate.py.txt: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright YEAR The Kubernetes Authors. 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | -------------------------------------------------------------------------------- /hack/boilerplate/boilerplate.sh.txt: -------------------------------------------------------------------------------- 1 | # Copyright YEAR The Kubernetes Authors. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | -------------------------------------------------------------------------------- /hack/ci/cloud-init/common.yaml.tpl: -------------------------------------------------------------------------------- 1 | #cloud-config 2 | runcmd: 3 | - sysctl -p /etc/sysctl.d/devstack.conf 4 | - /root/devstack.sh 5 | final_message: "The system is finally up, after $UPTIME seconds" 6 | users: 7 | - name: cloud 8 | lock_passwd: true 9 | sudo: ALL=(ALL) NOPASSWD:ALL 10 | ssh_authorized_keys: 11 | - ${SSH_PUBLIC_KEY} 12 | # Infrastructure packages required: 13 | # python3 - required by sshuttle 14 | # git - required to obtain devstack 15 | # jq - required by devstack-common.sh 16 | packages: 17 | - python3 18 | - git 19 | - jq 20 | package_upgrade: true 21 | write_files: 22 | - path: /etc/sysctl.d/devstack.conf 23 | permissions: "0644" 24 | content: | 25 | net.ipv4.ip_forward=1 26 | net.ipv4.conf.default.rp_filter=0 27 | net.ipv4.conf.all.rp_filter=0 28 | - path: /tmp/devstack-common.sh 29 | permissions: "0644" 30 | content: | 31 | # ensure nested virtualization 32 | function ensure_kvm { 33 | sudo modprobe kvm-intel 34 | if [ ! -c /dev/kvm ]; then 35 | echo /dev/kvm is not present 36 | exit 1 37 | fi 38 | } 39 | 40 | function run_devstack { 41 | su - stack -c "TERM=vt100 /opt/stack/devstack/stack.sh" 42 | } 43 | -------------------------------------------------------------------------------- /hack/ci/common.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Copyright 2021 The Kubernetes Authors. 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | # retry $1 times with $2 sleep in between 18 | function retry { 19 | attempt=0 20 | max_attempts=${1} 21 | interval=${2} 22 | shift; shift 23 | until [[ "$attempt" -ge "$max_attempts" ]] ; do 24 | attempt=$((attempt+1)) 25 | set +e 26 | eval "$*" && return || echo "failed $attempt times: $*" 27 | set -e 28 | sleep "$interval" 29 | done 30 | echo "error: reached max attempts at retry($*)" 31 | return 1 32 | } 33 | 34 | function wait_for_ssh { 35 | local ip=$1 && shift 36 | 37 | retry 10 30 "$(get_ssh_cmd) ${ip} -- true" 38 | } 39 | 40 | function get_ssh_cmd { 41 | echo "ssh -l cloud $(get_ssh_common_args)" 42 | } 43 | 44 | function get_ssh_common_args { 45 | local private_key_file=$(get_ssh_private_key_file) 46 | if [ -z "$private_key_file" ]; then 47 | # If there's no private key file use the public key instead 48 | # This allows us to specify a private key which is held only on a 49 | # hardware device and therefore has no key file 50 | private_key_file=$(get_ssh_public_key_file) 51 | fi 52 | 53 | echo "-i ${private_key_file} " \ 54 | "-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o IdentitiesOnly=yes -o PasswordAuthentication=no " 55 | } 56 | -------------------------------------------------------------------------------- /hack/ensure-go.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Copyright 2019 The Kubernetes Authors. 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | set -o errexit 18 | set -o nounset 19 | set -o pipefail 20 | 21 | # Ensure the go tool exists and is a viable version. 22 | verify_go_version() { 23 | if [[ -z "$(command -v go)" ]]; then 24 | cat <&2 36 | exit 1 37 | fi 38 | 39 | # Ensure the kustomize tool exists and is a viable version, or installs it 40 | verify_kustomize_version() { 41 | if ! [ -x "$(command -v "${BIN_ROOT}/kustomize")" ]; then 42 | echo "fetching kustomize@${kustomize_version}" 43 | if ! [ -d "${BIN_ROOT}" ]; then 44 | mkdir -p "${BIN_ROOT}" 45 | fi 46 | archive_name="kustomize-v${kustomize_version}.tar.gz" 47 | curl -sLo "${BIN_ROOT}/${archive_name}" https://github.com/kubernetes-sigs/kustomize/releases/download/kustomize%2Fv${kustomize_version}/kustomize_v${kustomize_version}_${goos}_${goarch}.tar.gz 48 | tar -zvxf "${BIN_ROOT}/${archive_name}" -C "${BIN_ROOT}/" 49 | chmod +x "${BIN_ROOT}/kustomize" 50 | rm "${BIN_ROOT}/${archive_name}" 51 | fi 52 | } 53 | 54 | verify_kustomize_version 55 | -------------------------------------------------------------------------------- /hack/ensure-trivy.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Copyright 2023 The Kubernetes Authors. 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | set -o errexit 18 | set -o nounset 19 | set -o pipefail 20 | 21 | if [[ "${TRACE-0}" == "1" ]]; then 22 | set -o xtrace 23 | fi 24 | 25 | VERSION=${1} 26 | 27 | GO_OS="$(go env GOOS)" 28 | if [[ "${GO_OS}" == "linux" ]]; then 29 | TRIVY_OS="Linux" 30 | elif [[ "${GO_OS}" == "darwin"* ]]; then 31 | TRIVY_OS="macOS" 32 | fi 33 | 34 | GO_ARCH="$(go env GOARCH)" 35 | if [[ "${GO_ARCH}" == "amd" ]]; then 36 | TRIVY_ARCH="32bit" 37 | elif [[ "${GO_ARCH}" == "amd64"* ]]; then 38 | TRIVY_ARCH="64bit" 39 | elif [[ "${GO_ARCH}" == "arm" ]]; then 40 | TRIVY_ARCH="ARM" 41 | elif [[ "${GO_ARCH}" == "arm64" ]]; then 42 | TRIVY_ARCH="ARM64" 43 | fi 44 | 45 | TOOL_BIN=hack/tools/bin 46 | mkdir -p ${TOOL_BIN} 47 | 48 | TRIVY="${TOOL_BIN}/trivy/${VERSION}/trivy" 49 | 50 | # Downloads trivy scanner 51 | if [ ! -f "$TRIVY" ]; then 52 | curl -L -o ${TOOL_BIN}/trivy.tar.gz "https://github.com/aquasecurity/trivy/releases/download/v${VERSION}/trivy_${VERSION}_${TRIVY_OS}-${TRIVY_ARCH}.tar.gz" 53 | mkdir -p "$(dirname "$0")/tools/bin/trivy/${VERSION}" 54 | tar -xf "${TOOL_BIN}/trivy.tar.gz" -C "${TOOL_BIN}/trivy/${VERSION}" trivy 55 | chmod +x "${TOOL_BIN}/trivy/${VERSION}/trivy" 56 | rm "${TOOL_BIN}/trivy.tar.gz" 57 | fi 58 | -------------------------------------------------------------------------------- /hack/image-patch/kustomization.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: kustomize.config.k8s.io/v1beta1 2 | images: 3 | - name: "" 4 | newName: "" 5 | newTag: "" 6 | kind: Kustomization 7 | patchesJson6902: 8 | - path: pull-policy-patch.yaml 9 | target: 10 | group: apps 11 | kind: Deployment 12 | name: controller-name 13 | namespace: namespace 14 | version: v1 15 | resources: 16 | - source-manifest.yaml 17 | -------------------------------------------------------------------------------- /hack/image-patch/pull-policy-patch.yaml: -------------------------------------------------------------------------------- 1 | - op: replace 2 | path: /spec/template/spec/containers/0/imagePullPolicy 3 | value: Always 4 | -------------------------------------------------------------------------------- /hack/tools/.gitignore: -------------------------------------------------------------------------------- 1 | # share file folder 2 | share 3 | -------------------------------------------------------------------------------- /hack/tools/plantuml.Dockerfile: -------------------------------------------------------------------------------- 1 | # Copyright 2019 The Kubernetes Authors. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | # Recommended usage: 16 | # 17 | # - Run an ephemeral container 18 | # - Mount the current working directory into the container. 19 | # - Run the entrypoint as the user invoking docker run. Otherwise the output 20 | # files will be owned by root, the default user. 21 | # 22 | # - Example: 23 | # docker run \ 24 | # --rm \ 25 | # --volume ${PWD}:/figures \ 26 | # --user $(shell id --user):$(shell id --group) \ 27 | # ${IMAGE_TAG} \ 28 | # -v /figures/*.plantuml 29 | 30 | FROM maven:3-jdk-8 31 | ARG PLANTUML_VERSION 32 | 33 | RUN apt-get update && apt-get install -y --no-install-recommends graphviz fonts-symbola fonts-wqy-zenhei && rm -rf /var/lib/apt/lists/* 34 | RUN wget -O /plantuml.jar https://github.com/plantuml/plantuml/releases/download/v${PLANTUML_VERSION}/plantuml-${PLANTUML_VERSION}.jar 35 | 36 | # By default, java writes a 'hsperfdata_' directory in the work dir. 37 | # This directory is not needed; to ensure it is not written, we set `-XX:-UsePerfData` 38 | ENTRYPOINT [ "java", "-XX:-UsePerfData", "-jar", "/plantuml.jar" ] 39 | -------------------------------------------------------------------------------- /hack/tools/tools.go: -------------------------------------------------------------------------------- 1 | //go:build tools 2 | // +build tools 3 | 4 | /* 5 | Copyright 2019 The Kubernetes Authors. 6 | 7 | Licensed under the Apache License, Version 2.0 (the "License"); 8 | you may not use this file except in compliance with the License. 9 | You may obtain a copy of the License at 10 | 11 | http://www.apache.org/licenses/LICENSE-2.0 12 | 13 | Unless required by applicable law or agreed to in writing, software 14 | distributed under the License is distributed on an "AS IS" BASIS, 15 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | See the License for the specific language governing permissions and 17 | limitations under the License. 18 | */ 19 | 20 | // This package imports things required by build scripts, to force `go mod` to see them as dependencies 21 | package tools 22 | 23 | import ( 24 | _ "github.com/a8m/envsubst" 25 | _ "github.com/ahmetb/gen-crd-api-reference-docs" 26 | _ "github.com/itchyny/gojq/cmd/gojq" 27 | _ "github.com/onsi/ginkgo/v2/ginkgo" 28 | _ "go.uber.org/mock/mockgen" 29 | _ "k8s.io/code-generator" 30 | _ "sigs.k8s.io/cluster-api/hack/tools/mdbook/embed" 31 | _ "sigs.k8s.io/cluster-api/hack/tools/mdbook/releaselink" 32 | _ "sigs.k8s.io/cluster-api/hack/tools/release" 33 | _ "sigs.k8s.io/controller-runtime/tools/setup-envtest" 34 | _ "sigs.k8s.io/controller-tools/cmd/controller-gen" 35 | _ "sigs.k8s.io/kustomize/kustomize/v5" 36 | 37 | // Pulling in CAPO ensures that any dependency which is also in CAPO 38 | // will be updated to at least the same version (e.g. ginkgo) 39 | _ "sigs.k8s.io/cluster-api-provider-openstack" 40 | ) 41 | -------------------------------------------------------------------------------- /hack/verify-boilerplate.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Copyright 2014 The Kubernetes Authors. 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | set -o errexit 18 | set -o nounset 19 | set -o pipefail 20 | # for debugging, enable verbose: 21 | #set -o verbose 22 | 23 | KUBE_ROOT=$(dirname "${BASH_SOURCE[0]}")/.. 24 | 25 | boilerDir="${KUBE_ROOT}/hack/boilerplate" 26 | boiler="${boilerDir}/boilerplate.py" 27 | 28 | boilerplate_out=$("$boiler" "$@") 29 | files_need_boilerplate=() 30 | while IFS=$'\n' read -r line; do 31 | if [ -n "$line" ]; then 32 | files_need_boilerplate+=( "$line" ) 33 | fi 34 | done <<< $boilerplate_out 35 | 36 | # Run boilerplate check 37 | if [[ ${#files_need_boilerplate[@]} -gt 0 ]]; then 38 | for file in "${files_need_boilerplate[@]}"; do 39 | echo "Boilerplate header is wrong for: ${file}" >&2 40 | done 41 | 42 | exit 1 43 | fi 44 | -------------------------------------------------------------------------------- /hack/verify-container-images.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Copyright 2022 The Kubernetes Authors. 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | set -o errexit 18 | set -o nounset 19 | set -o pipefail 20 | 21 | if [[ "${TRACE-0}" == "1" ]]; then 22 | set -o xtrace 23 | fi 24 | 25 | VERSION=${1} 26 | GO_ARCH="$(go env GOARCH)" 27 | DB_MIRROR="public.ecr.aws/aquasecurity/trivy-db" 28 | 29 | REPO_ROOT=$(git rev-parse --show-toplevel) 30 | "${REPO_ROOT}/hack/ensure-trivy.sh" "${VERSION}" 31 | 32 | TRIVY="${REPO_ROOT}/hack/tools/bin/trivy/${VERSION}/trivy" 33 | 34 | # Builds all the container images to be scanned and cleans up changes to ./*manager_image_patch.yaml ./*manager_pull_policy.yaml. 35 | make REGISTRY=gcr.io/k8s-staging-capi-openstack PULL_POLICY=IfNotPresent TAG=dev docker-build 36 | make clean-release-git 37 | 38 | # Scan the images 39 | "${TRIVY}" image --db-repository="${DB_MIRROR}" -q --exit-code 1 --ignore-unfixed --severity MEDIUM,HIGH,CRITICAL gcr.io/k8s-staging-capi-openstack/capi-openstack-controller-"${GO_ARCH}":dev && R1=$? || R1=$? 40 | 41 | echo "" 42 | BRed='\033[1;31m' 43 | BGreen='\033[1;32m' 44 | NC='\033[0m' # No 45 | 46 | if [ "$R1" -ne "0" ] 47 | then 48 | echo -e "${BRed}Check container images failed! There are vulnerabilities to be fixed${NC}" 49 | exit 1 50 | fi 51 | 52 | echo -e "${BGreen}Check container images passed! No vulnerability found${NC}" 53 | -------------------------------------------------------------------------------- /internal/util/ssa/applyconfigpatch.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2024 The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package ssa 18 | 19 | import ( 20 | "encoding/json" 21 | 22 | "k8s.io/apimachinery/pkg/types" 23 | "sigs.k8s.io/controller-runtime/pkg/client" 24 | ) 25 | 26 | // applyConfigPatch uses server-side apply to patch the object. 27 | type applyConfigPatch struct { 28 | applyConfig interface{} 29 | } 30 | 31 | // Type implements Patch. 32 | func (p applyConfigPatch) Type() types.PatchType { 33 | return types.ApplyPatchType 34 | } 35 | 36 | // Data implements Patch. 37 | func (p applyConfigPatch) Data(_ client.Object) ([]byte, error) { 38 | return json.Marshal(p.applyConfig) 39 | } 40 | 41 | func ApplyConfigPatch(applyConfig interface{}) client.Patch { 42 | return &applyConfigPatch{ 43 | applyConfig: applyConfig, 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /kustomize/v1beta1/default/kustomization.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: kustomize.config.k8s.io/v1beta1 2 | kind: Kustomization 3 | resources: 4 | - cluster-template.yaml 5 | -------------------------------------------------------------------------------- /kustomize/v1beta1/flatcar-sysext/kustomization.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: kustomize.config.k8s.io/v1beta1 2 | kind: Kustomization 3 | resources: 4 | - ../default 5 | 6 | patches: 7 | - path: patch-flatcar.yaml 8 | -------------------------------------------------------------------------------- /kustomize/v1beta1/flatcar/kustomization.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: kustomize.config.k8s.io/v1beta1 2 | kind: Kustomization 3 | resources: 4 | - ../default 5 | patches: 6 | - path: patch-flatcar.yaml 7 | -------------------------------------------------------------------------------- /kustomize/v1beta1/without-lb/kustomization.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: kustomize.config.k8s.io/v1beta1 2 | kind: Kustomization 3 | resources: 4 | - ../default 5 | patches: 6 | - path: patch-without-lb.yaml 7 | -------------------------------------------------------------------------------- /kustomize/v1beta1/without-lb/patch-without-lb.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 3 | kind: OpenStackCluster 4 | metadata: 5 | name: ${CLUSTER_NAME} 6 | spec: 7 | apiServerLoadBalancer: 8 | $patch: delete 9 | --- 10 | apiVersion: controlplane.cluster.x-k8s.io/v1beta1 11 | kind: KubeadmControlPlane 12 | metadata: 13 | name: "${CLUSTER_NAME}-control-plane" 14 | spec: 15 | replicas: 1 16 | -------------------------------------------------------------------------------- /metadata.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: clusterctl.cluster.x-k8s.io/v1alpha3 2 | kind: Metadata 3 | releaseSeries: 4 | - major: 0 5 | minor: 5 6 | contract: v1beta1 7 | - major: 0 8 | minor: 6 9 | contract: v1beta1 10 | - major: 0 11 | minor: 7 12 | contract: v1beta1 13 | - major: 0 14 | minor: 8 15 | contract: v1beta1 16 | - major: 0 17 | minor: 9 18 | contract: v1beta1 19 | - major: 0 20 | minor: 10 21 | contract: v1beta1 22 | - major: 0 23 | minor: 11 24 | contract: v1beta1 25 | - major: 0 26 | minor: 12 27 | contract: v1beta1 28 | -------------------------------------------------------------------------------- /netlify.toml: -------------------------------------------------------------------------------- 1 | # Netlify build instructions 2 | [build] 3 | command = "make -C docs/book build" 4 | publish = "docs/book/book" 5 | 6 | [build.environment] 7 | GO_VERSION = "1.23.8" 8 | 9 | # Standard Netlify redirects 10 | [[redirects]] 11 | from = "https://main--kubernetes-sigs-cluster-api-openstack.netlify.com/*" 12 | to = "https://main.cluster-api-openstack.sigs.k8s.io/:splat" 13 | status = 301 14 | force = true 15 | 16 | [[redirects]] 17 | from = "http://main--kubernetes-sigs-cluster-api-openstack.netlify.com/*" 18 | to = "http://main.cluster-api-openstack.sigs.k8s.io/:splat" 19 | status = 301 20 | force = true 21 | 22 | # HTTP-to-HTTPS rules 23 | [[redirects]] 24 | from = "http://main.cluster-api-openstack.sigs.k8s.io/*" 25 | to = "https://main.cluster-api-openstack.sigs.k8s.io/:splat" 26 | status = 301 27 | force = true 28 | -------------------------------------------------------------------------------- /pkg/cloud/services/compute/availabilityzone.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2020 The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package compute 18 | 19 | import ( 20 | "fmt" 21 | 22 | "github.com/gophercloud/gophercloud/v2/openstack/compute/v2/availabilityzones" 23 | ) 24 | 25 | func (s *Service) GetAvailabilityZones() ([]availabilityzones.AvailabilityZone, error) { 26 | availabilityZoneList, err := s.getComputeClient().ListAvailabilityZones() 27 | if err != nil { 28 | return nil, fmt.Errorf("error extracting availability zone list: %v", err) 29 | } 30 | 31 | available := make([]availabilityzones.AvailabilityZone, 0, len(availabilityZoneList)) 32 | 33 | for _, az := range availabilityZoneList { 34 | if az.ZoneState.Available { 35 | available = append(available, az) 36 | } 37 | } 38 | 39 | return available, nil 40 | } 41 | -------------------------------------------------------------------------------- /pkg/cloud/services/compute/server_resources.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2024 The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package compute 18 | 19 | import ( 20 | infrav1alpha1 "sigs.k8s.io/cluster-api-provider-openstack/api/v1alpha1" 21 | "sigs.k8s.io/cluster-api-provider-openstack/pkg/cloud/services/networking" 22 | "sigs.k8s.io/cluster-api-provider-openstack/pkg/scope" 23 | ) 24 | 25 | func AdoptServerResources(scope *scope.WithLogger, resolved *infrav1alpha1.ResolvedServerSpec, resources *infrav1alpha1.ServerResources) error { 26 | networkingService, err := networking.NewService(scope) 27 | if err != nil { 28 | return err 29 | } 30 | 31 | return networkingService.AdoptPortsServer(scope, resolved.Ports, resources) 32 | } 33 | -------------------------------------------------------------------------------- /pkg/cloud/services/loadbalancer/service.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2018 The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package loadbalancer 18 | 19 | import ( 20 | "fmt" 21 | 22 | "sigs.k8s.io/cluster-api-provider-openstack/pkg/clients" 23 | "sigs.k8s.io/cluster-api-provider-openstack/pkg/cloud/services/networking" 24 | "sigs.k8s.io/cluster-api-provider-openstack/pkg/scope" 25 | ) 26 | 27 | // Service interfaces with the OpenStack Neutron LBaaS v2 API. 28 | type Service struct { 29 | scope *scope.WithLogger 30 | loadbalancerClient clients.LbClient 31 | networkingService *networking.Service 32 | } 33 | 34 | // NewService returns an instance of the loadbalancer service. 35 | func NewService(scope *scope.WithLogger) (*Service, error) { 36 | loadbalancerClient, err := scope.NewLbClient() 37 | if err != nil { 38 | return nil, err 39 | } 40 | 41 | networkingService, err := networking.NewService(scope) 42 | if err != nil { 43 | return nil, fmt.Errorf("failed to create networking service: %v", err) 44 | } 45 | 46 | return &Service{ 47 | scope: scope, 48 | loadbalancerClient: loadbalancerClient, 49 | networkingService: networkingService, 50 | }, nil 51 | } 52 | -------------------------------------------------------------------------------- /pkg/generated/applyconfiguration/api/v1alpha1/serverresources.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2024 The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by applyconfiguration-gen. DO NOT EDIT. 18 | 19 | package v1alpha1 20 | 21 | import ( 22 | v1beta1 "sigs.k8s.io/cluster-api-provider-openstack/pkg/generated/applyconfiguration/api/v1beta1" 23 | ) 24 | 25 | // ServerResourcesApplyConfiguration represents a declarative configuration of the ServerResources type for use 26 | // with apply. 27 | type ServerResourcesApplyConfiguration struct { 28 | Ports []v1beta1.PortStatusApplyConfiguration `json:"ports,omitempty"` 29 | } 30 | 31 | // ServerResourcesApplyConfiguration constructs a declarative configuration of the ServerResources type for use with 32 | // apply. 33 | func ServerResources() *ServerResourcesApplyConfiguration { 34 | return &ServerResourcesApplyConfiguration{} 35 | } 36 | 37 | // WithPorts adds the given value to the Ports field in the declarative configuration 38 | // and returns the receiver, so that objects can be build by chaining "With" function invocations. 39 | // If called multiple times, values provided by each call will be appended to the Ports field. 40 | func (b *ServerResourcesApplyConfiguration) WithPorts(values ...*v1beta1.PortStatusApplyConfiguration) *ServerResourcesApplyConfiguration { 41 | for i := range values { 42 | if values[i] == nil { 43 | panic("nil value passed to WithPorts") 44 | } 45 | b.Ports = append(b.Ports, *values[i]) 46 | } 47 | return b 48 | } 49 | -------------------------------------------------------------------------------- /pkg/generated/applyconfiguration/api/v1beta1/addresspair.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2024 The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by applyconfiguration-gen. DO NOT EDIT. 18 | 19 | package v1beta1 20 | 21 | // AddressPairApplyConfiguration represents a declarative configuration of the AddressPair type for use 22 | // with apply. 23 | type AddressPairApplyConfiguration struct { 24 | IPAddress *string `json:"ipAddress,omitempty"` 25 | MACAddress *string `json:"macAddress,omitempty"` 26 | } 27 | 28 | // AddressPairApplyConfiguration constructs a declarative configuration of the AddressPair type for use with 29 | // apply. 30 | func AddressPair() *AddressPairApplyConfiguration { 31 | return &AddressPairApplyConfiguration{} 32 | } 33 | 34 | // WithIPAddress sets the IPAddress field in the declarative configuration to the given value 35 | // and returns the receiver, so that objects can be built by chaining "With" function invocations. 36 | // If called multiple times, the IPAddress field is set to the value of the last call. 37 | func (b *AddressPairApplyConfiguration) WithIPAddress(value string) *AddressPairApplyConfiguration { 38 | b.IPAddress = &value 39 | return b 40 | } 41 | 42 | // WithMACAddress sets the MACAddress field in the declarative configuration to the given value 43 | // and returns the receiver, so that objects can be built by chaining "With" function invocations. 44 | // If called multiple times, the MACAddress field is set to the value of the last call. 45 | func (b *AddressPairApplyConfiguration) WithMACAddress(value string) *AddressPairApplyConfiguration { 46 | b.MACAddress = &value 47 | return b 48 | } 49 | -------------------------------------------------------------------------------- /pkg/generated/applyconfiguration/api/v1beta1/allocationpool.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2024 The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by applyconfiguration-gen. DO NOT EDIT. 18 | 19 | package v1beta1 20 | 21 | // AllocationPoolApplyConfiguration represents a declarative configuration of the AllocationPool type for use 22 | // with apply. 23 | type AllocationPoolApplyConfiguration struct { 24 | Start *string `json:"start,omitempty"` 25 | End *string `json:"end,omitempty"` 26 | } 27 | 28 | // AllocationPoolApplyConfiguration constructs a declarative configuration of the AllocationPool type for use with 29 | // apply. 30 | func AllocationPool() *AllocationPoolApplyConfiguration { 31 | return &AllocationPoolApplyConfiguration{} 32 | } 33 | 34 | // WithStart sets the Start field in the declarative configuration to the given value 35 | // and returns the receiver, so that objects can be built by chaining "With" function invocations. 36 | // If called multiple times, the Start field is set to the value of the last call. 37 | func (b *AllocationPoolApplyConfiguration) WithStart(value string) *AllocationPoolApplyConfiguration { 38 | b.Start = &value 39 | return b 40 | } 41 | 42 | // WithEnd sets the End field in the declarative configuration to the given value 43 | // and returns the receiver, so that objects can be built by chaining "With" function invocations. 44 | // If called multiple times, the End field is set to the value of the last call. 45 | func (b *AllocationPoolApplyConfiguration) WithEnd(value string) *AllocationPoolApplyConfiguration { 46 | b.End = &value 47 | return b 48 | } 49 | -------------------------------------------------------------------------------- /pkg/generated/applyconfiguration/api/v1beta1/fixedip.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2024 The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by applyconfiguration-gen. DO NOT EDIT. 18 | 19 | package v1beta1 20 | 21 | // FixedIPApplyConfiguration represents a declarative configuration of the FixedIP type for use 22 | // with apply. 23 | type FixedIPApplyConfiguration struct { 24 | Subnet *SubnetParamApplyConfiguration `json:"subnet,omitempty"` 25 | IPAddress *string `json:"ipAddress,omitempty"` 26 | } 27 | 28 | // FixedIPApplyConfiguration constructs a declarative configuration of the FixedIP type for use with 29 | // apply. 30 | func FixedIP() *FixedIPApplyConfiguration { 31 | return &FixedIPApplyConfiguration{} 32 | } 33 | 34 | // WithSubnet sets the Subnet field in the declarative configuration to the given value 35 | // and returns the receiver, so that objects can be built by chaining "With" function invocations. 36 | // If called multiple times, the Subnet field is set to the value of the last call. 37 | func (b *FixedIPApplyConfiguration) WithSubnet(value *SubnetParamApplyConfiguration) *FixedIPApplyConfiguration { 38 | b.Subnet = value 39 | return b 40 | } 41 | 42 | // WithIPAddress sets the IPAddress field in the declarative configuration to the given value 43 | // and returns the receiver, so that objects can be built by chaining "With" function invocations. 44 | // If called multiple times, the IPAddress field is set to the value of the last call. 45 | func (b *FixedIPApplyConfiguration) WithIPAddress(value string) *FixedIPApplyConfiguration { 46 | b.IPAddress = &value 47 | return b 48 | } 49 | -------------------------------------------------------------------------------- /pkg/generated/applyconfiguration/api/v1beta1/imagefilter.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2024 The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by applyconfiguration-gen. DO NOT EDIT. 18 | 19 | package v1beta1 20 | 21 | // ImageFilterApplyConfiguration represents a declarative configuration of the ImageFilter type for use 22 | // with apply. 23 | type ImageFilterApplyConfiguration struct { 24 | Name *string `json:"name,omitempty"` 25 | Tags []string `json:"tags,omitempty"` 26 | } 27 | 28 | // ImageFilterApplyConfiguration constructs a declarative configuration of the ImageFilter type for use with 29 | // apply. 30 | func ImageFilter() *ImageFilterApplyConfiguration { 31 | return &ImageFilterApplyConfiguration{} 32 | } 33 | 34 | // WithName sets the Name field in the declarative configuration to the given value 35 | // and returns the receiver, so that objects can be built by chaining "With" function invocations. 36 | // If called multiple times, the Name field is set to the value of the last call. 37 | func (b *ImageFilterApplyConfiguration) WithName(value string) *ImageFilterApplyConfiguration { 38 | b.Name = &value 39 | return b 40 | } 41 | 42 | // WithTags adds the given value to the Tags field in the declarative configuration 43 | // and returns the receiver, so that objects can be build by chaining "With" function invocations. 44 | // If called multiple times, values provided by each call will be appended to the Tags field. 45 | func (b *ImageFilterApplyConfiguration) WithTags(values ...string) *ImageFilterApplyConfiguration { 46 | for i := range values { 47 | b.Tags = append(b.Tags, values[i]) 48 | } 49 | return b 50 | } 51 | -------------------------------------------------------------------------------- /pkg/generated/applyconfiguration/api/v1beta1/machineresources.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2024 The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by applyconfiguration-gen. DO NOT EDIT. 18 | 19 | package v1beta1 20 | 21 | // MachineResourcesApplyConfiguration represents a declarative configuration of the MachineResources type for use 22 | // with apply. 23 | type MachineResourcesApplyConfiguration struct { 24 | Ports []PortStatusApplyConfiguration `json:"ports,omitempty"` 25 | } 26 | 27 | // MachineResourcesApplyConfiguration constructs a declarative configuration of the MachineResources type for use with 28 | // apply. 29 | func MachineResources() *MachineResourcesApplyConfiguration { 30 | return &MachineResourcesApplyConfiguration{} 31 | } 32 | 33 | // WithPorts adds the given value to the Ports field in the declarative configuration 34 | // and returns the receiver, so that objects can be build by chaining "With" function invocations. 35 | // If called multiple times, values provided by each call will be appended to the Ports field. 36 | func (b *MachineResourcesApplyConfiguration) WithPorts(values ...*PortStatusApplyConfiguration) *MachineResourcesApplyConfiguration { 37 | for i := range values { 38 | if values[i] == nil { 39 | panic("nil value passed to WithPorts") 40 | } 41 | b.Ports = append(b.Ports, *values[i]) 42 | } 43 | return b 44 | } 45 | -------------------------------------------------------------------------------- /pkg/generated/applyconfiguration/api/v1beta1/networkparam.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2024 The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by applyconfiguration-gen. DO NOT EDIT. 18 | 19 | package v1beta1 20 | 21 | // NetworkParamApplyConfiguration represents a declarative configuration of the NetworkParam type for use 22 | // with apply. 23 | type NetworkParamApplyConfiguration struct { 24 | ID *string `json:"id,omitempty"` 25 | Filter *NetworkFilterApplyConfiguration `json:"filter,omitempty"` 26 | } 27 | 28 | // NetworkParamApplyConfiguration constructs a declarative configuration of the NetworkParam type for use with 29 | // apply. 30 | func NetworkParam() *NetworkParamApplyConfiguration { 31 | return &NetworkParamApplyConfiguration{} 32 | } 33 | 34 | // WithID sets the ID field in the declarative configuration to the given value 35 | // and returns the receiver, so that objects can be built by chaining "With" function invocations. 36 | // If called multiple times, the ID field is set to the value of the last call. 37 | func (b *NetworkParamApplyConfiguration) WithID(value string) *NetworkParamApplyConfiguration { 38 | b.ID = &value 39 | return b 40 | } 41 | 42 | // WithFilter sets the Filter field in the declarative configuration to the given value 43 | // and returns the receiver, so that objects can be built by chaining "With" function invocations. 44 | // If called multiple times, the Filter field is set to the value of the last call. 45 | func (b *NetworkParamApplyConfiguration) WithFilter(value *NetworkFilterApplyConfiguration) *NetworkParamApplyConfiguration { 46 | b.Filter = value 47 | return b 48 | } 49 | -------------------------------------------------------------------------------- /pkg/generated/applyconfiguration/api/v1beta1/openstackclustertemplateresource.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2024 The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by applyconfiguration-gen. DO NOT EDIT. 18 | 19 | package v1beta1 20 | 21 | // OpenStackClusterTemplateResourceApplyConfiguration represents a declarative configuration of the OpenStackClusterTemplateResource type for use 22 | // with apply. 23 | type OpenStackClusterTemplateResourceApplyConfiguration struct { 24 | Spec *OpenStackClusterSpecApplyConfiguration `json:"spec,omitempty"` 25 | } 26 | 27 | // OpenStackClusterTemplateResourceApplyConfiguration constructs a declarative configuration of the OpenStackClusterTemplateResource type for use with 28 | // apply. 29 | func OpenStackClusterTemplateResource() *OpenStackClusterTemplateResourceApplyConfiguration { 30 | return &OpenStackClusterTemplateResourceApplyConfiguration{} 31 | } 32 | 33 | // WithSpec sets the Spec field in the declarative configuration to the given value 34 | // and returns the receiver, so that objects can be built by chaining "With" function invocations. 35 | // If called multiple times, the Spec field is set to the value of the last call. 36 | func (b *OpenStackClusterTemplateResourceApplyConfiguration) WithSpec(value *OpenStackClusterSpecApplyConfiguration) *OpenStackClusterTemplateResourceApplyConfiguration { 37 | b.Spec = value 38 | return b 39 | } 40 | -------------------------------------------------------------------------------- /pkg/generated/applyconfiguration/api/v1beta1/openstackclustertemplatespec.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2024 The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by applyconfiguration-gen. DO NOT EDIT. 18 | 19 | package v1beta1 20 | 21 | // OpenStackClusterTemplateSpecApplyConfiguration represents a declarative configuration of the OpenStackClusterTemplateSpec type for use 22 | // with apply. 23 | type OpenStackClusterTemplateSpecApplyConfiguration struct { 24 | Template *OpenStackClusterTemplateResourceApplyConfiguration `json:"template,omitempty"` 25 | } 26 | 27 | // OpenStackClusterTemplateSpecApplyConfiguration constructs a declarative configuration of the OpenStackClusterTemplateSpec type for use with 28 | // apply. 29 | func OpenStackClusterTemplateSpec() *OpenStackClusterTemplateSpecApplyConfiguration { 30 | return &OpenStackClusterTemplateSpecApplyConfiguration{} 31 | } 32 | 33 | // WithTemplate sets the Template field in the declarative configuration to the given value 34 | // and returns the receiver, so that objects can be built by chaining "With" function invocations. 35 | // If called multiple times, the Template field is set to the value of the last call. 36 | func (b *OpenStackClusterTemplateSpecApplyConfiguration) WithTemplate(value *OpenStackClusterTemplateResourceApplyConfiguration) *OpenStackClusterTemplateSpecApplyConfiguration { 37 | b.Template = value 38 | return b 39 | } 40 | -------------------------------------------------------------------------------- /pkg/generated/applyconfiguration/api/v1beta1/openstackmachinetemplateresource.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2024 The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by applyconfiguration-gen. DO NOT EDIT. 18 | 19 | package v1beta1 20 | 21 | // OpenStackMachineTemplateResourceApplyConfiguration represents a declarative configuration of the OpenStackMachineTemplateResource type for use 22 | // with apply. 23 | type OpenStackMachineTemplateResourceApplyConfiguration struct { 24 | Spec *OpenStackMachineSpecApplyConfiguration `json:"spec,omitempty"` 25 | } 26 | 27 | // OpenStackMachineTemplateResourceApplyConfiguration constructs a declarative configuration of the OpenStackMachineTemplateResource type for use with 28 | // apply. 29 | func OpenStackMachineTemplateResource() *OpenStackMachineTemplateResourceApplyConfiguration { 30 | return &OpenStackMachineTemplateResourceApplyConfiguration{} 31 | } 32 | 33 | // WithSpec sets the Spec field in the declarative configuration to the given value 34 | // and returns the receiver, so that objects can be built by chaining "With" function invocations. 35 | // If called multiple times, the Spec field is set to the value of the last call. 36 | func (b *OpenStackMachineTemplateResourceApplyConfiguration) WithSpec(value *OpenStackMachineSpecApplyConfiguration) *OpenStackMachineTemplateResourceApplyConfiguration { 37 | b.Spec = value 38 | return b 39 | } 40 | -------------------------------------------------------------------------------- /pkg/generated/applyconfiguration/api/v1beta1/openstackmachinetemplatespec.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2024 The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by applyconfiguration-gen. DO NOT EDIT. 18 | 19 | package v1beta1 20 | 21 | // OpenStackMachineTemplateSpecApplyConfiguration represents a declarative configuration of the OpenStackMachineTemplateSpec type for use 22 | // with apply. 23 | type OpenStackMachineTemplateSpecApplyConfiguration struct { 24 | Template *OpenStackMachineTemplateResourceApplyConfiguration `json:"template,omitempty"` 25 | } 26 | 27 | // OpenStackMachineTemplateSpecApplyConfiguration constructs a declarative configuration of the OpenStackMachineTemplateSpec type for use with 28 | // apply. 29 | func OpenStackMachineTemplateSpec() *OpenStackMachineTemplateSpecApplyConfiguration { 30 | return &OpenStackMachineTemplateSpecApplyConfiguration{} 31 | } 32 | 33 | // WithTemplate sets the Template field in the declarative configuration to the given value 34 | // and returns the receiver, so that objects can be built by chaining "With" function invocations. 35 | // If called multiple times, the Template field is set to the value of the last call. 36 | func (b *OpenStackMachineTemplateSpecApplyConfiguration) WithTemplate(value *OpenStackMachineTemplateResourceApplyConfiguration) *OpenStackMachineTemplateSpecApplyConfiguration { 37 | b.Template = value 38 | return b 39 | } 40 | -------------------------------------------------------------------------------- /pkg/generated/applyconfiguration/api/v1beta1/portstatus.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2024 The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by applyconfiguration-gen. DO NOT EDIT. 18 | 19 | package v1beta1 20 | 21 | // PortStatusApplyConfiguration represents a declarative configuration of the PortStatus type for use 22 | // with apply. 23 | type PortStatusApplyConfiguration struct { 24 | ID *string `json:"id,omitempty"` 25 | } 26 | 27 | // PortStatusApplyConfiguration constructs a declarative configuration of the PortStatus type for use with 28 | // apply. 29 | func PortStatus() *PortStatusApplyConfiguration { 30 | return &PortStatusApplyConfiguration{} 31 | } 32 | 33 | // WithID sets the ID field in the declarative configuration to the given value 34 | // and returns the receiver, so that objects can be built by chaining "With" function invocations. 35 | // If called multiple times, the ID field is set to the value of the last call. 36 | func (b *PortStatusApplyConfiguration) WithID(value string) *PortStatusApplyConfiguration { 37 | b.ID = &value 38 | return b 39 | } 40 | -------------------------------------------------------------------------------- /pkg/generated/applyconfiguration/api/v1beta1/resourcereference.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2024 The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by applyconfiguration-gen. DO NOT EDIT. 18 | 19 | package v1beta1 20 | 21 | // ResourceReferenceApplyConfiguration represents a declarative configuration of the ResourceReference type for use 22 | // with apply. 23 | type ResourceReferenceApplyConfiguration struct { 24 | Name *string `json:"name,omitempty"` 25 | } 26 | 27 | // ResourceReferenceApplyConfiguration constructs a declarative configuration of the ResourceReference type for use with 28 | // apply. 29 | func ResourceReference() *ResourceReferenceApplyConfiguration { 30 | return &ResourceReferenceApplyConfiguration{} 31 | } 32 | 33 | // WithName sets the Name field in the declarative configuration to the given value 34 | // and returns the receiver, so that objects can be built by chaining "With" function invocations. 35 | // If called multiple times, the Name field is set to the value of the last call. 36 | func (b *ResourceReferenceApplyConfiguration) WithName(value string) *ResourceReferenceApplyConfiguration { 37 | b.Name = &value 38 | return b 39 | } 40 | -------------------------------------------------------------------------------- /pkg/generated/applyconfiguration/api/v1beta1/routerparam.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2024 The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by applyconfiguration-gen. DO NOT EDIT. 18 | 19 | package v1beta1 20 | 21 | // RouterParamApplyConfiguration represents a declarative configuration of the RouterParam type for use 22 | // with apply. 23 | type RouterParamApplyConfiguration struct { 24 | ID *string `json:"id,omitempty"` 25 | Filter *RouterFilterApplyConfiguration `json:"filter,omitempty"` 26 | } 27 | 28 | // RouterParamApplyConfiguration constructs a declarative configuration of the RouterParam type for use with 29 | // apply. 30 | func RouterParam() *RouterParamApplyConfiguration { 31 | return &RouterParamApplyConfiguration{} 32 | } 33 | 34 | // WithID sets the ID field in the declarative configuration to the given value 35 | // and returns the receiver, so that objects can be built by chaining "With" function invocations. 36 | // If called multiple times, the ID field is set to the value of the last call. 37 | func (b *RouterParamApplyConfiguration) WithID(value string) *RouterParamApplyConfiguration { 38 | b.ID = &value 39 | return b 40 | } 41 | 42 | // WithFilter sets the Filter field in the declarative configuration to the given value 43 | // and returns the receiver, so that objects can be built by chaining "With" function invocations. 44 | // If called multiple times, the Filter field is set to the value of the last call. 45 | func (b *RouterParamApplyConfiguration) WithFilter(value *RouterFilterApplyConfiguration) *RouterParamApplyConfiguration { 46 | b.Filter = value 47 | return b 48 | } 49 | -------------------------------------------------------------------------------- /pkg/generated/applyconfiguration/api/v1beta1/servergroupfilter.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2024 The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by applyconfiguration-gen. DO NOT EDIT. 18 | 19 | package v1beta1 20 | 21 | // ServerGroupFilterApplyConfiguration represents a declarative configuration of the ServerGroupFilter type for use 22 | // with apply. 23 | type ServerGroupFilterApplyConfiguration struct { 24 | Name *string `json:"name,omitempty"` 25 | } 26 | 27 | // ServerGroupFilterApplyConfiguration constructs a declarative configuration of the ServerGroupFilter type for use with 28 | // apply. 29 | func ServerGroupFilter() *ServerGroupFilterApplyConfiguration { 30 | return &ServerGroupFilterApplyConfiguration{} 31 | } 32 | 33 | // WithName sets the Name field in the declarative configuration to the given value 34 | // and returns the receiver, so that objects can be built by chaining "With" function invocations. 35 | // If called multiple times, the Name field is set to the value of the last call. 36 | func (b *ServerGroupFilterApplyConfiguration) WithName(value string) *ServerGroupFilterApplyConfiguration { 37 | b.Name = &value 38 | return b 39 | } 40 | -------------------------------------------------------------------------------- /pkg/generated/applyconfiguration/api/v1beta1/servermetadata.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2024 The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by applyconfiguration-gen. DO NOT EDIT. 18 | 19 | package v1beta1 20 | 21 | // ServerMetadataApplyConfiguration represents a declarative configuration of the ServerMetadata type for use 22 | // with apply. 23 | type ServerMetadataApplyConfiguration struct { 24 | Key *string `json:"key,omitempty"` 25 | Value *string `json:"value,omitempty"` 26 | } 27 | 28 | // ServerMetadataApplyConfiguration constructs a declarative configuration of the ServerMetadata type for use with 29 | // apply. 30 | func ServerMetadata() *ServerMetadataApplyConfiguration { 31 | return &ServerMetadataApplyConfiguration{} 32 | } 33 | 34 | // WithKey sets the Key field in the declarative configuration to the given value 35 | // and returns the receiver, so that objects can be built by chaining "With" function invocations. 36 | // If called multiple times, the Key field is set to the value of the last call. 37 | func (b *ServerMetadataApplyConfiguration) WithKey(value string) *ServerMetadataApplyConfiguration { 38 | b.Key = &value 39 | return b 40 | } 41 | 42 | // WithValue sets the Value field in the declarative configuration to the given value 43 | // and returns the receiver, so that objects can be built by chaining "With" function invocations. 44 | // If called multiple times, the Value field is set to the value of the last call. 45 | func (b *ServerMetadataApplyConfiguration) WithValue(value string) *ServerMetadataApplyConfiguration { 46 | b.Value = &value 47 | return b 48 | } 49 | -------------------------------------------------------------------------------- /pkg/generated/applyconfiguration/api/v1beta1/subnetparam.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2024 The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by applyconfiguration-gen. DO NOT EDIT. 18 | 19 | package v1beta1 20 | 21 | // SubnetParamApplyConfiguration represents a declarative configuration of the SubnetParam type for use 22 | // with apply. 23 | type SubnetParamApplyConfiguration struct { 24 | ID *string `json:"id,omitempty"` 25 | Filter *SubnetFilterApplyConfiguration `json:"filter,omitempty"` 26 | } 27 | 28 | // SubnetParamApplyConfiguration constructs a declarative configuration of the SubnetParam type for use with 29 | // apply. 30 | func SubnetParam() *SubnetParamApplyConfiguration { 31 | return &SubnetParamApplyConfiguration{} 32 | } 33 | 34 | // WithID sets the ID field in the declarative configuration to the given value 35 | // and returns the receiver, so that objects can be built by chaining "With" function invocations. 36 | // If called multiple times, the ID field is set to the value of the last call. 37 | func (b *SubnetParamApplyConfiguration) WithID(value string) *SubnetParamApplyConfiguration { 38 | b.ID = &value 39 | return b 40 | } 41 | 42 | // WithFilter sets the Filter field in the declarative configuration to the given value 43 | // and returns the receiver, so that objects can be built by chaining "With" function invocations. 44 | // If called multiple times, the Filter field is set to the value of the last call. 45 | func (b *SubnetParamApplyConfiguration) WithFilter(value *SubnetFilterApplyConfiguration) *SubnetParamApplyConfiguration { 46 | b.Filter = value 47 | return b 48 | } 49 | -------------------------------------------------------------------------------- /pkg/generated/clientset/clientset/fake/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2024 The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by client-gen. DO NOT EDIT. 18 | 19 | // This package has the automatically generated fake clientset. 20 | package fake 21 | -------------------------------------------------------------------------------- /pkg/generated/clientset/clientset/scheme/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2024 The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by client-gen. DO NOT EDIT. 18 | 19 | // This package contains the scheme of the automatically generated clientset. 20 | package scheme 21 | -------------------------------------------------------------------------------- /pkg/generated/clientset/clientset/typed/api/v1alpha1/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2024 The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by client-gen. DO NOT EDIT. 18 | 19 | // This package has the automatically generated typed clients. 20 | package v1alpha1 21 | -------------------------------------------------------------------------------- /pkg/generated/clientset/clientset/typed/api/v1alpha1/fake/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2024 The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by client-gen. DO NOT EDIT. 18 | 19 | // Package fake has the automatically generated clients. 20 | package fake 21 | -------------------------------------------------------------------------------- /pkg/generated/clientset/clientset/typed/api/v1alpha1/fake/fake_api_client.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2024 The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by client-gen. DO NOT EDIT. 18 | 19 | package fake 20 | 21 | import ( 22 | rest "k8s.io/client-go/rest" 23 | testing "k8s.io/client-go/testing" 24 | v1alpha1 "sigs.k8s.io/cluster-api-provider-openstack/pkg/generated/clientset/clientset/typed/api/v1alpha1" 25 | ) 26 | 27 | type FakeInfrastructureV1alpha1 struct { 28 | *testing.Fake 29 | } 30 | 31 | func (c *FakeInfrastructureV1alpha1) OpenStackServers(namespace string) v1alpha1.OpenStackServerInterface { 32 | return newFakeOpenStackServers(c, namespace) 33 | } 34 | 35 | // RESTClient returns a RESTClient that is used to communicate 36 | // with API server by this client implementation. 37 | func (c *FakeInfrastructureV1alpha1) RESTClient() rest.Interface { 38 | var ret *rest.RESTClient 39 | return ret 40 | } 41 | -------------------------------------------------------------------------------- /pkg/generated/clientset/clientset/typed/api/v1alpha1/generated_expansion.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2024 The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by client-gen. DO NOT EDIT. 18 | 19 | package v1alpha1 20 | 21 | type OpenStackServerExpansion interface{} 22 | -------------------------------------------------------------------------------- /pkg/generated/clientset/clientset/typed/api/v1beta1/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2024 The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by client-gen. DO NOT EDIT. 18 | 19 | // This package has the automatically generated typed clients. 20 | package v1beta1 21 | -------------------------------------------------------------------------------- /pkg/generated/clientset/clientset/typed/api/v1beta1/fake/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2024 The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by client-gen. DO NOT EDIT. 18 | 19 | // Package fake has the automatically generated clients. 20 | package fake 21 | -------------------------------------------------------------------------------- /pkg/generated/clientset/clientset/typed/api/v1beta1/fake/fake_api_client.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2024 The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by client-gen. DO NOT EDIT. 18 | 19 | package fake 20 | 21 | import ( 22 | rest "k8s.io/client-go/rest" 23 | testing "k8s.io/client-go/testing" 24 | v1beta1 "sigs.k8s.io/cluster-api-provider-openstack/pkg/generated/clientset/clientset/typed/api/v1beta1" 25 | ) 26 | 27 | type FakeInfrastructureV1beta1 struct { 28 | *testing.Fake 29 | } 30 | 31 | func (c *FakeInfrastructureV1beta1) OpenStackClusters(namespace string) v1beta1.OpenStackClusterInterface { 32 | return newFakeOpenStackClusters(c, namespace) 33 | } 34 | 35 | func (c *FakeInfrastructureV1beta1) OpenStackClusterTemplates(namespace string) v1beta1.OpenStackClusterTemplateInterface { 36 | return newFakeOpenStackClusterTemplates(c, namespace) 37 | } 38 | 39 | func (c *FakeInfrastructureV1beta1) OpenStackMachines(namespace string) v1beta1.OpenStackMachineInterface { 40 | return newFakeOpenStackMachines(c, namespace) 41 | } 42 | 43 | func (c *FakeInfrastructureV1beta1) OpenStackMachineTemplates(namespace string) v1beta1.OpenStackMachineTemplateInterface { 44 | return newFakeOpenStackMachineTemplates(c, namespace) 45 | } 46 | 47 | // RESTClient returns a RESTClient that is used to communicate 48 | // with API server by this client implementation. 49 | func (c *FakeInfrastructureV1beta1) RESTClient() rest.Interface { 50 | var ret *rest.RESTClient 51 | return ret 52 | } 53 | -------------------------------------------------------------------------------- /pkg/generated/clientset/clientset/typed/api/v1beta1/generated_expansion.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2024 The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by client-gen. DO NOT EDIT. 18 | 19 | package v1beta1 20 | 21 | type OpenStackClusterExpansion interface{} 22 | 23 | type OpenStackClusterTemplateExpansion interface{} 24 | 25 | type OpenStackMachineExpansion interface{} 26 | 27 | type OpenStackMachineTemplateExpansion interface{} 28 | -------------------------------------------------------------------------------- /pkg/generated/informers/externalversions/api/v1alpha1/interface.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2024 The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by informer-gen. DO NOT EDIT. 18 | 19 | package v1alpha1 20 | 21 | import ( 22 | internalinterfaces "sigs.k8s.io/cluster-api-provider-openstack/pkg/generated/informers/externalversions/internalinterfaces" 23 | ) 24 | 25 | // Interface provides access to all the informers in this group version. 26 | type Interface interface { 27 | // OpenStackServers returns a OpenStackServerInformer. 28 | OpenStackServers() OpenStackServerInformer 29 | } 30 | 31 | type version struct { 32 | factory internalinterfaces.SharedInformerFactory 33 | namespace string 34 | tweakListOptions internalinterfaces.TweakListOptionsFunc 35 | } 36 | 37 | // New returns a new Interface. 38 | func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { 39 | return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} 40 | } 41 | 42 | // OpenStackServers returns a OpenStackServerInformer. 43 | func (v *version) OpenStackServers() OpenStackServerInformer { 44 | return &openStackServerInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} 45 | } 46 | -------------------------------------------------------------------------------- /pkg/generated/informers/externalversions/internalinterfaces/factory_interfaces.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2024 The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by informer-gen. DO NOT EDIT. 18 | 19 | package internalinterfaces 20 | 21 | import ( 22 | time "time" 23 | 24 | v1 "k8s.io/apimachinery/pkg/apis/meta/v1" 25 | runtime "k8s.io/apimachinery/pkg/runtime" 26 | cache "k8s.io/client-go/tools/cache" 27 | clientset "sigs.k8s.io/cluster-api-provider-openstack/pkg/generated/clientset/clientset" 28 | ) 29 | 30 | // NewInformerFunc takes clientset.Interface and time.Duration to return a SharedIndexInformer. 31 | type NewInformerFunc func(clientset.Interface, time.Duration) cache.SharedIndexInformer 32 | 33 | // SharedInformerFactory a small interface to allow for adding an informer without an import cycle 34 | type SharedInformerFactory interface { 35 | Start(stopCh <-chan struct{}) 36 | InformerFor(obj runtime.Object, newFunc NewInformerFunc) cache.SharedIndexInformer 37 | } 38 | 39 | // TweakListOptionsFunc is a function that transforms a v1.ListOptions. 40 | type TweakListOptionsFunc func(*v1.ListOptions) 41 | -------------------------------------------------------------------------------- /pkg/generated/listers/api/v1alpha1/expansion_generated.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2024 The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by lister-gen. DO NOT EDIT. 18 | 19 | package v1alpha1 20 | 21 | // OpenStackServerListerExpansion allows custom methods to be added to 22 | // OpenStackServerLister. 23 | type OpenStackServerListerExpansion interface{} 24 | 25 | // OpenStackServerNamespaceListerExpansion allows custom methods to be added to 26 | // OpenStackServerNamespaceLister. 27 | type OpenStackServerNamespaceListerExpansion interface{} 28 | -------------------------------------------------------------------------------- /pkg/scope/hash.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2022 The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package scope 18 | 19 | import ( 20 | "fmt" 21 | "hash" 22 | "hash/fnv" 23 | 24 | "github.com/davecgh/go-spew/spew" 25 | ) 26 | 27 | // spewHashObject writes specified object to hash using the spew library 28 | // which follows pointers and prints actual values of the nested objects 29 | // ensuring the hash does not change when a pointer changes. 30 | func spewHashObject(hasher hash.Hash, objectToWrite interface{}) error { 31 | hasher.Reset() 32 | printer := spew.ConfigState{ 33 | Indent: " ", 34 | SortKeys: true, 35 | DisableMethods: true, 36 | SpewKeys: true, 37 | } 38 | 39 | if _, err := printer.Fprintf(hasher, "%#v", objectToWrite); err != nil { 40 | return fmt.Errorf("failed to write object to hasher") 41 | } 42 | return nil 43 | } 44 | 45 | // computeSpewHash computes the hash of an object using the spew library. 46 | func computeSpewHash(objectToWrite interface{}) (uint32, error) { 47 | instanceSpecHasher := fnv.New32a() 48 | if err := spewHashObject(instanceSpecHasher, objectToWrite); err != nil { 49 | return 0, err 50 | } 51 | return instanceSpecHasher.Sum32(), nil 52 | } 53 | -------------------------------------------------------------------------------- /pkg/utils/controllers/controllers.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2023 The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package controllers 18 | 19 | import ( 20 | "fmt" 21 | "net" 22 | 23 | infrav1 "sigs.k8s.io/cluster-api-provider-openstack/api/v1beta1" 24 | ) 25 | 26 | // ValidateSubnets validates if the amount of IPv4 and IPv6 subnets is allowed by OpenStackCluster. 27 | func ValidateSubnets(subnets []infrav1.Subnet) error { 28 | isIPv6 := []bool{false, false} 29 | for i, subnet := range subnets { 30 | ip, _, err := net.ParseCIDR(subnet.CIDR) 31 | if err != nil { 32 | return err 33 | } 34 | 35 | if ip.To4() == nil { 36 | isIPv6[i] = true 37 | } 38 | } 39 | 40 | if len(subnets) > 1 && isIPv6[0] == isIPv6[1] { 41 | ethertype := 4 42 | if isIPv6[0] { 43 | ethertype = 6 44 | } 45 | return fmt.Errorf("multiple IPv%d Subnet not allowed on OpenStackCluster", ethertype) 46 | } 47 | return nil 48 | } 49 | -------------------------------------------------------------------------------- /pkg/utils/controllers/interface.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2024 The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package controllers 18 | 19 | import ( 20 | "context" 21 | 22 | ctrl "sigs.k8s.io/controller-runtime" 23 | "sigs.k8s.io/controller-runtime/pkg/controller" 24 | ) 25 | 26 | type SetupWithManager interface { 27 | SetupWithManager(context.Context, ctrl.Manager, controller.Options) error 28 | } 29 | -------------------------------------------------------------------------------- /pkg/utils/conversioncommon/volumeavailabilityzone.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2024 The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package conversioncommon 18 | 19 | import ( 20 | "k8s.io/apimachinery/pkg/conversion" 21 | 22 | infrav1 "sigs.k8s.io/cluster-api-provider-openstack/api/v1beta1" 23 | ) 24 | 25 | func Convert_string_To_Pointer_v1beta1_VolumeAvailabilityZone(in *string, out **infrav1.VolumeAvailabilityZone, _ conversion.Scope) error { 26 | switch *in { 27 | case "": 28 | *out = &infrav1.VolumeAvailabilityZone{ 29 | From: infrav1.VolumeAZFromMachine, 30 | } 31 | default: 32 | azName := infrav1.VolumeAZName(*in) 33 | *out = &infrav1.VolumeAvailabilityZone{ 34 | From: infrav1.VolumeAZFromName, 35 | Name: &azName, 36 | } 37 | } 38 | 39 | return nil 40 | } 41 | 42 | func Convert_Pointer_v1beta1_VolumeAvailabilityZone_To_string(in **infrav1.VolumeAvailabilityZone, out *string, _ conversion.Scope) error { 43 | // This is a lossy: can't specify no AZ prior to v1beta1 44 | if *in == nil { 45 | *out = "" 46 | return nil 47 | } 48 | 49 | switch (*in).From { 50 | case "", infrav1.VolumeAZFromName: 51 | name := (*in).Name 52 | if name != nil { 53 | *out = string(*name) 54 | } else { 55 | *out = "" 56 | } 57 | case infrav1.VolumeAZFromMachine: 58 | *out = "" 59 | } 60 | 61 | return nil 62 | } 63 | -------------------------------------------------------------------------------- /pkg/utils/errors/terminal.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2024 The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package errors 18 | 19 | import ( 20 | goerrors "errors" 21 | ) 22 | 23 | type TerminalError struct { 24 | Reason string 25 | Message string 26 | } 27 | 28 | func (e *TerminalError) Error() string { 29 | return "reconciliation cannot continue: " + e.Message 30 | } 31 | 32 | var _ error = &TerminalError{} 33 | 34 | func Terminal(reason, message string, errs ...error) error { 35 | errs = append(errs, &TerminalError{ 36 | Reason: reason, 37 | Message: message, 38 | }) 39 | return goerrors.Join(errs...) 40 | } 41 | -------------------------------------------------------------------------------- /pkg/utils/names/names.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2021 The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package names 18 | 19 | import ( 20 | "fmt" 21 | "strings" 22 | 23 | clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1" 24 | ) 25 | 26 | const ( 27 | FloatingAddressIPClaimNameSuffix = "floating-ip-address" 28 | ) 29 | 30 | func GetDescription(clusterResourceName string) string { 31 | return fmt.Sprintf("Created by cluster-api-provider-openstack cluster %s", clusterResourceName) 32 | } 33 | 34 | func GetFloatingAddressClaimName(openStackMachineName string) string { 35 | return fmt.Sprintf("%s-%s", openStackMachineName, FloatingAddressIPClaimNameSuffix) 36 | } 37 | 38 | func GetOpenStackMachineNameFromClaimName(claimName string) string { 39 | return strings.TrimSuffix(claimName, fmt.Sprintf("-%s", FloatingAddressIPClaimNameSuffix)) 40 | } 41 | 42 | // ClusterResourceName returns a string which is used as the base of all 43 | // OpenStack resources created for the cluster. 44 | func ClusterResourceName(cluster *clusterv1.Cluster) string { 45 | return fmt.Sprintf("%s-%s", cluster.Namespace, cluster.Name) 46 | } 47 | -------------------------------------------------------------------------------- /pkg/utils/objects/gvk.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2024 The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package objects 18 | 19 | import ( 20 | "fmt" 21 | 22 | "k8s.io/apimachinery/pkg/runtime" 23 | "k8s.io/apimachinery/pkg/runtime/schema" 24 | ) 25 | 26 | func GetGVK(obj runtime.Object, scheme *runtime.Scheme) (*schema.GroupVersionKind, error) { 27 | // Return it if it's already set on the object 28 | gvk := obj.GetObjectKind().GroupVersionKind() 29 | if gvk.Kind != "" { 30 | return &gvk, nil 31 | } 32 | 33 | gvks, _, err := scheme.ObjectKinds(obj) 34 | if err != nil { 35 | return nil, err 36 | } 37 | if len(gvks) == 0 { 38 | // This is probably a programming error 39 | return nil, fmt.Errorf("scheme does not contain a gvk mapping for %T", obj) 40 | } 41 | 42 | return &gvks[0], nil 43 | } 44 | -------------------------------------------------------------------------------- /pkg/utils/optional/types.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2024 The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package optional 18 | 19 | // String is a string that can be unspecified. strings which are converted to 20 | // optional.String during API conversion will be converted to nil if the value 21 | // was previously the empty string. 22 | // +optional. 23 | type String *string 24 | 25 | // Int is an int that can be unspecified. ints which are converted to 26 | // optional.Int during API conversion will be converted to nil if the value 27 | // was previously 0. 28 | // +optional. 29 | type Int *int 30 | 31 | // UInt16 is a uint16 that can be unspecified. uint16s which are converted to 32 | // optional.UInt16 during API conversion will be converted to nil if the value 33 | // was previously 0. 34 | // +kubebuilder:validation:Minimum:=0 35 | // +kubebuilder:validation:Maximum:=65535 36 | // +optional. 37 | type UInt16 *uint16 38 | 39 | // Bool is a bool that can be unspecified. bools which are converted to 40 | // optional.Bool during API conversion will be converted to nil if the value 41 | // was previously false. 42 | type Bool *bool 43 | -------------------------------------------------------------------------------- /pkg/utils/orc/identity_ref.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2024 The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package orc 18 | 19 | import ( 20 | orcv1alpha1 "github.com/k-orc/openstack-resource-controller/v2/api/v1alpha1" 21 | 22 | infrav1 "sigs.k8s.io/cluster-api-provider-openstack/api/v1beta1" 23 | ) 24 | 25 | type orcIdentityRefProvider struct { 26 | orcv1alpha1.CloudCredentialsRefProvider 27 | } 28 | 29 | func (o orcIdentityRefProvider) GetIdentityRef() (*string, *infrav1.OpenStackIdentityReference) { 30 | namespace, openStackCredentialsRef := o.GetCloudCredentialsRef() 31 | if namespace == nil || openStackCredentialsRef == nil { 32 | return nil, nil 33 | } 34 | 35 | return namespace, &infrav1.OpenStackIdentityReference{ 36 | Name: openStackCredentialsRef.SecretName, 37 | CloudName: openStackCredentialsRef.CloudName, 38 | } 39 | } 40 | 41 | var _ infrav1.IdentityRefProvider = orcIdentityRefProvider{} 42 | 43 | func IdentityRefProvider(o orcv1alpha1.CloudCredentialsRefProvider) infrav1.IdentityRefProvider { 44 | return orcIdentityRefProvider{o} 45 | } 46 | -------------------------------------------------------------------------------- /pkg/utils/strings/strings.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2022 The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package strings 18 | 19 | import ( 20 | "cmp" 21 | "slices" 22 | ) 23 | 24 | func Canonicalize[S ~[]E, E cmp.Ordered](s S) S { 25 | slices.Sort(s) 26 | return slices.Compact(s) 27 | } 28 | -------------------------------------------------------------------------------- /pkg/utils/strings/strings_test.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2024 The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package strings 18 | 19 | import ( 20 | "slices" 21 | "testing" 22 | ) 23 | 24 | func TestCanonicalize(t *testing.T) { 25 | tests := []struct { 26 | name string 27 | value []string 28 | want []string 29 | }{ 30 | { 31 | name: "Empty list", 32 | value: []string{}, 33 | want: []string{}, 34 | }, 35 | { 36 | name: "Identity", 37 | value: []string{"a", "b", "c"}, 38 | want: []string{"a", "b", "c"}, 39 | }, 40 | { 41 | name: "Out of order", 42 | value: []string{"c", "b", "a"}, 43 | want: []string{"a", "b", "c"}, 44 | }, 45 | { 46 | name: "Duplicate elements", 47 | value: []string{"c", "b", "a", "c"}, 48 | want: []string{"a", "b", "c"}, 49 | }, 50 | } 51 | 52 | for _, tt := range tests { 53 | t.Run(tt.name, func(t *testing.T) { 54 | got := Canonicalize(tt.value) 55 | if !slices.Equal(got, tt.want) { 56 | t.Errorf("CompareLists() = %v, want %v", got, tt.want) 57 | } 58 | }) 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /pkg/webhooks/errors.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2023 The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package webhooks 18 | 19 | import ( 20 | apierrors "k8s.io/apimachinery/pkg/api/errors" 21 | "k8s.io/apimachinery/pkg/runtime/schema" 22 | "k8s.io/apimachinery/pkg/util/validation/field" 23 | "sigs.k8s.io/controller-runtime/pkg/webhook/admission" 24 | ) 25 | 26 | func aggregateObjErrors(gk schema.GroupKind, name string, allErrs field.ErrorList) (admission.Warnings, error) { 27 | if len(allErrs) == 0 { 28 | return nil, nil 29 | } 30 | 31 | return nil, apierrors.NewInvalid( 32 | gk, 33 | name, 34 | allErrs, 35 | ) 36 | } 37 | -------------------------------------------------------------------------------- /scripts/ci-apidiff.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Copyright 2020 The Kubernetes Authors. 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | set -o errexit 18 | set -o nounset 19 | set -o pipefail 20 | 21 | REPO_ROOT=$(dirname "${BASH_SOURCE[0]}")/.. 22 | 23 | cd "${REPO_ROOT}" 24 | 25 | echo "*** Running go-apidiff ***" 26 | APIDIFF_OLD_COMMIT="${PULL_BASE_SHA}" make apidiff 27 | -------------------------------------------------------------------------------- /scripts/ci-build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Copyright 2020 The Kubernetes Authors. 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | set -o errexit 18 | set -o nounset 19 | set -o pipefail 20 | 21 | REPO_ROOT=$(dirname "${BASH_SOURCE[0]}")/.. 22 | # shellcheck source=../hack/ensure-go.sh 23 | source "${REPO_ROOT}/hack/ensure-go.sh" 24 | 25 | cd "${REPO_ROOT}" && make binaries compile-e2e 26 | -------------------------------------------------------------------------------- /scripts/ci-test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Copyright 2020 The Kubernetes Authors. 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | set -o errexit 18 | set -o nounset 19 | set -o pipefail 20 | 21 | REPO_ROOT=$(dirname "${BASH_SOURCE[0]}")/.. 22 | # shellcheck source=../hack/ensure-go.sh 23 | source "${REPO_ROOT}/hack/ensure-go.sh" 24 | 25 | cd "${REPO_ROOT}" && make generate templates lint verify test 26 | 27 | # Fail if the repo is dirty after generate/templates 28 | if [[ -n $(git status --short) ]]; then 29 | echo "There are modified and/or untracked files." 30 | echo "Did you remember to run 'make generate' and/or 'make templates'" 31 | echo "$(git status)" 32 | fi 33 | -------------------------------------------------------------------------------- /scripts/go_install.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Copyright 2021 The Kubernetes Authors. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | set -o errexit 17 | set -o nounset 18 | set -o pipefail 19 | 20 | if [ -z "${1}" ]; then 21 | echo "must provide module as first parameter" 22 | exit 1 23 | fi 24 | 25 | if [ -z "${2}" ]; then 26 | echo "must provide binary name as second parameter" 27 | exit 1 28 | fi 29 | 30 | if [ -z "${3}" ]; then 31 | echo "must provide version as third parameter" 32 | exit 1 33 | fi 34 | 35 | if [ -z "${GOBIN}" ]; then 36 | echo "GOBIN is not set. Must set GOBIN to install the bin in a specified directory." 37 | exit 1 38 | fi 39 | 40 | rm "${GOBIN}/${2}"* || true 41 | 42 | # install the golang module specified as the first argument 43 | go install -tags tools "${1}@${3}" 44 | mv "${GOBIN}/${2}" "${GOBIN}/${2}-${3}" 45 | ln -sf "${GOBIN}/${2}-${3}" "${GOBIN}/${2}" 46 | -------------------------------------------------------------------------------- /templates/README.txt: -------------------------------------------------------------------------------- 1 | To generate the templates in this directory run `make templates` at the top-level. 2 | 3 | Note that generated artifacts, including these templates, are also attached to 4 | releases in GitHub. 5 | -------------------------------------------------------------------------------- /templates/cluster-template-development.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: cluster.x-k8s.io/v1beta1 2 | kind: Cluster 3 | metadata: 4 | name: ${CLUSTER_NAME} 5 | spec: 6 | topology: 7 | class: dev-test 8 | version: ${KUBERNETES_VERSION} 9 | controlPlane: 10 | replicas: ${CONTROL_PLANE_MACHINE_COUNT} 11 | workers: 12 | machineDeployments: 13 | - class: default-worker 14 | name: md-0 15 | replicas: ${WORKER_MACHINE_COUNT} 16 | variables: 17 | - name: identityRef 18 | value: 19 | name: ${CLOUD_CONFIG_SECRET:=dev-test-cloud-config} 20 | cloudName: ${OPENSTACK_CLOUD:=capo-e2e} 21 | - name: imageName 22 | value: ${IMAGE_NAME:=flatcar_production} 23 | - name: addImageVersion 24 | value: ${ADD_IMAGE_VERSION:=false} 25 | - name: injectIgnitionSysext 26 | value: ${INJECT_IGNITION_SYSEXT:=true} 27 | -------------------------------------------------------------------------------- /templates/image-template-bastion.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: openstack.k-orc.cloud/v1alpha1 3 | kind: Image 4 | metadata: 5 | name: bastion-image 6 | spec: 7 | managementPolicy: managed 8 | resource: 9 | name: ubuntu-24.04 10 | content: 11 | diskFormat: qcow2 12 | download: 13 | url: ${BASTION_IMAGE_URL:="https://cloud-images.ubuntu.com/releases/noble/release/ubuntu-24.04-server-cloudimg-amd64.img"} 14 | cloudCredentialsRef: 15 | secretName: ${CLOUD_CONFIG_SECRET:=dev-test-cloud-config} 16 | cloudName: ${OPENSTACK_CLOUD:=capo-e2e} 17 | -------------------------------------------------------------------------------- /templates/image-template-node.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: openstack.k-orc.cloud/v1alpha1 3 | kind: Image 4 | metadata: 5 | name: node-image 6 | spec: 7 | managementPolicy: managed 8 | resource: 9 | name: flatcar_production 10 | content: 11 | diskFormat: qcow2 12 | download: 13 | url: ${NODE_IMAGE_URL:="https://stable.release.flatcar-linux.net/amd64-usr/current/flatcar_production_openstack_image.img"} 14 | cloudCredentialsRef: 15 | secretName: ${CLOUD_CONFIG_SECRET:=dev-test-cloud-config} 16 | cloudName: ${OPENSTACK_CLOUD:=capo-e2e} 17 | -------------------------------------------------------------------------------- /test/e2e/data/ci-artifacts-platform-kustomization.yaml: -------------------------------------------------------------------------------- 1 | # Can be used to modify the resources when use-ci-artifacts is enabled. 2 | # Be careful arrays are completely overwritten with 'patchesStrategicMerge'. 3 | # We currently don't need to patch anything, but the shared util func (GenerateCIArtifactsInjectedTemplateForDebian) 4 | # which is using this does not allow an empty patch 5 | --- 6 | apiVersion: controlplane.cluster.x-k8s.io/v1beta1 7 | kind: KubeadmControlPlane 8 | metadata: 9 | name: ${CLUSTER_NAME}-control-plane 10 | spec: 11 | version: ${KUBERNETES_VERSION} 12 | # Comment this out for debbuging in case there are problems with the OpenStack key pair mechanism 13 | # kubeadmConfigSpec: 14 | # users: 15 | # - name: "capi" 16 | # sudo: "ALL=(ALL) NOPASSWD:ALL" 17 | # # user: capi, passwd: capi 18 | # passwd: "$6$rounds=4096$yKTFKL6RmN128$a7cGMiNjeTSd091s6QzZcUNrMTgm3HhML5rVmpDFlCfgD7scTW7ZHr0OChcXCaeiO/kbhdn0XzIzWk63nSqRH1" 19 | # lockPassword: false 20 | #--- 21 | #apiVersion: bootstrap.cluster.x-k8s.io/v1beta1 22 | #kind: KubeadmConfigTemplate 23 | #metadata: 24 | # name: ${CLUSTER_NAME}-md-0 25 | #spec: 26 | # template: 27 | # spec: 28 | # users: 29 | # - name: "capi" 30 | # sudo: "ALL=(ALL) NOPASSWD:ALL" 31 | # # user: capi, passwd: capi 32 | # passwd: "$6$rounds=4096$yKTFKL6RmN128$a7cGMiNjeTSd091s6QzZcUNrMTgm3HhML5rVmpDFlCfgD7scTW7ZHr0OChcXCaeiO/kbhdn0XzIzWk63nSqRH1" 33 | # lockPassword: false 34 | -------------------------------------------------------------------------------- /test/e2e/data/infrastructure-openstack-no-artifact/.gitignore: -------------------------------------------------------------------------------- 1 | /cluster-template*.yaml 2 | -------------------------------------------------------------------------------- /test/e2e/data/infrastructure-openstack/.gitignore: -------------------------------------------------------------------------------- 1 | /cluster-template*.yaml 2 | -------------------------------------------------------------------------------- /test/e2e/data/kubetest/conformance-fast.yaml: -------------------------------------------------------------------------------- 1 | ginkgo.focus: \[Conformance\] 2 | ginkgo.skip: .*\[Serial\].* 3 | disable-log-dump: true 4 | ginkgo.show-node-events: true 5 | ginkgo.slow-spec-threshold: 120s 6 | ginkgo.flake-attempts: 3 7 | ginkgo.trace: true 8 | ginkgo.timeout: 3h 9 | ginkgo.v: true 10 | -------------------------------------------------------------------------------- /test/e2e/data/kubetest/conformance.yaml: -------------------------------------------------------------------------------- 1 | ginkgo.focus: \[Conformance\] 2 | disable-log-dump: true 3 | ginkgo.show-node-events: true 4 | ginkgo.slow-spec-threshold: 120s 5 | ginkgo.flake-attempts: 3 6 | ginkgo.trace: true 7 | ginkgo.timeout: 3h 8 | ginkgo.v: true 9 | -------------------------------------------------------------------------------- /test/e2e/data/kustomize/common-patches/ccm/ccm.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: v1 3 | kind: ConfigMap 4 | metadata: 5 | name: ccm-${CLUSTER_NAME}-crs-1 6 | data: ${CCM_RESOURCES} 7 | --- 8 | apiVersion: addons.cluster.x-k8s.io/v1beta1 9 | kind: ClusterResourceSet 10 | metadata: 11 | name: ${CLUSTER_NAME}-crs-1 12 | spec: 13 | clusterSelector: 14 | matchLabels: 15 | ccm: ${CLUSTER_NAME}-crs-1 16 | resources: 17 | - kind: ConfigMap 18 | name: ccm-${CLUSTER_NAME}-crs-1 19 | strategy: ApplyOnce 20 | -------------------------------------------------------------------------------- /test/e2e/data/kustomize/common-patches/ccm/kustomization.yaml: -------------------------------------------------------------------------------- 1 | # Modifications to release templates common to all e2e test scenarios 2 | --- 3 | apiVersion: kustomize.config.k8s.io/v1alpha1 4 | kind: Component 5 | 6 | resources: 7 | - ccm.yaml 8 | 9 | patches: 10 | - target: 11 | kind: KubeadmControlPlane 12 | name: \${CLUSTER_NAME}-control-plane 13 | path: patch-ccm-cloud-config.yaml 14 | - path: patch-ccm.yaml 15 | -------------------------------------------------------------------------------- /test/e2e/data/kustomize/common-patches/ccm/patch-ccm-cloud-config.yaml: -------------------------------------------------------------------------------- 1 | - op: add 2 | path: /spec/kubeadmConfigSpec/files/- 3 | value: 4 | content: ${OPENSTACK_CLOUD_PROVIDER_CONF_B64} 5 | encoding: base64 6 | owner: root 7 | path: /etc/kubernetes/cloud.conf 8 | permissions: "0600" 9 | - op: add 10 | path: /spec/kubeadmConfigSpec/files/- 11 | value: 12 | content: ${OPENSTACK_CLOUD_CACERT_B64} 13 | encoding: base64 14 | owner: root 15 | path: /etc/certs/cacert 16 | permissions: "0600" 17 | -------------------------------------------------------------------------------- /test/e2e/data/kustomize/common-patches/ccm/patch-ccm.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: cluster.x-k8s.io/v1beta1 3 | kind: Cluster 4 | metadata: 5 | name: ${CLUSTER_NAME} 6 | labels: 7 | ccm: ${CLUSTER_NAME}-crs-1 8 | -------------------------------------------------------------------------------- /test/e2e/data/kustomize/common-patches/cluster-prev1beta1/kustomization.yaml: -------------------------------------------------------------------------------- 1 | # Modifications to release templates common to all e2e test scenarios 2 | --- 3 | apiVersion: kustomize.config.k8s.io/v1alpha1 4 | kind: Component 5 | 6 | patches: 7 | - target: 8 | kind: OpenStackCluster 9 | name: \${CLUSTER_NAME} 10 | path: patch-cluster.yaml 11 | -------------------------------------------------------------------------------- /test/e2e/data/kustomize/common-patches/cluster-prev1beta1/patch-cluster.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - op: add 3 | path: /spec/bastion 4 | value: 5 | enabled: true 6 | spec: 7 | flavor: ${OPENSTACK_BASTION_MACHINE_FLAVOR} 8 | image: 9 | name: ${OPENSTACK_BASTION_IMAGE_NAME} 10 | sshKeyName: ${OPENSTACK_SSH_KEY_NAME} 11 | - op: add 12 | path: /spec/controlPlaneAvailabilityZones 13 | value: 14 | - ${OPENSTACK_FAILURE_DOMAIN} 15 | -------------------------------------------------------------------------------- /test/e2e/data/kustomize/common-patches/cluster/kustomization.yaml: -------------------------------------------------------------------------------- 1 | # Modifications to release templates common to all e2e test scenarios 2 | --- 3 | apiVersion: kustomize.config.k8s.io/v1alpha1 4 | kind: Component 5 | 6 | patches: 7 | - target: 8 | kind: OpenStackCluster 9 | name: \${CLUSTER_NAME} 10 | path: patch-cluster.yaml 11 | -------------------------------------------------------------------------------- /test/e2e/data/kustomize/common-patches/cluster/patch-cluster.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - op: add 3 | path: /spec/bastion 4 | value: 5 | enabled: true 6 | spec: 7 | flavor: ${OPENSTACK_BASTION_MACHINE_FLAVOR} 8 | image: 9 | filter: 10 | name: ${OPENSTACK_BASTION_IMAGE_NAME} 11 | sshKeyName: ${OPENSTACK_SSH_KEY_NAME} 12 | - op: add 13 | path: /spec/controlPlaneAvailabilityZones 14 | value: 15 | - ${OPENSTACK_FAILURE_DOMAIN} 16 | -------------------------------------------------------------------------------- /test/e2e/data/kustomize/common-patches/cni/cni.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: v1 3 | kind: ConfigMap 4 | metadata: 5 | name: cni-${CLUSTER_NAME}-crs-0 6 | data: ${CNI_RESOURCES} 7 | --- 8 | apiVersion: addons.cluster.x-k8s.io/v1beta1 9 | kind: ClusterResourceSet 10 | metadata: 11 | name: ${CLUSTER_NAME}-crs-0 12 | spec: 13 | clusterSelector: 14 | matchLabels: 15 | cni: ${CLUSTER_NAME}-crs-0 16 | resources: 17 | - kind: ConfigMap 18 | name: cni-${CLUSTER_NAME}-crs-0 19 | strategy: ApplyOnce 20 | -------------------------------------------------------------------------------- /test/e2e/data/kustomize/common-patches/cni/kustomization.yaml: -------------------------------------------------------------------------------- 1 | # Modifications to release templates common to all e2e test scenarios 2 | --- 3 | apiVersion: kustomize.config.k8s.io/v1alpha1 4 | kind: Component 5 | 6 | resources: 7 | - cni.yaml 8 | 9 | patches: 10 | - path: patch-cni.yaml 11 | -------------------------------------------------------------------------------- /test/e2e/data/kustomize/common-patches/cni/patch-cni.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: cluster.x-k8s.io/v1beta1 3 | kind: Cluster 4 | metadata: 5 | name: ${CLUSTER_NAME} 6 | labels: 7 | cni: ${CLUSTER_NAME}-crs-0 8 | -------------------------------------------------------------------------------- /test/e2e/data/kustomize/common-patches/externalNetworkByName/kustomization.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: kustomize.config.k8s.io/v1alpha1 3 | kind: Component 4 | 5 | patches: 6 | - patch: |- 7 | - op: "remove" 8 | path: "/spec/externalNetwork" 9 | - op: "add" 10 | path: "/spec/externalNetwork" 11 | value: 12 | filter: 13 | name: "${OPENSTACK_EXTERNAL_NETWORK_NAME}" 14 | target: 15 | kind: OpenStackCluster 16 | -------------------------------------------------------------------------------- /test/e2e/data/kustomize/common-patches/images-without-ref/images.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: openstack.k-orc.cloud/v1alpha1 3 | kind: Image 4 | metadata: 5 | name: node-image 6 | spec: 7 | import: 8 | filter: 9 | name: ${OPENSTACK_IMAGE_NAME} 10 | managementPolicy: unmanaged 11 | cloudCredentialsRef: 12 | secretName: ${CLUSTER_NAME}-cloud-config 13 | cloudName: ${OPENSTACK_CLOUD} 14 | --- 15 | apiVersion: openstack.k-orc.cloud/v1alpha1 16 | kind: Image 17 | metadata: 18 | name: bastion-image 19 | spec: 20 | import: 21 | filter: 22 | name: ${OPENSTACK_BASTION_IMAGE_NAME} 23 | managementPolicy: unmanaged 24 | cloudCredentialsRef: 25 | secretName: ${CLUSTER_NAME}-cloud-config 26 | cloudName: ${OPENSTACK_CLOUD} -------------------------------------------------------------------------------- /test/e2e/data/kustomize/common-patches/images-without-ref/kustomization.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: kustomize.config.k8s.io/v1alpha1 3 | kind: Component 4 | 5 | resources: 6 | - images.yaml 7 | 8 | patches: 9 | - target: 10 | group: infrastructure.cluster.x-k8s.io 11 | version: v1beta1 12 | kind: OpenStackMachineTemplate 13 | patch: |- 14 | - op: replace 15 | path: /spec/template/spec/image 16 | value: 17 | filter: 18 | name: ${OPENSTACK_IMAGE_NAME} 19 | - target: 20 | group: infrastructure.cluster.x-k8s.io 21 | version: v1beta1 22 | kind: OpenStackCluster 23 | patch: |- 24 | - op: replace 25 | path: /spec/bastion/spec/image 26 | value: 27 | filter: 28 | name: ${OPENSTACK_BASTION_IMAGE_NAME} 29 | -------------------------------------------------------------------------------- /test/e2e/data/kustomize/common-patches/images/images.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: openstack.k-orc.cloud/v1alpha1 3 | kind: Image 4 | metadata: 5 | name: node-image 6 | spec: 7 | import: 8 | filter: 9 | name: ${OPENSTACK_IMAGE_NAME} 10 | managementPolicy: unmanaged 11 | cloudCredentialsRef: 12 | secretName: ${CLUSTER_NAME}-cloud-config 13 | cloudName: ${OPENSTACK_CLOUD} 14 | --- 15 | apiVersion: openstack.k-orc.cloud/v1alpha1 16 | kind: Image 17 | metadata: 18 | name: bastion-image 19 | spec: 20 | import: 21 | filter: 22 | name: ${OPENSTACK_BASTION_IMAGE_NAME} 23 | managementPolicy: unmanaged 24 | cloudCredentialsRef: 25 | secretName: ${CLUSTER_NAME}-cloud-config 26 | cloudName: ${OPENSTACK_CLOUD} -------------------------------------------------------------------------------- /test/e2e/data/kustomize/common-patches/images/kustomization.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: kustomize.config.k8s.io/v1alpha1 3 | kind: Component 4 | 5 | resources: 6 | - images.yaml 7 | 8 | patches: 9 | - target: 10 | group: infrastructure.cluster.x-k8s.io 11 | version: v1beta1 12 | kind: OpenStackMachineTemplate 13 | patch: |- 14 | - op: replace 15 | path: /spec/template/spec/image 16 | value: 17 | imageRef: 18 | name: node-image 19 | - target: 20 | group: infrastructure.cluster.x-k8s.io 21 | version: v1beta1 22 | kind: OpenStackCluster 23 | patch: |- 24 | - op: replace 25 | path: /spec/bastion/spec/image 26 | value: 27 | imageRef: 28 | name: bastion-image 29 | -------------------------------------------------------------------------------- /test/e2e/data/kustomize/default/kustomization.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: kustomize.config.k8s.io/v1beta1 2 | kind: Kustomization 3 | 4 | resources: 5 | - ../../../../../kustomize/v1beta1/default 6 | 7 | components: 8 | - ../common-patches/cluster 9 | - ../common-patches/cni 10 | - ../upgrade-patches 11 | - ../common-patches/ccm 12 | - ../common-patches/externalNetworkByName 13 | - ../common-patches/images 14 | -------------------------------------------------------------------------------- /test/e2e/data/kustomize/flatcar-sysext/kustomization.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | resources: 3 | - ../../../../../kustomize/v1beta1/flatcar-sysext 4 | 5 | components: 6 | - ../common-patches/cluster 7 | - ../common-patches/cni 8 | - ../common-patches/ccm 9 | - ../common-patches/externalNetworkByName 10 | - ../common-patches/images 11 | 12 | patches: 13 | - target: 14 | group: openstack.k-orc.cloud 15 | version: v1alpha1 16 | kind: Image 17 | name: node-image 18 | patch: |- 19 | - op: replace 20 | path: /spec/import/filter/name 21 | value: ${FLATCAR_IMAGE_NAME} 22 | -------------------------------------------------------------------------------- /test/e2e/data/kustomize/flatcar/kustomization.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: kustomize.config.k8s.io/v1beta1 2 | kind: Kustomization 3 | 4 | resources: 5 | - ../../../../../kustomize/v1beta1/flatcar 6 | 7 | components: 8 | - ../common-patches/cluster 9 | - ../common-patches/cni 10 | - ../common-patches/ccm 11 | - ../common-patches/externalNetworkByName 12 | - ../common-patches/images 13 | 14 | patches: 15 | - target: 16 | group: openstack.k-orc.cloud 17 | version: v1alpha1 18 | kind: Image 19 | name: node-image 20 | patch: |- 21 | - op: replace 22 | path: /spec/import/filter/name 23 | value: ${OPENSTACK_FLATCAR_IMAGE_NAME} 24 | -------------------------------------------------------------------------------- /test/e2e/data/kustomize/k8s-upgrade/kcp-patch.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: controlplane.cluster.x-k8s.io/v1beta1 2 | kind: KubeadmControlPlane 3 | metadata: 4 | name: ${CLUSTER_NAME}-control-plane 5 | spec: 6 | machineTemplate: 7 | infrastructureRef: 8 | apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 9 | kind: OpenStackMachineTemplate 10 | name: ${CLUSTER_NAME}-upgrade-from-control-plane 11 | -------------------------------------------------------------------------------- /test/e2e/data/kustomize/k8s-upgrade/kustomization.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: kustomize.config.k8s.io/v1beta1 2 | kind: Kustomization 3 | resources: 4 | - ../default 5 | - upgrade-from-template.yaml 6 | - upgrade-to-template.yaml 7 | 8 | patches: 9 | - path: kcp-patch.yaml 10 | - path: md-patch.yaml 11 | -------------------------------------------------------------------------------- /test/e2e/data/kustomize/k8s-upgrade/md-patch.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: cluster.x-k8s.io/v1beta1 2 | kind: MachineDeployment 3 | metadata: 4 | name: ${CLUSTER_NAME}-md-0 5 | spec: 6 | template: 7 | spec: 8 | infrastructureRef: 9 | apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 10 | kind: OpenStackMachineTemplate 11 | name: ${CLUSTER_NAME}-upgrade-from-md-0 12 | -------------------------------------------------------------------------------- /test/e2e/data/kustomize/k8s-upgrade/upgrade-from-template.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 3 | kind: OpenStackMachineTemplate 4 | metadata: 5 | name: ${CLUSTER_NAME}-upgrade-from-control-plane 6 | spec: 7 | template: 8 | spec: 9 | flavor: ${OPENSTACK_CONTROL_PLANE_MACHINE_FLAVOR} 10 | image: 11 | filter: 12 | name: ${OPENSTACK_IMAGE_NAME_UPGRADE_FROM} 13 | sshKeyName: ${OPENSTACK_SSH_KEY_NAME} 14 | tags: 15 | - control-plane 16 | --- 17 | apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 18 | kind: OpenStackMachineTemplate 19 | metadata: 20 | name: ${CLUSTER_NAME}-upgrade-from-md-0 21 | spec: 22 | template: 23 | spec: 24 | flavor: ${OPENSTACK_NODE_MACHINE_FLAVOR} 25 | image: 26 | filter: 27 | name: ${OPENSTACK_IMAGE_NAME_UPGRADE_FROM} 28 | sshKeyName: ${OPENSTACK_SSH_KEY_NAME} 29 | tags: 30 | - machine 31 | -------------------------------------------------------------------------------- /test/e2e/data/kustomize/k8s-upgrade/upgrade-to-template.yaml: -------------------------------------------------------------------------------- 1 | # This is just a copy of the normal cluster template OSMTs. 2 | # It is needed because we need a static name that we can put in the e2e config. 3 | # The normal templates has the cluster name as part of the OSMT name. 4 | # See CONTROL_PLANE_MACHINE_TEMPLATE_UPGRADE_TO and WORKERS_MACHINE_TEMPLATE_UPGRADE_TO 5 | # in the e2e config. 6 | --- 7 | apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 8 | kind: OpenStackMachineTemplate 9 | metadata: 10 | name: upgrade-to-control-plane 11 | labels: 12 | clusterctl.cluster.x-k8s.io/move: "" 13 | spec: 14 | template: 15 | spec: 16 | flavor: ${OPENSTACK_CONTROL_PLANE_MACHINE_FLAVOR} 17 | image: 18 | filter: 19 | name: ${OPENSTACK_IMAGE_NAME} 20 | sshKeyName: ${OPENSTACK_SSH_KEY_NAME} 21 | tags: 22 | - control-plane 23 | --- 24 | apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 25 | kind: OpenStackMachineTemplate 26 | metadata: 27 | name: upgrade-to-md-0 28 | labels: 29 | clusterctl.cluster.x-k8s.io/move: "" 30 | spec: 31 | template: 32 | spec: 33 | flavor: ${OPENSTACK_NODE_MACHINE_FLAVOR} 34 | image: 35 | filter: 36 | name: ${OPENSTACK_IMAGE_NAME} 37 | sshKeyName: ${OPENSTACK_SSH_KEY_NAME} 38 | tags: 39 | - machine 40 | -------------------------------------------------------------------------------- /test/e2e/data/kustomize/kcp-remediation/kustomization.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: kustomize.config.k8s.io/v1beta1 2 | kind: Kustomization 3 | resources: 4 | - ../default 5 | - mhc.yaml 6 | -------------------------------------------------------------------------------- /test/e2e/data/kustomize/kcp-remediation/mhc.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | # MachineHealthCheck object with 3 | # - a selector that targets all the machines with label cluster.x-k8s.io/control-plane="" 4 | # - unhealthyConditions triggering remediation after 10s the condition is set 5 | apiVersion: cluster.x-k8s.io/v1beta1 6 | kind: MachineHealthCheck 7 | metadata: 8 | name: "${CLUSTER_NAME}-mhc-0" 9 | spec: 10 | clusterName: "${CLUSTER_NAME}" 11 | maxUnhealthy: 100% 12 | selector: 13 | matchLabels: 14 | cluster.x-k8s.io/control-plane: "" 15 | unhealthyConditions: 16 | - type: e2e.remediation.condition 17 | status: "False" 18 | timeout: 10s 19 | -------------------------------------------------------------------------------- /test/e2e/data/kustomize/md-remediation/kustomization.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: kustomize.config.k8s.io/v1beta1 2 | kind: Kustomization 3 | resources: 4 | - ../default 5 | - mhc.yaml 6 | 7 | patches: 8 | - path: md.yaml 9 | -------------------------------------------------------------------------------- /test/e2e/data/kustomize/md-remediation/md.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: cluster.x-k8s.io/v1beta1 2 | kind: MachineDeployment 3 | metadata: 4 | name: "${CLUSTER_NAME}-md-0" 5 | spec: 6 | template: 7 | metadata: 8 | labels: 9 | "e2e.remediation.label": "" 10 | -------------------------------------------------------------------------------- /test/e2e/data/kustomize/md-remediation/mhc.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | # MachineHealthCheck object with 3 | # - a selector that targets all the machines with label e2e.remediation.label="" 4 | # - unhealthyConditions triggering remediation after 10s the condition is set 5 | apiVersion: cluster.x-k8s.io/v1beta1 6 | kind: MachineHealthCheck 7 | metadata: 8 | name: "${CLUSTER_NAME}-mhc-0" 9 | spec: 10 | clusterName: "${CLUSTER_NAME}" 11 | maxUnhealthy: 100% 12 | selector: 13 | matchLabels: 14 | e2e.remediation.label: "" 15 | unhealthyConditions: 16 | - type: e2e.remediation.condition 17 | status: "False" 18 | timeout: 10s 19 | -------------------------------------------------------------------------------- /test/e2e/data/kustomize/multi-az/kustomization.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: kustomize.config.k8s.io/v1beta1 2 | kind: Kustomization 3 | resources: 4 | - ../default 5 | 6 | patches: 7 | - path: patch-control-plane.yaml 8 | target: 9 | kind: OpenStackCluster 10 | name: \${CLUSTER_NAME} 11 | - path: patch-machine-deployment.yaml 12 | target: 13 | kind: MachineDeployment 14 | name: \${CLUSTER_NAME}-md-0 15 | - path: patch-machine-template-control-plane.yaml 16 | target: 17 | kind: OpenStackMachineTemplate 18 | name: \${CLUSTER_NAME}-control-plane 19 | - path: patch-machine-template-worker.yaml 20 | target: 21 | kind: OpenStackMachineTemplate 22 | name: \${CLUSTER_NAME}-md-0 23 | -------------------------------------------------------------------------------- /test/e2e/data/kustomize/multi-az/patch-control-plane.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - op: add 3 | path: /spec/controlPlaneAvailabilityZones/- 4 | value: ${OPENSTACK_FAILURE_DOMAIN_ALT} 5 | -------------------------------------------------------------------------------- /test/e2e/data/kustomize/multi-az/patch-machine-deployment.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - op: replace 3 | path: /spec/template/spec/failureDomain 4 | value: ${OPENSTACK_FAILURE_DOMAIN_ALT} 5 | -------------------------------------------------------------------------------- /test/e2e/data/kustomize/multi-az/patch-machine-template-control-plane.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - op: add 3 | path: /spec/template/spec/rootVolume 4 | value: 5 | sizeGiB: 25 6 | availabilityZone: 7 | from: Machine 8 | - op: add 9 | path: /spec/template/spec/additionalBlockDevices 10 | value: 11 | - name: extravol 12 | sizeGiB: 1 13 | storage: 14 | type: Volume 15 | volume: 16 | availabilityZone: 17 | from: Machine 18 | - name: etcd 19 | sizeGiB: 1 20 | storage: 21 | type: Local 22 | -------------------------------------------------------------------------------- /test/e2e/data/kustomize/multi-az/patch-machine-template-worker.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - op: add 3 | path: /spec/template/spec/rootVolume 4 | value: 5 | sizeGiB: 25 6 | type: ${OPENSTACK_VOLUME_TYPE_ALT} 7 | availabilityZone: 8 | name: ${OPENSTACK_FAILURE_DOMAIN} 9 | - op: add 10 | path: /spec/template/spec/additionalBlockDevices 11 | value: 12 | - name: extravol 13 | sizeGiB: 1 14 | storage: 15 | type: Volume 16 | volume: 17 | type: ${OPENSTACK_VOLUME_TYPE_ALT} 18 | availabilityZone: 19 | name: ${OPENSTACK_FAILURE_DOMAIN} 20 | - name: etcd 21 | sizeGiB: 1 22 | storage: 23 | type: Local -------------------------------------------------------------------------------- /test/e2e/data/kustomize/multi-network/kustomization.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: kustomize.config.k8s.io/v1beta1 2 | kind: Kustomization 3 | resources: 4 | - ../default 5 | 6 | patches: 7 | - path: patch-machine-template-networks.yaml 8 | target: 9 | kind: OpenStackMachineTemplate 10 | -------------------------------------------------------------------------------- /test/e2e/data/kustomize/multi-network/patch-machine-template-networks.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - op: add 3 | path: /spec/template/spec/ports 4 | value: 5 | - description: "primary" 6 | - description: "Extra Network 1" 7 | network: 8 | id: "${CLUSTER_EXTRA_NET_1}" 9 | - description: "Extra Network 2" 10 | network: 11 | id: "${CLUSTER_EXTRA_NET_2}" 12 | -------------------------------------------------------------------------------- /test/e2e/data/kustomize/no-bastion/kustomization.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: kustomize.config.k8s.io/v1beta1 2 | kind: Kustomization 3 | 4 | resources: 5 | - ../default 6 | 7 | patches: 8 | - path: patch-no-bastion.yaml 9 | target: 10 | kind: OpenStackCluster 11 | name: \${CLUSTER_NAME} 12 | -------------------------------------------------------------------------------- /test/e2e/data/kustomize/no-bastion/patch-no-bastion.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - op: remove 3 | path: /spec/bastion 4 | -------------------------------------------------------------------------------- /test/e2e/data/kustomize/upgrade-patches/ci-hack-kcp.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | # Workaround for https://github.com/kubernetes-sigs/cluster-api/issues/7457 3 | # There is a small but important difference between these two: 4 | # path: /a/b/c 5 | # *creates* the c array, overwriting anything that was there before 6 | # path: /a/b/c/- 7 | # *adds* to the c array and does not work if the array is missing 8 | # 9 | # We add to the postKubeadmCommands (instead of pre*) since we need the CI artifacts 10 | # script to run first. Without this, the container images are not imported properly. 11 | - op: add 12 | path: /spec/kubeadmConfigSpec/postKubeadmCommands 13 | value: 14 | - /usr/local/bin/ci-artifacts-openstack.sh 15 | - op: add 16 | path: /spec/kubeadmConfigSpec/files/- 17 | value: 18 | content: | 19 | #!/bin/bash 20 | DOWNLOAD_E2E_IMAGE=${DOWNLOAD_E2E_IMAGE:=false} 21 | if [ ! "${DOWNLOAD_E2E_IMAGE}" = true ]; then 22 | echo "Not downloading E2E image, exiting" 23 | exit 0 24 | fi 25 | # Download the locally built CAPO controller image 26 | echo "Downloading ${E2E_IMAGE_URL}" 27 | wget "${E2E_IMAGE_URL}" -O "/tmp/capo-controller-manager.tar" 28 | sudo ctr -n k8s.io images import "/tmp/capo-controller-manager.tar" || echo "* ignoring expected 'ctr images import' result" 29 | owner: root:root 30 | path: /usr/local/bin/ci-artifacts-openstack.sh 31 | permissions: "0750" 32 | -------------------------------------------------------------------------------- /test/e2e/data/kustomize/upgrade-patches/ci-hack-kct.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | # Workaround for https://github.com/kubernetes-sigs/cluster-api/issues/7457 3 | # There is a small but important difference between these two: 4 | # path: /a/b/c 5 | # *creates* the c array, overwriting anything that was there before 6 | # path: /a/b/c/- 7 | # *adds* to the c array and does not work if the array is missing 8 | # 9 | # We add to the postKubeadmCommands (instead of pre*) since we need the CI artifacts 10 | # script to run first. Without this, the container images are not imported properly. 11 | - op: add 12 | path: /spec/template/spec/postKubeadmCommands 13 | value: 14 | - /usr/local/bin/ci-artifacts-openstack.sh 15 | - op: add 16 | path: /spec/template/spec/files/- 17 | value: 18 | content: | 19 | #!/bin/bash 20 | DOWNLOAD_E2E_IMAGE=${DOWNLOAD_E2E_IMAGE:=false} 21 | if [ ! "${DOWNLOAD_E2E_IMAGE}" = true ]; then 22 | echo "Not downloading E2E image, exiting" 23 | exit 0 24 | fi 25 | # Download the locally built CAPO controller image 26 | echo "Downloading ${E2E_IMAGE_URL}" 27 | wget "${E2E_IMAGE_URL}" -O "/tmp/capo-controller-manager.tar" 28 | sudo ctr -n k8s.io images import "/tmp/capo-controller-manager.tar" || echo "* ignoring expected 'ctr images import' result" 29 | owner: root:root 30 | path: /usr/local/bin/ci-artifacts-openstack.sh 31 | permissions: "0750" 32 | -------------------------------------------------------------------------------- /test/e2e/data/kustomize/upgrade-patches/kustomization.yaml: -------------------------------------------------------------------------------- 1 | # Modifications to release templates for clusterctl upgrade scenarios 2 | apiVersion: kustomize.config.k8s.io/v1alpha1 3 | kind: Component 4 | 5 | patches: 6 | - path: ci-hack-kcp.yaml 7 | target: 8 | kind: KubeadmControlPlane 9 | name: \${CLUSTER_NAME}-control-plane 10 | - path: ci-hack-kct.yaml 11 | target: 12 | kind: KubeadmConfigTemplate 13 | name: \${CLUSTER_NAME}-md-0 14 | -------------------------------------------------------------------------------- /test/e2e/data/kustomize/with-tags/kustomization.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: kustomize.config.k8s.io/v1beta1 2 | kind: Kustomization 3 | resources: 4 | - ../default 5 | 6 | patches: 7 | - path: patch-cluster.yaml 8 | target: 9 | kind: OpenStackCluster 10 | name: \${CLUSTER_NAME} 11 | - path: patch-machine-template-control-plane.yaml 12 | target: 13 | kind: OpenStackMachineTemplate 14 | name: \${CLUSTER_NAME}-control-plane 15 | - path: patch-machine-template-worker.yaml 16 | target: 17 | kind: OpenStackMachineTemplate 18 | name: \${CLUSTER_NAME}-md-0 19 | -------------------------------------------------------------------------------- /test/e2e/data/kustomize/with-tags/patch-cluster.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - op: add 3 | path: /spec/tags 4 | value: 5 | - ${CLUSTER_NAME} 6 | -------------------------------------------------------------------------------- /test/e2e/data/kustomize/with-tags/patch-machine-template-control-plane.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - op: add 3 | path: /spec/template/spec/tags 4 | value: 5 | - control-plane 6 | -------------------------------------------------------------------------------- /test/e2e/data/kustomize/with-tags/patch-machine-template-worker.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - op: add 3 | path: /spec/template/spec/tags 4 | value: 5 | - machine 6 | -------------------------------------------------------------------------------- /test/e2e/data/kustomize/without-lb/kustomization.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: kustomize.config.k8s.io/v1beta1 2 | kind: Kustomization 3 | resources: 4 | - ../../../../../kustomize/v1beta1/without-lb 5 | 6 | components: 7 | - ../common-patches/cluster 8 | - ../common-patches/cni 9 | - ../common-patches/ccm 10 | - ../common-patches/externalNetworkByName 11 | - ../common-patches/images 12 | -------------------------------------------------------------------------------- /test/e2e/data/shared/openstack-resource-controller/metadata.yaml: -------------------------------------------------------------------------------- 1 | # ORC isn't a provider but we fake it so it can be handled by the clusterctl machinery. 2 | apiVersion: clusterctl.cluster.x-k8s.io/v1alpha3 3 | kind: Metadata 4 | releaseSeries: 5 | - major: 1 6 | minor: 0 7 | contract: v1beta1 8 | - major: 2 9 | minor: 0 10 | contract: v1beta1 11 | -------------------------------------------------------------------------------- /test/e2e/data/shared/v1beta1/metadata.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: clusterctl.cluster.x-k8s.io/v1alpha3 2 | kind: Metadata 3 | releaseSeries: 4 | - major: 1 5 | minor: 2 6 | contract: v1beta1 7 | - major: 1 8 | minor: 3 9 | contract: v1beta1 10 | - major: 1 11 | minor: 4 12 | contract: v1beta1 13 | - major: 1 14 | minor: 5 15 | contract: v1beta1 16 | - major: 1 17 | minor: 6 18 | contract: v1beta1 19 | - major: 1 20 | minor: 7 21 | contract: v1beta1 22 | - major: 1 23 | minor: 8 24 | contract: v1beta1 25 | - major: 1 26 | minor: 9 27 | contract: v1beta1 28 | - major: 1 29 | minor: 10 30 | contract: v1beta1 31 | -------------------------------------------------------------------------------- /test/e2e/data/shared/v1beta1_provider/metadata.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: clusterctl.cluster.x-k8s.io/v1alpha3 2 | kind: Metadata 3 | releaseSeries: 4 | - major: 0 5 | minor: 5 6 | contract: v1beta1 7 | - major: 0 8 | minor: 6 9 | contract: v1beta1 10 | - major: 0 11 | minor: 7 12 | contract: v1beta1 13 | - major: 0 14 | minor: 8 15 | contract: v1beta1 16 | - major: 0 17 | minor: 9 18 | contract: v1beta1 19 | - major: 0 20 | minor: 10 21 | contract: v1beta1 22 | - major: 0 23 | minor: 11 24 | contract: v1beta1 25 | - major: 0 26 | minor: 12 27 | contract: v1beta1 28 | -------------------------------------------------------------------------------- /test/e2e/shared/openstack_test.go: -------------------------------------------------------------------------------- 1 | //go:build e2e 2 | // +build e2e 3 | 4 | /* 5 | Copyright 2021 The Kubernetes Authors. 6 | 7 | Licensed under the Apache License, Version 2.0 (the "License"); 8 | you may not use this file except in compliance with the License. 9 | You may obtain a copy of the License at 10 | 11 | http://www.apache.org/licenses/LICENSE-2.0 12 | 13 | Unless required by applicable law or agreed to in writing, software 14 | distributed under the License is distributed on an "AS IS" BASIS, 15 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | See the License for the specific language governing permissions and 17 | limitations under the License. 18 | */ 19 | 20 | package shared 21 | 22 | import ( 23 | "context" 24 | "fmt" 25 | "os" 26 | "testing" 27 | 28 | . "github.com/onsi/ginkgo/v2" 29 | . "github.com/onsi/gomega" 30 | "sigs.k8s.io/cluster-api/test/framework/clusterctl" 31 | ) 32 | 33 | // Test_dumpOpenStackClusters can be used to develop and test 34 | // dumpOpenStackClusters locally. 35 | func Test_dumpOpenStackClusters(t *testing.T) { 36 | t.Skip() 37 | RegisterFailHandler(Fail) 38 | 39 | currentDir, err := os.Getwd() 40 | if err != nil { 41 | t.Fatal(err) 42 | } 43 | 44 | dumpOpenStack(context.TODO(), &E2EContext{ 45 | E2EConfig: &clusterctl.E2EConfig{ 46 | Variables: map[string]string{ 47 | OpenStackCloudYAMLFile: fmt.Sprintf("%s/../../../clouds.yaml", currentDir), 48 | OpenStackCloud: "capo-e2e", 49 | }, 50 | }, 51 | Settings: Settings{ 52 | ArtifactFolder: "/tmp", 53 | }, 54 | }, "bootstrap") 55 | } 56 | -------------------------------------------------------------------------------- /test/e2e/suites/conformance/conformance_suite_test.go: -------------------------------------------------------------------------------- 1 | //go:build e2e 2 | // +build e2e 3 | 4 | /* 5 | Copyright 2021 The Kubernetes Authors. 6 | 7 | Licensed under the Apache License, Version 2.0 (the "License"); 8 | you may not use this file except in compliance with the License. 9 | You may obtain a copy of the License at 10 | 11 | http://www.apache.org/licenses/LICENSE-2.0 12 | 13 | Unless required by applicable law or agreed to in writing, software 14 | distributed under the License is distributed on an "AS IS" BASIS, 15 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | See the License for the specific language governing permissions and 17 | limitations under the License. 18 | */ 19 | 20 | package conformance 21 | 22 | import ( 23 | "context" 24 | "testing" 25 | 26 | . "github.com/onsi/ginkgo/v2" 27 | . "github.com/onsi/gomega" 28 | ctrl "sigs.k8s.io/controller-runtime" 29 | 30 | "sigs.k8s.io/cluster-api-provider-openstack/test/e2e/shared" 31 | ) 32 | 33 | var e2eCtx *shared.E2EContext 34 | 35 | func init() { 36 | e2eCtx = shared.NewE2EContext() 37 | shared.CreateDefaultFlags(e2eCtx) 38 | } 39 | 40 | func TestConformance(t *testing.T) { 41 | RegisterFailHandler(Fail) 42 | ctrl.SetLogger(GinkgoLogr) 43 | RunSpecs(t, "capo-conformance") 44 | } 45 | 46 | var _ = SynchronizedBeforeSuite(func(ctx context.Context) []byte { 47 | return shared.Node1BeforeSuite(ctx, e2eCtx) 48 | }, func(data []byte) { 49 | shared.AllNodesBeforeSuite(e2eCtx, data) 50 | }) 51 | 52 | var _ = SynchronizedAfterSuite(func() { 53 | shared.AllNodesAfterSuite(e2eCtx) 54 | }, func(ctx context.Context) { 55 | shared.Node1AfterSuite(ctx, e2eCtx) 56 | }) 57 | -------------------------------------------------------------------------------- /test/e2e/suites/e2e/remediations_test.go: -------------------------------------------------------------------------------- 1 | //go:build e2e 2 | // +build e2e 3 | 4 | /* 5 | Copyright 2021 The Kubernetes Authors. 6 | 7 | Licensed under the Apache License, Version 2.0 (the "License"); 8 | you may not use this file except in compliance with the License. 9 | You may obtain a copy of the License at 10 | 11 | http://www.apache.org/licenses/LICENSE-2.0 12 | 13 | Unless required by applicable law or agreed to in writing, software 14 | distributed under the License is distributed on an "AS IS" BASIS, 15 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | See the License for the specific language governing permissions and 17 | limitations under the License. 18 | */ 19 | 20 | package e2e 21 | 22 | import ( 23 | "context" 24 | 25 | . "github.com/onsi/ginkgo/v2" 26 | "k8s.io/utils/ptr" 27 | capi_e2e "sigs.k8s.io/cluster-api/test/e2e" 28 | 29 | "sigs.k8s.io/cluster-api-provider-openstack/test/e2e/shared" 30 | ) 31 | 32 | var _ = Describe("When testing unhealthy machines remediation", func() { 33 | Describe("When testing MachineDeployment remediation", func() { 34 | BeforeEach(func(ctx context.Context) { 35 | shared.ApplyCoreImagesPlus(ctx, e2eCtx) 36 | }) 37 | 38 | capi_e2e.MachineDeploymentRemediationSpec(context.TODO(), func() capi_e2e.MachineDeploymentRemediationSpecInput { 39 | return capi_e2e.MachineDeploymentRemediationSpecInput{ 40 | E2EConfig: e2eCtx.E2EConfig, 41 | ClusterctlConfigPath: e2eCtx.Environment.ClusterctlConfigPath, 42 | BootstrapClusterProxy: e2eCtx.Environment.BootstrapClusterProxy, 43 | ArtifactFolder: e2eCtx.Settings.ArtifactFolder, 44 | SkipCleanup: false, 45 | Flavor: ptr.To(shared.FlavorMDRemediation), 46 | } 47 | }) 48 | }) 49 | }) 50 | -------------------------------------------------------------------------------- /test/e2e/suites/e2e/self_hosted_test.go: -------------------------------------------------------------------------------- 1 | //go:build e2e 2 | // +build e2e 3 | 4 | /* 5 | Copyright 2022 The Kubernetes Authors. 6 | 7 | Licensed under the Apache License, Version 2.0 (the "License"); 8 | you may not use this file except in compliance with the License. 9 | You may obtain a copy of the License at 10 | 11 | http://www.apache.org/licenses/LICENSE-2.0 12 | 13 | Unless required by applicable law or agreed to in writing, software 14 | distributed under the License is distributed on an "AS IS" BASIS, 15 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | See the License for the specific language governing permissions and 17 | limitations under the License. 18 | */ 19 | 20 | package e2e 21 | 22 | import ( 23 | "context" 24 | 25 | . "github.com/onsi/ginkgo/v2" 26 | capie2e "sigs.k8s.io/cluster-api/test/e2e" 27 | 28 | "sigs.k8s.io/cluster-api-provider-openstack/test/e2e/shared" 29 | ) 30 | 31 | var _ = Describe("When testing Cluster API provider Openstack working on [self-hosted] clusters", func() { 32 | BeforeEach(func(ctx context.Context) { 33 | shared.ApplyCoreImagesPlus(ctx, e2eCtx, upgradeImage) 34 | 35 | setDownloadE2EImageEnvVar() 36 | }) 37 | 38 | capie2e.SelfHostedSpec(context.TODO(), func() capie2e.SelfHostedSpecInput { 39 | return capie2e.SelfHostedSpecInput{ 40 | E2EConfig: e2eCtx.E2EConfig, 41 | ClusterctlConfigPath: e2eCtx.Environment.ClusterctlConfigPath, 42 | BootstrapClusterProxy: e2eCtx.Environment.BootstrapClusterProxy, 43 | ArtifactFolder: e2eCtx.Settings.ArtifactFolder, 44 | SkipUpgrade: false, 45 | SkipCleanup: false, 46 | Flavor: shared.FlavorKubernetesUpgrade, 47 | } 48 | }) 49 | }) 50 | -------------------------------------------------------------------------------- /test/helpers/fuzz_restorer.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2024 The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package helpers 18 | 19 | import ( 20 | "runtime/debug" 21 | "testing" 22 | 23 | "github.com/onsi/gomega/format" 24 | "k8s.io/client-go/kubernetes/scheme" 25 | utilconversion "sigs.k8s.io/cluster-api/util/conversion" 26 | ) 27 | 28 | // FuzzRestorer fuzzes the inputs to a restore function and ensures that the function does not panic. 29 | func FuzzRestorer[T any](t *testing.T, name string, f func(*T, *T)) { 30 | t.Helper() 31 | fuzz := utilconversion.GetFuzzer(scheme.Scheme) 32 | 33 | t.Run(name, func(t *testing.T) { 34 | for i := 0; i < 1000; i++ { 35 | previous := new(T) 36 | dst := new(T) 37 | fuzz.Fuzz(previous) 38 | fuzz.Fuzz(dst) 39 | 40 | func() { 41 | defer func() { 42 | if r := recover(); r != nil { 43 | t.Errorf("PANIC with arguments\nPrevious: %s\nDest: %s\nStack: %s", 44 | format.Object(previous, 1), 45 | format.Object(dst, 1), 46 | debug.Stack()) 47 | t.FailNow() 48 | } 49 | }() 50 | f(previous, dst) 51 | }() 52 | } 53 | }) 54 | } 55 | -------------------------------------------------------------------------------- /test/infrastructure/openstack-resource-controller/config/default/kustomization.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: kustomize.config.k8s.io/v1beta1 2 | kind: Kustomization 3 | 4 | labels: 5 | # openstack-resource-controller is not a provider, but by adding this label 6 | # we can get this installed by Cluster APIs Tiltfile and by the clusterctl machinery we use in E2E tests. 7 | - pairs: 8 | cluster.x-k8s.io/provider: "runtime-extension-openstack-resource-controller" 9 | 10 | resources: 11 | - https://github.com/k-orc/openstack-resource-controller/releases/download/v2.0.3/install.yaml 12 | -------------------------------------------------------------------------------- /tilt-provider.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "openstack", 3 | "config": { 4 | "image": "gcr.io/k8s-staging-capi-openstack/capi-openstack-controller", 5 | "live_reload_deps": [ 6 | "main.go", 7 | "go.mod", 8 | "go.sum", 9 | "api", 10 | "config", 11 | "controllers", 12 | "pkg" 13 | ], 14 | "label": "CAPO" 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /versions.mk: -------------------------------------------------------------------------------- 1 | # Copyright 2021 The Kubernetes Authors. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | MDBOOK_VERSION := v0.4.35 16 | PLANTUML_VERSION := 1.2022.6 17 | GH_VERSION := 1.2.0 18 | --------------------------------------------------------------------------------