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 |
--------------------------------------------------------------------------------