├── .github ├── CODEOWNERS ├── ISSUE_TEMPLATE │ ├── feature.md │ └── bug.md ├── release.yml ├── workflows │ ├── lint.yml │ └── release.yml ├── PULL_REQUEST_TEMPLATE.md └── dependabot.yml ├── config ├── prometheus │ ├── kustomization.yaml │ ├── monitor_tls_patch.yaml │ └── monitor.yaml ├── network-policy │ ├── kustomization.yaml │ └── allow-metrics-traffic.yaml ├── default │ ├── manager_metrics_patch.yaml │ ├── manager_pull_policy.yaml │ ├── manager_config_patch.yaml │ ├── manager_image_patch.yaml │ ├── metrics_service.yaml │ ├── cert_metrics_manager_patch.yaml │ ├── manager_auth_proxy_patch.yaml │ └── kustomization.yaml ├── rbac │ ├── metrics_reader_role.yaml │ ├── metrics_auth_role_binding.yaml │ ├── metrics_auth_role.yaml │ ├── service_account.yaml │ ├── auth_proxy_client_clusterrole.yaml │ ├── role_binding.yaml │ ├── auth_proxy_role_binding.yaml │ ├── leader_election_role_binding.yaml │ ├── auth_proxy_role.yaml │ ├── auth_proxy_service.yaml │ ├── kustomization.yaml │ ├── harvestermachinetemplate_viewer_role.yaml │ ├── harvestercluster_viewer_role.yaml │ ├── harvestermachine_viewer_role.yaml │ ├── harvestermachinetemplate_editor_role.yaml │ ├── harvestercluster_editor_role.yaml │ ├── harvestermachine_editor_role.yaml │ ├── harvestercluster_admin_role.yaml │ ├── harvestermachine_admin_role.yaml │ ├── leader_election_role.yaml │ ├── harvesterclustertemplate_admin_role.yaml │ ├── harvestermachinetemplate_admin_role.yaml │ ├── harvesterclustertemplate_viewer_role.yaml │ ├── harvesterclustertemplate_editor_role.yaml │ └── role.yaml ├── manager │ ├── kustomization.yaml │ └── manager.yaml ├── samples │ ├── kustomization.yaml │ ├── infrastructure_v1alpha1_harvesterclustertemplate.yaml │ ├── infrastructure_v1alpha1_harvestermachinetemplate.yaml │ ├── infrastructure_v1alpha1_harvestercluster.yaml │ └── infrastructure_v1alpha1_harvestermachine.yaml └── crd │ ├── patches │ ├── cainjection_in_harvesterclusters.yaml │ ├── cainjection_in_harvestermachines.yaml │ ├── cainjection_in_harvestermachinetemplates.yaml │ ├── webhook_in_harvesterclusters.yaml │ ├── webhook_in_harvestermachines.yaml │ └── webhook_in_harvestermachinetemplates.yaml │ ├── kustomizeconfig.yaml │ └── kustomization.yaml ├── .dockerignore ├── metadata.yaml ├── hack ├── boilerplate.go.txt └── create-kind-cluster.sh ├── pkg └── clientset │ └── versioned │ ├── doc.go │ ├── fake │ ├── doc.go │ └── register.go │ ├── typed │ ├── upgrade.cattle.io │ │ └── v1 │ │ │ ├── generated_expansion.go │ │ │ ├── doc.go │ │ │ ├── fake │ │ │ ├── doc.go │ │ │ └── fake_upgrade.cattle.io_client.go │ │ │ └── upgrade.cattle.io_client.go │ ├── kubevirt.io │ │ └── v1 │ │ │ ├── doc.go │ │ │ ├── fake │ │ │ ├── doc.go │ │ │ └── fake_kubevirt.io_client.go │ │ │ ├── generated_expansion.go │ │ │ └── kubevirt.io_client.go │ ├── storage.k8s.io │ │ └── v1 │ │ │ ├── doc.go │ │ │ ├── fake │ │ │ ├── doc.go │ │ │ ├── fake_storage.k8s.io_client.go │ │ │ ├── fake_csinode.go │ │ │ └── fake_csidriver.go │ │ │ ├── generated_expansion.go │ │ │ └── storage.k8s.io_client.go │ ├── catalog.cattle.io │ │ └── v1 │ │ │ ├── doc.go │ │ │ ├── fake │ │ │ ├── doc.go │ │ │ └── fake_catalog.cattle.io_client.go │ │ │ ├── generated_expansion.go │ │ │ └── catalog.cattle.io_client.go │ ├── k8s.cni.cncf.io │ │ └── v1 │ │ │ ├── doc.go │ │ │ ├── fake │ │ │ ├── doc.go │ │ │ └── fake_k8s.cni.cncf.io_client.go │ │ │ ├── generated_expansion.go │ │ │ └── k8s.cni.cncf.io_client.go │ ├── longhorn.io │ │ └── v1beta2 │ │ │ ├── fake │ │ │ ├── doc.go │ │ │ ├── fake_longhorn.io_client.go │ │ │ └── fake_setting.go │ │ │ ├── doc.go │ │ │ └── generated_expansion.go │ ├── networking.k8s.io │ │ └── v1 │ │ │ ├── doc.go │ │ │ ├── fake │ │ │ ├── doc.go │ │ │ └── fake_networking.k8s.io_client.go │ │ │ ├── generated_expansion.go │ │ │ └── networking.k8s.io_client.go │ ├── cluster.x-k8s.io │ │ └── v1beta1 │ │ │ ├── fake │ │ │ ├── doc.go │ │ │ └── fake_cluster.x-k8s.io_client.go │ │ │ ├── doc.go │ │ │ ├── generated_expansion.go │ │ │ └── cluster.x-k8s.io_client.go │ ├── harvesterhci.io │ │ └── v1beta1 │ │ │ ├── fake │ │ │ ├── doc.go │ │ │ ├── fake_harvesterhci.io_client.go │ │ │ └── fake_version.go │ │ │ ├── doc.go │ │ │ └── generated_expansion.go │ ├── monitoring.coreos.com │ │ └── v1 │ │ │ ├── doc.go │ │ │ ├── fake │ │ │ ├── doc.go │ │ │ ├── fake_monitoring.coreos.com_client.go │ │ │ └── fake_probe.go │ │ │ ├── generated_expansion.go │ │ │ └── monitoring.coreos.com_client.go │ └── snapshot.storage.k8s.io │ │ └── v1 │ │ ├── doc.go │ │ ├── fake │ │ ├── doc.go │ │ └── fake_snapshot.storage.k8s.io_client.go │ │ ├── generated_expansion.go │ │ └── snapshot.storage.k8s.io_client.go │ └── scheme │ ├── doc.go │ └── register.go ├── util ├── util_suite_test.go ├── cloudinit_test.go ├── util_test.go └── cloudinit.go ├── .gitignore ├── Dockerfile ├── api └── v1alpha1 │ ├── groupversion_info.go │ ├── harvestermachinetemplate_types.go │ └── harvesterclustertemplate_types.go ├── PROJECT ├── internal └── controller │ ├── harvestermachine_controller_test.go │ └── suite_test.go ├── .golangci.yml ├── test └── e2e │ └── e2e_suite_test.go └── cmd └── main.go /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | belgaied2 2 | -------------------------------------------------------------------------------- /config/prometheus/kustomization.yaml: -------------------------------------------------------------------------------- 1 | resources: 2 | - monitor.yaml 3 | -------------------------------------------------------------------------------- /config/network-policy/kustomization.yaml: -------------------------------------------------------------------------------- 1 | resources: 2 | - allow-metrics-traffic.yaml 3 | -------------------------------------------------------------------------------- /.dockerignore: -------------------------------------------------------------------------------- 1 | # More info: https://docs.docker.com/engine/reference/builder/#dockerignore-file 2 | # Ignore build and test binaries. 3 | bin/ 4 | -------------------------------------------------------------------------------- /config/default/manager_metrics_patch.yaml: -------------------------------------------------------------------------------- 1 | # This patch adds the args to allow exposing the metrics endpoint using HTTPS 2 | - op: add 3 | path: /spec/template/spec/containers/0/args/0 4 | value: --metrics-bind-address=:8443 5 | -------------------------------------------------------------------------------- /config/rbac/metrics_reader_role.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: rbac.authorization.k8s.io/v1 2 | kind: ClusterRole 3 | metadata: 4 | name: metrics-reader 5 | rules: 6 | - nonResourceURLs: 7 | - "/metrics" 8 | verbs: 9 | - get 10 | -------------------------------------------------------------------------------- /config/manager/kustomization.yaml: -------------------------------------------------------------------------------- 1 | resources: 2 | - manager.yaml 3 | apiVersion: kustomize.config.k8s.io/v1beta1 4 | kind: Kustomization 5 | images: 6 | - name: controller 7 | newName: ghcr.io/rancher-sandbox/cluster-api-harvester-controller 8 | newTag: latest 9 | -------------------------------------------------------------------------------- /config/default/manager_pull_policy.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1 2 | kind: Deployment 3 | metadata: 4 | name: controller-manager 5 | namespace: system 6 | spec: 7 | template: 8 | spec: 9 | containers: 10 | - name: manager 11 | imagePullPolicy: Always -------------------------------------------------------------------------------- /config/default/manager_config_patch.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1 2 | kind: Deployment 3 | metadata: 4 | name: controller-manager 5 | namespace: system 6 | spec: 7 | template: 8 | spec: 9 | containers: 10 | - name: manager 11 | image: ghcr.io/rancher-sandbox/cluster-api-provider-harvester:dev 12 | -------------------------------------------------------------------------------- /config/default/manager_image_patch.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1 2 | kind: Deployment 3 | metadata: 4 | name: controller-manager 5 | namespace: system 6 | spec: 7 | template: 8 | spec: 9 | containers: 10 | - image: ghcr.io/rancher-sandbox/cluster-api-provider-harvester:dev 11 | name: manager -------------------------------------------------------------------------------- /config/samples/kustomization.yaml: -------------------------------------------------------------------------------- 1 | ## Append samples of your project ## 2 | resources: 3 | - infrastructure_v1alpha1_harvestermachine.yaml 4 | - infrastructure_v1alpha1_harvestercluster.yaml 5 | - infrastructure_v1alpha1_harvestermachinetemplate.yaml 6 | - infrastructure_v1alpha1_harvesterclustertemplate.yaml 7 | # +kubebuilder:scaffold:manifestskustomizesamples 8 | -------------------------------------------------------------------------------- /config/rbac/metrics_auth_role_binding.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: rbac.authorization.k8s.io/v1 2 | kind: ClusterRoleBinding 3 | metadata: 4 | name: metrics-auth-rolebinding 5 | roleRef: 6 | apiGroup: rbac.authorization.k8s.io 7 | kind: ClusterRole 8 | name: metrics-auth-role 9 | subjects: 10 | - kind: ServiceAccount 11 | name: controller-manager 12 | namespace: system 13 | -------------------------------------------------------------------------------- /config/crd/patches/cainjection_in_harvesterclusters.yaml: -------------------------------------------------------------------------------- 1 | # The following patch adds a directive for certmanager to inject CA into the CRD 2 | apiVersion: apiextensions.k8s.io/v1 3 | kind: CustomResourceDefinition 4 | metadata: 5 | annotations: 6 | cert-manager.io/inject-ca-from: $(CERTIFICATE_NAMESPACE)/$(CERTIFICATE_NAME) 7 | name: harvesterclusters.infrastructure.cluster.x-k8s.io 8 | -------------------------------------------------------------------------------- /config/crd/patches/cainjection_in_harvestermachines.yaml: -------------------------------------------------------------------------------- 1 | # The following patch adds a directive for certmanager to inject CA into the CRD 2 | apiVersion: apiextensions.k8s.io/v1 3 | kind: CustomResourceDefinition 4 | metadata: 5 | annotations: 6 | cert-manager.io/inject-ca-from: $(CERTIFICATE_NAMESPACE)/$(CERTIFICATE_NAME) 7 | name: harvestermachines.infrastructure.cluster.x-k8s.io 8 | -------------------------------------------------------------------------------- /config/samples/infrastructure_v1alpha1_harvesterclustertemplate.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: infrastructure.cluster.x-k8s.io/v1alpha1 2 | kind: HarvesterClusterTemplate 3 | metadata: 4 | labels: 5 | app.kubernetes.io/name: cluster-api-provider-harvester 6 | app.kubernetes.io/managed-by: kustomize 7 | name: harvesterclustertemplate-sample 8 | spec: 9 | # TODO(user): Add fields here 10 | -------------------------------------------------------------------------------- /config/rbac/metrics_auth_role.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: rbac.authorization.k8s.io/v1 2 | kind: ClusterRole 3 | metadata: 4 | name: metrics-auth-role 5 | rules: 6 | - apiGroups: 7 | - authentication.k8s.io 8 | resources: 9 | - tokenreviews 10 | verbs: 11 | - create 12 | - apiGroups: 13 | - authorization.k8s.io 14 | resources: 15 | - subjectaccessreviews 16 | verbs: 17 | - create 18 | -------------------------------------------------------------------------------- /config/crd/patches/cainjection_in_harvestermachinetemplates.yaml: -------------------------------------------------------------------------------- 1 | # The following patch adds a directive for certmanager to inject CA into the CRD 2 | apiVersion: apiextensions.k8s.io/v1 3 | kind: CustomResourceDefinition 4 | metadata: 5 | annotations: 6 | cert-manager.io/inject-ca-from: $(CERTIFICATE_NAMESPACE)/$(CERTIFICATE_NAME) 7 | name: harvestermachinetemplates.infrastructure.cluster.x-k8s.io 8 | -------------------------------------------------------------------------------- /metadata.yaml: -------------------------------------------------------------------------------- 1 | # maps release series of major.minor to cluster-api contract version 2 | # the contract version may change between minor or major versions, but *not* 3 | # between patch versions. 4 | # 5 | # update this file only when a new major or minor version is released 6 | apiVersion: clusterctl.cluster.x-k8s.io/v1alpha3 7 | kind: Metadata 8 | releaseSeries: 9 | - major: 0 10 | minor: 1 11 | contract: v1beta1 -------------------------------------------------------------------------------- /config/rbac/service_account.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: ServiceAccount 3 | metadata: 4 | labels: 5 | app.kubernetes.io/name: serviceaccount 6 | app.kuberentes.io/instance: controller-manager 7 | app.kubernetes.io/component: rbac 8 | app.kubernetes.io/created-by: cluster-api-provider-harvester 9 | app.kubernetes.io/part-of: cluster-api-provider-harvester 10 | app.kubernetes.io/managed-by: kustomize 11 | name: controller-manager 12 | namespace: system 13 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for the Harvester Provider 4 | title: '' 5 | labels: kind/feature, needs-priority, needs-triage 6 | assigness: '' 7 | --- 8 | 9 | **Describe the solution you'd like:** 10 | [A clear and concise description of what you want to happen.] 11 | 12 | **Why do you want this feature:** 13 | 14 | **Anything else you would like to add:** 15 | [Miscellaneous information that will assist in solving the issue.] 16 | -------------------------------------------------------------------------------- /.github/release.yml: -------------------------------------------------------------------------------- 1 | changelog: 2 | categories: 3 | - title: 🚀 Enhancements 4 | labels: 5 | - kind/feature 6 | - title: 👒 Dependency bumps 7 | labels: 8 | - area/dependency 9 | - area/build-and-release 10 | - title: 🐛 Bugs 11 | labels: 12 | - kind/bug 13 | - kind/regression 14 | - title: 📖 Docs 15 | labels: 16 | - kind/documentation 17 | - title: Other Changes 18 | labels: 19 | - "*" 20 | -------------------------------------------------------------------------------- /.github/workflows/lint.yml: -------------------------------------------------------------------------------- 1 | name: Lint 2 | 3 | on: 4 | push: 5 | pull_request: 6 | 7 | jobs: 8 | lint: 9 | name: Run on Ubuntu 10 | runs-on: ubuntu-latest 11 | steps: 12 | - name: Clone the code 13 | uses: actions/checkout@v4 14 | 15 | - name: Setup Go 16 | uses: actions/setup-go@v5 17 | with: 18 | go-version-file: go.mod 19 | 20 | - name: Run linter 21 | uses: golangci/golangci-lint-action@v8 22 | with: 23 | version: v2.2.1 24 | -------------------------------------------------------------------------------- /config/samples/infrastructure_v1alpha1_harvestermachinetemplate.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: infrastructure.cluster.x-k8s.io/v1alpha1 2 | kind: HarvesterMachineTemplate 3 | metadata: 4 | labels: 5 | app.kubernetes.io/name: harvestermachinetemplate 6 | app.kubernetes.io/instance: harvestermachinetemplate-sample 7 | app.kubernetes.io/part-of: caph 8 | app.kubernetes.io/managed-by: kustomize 9 | app.kubernetes.io/created-by: caph 10 | name: harvestermachinetemplate-sample 11 | spec: 12 | # TODO(user): Add fields here 13 | -------------------------------------------------------------------------------- /config/crd/patches/webhook_in_harvesterclusters.yaml: -------------------------------------------------------------------------------- 1 | # The following patch enables a conversion webhook for the CRD 2 | apiVersion: apiextensions.k8s.io/v1 3 | kind: CustomResourceDefinition 4 | metadata: 5 | name: harvesterclusters.infrastructure.cluster.x-k8s.io 6 | spec: 7 | conversion: 8 | strategy: Webhook 9 | webhook: 10 | clientConfig: 11 | service: 12 | namespace: system 13 | name: webhook-service 14 | path: /convert 15 | conversionReviewVersions: 16 | - v1 17 | -------------------------------------------------------------------------------- /config/crd/patches/webhook_in_harvestermachines.yaml: -------------------------------------------------------------------------------- 1 | # The following patch enables a conversion webhook for the CRD 2 | apiVersion: apiextensions.k8s.io/v1 3 | kind: CustomResourceDefinition 4 | metadata: 5 | name: harvestermachines.infrastructure.cluster.x-k8s.io 6 | spec: 7 | conversion: 8 | strategy: Webhook 9 | webhook: 10 | clientConfig: 11 | service: 12 | namespace: system 13 | name: webhook-service 14 | path: /convert 15 | conversionReviewVersions: 16 | - v1 17 | -------------------------------------------------------------------------------- /config/samples/infrastructure_v1alpha1_harvestercluster.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: infrastructure.cluster.x-k8s.io/v1alpha1 2 | kind: HarvesterCluster 3 | metadata: 4 | labels: 5 | app.kubernetes.io/name: harvestercluster 6 | app.kubernetes.io/instance: harvestercluster-sample 7 | app.kubernetes.io/part-of: cluster-api-provider-harvester 8 | app.kuberentes.io/managed-by: kustomize 9 | app.kubernetes.io/created-by: cluster-api-provider-harvester 10 | name: harvestercluster-sample 11 | spec: 12 | # TODO(user): Add fields here 13 | -------------------------------------------------------------------------------- /config/samples/infrastructure_v1alpha1_harvestermachine.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: infrastructure.cluster.x-k8s.io/v1alpha1 2 | kind: HarvesterMachine 3 | metadata: 4 | labels: 5 | app.kubernetes.io/name: harvestermachine 6 | app.kubernetes.io/instance: harvestermachine-sample 7 | app.kubernetes.io/part-of: cluster-api-provider-harvester 8 | app.kuberentes.io/managed-by: kustomize 9 | app.kubernetes.io/created-by: cluster-api-provider-harvester 10 | name: harvestermachine-sample 11 | spec: 12 | # TODO(user): Add fields here 13 | -------------------------------------------------------------------------------- /config/crd/patches/webhook_in_harvestermachinetemplates.yaml: -------------------------------------------------------------------------------- 1 | # The following patch enables a conversion webhook for the CRD 2 | apiVersion: apiextensions.k8s.io/v1 3 | kind: CustomResourceDefinition 4 | metadata: 5 | name: harvestermachinetemplates.infrastructure.cluster.x-k8s.io 6 | spec: 7 | conversion: 8 | strategy: Webhook 9 | webhook: 10 | clientConfig: 11 | service: 12 | namespace: system 13 | name: webhook-service 14 | path: /convert 15 | conversionReviewVersions: 16 | - v1 17 | -------------------------------------------------------------------------------- /config/default/metrics_service.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | labels: 5 | control-plane: controller-manager 6 | app.kubernetes.io/name: cluster-api-provider-harvester 7 | app.kubernetes.io/managed-by: kustomize 8 | name: controller-manager-metrics-service 9 | namespace: system 10 | spec: 11 | ports: 12 | - name: https 13 | port: 8443 14 | protocol: TCP 15 | targetPort: 8443 16 | selector: 17 | control-plane: controller-manager 18 | app.kubernetes.io/name: cluster-api-provider-harvester 19 | -------------------------------------------------------------------------------- /config/rbac/auth_proxy_client_clusterrole.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: rbac.authorization.k8s.io/v1 2 | kind: ClusterRole 3 | metadata: 4 | labels: 5 | app.kubernetes.io/name: clusterrole 6 | app.kubernetes.io/instance: metrics-reader 7 | app.kubernetes.io/component: kube-rbac-proxy 8 | app.kubernetes.io/created-by: cluster-api-provider-harvester 9 | app.kubernetes.io/part-of: cluster-api-provider-harvester 10 | app.kubernetes.io/managed-by: kustomize 11 | name: metrics-reader 12 | rules: 13 | - nonResourceURLs: 14 | - "/metrics" 15 | verbs: 16 | - get 17 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Tell us about a problem you are experiencing 4 | title: '' 5 | labels: kind/bug, needs-priority, needs-triage 6 | assignees: '' 7 | --- 8 | 9 | **What happened:** 10 | [A clear and concise description of what the bug is.] 11 | 12 | **What did you expect to happen:** 13 | 14 | **How to reproduce it:** 15 | 16 | **Anything else you would like to add:** 17 | [Miscellaneous information that will assist in solving the issue.] 18 | 19 | **Environment:** 20 | 21 | - rke provider version: 22 | - OS (e.g. from `/etc/os-release`): 23 | -------------------------------------------------------------------------------- /config/crd/kustomizeconfig.yaml: -------------------------------------------------------------------------------- 1 | # This file is for teaching kustomize how to substitute name and namespace reference in CRD 2 | nameReference: 3 | - kind: Service 4 | version: v1 5 | fieldSpecs: 6 | - kind: CustomResourceDefinition 7 | version: v1 8 | group: apiextensions.k8s.io 9 | path: spec/conversion/webhook/clientConfig/service/name 10 | 11 | namespace: 12 | - kind: CustomResourceDefinition 13 | version: v1 14 | group: apiextensions.k8s.io 15 | path: spec/conversion/webhook/clientConfig/service/namespace 16 | create: false 17 | 18 | varReference: 19 | - path: metadata/annotations 20 | -------------------------------------------------------------------------------- /hack/boilerplate.go.txt: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2025 SUSE. 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 | */ -------------------------------------------------------------------------------- /config/prometheus/monitor_tls_patch.yaml: -------------------------------------------------------------------------------- 1 | # Patch for Prometheus ServiceMonitor to enable secure TLS configuration 2 | # using certificates managed by cert-manager 3 | - op: replace 4 | path: /spec/endpoints/0/tlsConfig 5 | value: 6 | # SERVICE_NAME and SERVICE_NAMESPACE will be substituted by kustomize 7 | serverName: SERVICE_NAME.SERVICE_NAMESPACE.svc 8 | insecureSkipVerify: false 9 | ca: 10 | secret: 11 | name: metrics-server-cert 12 | key: ca.crt 13 | cert: 14 | secret: 15 | name: metrics-server-cert 16 | key: tls.crt 17 | keySecret: 18 | name: metrics-server-cert 19 | key: tls.key 20 | -------------------------------------------------------------------------------- /config/rbac/role_binding.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: rbac.authorization.k8s.io/v1 2 | kind: ClusterRoleBinding 3 | metadata: 4 | labels: 5 | app.kubernetes.io/name: clusterrolebinding 6 | app.kubernetes.io/instance: manager-rolebinding 7 | app.kubernetes.io/component: rbac 8 | app.kubernetes.io/created-by: cluster-api-provider-harvester 9 | app.kubernetes.io/part-of: cluster-api-provider-harvester 10 | app.kubernetes.io/managed-by: kustomize 11 | name: manager-rolebinding 12 | roleRef: 13 | apiGroup: rbac.authorization.k8s.io 14 | kind: ClusterRole 15 | name: manager-role 16 | subjects: 17 | - kind: ServiceAccount 18 | name: controller-manager 19 | namespace: system 20 | -------------------------------------------------------------------------------- /config/rbac/auth_proxy_role_binding.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: rbac.authorization.k8s.io/v1 2 | kind: ClusterRoleBinding 3 | metadata: 4 | labels: 5 | app.kubernetes.io/name: clusterrolebinding 6 | app.kubernetes.io/instance: proxy-rolebinding 7 | app.kubernetes.io/component: kube-rbac-proxy 8 | app.kubernetes.io/created-by: cluster-api-provider-harvester 9 | app.kubernetes.io/part-of: cluster-api-provider-harvester 10 | app.kubernetes.io/managed-by: kustomize 11 | name: proxy-rolebinding 12 | roleRef: 13 | apiGroup: rbac.authorization.k8s.io 14 | kind: ClusterRole 15 | name: proxy-role 16 | subjects: 17 | - kind: ServiceAccount 18 | name: controller-manager 19 | namespace: system 20 | -------------------------------------------------------------------------------- /config/rbac/leader_election_role_binding.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: rbac.authorization.k8s.io/v1 2 | kind: RoleBinding 3 | metadata: 4 | labels: 5 | app.kubernetes.io/name: rolebinding 6 | app.kubernetes.io/instance: leader-election-rolebinding 7 | app.kubernetes.io/component: rbac 8 | app.kubernetes.io/created-by: cluster-api-provider-harvester 9 | app.kubernetes.io/part-of: cluster-api-provider-harvester 10 | app.kubernetes.io/managed-by: kustomize 11 | name: leader-election-rolebinding 12 | roleRef: 13 | apiGroup: rbac.authorization.k8s.io 14 | kind: Role 15 | name: leader-election-role 16 | subjects: 17 | - kind: ServiceAccount 18 | name: controller-manager 19 | namespace: system 20 | -------------------------------------------------------------------------------- /config/rbac/auth_proxy_role.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: rbac.authorization.k8s.io/v1 2 | kind: ClusterRole 3 | metadata: 4 | labels: 5 | app.kubernetes.io/name: clusterrole 6 | app.kubernetes.io/instance: proxy-role 7 | app.kubernetes.io/component: kube-rbac-proxy 8 | app.kubernetes.io/created-by: cluster-api-provider-harvester 9 | app.kubernetes.io/part-of: cluster-api-provider-harvester 10 | app.kubernetes.io/managed-by: kustomize 11 | name: proxy-role 12 | rules: 13 | - apiGroups: 14 | - authentication.k8s.io 15 | resources: 16 | - tokenreviews 17 | verbs: 18 | - create 19 | - apiGroups: 20 | - authorization.k8s.io 21 | resources: 22 | - subjectaccessreviews 23 | verbs: 24 | - create 25 | -------------------------------------------------------------------------------- /config/rbac/auth_proxy_service.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | labels: 5 | control-plane: controller-manager 6 | app.kubernetes.io/name: service 7 | app.kubernetes.io/instance: controller-manager-metrics-service 8 | app.kubernetes.io/component: kube-rbac-proxy 9 | app.kubernetes.io/created-by: cluster-api-provider-harvester 10 | app.kubernetes.io/part-of: cluster-api-provider-harvester 11 | app.kubernetes.io/managed-by: kustomize 12 | name: controller-manager-metrics-service 13 | namespace: system 14 | spec: 15 | ports: 16 | - name: https 17 | port: 8443 18 | protocol: TCP 19 | targetPort: https 20 | selector: 21 | control-plane: controller-manager 22 | -------------------------------------------------------------------------------- /pkg/clientset/versioned/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2025 SUSE. 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 main. DO NOT EDIT. 18 | 19 | // This package has the automatically generated clientset. 20 | package versioned 21 | -------------------------------------------------------------------------------- /pkg/clientset/versioned/fake/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2025 SUSE. 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 main. DO NOT EDIT. 18 | 19 | // This package has the automatically generated fake clientset. 20 | package fake 21 | -------------------------------------------------------------------------------- /config/rbac/kustomization.yaml: -------------------------------------------------------------------------------- 1 | resources: 2 | # All RBAC will be applied under this service account in 3 | # the deployment namespace. You may comment out this resource 4 | # if your manager will use a service account that exists at 5 | # runtime. Be sure to update RoleBinding and ClusterRoleBinding 6 | # subjects if changing service account names. 7 | - service_account.yaml 8 | - role.yaml 9 | - role_binding.yaml 10 | - leader_election_role.yaml 11 | - leader_election_role_binding.yaml 12 | # Comment the following 4 lines if you want to disable 13 | # the auth proxy (https://github.com/brancz/kube-rbac-proxy) 14 | # which protects your /metrics endpoint. 15 | - auth_proxy_service.yaml 16 | - auth_proxy_role.yaml 17 | - auth_proxy_role_binding.yaml 18 | - auth_proxy_client_clusterrole.yaml 19 | -------------------------------------------------------------------------------- /pkg/clientset/versioned/typed/upgrade.cattle.io/v1/generated_expansion.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2025 SUSE. 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 main. DO NOT EDIT. 18 | 19 | package v1 20 | 21 | type PlanExpansion interface{} 22 | -------------------------------------------------------------------------------- /pkg/clientset/versioned/typed/kubevirt.io/v1/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2025 SUSE. 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 main. DO NOT EDIT. 18 | 19 | // This package has the automatically generated typed clients. 20 | package v1 21 | -------------------------------------------------------------------------------- /pkg/clientset/versioned/typed/kubevirt.io/v1/fake/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2025 SUSE. 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 main. DO NOT EDIT. 18 | 19 | // Package fake has the automatically generated clients. 20 | package fake 21 | -------------------------------------------------------------------------------- /pkg/clientset/versioned/typed/storage.k8s.io/v1/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2025 SUSE. 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 main. DO NOT EDIT. 18 | 19 | // This package has the automatically generated typed clients. 20 | package v1 21 | -------------------------------------------------------------------------------- /pkg/clientset/versioned/scheme/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2025 SUSE. 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 main. DO NOT EDIT. 18 | 19 | // This package contains the scheme of the automatically generated clientset. 20 | package scheme 21 | -------------------------------------------------------------------------------- /pkg/clientset/versioned/typed/catalog.cattle.io/v1/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2025 SUSE. 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 main. DO NOT EDIT. 18 | 19 | // This package has the automatically generated typed clients. 20 | package v1 21 | -------------------------------------------------------------------------------- /pkg/clientset/versioned/typed/catalog.cattle.io/v1/fake/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2025 SUSE. 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 main. DO NOT EDIT. 18 | 19 | // Package fake has the automatically generated clients. 20 | package fake 21 | -------------------------------------------------------------------------------- /pkg/clientset/versioned/typed/k8s.cni.cncf.io/v1/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2025 SUSE. 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 main. DO NOT EDIT. 18 | 19 | // This package has the automatically generated typed clients. 20 | package v1 21 | -------------------------------------------------------------------------------- /pkg/clientset/versioned/typed/k8s.cni.cncf.io/v1/fake/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2025 SUSE. 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 main. DO NOT EDIT. 18 | 19 | // Package fake has the automatically generated clients. 20 | package fake 21 | -------------------------------------------------------------------------------- /pkg/clientset/versioned/typed/longhorn.io/v1beta2/fake/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2025 SUSE. 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 main. DO NOT EDIT. 18 | 19 | // Package fake has the automatically generated clients. 20 | package fake 21 | -------------------------------------------------------------------------------- /pkg/clientset/versioned/typed/networking.k8s.io/v1/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2025 SUSE. 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 main. DO NOT EDIT. 18 | 19 | // This package has the automatically generated typed clients. 20 | package v1 21 | -------------------------------------------------------------------------------- /pkg/clientset/versioned/typed/networking.k8s.io/v1/fake/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2025 SUSE. 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 main. DO NOT EDIT. 18 | 19 | // Package fake has the automatically generated clients. 20 | package fake 21 | -------------------------------------------------------------------------------- /pkg/clientset/versioned/typed/storage.k8s.io/v1/fake/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2025 SUSE. 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 main. DO NOT EDIT. 18 | 19 | // Package fake has the automatically generated clients. 20 | package fake 21 | -------------------------------------------------------------------------------- /pkg/clientset/versioned/typed/upgrade.cattle.io/v1/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2025 SUSE. 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 main. DO NOT EDIT. 18 | 19 | // This package has the automatically generated typed clients. 20 | package v1 21 | -------------------------------------------------------------------------------- /pkg/clientset/versioned/typed/upgrade.cattle.io/v1/fake/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2025 SUSE. 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 main. DO NOT EDIT. 18 | 19 | // Package fake has the automatically generated clients. 20 | package fake 21 | -------------------------------------------------------------------------------- /pkg/clientset/versioned/typed/cluster.x-k8s.io/v1beta1/fake/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2025 SUSE. 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 main. DO NOT EDIT. 18 | 19 | // Package fake has the automatically generated clients. 20 | package fake 21 | -------------------------------------------------------------------------------- /pkg/clientset/versioned/typed/harvesterhci.io/v1beta1/fake/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2025 SUSE. 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 main. DO NOT EDIT. 18 | 19 | // Package fake has the automatically generated clients. 20 | package fake 21 | -------------------------------------------------------------------------------- /pkg/clientset/versioned/typed/longhorn.io/v1beta2/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2025 SUSE. 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 main. DO NOT EDIT. 18 | 19 | // This package has the automatically generated typed clients. 20 | package v1beta2 21 | -------------------------------------------------------------------------------- /pkg/clientset/versioned/typed/monitoring.coreos.com/v1/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2025 SUSE. 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 main. DO NOT EDIT. 18 | 19 | // This package has the automatically generated typed clients. 20 | package v1 21 | -------------------------------------------------------------------------------- /pkg/clientset/versioned/typed/monitoring.coreos.com/v1/fake/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2025 SUSE. 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 main. DO NOT EDIT. 18 | 19 | // Package fake has the automatically generated clients. 20 | package fake 21 | -------------------------------------------------------------------------------- /pkg/clientset/versioned/typed/snapshot.storage.k8s.io/v1/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2025 SUSE. 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 main. DO NOT EDIT. 18 | 19 | // This package has the automatically generated typed clients. 20 | package v1 21 | -------------------------------------------------------------------------------- /pkg/clientset/versioned/typed/snapshot.storage.k8s.io/v1/fake/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2025 SUSE. 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 main. DO NOT EDIT. 18 | 19 | // Package fake has the automatically generated clients. 20 | package fake 21 | -------------------------------------------------------------------------------- /pkg/clientset/versioned/typed/cluster.x-k8s.io/v1beta1/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2025 SUSE. 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 main. DO NOT EDIT. 18 | 19 | // This package has the automatically generated typed clients. 20 | package v1beta1 21 | -------------------------------------------------------------------------------- /pkg/clientset/versioned/typed/harvesterhci.io/v1beta1/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2025 SUSE. 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 main. DO NOT EDIT. 18 | 19 | // This package has the automatically generated typed clients. 20 | package v1beta1 21 | -------------------------------------------------------------------------------- /pkg/clientset/versioned/typed/k8s.cni.cncf.io/v1/generated_expansion.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2025 SUSE. 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 main. DO NOT EDIT. 18 | 19 | package v1 20 | 21 | type NetworkAttachmentDefinitionExpansion interface{} 22 | -------------------------------------------------------------------------------- /pkg/clientset/versioned/typed/cluster.x-k8s.io/v1beta1/generated_expansion.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2025 SUSE. 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 main. DO NOT EDIT. 18 | 19 | package v1beta1 20 | 21 | type ClusterExpansion interface{} 22 | 23 | type MachineExpansion interface{} 24 | -------------------------------------------------------------------------------- /config/rbac/harvestermachinetemplate_viewer_role.yaml: -------------------------------------------------------------------------------- 1 | # permissions for end users to view harvestermachinetemplates. 2 | apiVersion: rbac.authorization.k8s.io/v1 3 | kind: ClusterRole 4 | metadata: 5 | labels: 6 | app.kubernetes.io/name: clusterrole 7 | app.kubernetes.io/instance: harvestermachinetemplate-viewer-role 8 | app.kubernetes.io/component: rbac 9 | app.kubernetes.io/created-by: caph 10 | app.kubernetes.io/part-of: caph 11 | app.kubernetes.io/managed-by: kustomize 12 | name: harvestermachinetemplate-viewer-role 13 | rules: 14 | - apiGroups: 15 | - infrastructure.cluster.x-k8s.io 16 | resources: 17 | - harvestermachinetemplates 18 | verbs: 19 | - get 20 | - list 21 | - watch 22 | - apiGroups: 23 | - infrastructure.cluster.x-k8s.io 24 | resources: 25 | - harvestermachinetemplates/status 26 | verbs: 27 | - get 28 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | 10 | 11 | **What this PR does / why we need it**: 12 | 13 | 14 | 15 | **Which issue(s) this PR fixes** *(optional, in `fixes #(, fixes #, ...)` format, will close the issue(s) when PR gets merged)*: 16 | Fixes # 17 | 18 | **Special notes for your reviewer**: 19 | 20 | **Checklist**: 21 | 22 | 23 | - [ ] squashed commits into logical changes 24 | - [ ] includes documentation 25 | - [ ] adds unit tests 26 | - [ ] adds or updates e2e tests 27 | -------------------------------------------------------------------------------- /config/rbac/harvestercluster_viewer_role.yaml: -------------------------------------------------------------------------------- 1 | # permissions for end users to view harvesterclusters. 2 | apiVersion: rbac.authorization.k8s.io/v1 3 | kind: ClusterRole 4 | metadata: 5 | labels: 6 | app.kubernetes.io/name: clusterrole 7 | app.kubernetes.io/instance: harvestercluster-viewer-role 8 | app.kubernetes.io/component: rbac 9 | app.kubernetes.io/created-by: cluster-api-provider-harvester 10 | app.kubernetes.io/part-of: cluster-api-provider-harvester 11 | app.kubernetes.io/managed-by: kustomize 12 | name: harvestercluster-viewer-role 13 | rules: 14 | - apiGroups: 15 | - infrastructure.cluster.x-k8s.io 16 | resources: 17 | - harvesterclusters 18 | verbs: 19 | - get 20 | - list 21 | - watch 22 | - apiGroups: 23 | - infrastructure.cluster.x-k8s.io 24 | resources: 25 | - harvesterclusters/status 26 | verbs: 27 | - get 28 | -------------------------------------------------------------------------------- /config/rbac/harvestermachine_viewer_role.yaml: -------------------------------------------------------------------------------- 1 | # permissions for end users to view harvestermachines. 2 | apiVersion: rbac.authorization.k8s.io/v1 3 | kind: ClusterRole 4 | metadata: 5 | labels: 6 | app.kubernetes.io/name: clusterrole 7 | app.kubernetes.io/instance: harvestermachine-viewer-role 8 | app.kubernetes.io/component: rbac 9 | app.kubernetes.io/created-by: cluster-api-provider-harvester 10 | app.kubernetes.io/part-of: cluster-api-provider-harvester 11 | app.kubernetes.io/managed-by: kustomize 12 | name: harvestermachine-viewer-role 13 | rules: 14 | - apiGroups: 15 | - infrastructure.cluster.x-k8s.io 16 | resources: 17 | - harvestermachines 18 | verbs: 19 | - get 20 | - list 21 | - watch 22 | - apiGroups: 23 | - infrastructure.cluster.x-k8s.io 24 | resources: 25 | - harvestermachines/status 26 | verbs: 27 | - get 28 | -------------------------------------------------------------------------------- /pkg/clientset/versioned/typed/catalog.cattle.io/v1/generated_expansion.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2025 SUSE. 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 main. DO NOT EDIT. 18 | 19 | package v1 20 | 21 | type AppExpansion interface{} 22 | 23 | type ClusterRepoExpansion interface{} 24 | 25 | type OperationExpansion interface{} 26 | -------------------------------------------------------------------------------- /util/util_suite_test.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2025 SUSE. 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 util 18 | 19 | import ( 20 | "testing" 21 | 22 | . "github.com/onsi/ginkgo" 23 | . "github.com/onsi/gomega" 24 | ) 25 | 26 | func TestCloudInit(t *testing.T) { 27 | RegisterFailHandler(Fail) 28 | 29 | RunSpecs(t, "Util Suite") 30 | } 31 | -------------------------------------------------------------------------------- /pkg/clientset/versioned/typed/networking.k8s.io/v1/generated_expansion.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2025 SUSE. 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 main. DO NOT EDIT. 18 | 19 | package v1 20 | 21 | type IngressExpansion interface{} 22 | 23 | type IngressClassExpansion interface{} 24 | 25 | type NetworkPolicyExpansion interface{} 26 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # If you prefer the allow list template instead of the deny list, see community template: 2 | # https://github.com/github/gitignore/blob/main/community/Golang/Go.AllowList.gitignore 3 | # 4 | # Binaries for programs and plugins 5 | *.exe 6 | *.exe~ 7 | *.dll 8 | *.so 9 | *.dylib 10 | 11 | # Test binary, built with `go test -c` 12 | *.test 13 | 14 | # Output of the go coverage tool, specifically when used with LiteIDE 15 | *.out 16 | 17 | # Dependency directories (remove the comment below to include it) 18 | # vendor/ 19 | 20 | # Go workspace file 21 | go.work 22 | 23 | # compilation targets 24 | bin/ 25 | out/ 26 | 27 | # Tilt 28 | tilt-provider.json 29 | .tiltbuild/ 30 | 31 | # IDE files 32 | .idea/ 33 | .vscode/ 34 | .devcontainer/ 35 | 36 | # All environment variables should be added to .env file 37 | *.env 38 | 39 | # Aider files 40 | .aider.* 41 | conditions-adding.md 42 | .aider* 43 | -------------------------------------------------------------------------------- /pkg/clientset/versioned/typed/snapshot.storage.k8s.io/v1/generated_expansion.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2025 SUSE. 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 main. DO NOT EDIT. 18 | 19 | package v1 20 | 21 | type VolumeSnapshotExpansion interface{} 22 | 23 | type VolumeSnapshotClassExpansion interface{} 24 | 25 | type VolumeSnapshotContentExpansion interface{} 26 | -------------------------------------------------------------------------------- /config/rbac/harvestermachinetemplate_editor_role.yaml: -------------------------------------------------------------------------------- 1 | # permissions for end users to edit harvestermachinetemplates. 2 | apiVersion: rbac.authorization.k8s.io/v1 3 | kind: ClusterRole 4 | metadata: 5 | labels: 6 | app.kubernetes.io/name: clusterrole 7 | app.kubernetes.io/instance: harvestermachinetemplate-editor-role 8 | app.kubernetes.io/component: rbac 9 | app.kubernetes.io/created-by: caph 10 | app.kubernetes.io/part-of: caph 11 | app.kubernetes.io/managed-by: kustomize 12 | name: harvestermachinetemplate-editor-role 13 | rules: 14 | - apiGroups: 15 | - infrastructure.cluster.x-k8s.io 16 | resources: 17 | - harvestermachinetemplates 18 | verbs: 19 | - create 20 | - delete 21 | - get 22 | - list 23 | - patch 24 | - update 25 | - watch 26 | - apiGroups: 27 | - infrastructure.cluster.x-k8s.io 28 | resources: 29 | - harvestermachinetemplates/status 30 | verbs: 31 | - get 32 | -------------------------------------------------------------------------------- /config/rbac/harvestercluster_editor_role.yaml: -------------------------------------------------------------------------------- 1 | # permissions for end users to edit harvesterclusters. 2 | apiVersion: rbac.authorization.k8s.io/v1 3 | kind: ClusterRole 4 | metadata: 5 | labels: 6 | app.kubernetes.io/name: clusterrole 7 | app.kubernetes.io/instance: harvestercluster-editor-role 8 | app.kubernetes.io/component: rbac 9 | app.kubernetes.io/created-by: cluster-api-provider-harvester 10 | app.kubernetes.io/part-of: cluster-api-provider-harvester 11 | app.kubernetes.io/managed-by: kustomize 12 | name: harvestercluster-editor-role 13 | rules: 14 | - apiGroups: 15 | - infrastructure.cluster.x-k8s.io 16 | resources: 17 | - harvesterclusters 18 | verbs: 19 | - create 20 | - delete 21 | - get 22 | - list 23 | - patch 24 | - update 25 | - watch 26 | - apiGroups: 27 | - infrastructure.cluster.x-k8s.io 28 | resources: 29 | - harvesterclusters/status 30 | verbs: 31 | - get 32 | -------------------------------------------------------------------------------- /config/rbac/harvestermachine_editor_role.yaml: -------------------------------------------------------------------------------- 1 | # permissions for end users to edit harvestermachines. 2 | apiVersion: rbac.authorization.k8s.io/v1 3 | kind: ClusterRole 4 | metadata: 5 | labels: 6 | app.kubernetes.io/name: clusterrole 7 | app.kubernetes.io/instance: harvestermachine-editor-role 8 | app.kubernetes.io/component: rbac 9 | app.kubernetes.io/created-by: cluster-api-provider-harvester 10 | app.kubernetes.io/part-of: cluster-api-provider-harvester 11 | app.kubernetes.io/managed-by: kustomize 12 | name: harvestermachine-editor-role 13 | rules: 14 | - apiGroups: 15 | - infrastructure.cluster.x-k8s.io 16 | resources: 17 | - harvestermachines 18 | verbs: 19 | - create 20 | - delete 21 | - get 22 | - list 23 | - patch 24 | - update 25 | - watch 26 | - apiGroups: 27 | - infrastructure.cluster.x-k8s.io 28 | resources: 29 | - harvestermachines/status 30 | verbs: 31 | - get 32 | -------------------------------------------------------------------------------- /config/prometheus/monitor.yaml: -------------------------------------------------------------------------------- 1 | 2 | # Prometheus Monitor Service (Metrics) 3 | apiVersion: monitoring.coreos.com/v1 4 | kind: ServiceMonitor 5 | metadata: 6 | labels: 7 | control-plane: controller-manager 8 | app.kubernetes.io/name: servicemonitor 9 | app.kubernetes.io/instance: controller-manager-metrics-monitor 10 | app.kubernetes.io/component: metrics 11 | app.kubernetes.io/created-by: cluster-api-provider-harvester 12 | app.kubernetes.io/part-of: cluster-api-provider-harvester 13 | app.kubernetes.io/managed-by: kustomize 14 | name: controller-manager-metrics-monitor 15 | namespace: system 16 | spec: 17 | endpoints: 18 | - path: /metrics 19 | port: https 20 | scheme: https 21 | bearerTokenFile: /var/run/secrets/kubernetes.io/serviceaccount/token 22 | tlsConfig: 23 | insecureSkipVerify: true 24 | selector: 25 | matchLabels: 26 | control-plane: controller-manager 27 | -------------------------------------------------------------------------------- /pkg/clientset/versioned/typed/storage.k8s.io/v1/generated_expansion.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2025 SUSE. 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 main. DO NOT EDIT. 18 | 19 | package v1 20 | 21 | type CSIDriverExpansion interface{} 22 | 23 | type CSINodeExpansion interface{} 24 | 25 | type CSIStorageCapacityExpansion interface{} 26 | 27 | type StorageClassExpansion interface{} 28 | 29 | type VolumeAttachmentExpansion interface{} 30 | -------------------------------------------------------------------------------- /config/rbac/harvestercluster_admin_role.yaml: -------------------------------------------------------------------------------- 1 | # This rule is not used by the project cluster-api-provider-harvester itself. 2 | # It is provided to allow the cluster admin to help manage permissions for users. 3 | # 4 | # Grants full permissions ('*') over infrastructure.cluster.x-k8s.io. 5 | # This role is intended for users authorized to modify roles and bindings within the cluster, 6 | # enabling them to delegate specific permissions to other users or groups as needed. 7 | 8 | apiVersion: rbac.authorization.k8s.io/v1 9 | kind: ClusterRole 10 | metadata: 11 | labels: 12 | app.kubernetes.io/name: cluster-api-provider-harvester 13 | app.kubernetes.io/managed-by: kustomize 14 | name: harvestercluster-admin-role 15 | rules: 16 | - apiGroups: 17 | - infrastructure.cluster.x-k8s.io 18 | resources: 19 | - harvesterclusters 20 | verbs: 21 | - '*' 22 | - apiGroups: 23 | - infrastructure.cluster.x-k8s.io 24 | resources: 25 | - harvesterclusters/status 26 | verbs: 27 | - get 28 | -------------------------------------------------------------------------------- /config/rbac/harvestermachine_admin_role.yaml: -------------------------------------------------------------------------------- 1 | # This rule is not used by the project cluster-api-provider-harvester itself. 2 | # It is provided to allow the cluster admin to help manage permissions for users. 3 | # 4 | # Grants full permissions ('*') over infrastructure.cluster.x-k8s.io. 5 | # This role is intended for users authorized to modify roles and bindings within the cluster, 6 | # enabling them to delegate specific permissions to other users or groups as needed. 7 | 8 | apiVersion: rbac.authorization.k8s.io/v1 9 | kind: ClusterRole 10 | metadata: 11 | labels: 12 | app.kubernetes.io/name: cluster-api-provider-harvester 13 | app.kubernetes.io/managed-by: kustomize 14 | name: harvestermachine-admin-role 15 | rules: 16 | - apiGroups: 17 | - infrastructure.cluster.x-k8s.io 18 | resources: 19 | - harvestermachines 20 | verbs: 21 | - '*' 22 | - apiGroups: 23 | - infrastructure.cluster.x-k8s.io 24 | resources: 25 | - harvestermachines/status 26 | verbs: 27 | - get 28 | -------------------------------------------------------------------------------- /config/rbac/leader_election_role.yaml: -------------------------------------------------------------------------------- 1 | # permissions to do leader election. 2 | apiVersion: rbac.authorization.k8s.io/v1 3 | kind: Role 4 | metadata: 5 | labels: 6 | app.kubernetes.io/name: role 7 | app.kubernetes.io/instance: leader-election-role 8 | app.kubernetes.io/component: rbac 9 | app.kubernetes.io/created-by: cluster-api-provider-harvester 10 | app.kubernetes.io/part-of: cluster-api-provider-harvester 11 | app.kubernetes.io/managed-by: kustomize 12 | name: leader-election-role 13 | rules: 14 | - apiGroups: 15 | - "" 16 | resources: 17 | - configmaps 18 | verbs: 19 | - get 20 | - list 21 | - watch 22 | - create 23 | - update 24 | - patch 25 | - delete 26 | - apiGroups: 27 | - coordination.k8s.io 28 | resources: 29 | - leases 30 | verbs: 31 | - get 32 | - list 33 | - watch 34 | - create 35 | - update 36 | - patch 37 | - delete 38 | - apiGroups: 39 | - "" 40 | resources: 41 | - events 42 | verbs: 43 | - create 44 | - patch 45 | -------------------------------------------------------------------------------- /config/network-policy/allow-metrics-traffic.yaml: -------------------------------------------------------------------------------- 1 | # This NetworkPolicy allows ingress traffic 2 | # with Pods running on namespaces labeled with 'metrics: enabled'. Only Pods on those 3 | # namespaces are able to gather data from the metrics endpoint. 4 | apiVersion: networking.k8s.io/v1 5 | kind: NetworkPolicy 6 | metadata: 7 | labels: 8 | app.kubernetes.io/name: cluster-api-provider-harvester 9 | app.kubernetes.io/managed-by: kustomize 10 | name: allow-metrics-traffic 11 | namespace: system 12 | spec: 13 | podSelector: 14 | matchLabels: 15 | control-plane: controller-manager 16 | app.kubernetes.io/name: cluster-api-provider-harvester 17 | policyTypes: 18 | - Ingress 19 | ingress: 20 | # This allows ingress traffic from any namespace with the label metrics: enabled 21 | - from: 22 | - namespaceSelector: 23 | matchLabels: 24 | metrics: enabled # Only from namespaces with this label 25 | ports: 26 | - port: 8443 27 | protocol: TCP 28 | -------------------------------------------------------------------------------- /config/rbac/harvesterclustertemplate_admin_role.yaml: -------------------------------------------------------------------------------- 1 | # This rule is not used by the project cluster-api-provider-harvester itself. 2 | # It is provided to allow the cluster admin to help manage permissions for users. 3 | # 4 | # Grants full permissions ('*') over infrastructure.cluster.x-k8s.io. 5 | # This role is intended for users authorized to modify roles and bindings within the cluster, 6 | # enabling them to delegate specific permissions to other users or groups as needed. 7 | 8 | apiVersion: rbac.authorization.k8s.io/v1 9 | kind: ClusterRole 10 | metadata: 11 | labels: 12 | app.kubernetes.io/name: cluster-api-provider-harvester 13 | app.kubernetes.io/managed-by: kustomize 14 | name: harvesterclustertemplate-admin-role 15 | rules: 16 | - apiGroups: 17 | - infrastructure.cluster.x-k8s.io 18 | resources: 19 | - harvesterclustertemplates 20 | verbs: 21 | - '*' 22 | - apiGroups: 23 | - infrastructure.cluster.x-k8s.io 24 | resources: 25 | - harvesterclustertemplates/status 26 | verbs: 27 | - get 28 | -------------------------------------------------------------------------------- /config/rbac/harvestermachinetemplate_admin_role.yaml: -------------------------------------------------------------------------------- 1 | # This rule is not used by the project cluster-api-provider-harvester itself. 2 | # It is provided to allow the cluster admin to help manage permissions for users. 3 | # 4 | # Grants full permissions ('*') over infrastructure.cluster.x-k8s.io. 5 | # This role is intended for users authorized to modify roles and bindings within the cluster, 6 | # enabling them to delegate specific permissions to other users or groups as needed. 7 | 8 | apiVersion: rbac.authorization.k8s.io/v1 9 | kind: ClusterRole 10 | metadata: 11 | labels: 12 | app.kubernetes.io/name: cluster-api-provider-harvester 13 | app.kubernetes.io/managed-by: kustomize 14 | name: harvestermachinetemplate-admin-role 15 | rules: 16 | - apiGroups: 17 | - infrastructure.cluster.x-k8s.io 18 | resources: 19 | - harvestermachinetemplates 20 | verbs: 21 | - '*' 22 | - apiGroups: 23 | - infrastructure.cluster.x-k8s.io 24 | resources: 25 | - harvestermachinetemplates/status 26 | verbs: 27 | - get 28 | -------------------------------------------------------------------------------- /config/default/cert_metrics_manager_patch.yaml: -------------------------------------------------------------------------------- 1 | # This patch adds the args, volumes, and ports to allow the manager to use the metrics-server certs. 2 | 3 | # Add the volumeMount for the metrics-server certs 4 | - op: add 5 | path: /spec/template/spec/containers/0/volumeMounts/- 6 | value: 7 | mountPath: /tmp/k8s-metrics-server/metrics-certs 8 | name: metrics-certs 9 | readOnly: true 10 | 11 | # Add the --metrics-cert-path argument for the metrics server 12 | - op: add 13 | path: /spec/template/spec/containers/0/args/- 14 | value: --metrics-cert-path=/tmp/k8s-metrics-server/metrics-certs 15 | 16 | # Add the metrics-server certs volume configuration 17 | - op: add 18 | path: /spec/template/spec/volumes/- 19 | value: 20 | name: metrics-certs 21 | secret: 22 | secretName: metrics-server-cert 23 | optional: false 24 | items: 25 | - key: ca.crt 26 | path: ca.crt 27 | - key: tls.crt 28 | path: tls.crt 29 | - key: tls.key 30 | path: tls.key 31 | -------------------------------------------------------------------------------- /config/rbac/harvesterclustertemplate_viewer_role.yaml: -------------------------------------------------------------------------------- 1 | # This rule is not used by the project cluster-api-provider-harvester itself. 2 | # It is provided to allow the cluster admin to help manage permissions for users. 3 | # 4 | # Grants read-only access to infrastructure.cluster.x-k8s.io resources. 5 | # This role is intended for users who need visibility into these resources 6 | # without permissions to modify them. It is ideal for monitoring purposes and limited-access viewing. 7 | 8 | apiVersion: rbac.authorization.k8s.io/v1 9 | kind: ClusterRole 10 | metadata: 11 | labels: 12 | app.kubernetes.io/name: cluster-api-provider-harvester 13 | app.kubernetes.io/managed-by: kustomize 14 | name: harvesterclustertemplate-viewer-role 15 | rules: 16 | - apiGroups: 17 | - infrastructure.cluster.x-k8s.io 18 | resources: 19 | - harvesterclustertemplates 20 | verbs: 21 | - get 22 | - list 23 | - watch 24 | - apiGroups: 25 | - infrastructure.cluster.x-k8s.io 26 | resources: 27 | - harvesterclustertemplates/status 28 | verbs: 29 | - get 30 | -------------------------------------------------------------------------------- /pkg/clientset/versioned/typed/monitoring.coreos.com/v1/generated_expansion.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2025 SUSE. 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 main. DO NOT EDIT. 18 | 19 | package v1 20 | 21 | type AlertmanagerExpansion interface{} 22 | 23 | type PodMonitorExpansion interface{} 24 | 25 | type ProbeExpansion interface{} 26 | 27 | type PrometheusExpansion interface{} 28 | 29 | type PrometheusRuleExpansion interface{} 30 | 31 | type ServiceMonitorExpansion interface{} 32 | 33 | type ThanosRulerExpansion interface{} 34 | -------------------------------------------------------------------------------- /pkg/clientset/versioned/typed/kubevirt.io/v1/generated_expansion.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2025 SUSE. 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 main. DO NOT EDIT. 18 | 19 | package v1 20 | 21 | type KubeVirtExpansion interface{} 22 | 23 | type VirtualMachineExpansion interface{} 24 | 25 | type VirtualMachineInstanceExpansion interface{} 26 | 27 | type VirtualMachineInstanceMigrationExpansion interface{} 28 | 29 | type VirtualMachineInstancePresetExpansion interface{} 30 | 31 | type VirtualMachineInstanceReplicaSetExpansion interface{} 32 | -------------------------------------------------------------------------------- /config/rbac/harvesterclustertemplate_editor_role.yaml: -------------------------------------------------------------------------------- 1 | # This rule is not used by the project cluster-api-provider-harvester itself. 2 | # It is provided to allow the cluster admin to help manage permissions for users. 3 | # 4 | # Grants permissions to create, update, and delete resources within the infrastructure.cluster.x-k8s.io. 5 | # This role is intended for users who need to manage these resources 6 | # but should not control RBAC or manage permissions for others. 7 | 8 | apiVersion: rbac.authorization.k8s.io/v1 9 | kind: ClusterRole 10 | metadata: 11 | labels: 12 | app.kubernetes.io/name: cluster-api-provider-harvester 13 | app.kubernetes.io/managed-by: kustomize 14 | name: harvesterclustertemplate-editor-role 15 | rules: 16 | - apiGroups: 17 | - infrastructure.cluster.x-k8s.io 18 | resources: 19 | - harvesterclustertemplates 20 | verbs: 21 | - create 22 | - delete 23 | - get 24 | - list 25 | - patch 26 | - update 27 | - watch 28 | - apiGroups: 29 | - infrastructure.cluster.x-k8s.io 30 | resources: 31 | - harvesterclustertemplates/status 32 | verbs: 33 | - get 34 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | - package-ecosystem: "gomod" 4 | directory: "/" 5 | schedule: 6 | interval: "weekly" 7 | labels: 8 | - "kind/bump" 9 | - "area/dependency" 10 | ignore: 11 | # Ignore Cluster-API as its upgraded manually. 12 | - dependency-name: "sigs.k8s.io/cluster-api" 13 | # Ignore controller-runtime as its upgraded manually. 14 | - dependency-name: "sigs.k8s.io/controller-runtime" 15 | # Ignore k8s and its transitives modules as they are upgraded manually 16 | # together with controller-runtime. 17 | - dependency-name: "k8s.io/*" 18 | - dependency-name: "go.etcd.io/*" 19 | - dependency-name: "google.golang.org/grpc" 20 | - package-ecosystem: "docker" 21 | directory: "/" 22 | schedule: 23 | interval: "weekly" 24 | labels: 25 | - "kind/cleanup" 26 | - "area/build-and-release" 27 | - package-ecosystem: "github-actions" 28 | directory: "/" 29 | schedule: 30 | interval: "weekly" 31 | labels: 32 | - "kind/cleanup" 33 | - "area/build-and-release" 34 | -------------------------------------------------------------------------------- /config/default/manager_auth_proxy_patch.yaml: -------------------------------------------------------------------------------- 1 | # This patch inject a sidecar container which is a HTTP proxy for the 2 | # controller manager, it performs RBAC authorization against the Kubernetes API using SubjectAccessReviews. 3 | apiVersion: apps/v1 4 | kind: Deployment 5 | metadata: 6 | name: controller-manager 7 | namespace: system 8 | spec: 9 | template: 10 | spec: 11 | affinity: 12 | nodeAffinity: 13 | requiredDuringSchedulingIgnoredDuringExecution: 14 | nodeSelectorTerms: 15 | - matchExpressions: 16 | - key: kubernetes.io/arch 17 | operator: In 18 | values: 19 | - amd64 20 | - arm64 21 | - ppc64le 22 | - s390x 23 | - key: kubernetes.io/os 24 | operator: In 25 | values: 26 | - linux 27 | containers: 28 | - name: manager 29 | args: 30 | - "--health-probe-bind-address=:8081" 31 | - "--metrics-bind-address=127.0.0.1:8080" 32 | - "--leader-elect" 33 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | # Build the manager binary 2 | FROM --platform=$BUILDPLATFORM registry.suse.com/bci/golang:1.24.5 AS builder 3 | 4 | WORKDIR /workspace 5 | # Copy the Go Modules manifests 6 | COPY go.mod go.mod 7 | COPY go.sum go.sum 8 | # cache deps before building and copying source so that we don't need to re-download as much 9 | # and so that source changes don't invalidate our downloaded layer 10 | RUN go mod download 11 | 12 | # Copy the go source 13 | COPY cmd/ cmd/ 14 | COPY api/ api/ 15 | COPY internal/ internal/ 16 | COPY pkg/ pkg/ 17 | COPY util util/ 18 | 19 | # Build 20 | # the GOARCH has not a default value to allow the binary be built according to the host where the command 21 | # was called. For example, if we call make docker-build in a local env which has the Apple Silicon M1 SO 22 | # the docker BUILDPLATFORM arg will be linux/arm64 when for Apple x86 it will be linux/amd64. Therefore, 23 | # by leaving it empty we can ensure that the container and binary shipped on it will have the same platform. 24 | ARG TARGETOS 25 | ARG TARGETARCH 26 | ARG LDFLAGS 27 | RUN CGO_ENABLED=0 GOOS=${TARGETOS:-linux} GOARCH=${TARGETARCH} go build -a -o manager cmd/main.go 28 | 29 | FROM registry.suse.com/bci/bci-micro:15.7 30 | WORKDIR / 31 | COPY --from=builder /workspace/manager . 32 | USER 65532:65532 33 | ENTRYPOINT ["/manager"] 34 | -------------------------------------------------------------------------------- /pkg/clientset/versioned/typed/harvesterhci.io/v1beta1/generated_expansion.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2025 SUSE. 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 main. DO NOT EDIT. 18 | 19 | package v1beta1 20 | 21 | type AddonExpansion interface{} 22 | 23 | type KeyPairExpansion interface{} 24 | 25 | type PreferenceExpansion interface{} 26 | 27 | type SettingExpansion interface{} 28 | 29 | type SupportBundleExpansion interface{} 30 | 31 | type UpgradeExpansion interface{} 32 | 33 | type UpgradeLogExpansion interface{} 34 | 35 | type VersionExpansion interface{} 36 | 37 | type VirtualMachineBackupExpansion interface{} 38 | 39 | type VirtualMachineImageExpansion interface{} 40 | 41 | type VirtualMachineRestoreExpansion interface{} 42 | 43 | type VirtualMachineTemplateExpansion interface{} 44 | 45 | type VirtualMachineTemplateVersionExpansion interface{} 46 | -------------------------------------------------------------------------------- /pkg/clientset/versioned/typed/upgrade.cattle.io/v1/fake/fake_upgrade.cattle.io_client.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2025 SUSE. 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 main. 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 | 25 | v1 "github.com/rancher-sandbox/cluster-api-provider-harvester/pkg/clientset/versioned/typed/upgrade.cattle.io/v1" 26 | ) 27 | 28 | type FakeUpgradeV1 struct { 29 | *testing.Fake 30 | } 31 | 32 | func (c *FakeUpgradeV1) Plans(namespace string) v1.PlanInterface { 33 | return &FakePlans{c, namespace} 34 | } 35 | 36 | // RESTClient returns a RESTClient that is used to communicate 37 | // with API server by this client implementation. 38 | func (c *FakeUpgradeV1) RESTClient() rest.Interface { 39 | var ret *rest.RESTClient 40 | return ret 41 | } 42 | -------------------------------------------------------------------------------- /api/v1alpha1/groupversion_info.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2025 SUSE. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Package v1alpha1 contains API Schema definitions for the infrastructure v1alpha1 API group. 18 | // +kubebuilder:object:generate=true 19 | // +groupName=infrastructure.cluster.x-k8s.io 20 | package v1alpha1 21 | 22 | import ( 23 | "sigs.k8s.io/controller-runtime/pkg/scheme" 24 | 25 | "k8s.io/apimachinery/pkg/runtime/schema" 26 | ) 27 | 28 | var ( 29 | // GroupVersion is group version used to register these objects. 30 | GroupVersion = schema.GroupVersion{Group: "infrastructure.cluster.x-k8s.io", Version: "v1alpha1"} 31 | 32 | // SchemeBuilder is used to add go types to the GroupVersionKind scheme. 33 | SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion} 34 | 35 | // AddToScheme adds the types in this group-version to the given scheme. 36 | AddToScheme = SchemeBuilder.AddToScheme 37 | ) 38 | -------------------------------------------------------------------------------- /config/crd/kustomization.yaml: -------------------------------------------------------------------------------- 1 | # This kustomization.yaml is not intended to be run by itself, 2 | # since it depends on service name and namespace that are out of this kustomize package. 3 | # It should be run by config/default 4 | resources: 5 | - bases/infrastructure.cluster.x-k8s.io_harvestermachines.yaml 6 | - bases/infrastructure.cluster.x-k8s.io_harvesterclusters.yaml 7 | - bases/infrastructure.cluster.x-k8s.io_harvestermachinetemplates.yaml 8 | - bases/infrastructure.cluster.x-k8s.io_harvesterclustertemplates.yaml 9 | #+kubebuilder:scaffold:crdkustomizeresource 10 | 11 | patchesStrategicMerge: 12 | # [WEBHOOK] To enable webhook, uncomment all the sections with [WEBHOOK] prefix. 13 | # patches here are for enabling the conversion webhook for each CRD 14 | #- patches/webhook_in_harvestermachines.yaml 15 | #- patches/webhook_in_harvesterclusters.yaml 16 | #- patches/webhook_in_harvestermachinetemplates.yaml 17 | #+kubebuilder:scaffold:crdkustomizewebhookpatch 18 | 19 | # [CERTMANAGER] To enable cert-manager, uncomment all the sections with [CERTMANAGER] prefix. 20 | # patches here are for enabling the CA injection for each CRD 21 | #- patches/cainjection_in_harvestermachines.yaml 22 | #- patches/cainjection_in_harvesterclusters.yaml 23 | #- patches/cainjection_in_harvestermachinetemplates.yaml 24 | #+kubebuilder:scaffold:crdkustomizecainjectionpatch 25 | 26 | # the following config is for teaching kustomize how to do kustomization for CRDs. 27 | configurations: 28 | - kustomizeconfig.yaml 29 | -------------------------------------------------------------------------------- /pkg/clientset/versioned/typed/k8s.cni.cncf.io/v1/fake/fake_k8s.cni.cncf.io_client.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2025 SUSE. 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 main. 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 | 25 | v1 "github.com/rancher-sandbox/cluster-api-provider-harvester/pkg/clientset/versioned/typed/k8s.cni.cncf.io/v1" 26 | ) 27 | 28 | type FakeK8sCniCncfIoV1 struct { 29 | *testing.Fake 30 | } 31 | 32 | func (c *FakeK8sCniCncfIoV1) NetworkAttachmentDefinitions(namespace string) v1.NetworkAttachmentDefinitionInterface { 33 | return &FakeNetworkAttachmentDefinitions{c, namespace} 34 | } 35 | 36 | // RESTClient returns a RESTClient that is used to communicate 37 | // with API server by this client implementation. 38 | func (c *FakeK8sCniCncfIoV1) RESTClient() rest.Interface { 39 | var ret *rest.RESTClient 40 | return ret 41 | } 42 | -------------------------------------------------------------------------------- /config/rbac/role.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: rbac.authorization.k8s.io/v1 3 | kind: ClusterRole 4 | metadata: 5 | name: manager-role 6 | rules: 7 | - apiGroups: 8 | - "" 9 | resources: 10 | - configmaps 11 | verbs: 12 | - delete 13 | - get 14 | - list 15 | - patch 16 | - update 17 | - watch 18 | - apiGroups: 19 | - "" 20 | resources: 21 | - secrets 22 | verbs: 23 | - get 24 | - list 25 | - watch 26 | - apiGroups: 27 | - cluster.x-k8s.io 28 | resources: 29 | - clusters 30 | - clusters/status 31 | - machinepools 32 | - machinepools/status 33 | - machines 34 | - machines/status 35 | - machinesets 36 | verbs: 37 | - create 38 | - delete 39 | - get 40 | - list 41 | - patch 42 | - update 43 | - watch 44 | - apiGroups: 45 | - infrastructure.cluster.x-k8s.io 46 | resources: 47 | - clusters 48 | - machines 49 | verbs: 50 | - get 51 | - list 52 | - watch 53 | - apiGroups: 54 | - infrastructure.cluster.x-k8s.io 55 | resources: 56 | - harvesterclusters 57 | - harvestermachines 58 | verbs: 59 | - create 60 | - delete 61 | - get 62 | - list 63 | - patch 64 | - update 65 | - watch 66 | - apiGroups: 67 | - infrastructure.cluster.x-k8s.io 68 | resources: 69 | - harvesterclusters/finalizers 70 | - harvestermachines/finalizers 71 | verbs: 72 | - update 73 | - apiGroups: 74 | - infrastructure.cluster.x-k8s.io 75 | resources: 76 | - harvesterclusters/status 77 | - harvestermachines/status 78 | verbs: 79 | - get 80 | - patch 81 | - update 82 | -------------------------------------------------------------------------------- /PROJECT: -------------------------------------------------------------------------------- 1 | # Code generated by tool. DO NOT EDIT. 2 | # This file is used to track the info used to scaffold your project 3 | # and allow the plugins properly work. 4 | # More info: https://book.kubebuilder.io/reference/project-config.html 5 | cliVersion: 4.6.0 6 | domain: cluster.x-k8s.io 7 | layout: 8 | - go.kubebuilder.io/v4 9 | projectName: cluster-api-provider-harvester 10 | repo: github.com/rancher-sandbox/cluster-api-provider-harvester 11 | resources: 12 | - api: 13 | crdVersion: v1 14 | namespaced: true 15 | controller: true 16 | domain: cluster.x-k8s.io 17 | group: infrastructure 18 | kind: HarvesterMachine 19 | path: github.com/rancher-sandbox/cluster-api-provider-harvester/api/v1alpha1 20 | version: v1alpha1 21 | - api: 22 | crdVersion: v1 23 | namespaced: true 24 | controller: true 25 | domain: cluster.x-k8s.io 26 | group: infrastructure 27 | kind: HarvesterCluster 28 | path: github.com/rancher-sandbox/cluster-api-provider-harvester/api/v1alpha1 29 | version: v1alpha1 30 | - api: 31 | crdVersion: v1 32 | namespaced: true 33 | domain: cluster.x-k8s.io 34 | group: infrastructure 35 | kind: HarvesterMachineTemplate 36 | path: github.com/rancher-sandbox/cluster-api-provider-harvester/api/v1alpha1 37 | version: v1alpha1 38 | - api: 39 | crdVersion: v1 40 | namespaced: true 41 | domain: cluster.x-k8s.io 42 | group: infrastructure 43 | kind: HarvesterClusterTemplate 44 | path: github.com/rancher-sandbox/cluster-api-provider-harvester/api/v1alpha1 45 | version: v1alpha1 46 | version: "3" 47 | -------------------------------------------------------------------------------- /pkg/clientset/versioned/typed/cluster.x-k8s.io/v1beta1/fake/fake_cluster.x-k8s.io_client.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2025 SUSE. 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 main. 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 | 25 | v1beta1 "github.com/rancher-sandbox/cluster-api-provider-harvester/pkg/clientset/versioned/typed/cluster.x-k8s.io/v1beta1" 26 | ) 27 | 28 | type FakeClusterv1beta1 struct { 29 | *testing.Fake 30 | } 31 | 32 | func (c *FakeClusterv1beta1) Clusters(namespace string) v1beta1.ClusterInterface { 33 | return &FakeClusters{c, namespace} 34 | } 35 | 36 | func (c *FakeClusterv1beta1) Machines(namespace string) v1beta1.MachineInterface { 37 | return &FakeMachines{c, namespace} 38 | } 39 | 40 | // RESTClient returns a RESTClient that is used to communicate 41 | // with API server by this client implementation. 42 | func (c *FakeClusterv1beta1) RESTClient() rest.Interface { 43 | var ret *rest.RESTClient 44 | return ret 45 | } 46 | -------------------------------------------------------------------------------- /pkg/clientset/versioned/typed/catalog.cattle.io/v1/fake/fake_catalog.cattle.io_client.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2025 SUSE. 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 main. 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 | 25 | v1 "github.com/rancher-sandbox/cluster-api-provider-harvester/pkg/clientset/versioned/typed/catalog.cattle.io/v1" 26 | ) 27 | 28 | type FakeCatalogV1 struct { 29 | *testing.Fake 30 | } 31 | 32 | func (c *FakeCatalogV1) Apps(namespace string) v1.AppInterface { 33 | return &FakeApps{c, namespace} 34 | } 35 | 36 | func (c *FakeCatalogV1) ClusterRepos() v1.ClusterRepoInterface { 37 | return &FakeClusterRepos{c} 38 | } 39 | 40 | func (c *FakeCatalogV1) Operations(namespace string) v1.OperationInterface { 41 | return &FakeOperations{c, namespace} 42 | } 43 | 44 | // RESTClient returns a RESTClient that is used to communicate 45 | // with API server by this client implementation. 46 | func (c *FakeCatalogV1) RESTClient() rest.Interface { 47 | var ret *rest.RESTClient 48 | return ret 49 | } 50 | -------------------------------------------------------------------------------- /pkg/clientset/versioned/typed/longhorn.io/v1beta2/generated_expansion.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2025 SUSE. 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 main. DO NOT EDIT. 18 | 19 | package v1beta2 20 | 21 | type BackingImageExpansion interface{} 22 | 23 | type BackingImageDataSourceExpansion interface{} 24 | 25 | type BackingImageManagerExpansion interface{} 26 | 27 | type BackupExpansion interface{} 28 | 29 | type BackupTargetExpansion interface{} 30 | 31 | type BackupVolumeExpansion interface{} 32 | 33 | type EngineExpansion interface{} 34 | 35 | type EngineImageExpansion interface{} 36 | 37 | type InstanceManagerExpansion interface{} 38 | 39 | type NodeExpansion interface{} 40 | 41 | type OrphanExpansion interface{} 42 | 43 | type RecurringJobExpansion interface{} 44 | 45 | type ReplicaExpansion interface{} 46 | 47 | type SettingExpansion interface{} 48 | 49 | type ShareManagerExpansion interface{} 50 | 51 | type SnapshotExpansion interface{} 52 | 53 | type SupportBundleExpansion interface{} 54 | 55 | type SystemBackupExpansion interface{} 56 | 57 | type SystemRestoreExpansion interface{} 58 | 59 | type VolumeExpansion interface{} 60 | -------------------------------------------------------------------------------- /pkg/clientset/versioned/typed/networking.k8s.io/v1/fake/fake_networking.k8s.io_client.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2025 SUSE. 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 main. 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 | 25 | v1 "github.com/rancher-sandbox/cluster-api-provider-harvester/pkg/clientset/versioned/typed/networking.k8s.io/v1" 26 | ) 27 | 28 | type FakeNetworkingV1 struct { 29 | *testing.Fake 30 | } 31 | 32 | func (c *FakeNetworkingV1) Ingresses(namespace string) v1.IngressInterface { 33 | return &FakeIngresses{c, namespace} 34 | } 35 | 36 | func (c *FakeNetworkingV1) IngressClasses() v1.IngressClassInterface { 37 | return &FakeIngressClasses{c} 38 | } 39 | 40 | func (c *FakeNetworkingV1) NetworkPolicies(namespace string) v1.NetworkPolicyInterface { 41 | return &FakeNetworkPolicies{c, namespace} 42 | } 43 | 44 | // RESTClient returns a RESTClient that is used to communicate 45 | // with API server by this client implementation. 46 | func (c *FakeNetworkingV1) RESTClient() rest.Interface { 47 | var ret *rest.RESTClient 48 | return ret 49 | } 50 | -------------------------------------------------------------------------------- /pkg/clientset/versioned/typed/snapshot.storage.k8s.io/v1/fake/fake_snapshot.storage.k8s.io_client.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2025 SUSE. 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 main. 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 | 25 | v1 "github.com/rancher-sandbox/cluster-api-provider-harvester/pkg/clientset/versioned/typed/snapshot.storage.k8s.io/v1" 26 | ) 27 | 28 | type FakeSnapshotV1 struct { 29 | *testing.Fake 30 | } 31 | 32 | func (c *FakeSnapshotV1) VolumeSnapshots(namespace string) v1.VolumeSnapshotInterface { 33 | return &FakeVolumeSnapshots{c, namespace} 34 | } 35 | 36 | func (c *FakeSnapshotV1) VolumeSnapshotClasses() v1.VolumeSnapshotClassInterface { 37 | return &FakeVolumeSnapshotClasses{c} 38 | } 39 | 40 | func (c *FakeSnapshotV1) VolumeSnapshotContents() v1.VolumeSnapshotContentInterface { 41 | return &FakeVolumeSnapshotContents{c} 42 | } 43 | 44 | // RESTClient returns a RESTClient that is used to communicate 45 | // with API server by this client implementation. 46 | func (c *FakeSnapshotV1) RESTClient() rest.Interface { 47 | var ret *rest.RESTClient 48 | return ret 49 | } 50 | -------------------------------------------------------------------------------- /pkg/clientset/versioned/typed/storage.k8s.io/v1/fake/fake_storage.k8s.io_client.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2025 SUSE. 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 main. 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 | 25 | v1 "github.com/rancher-sandbox/cluster-api-provider-harvester/pkg/clientset/versioned/typed/storage.k8s.io/v1" 26 | ) 27 | 28 | type FakeStorageV1 struct { 29 | *testing.Fake 30 | } 31 | 32 | func (c *FakeStorageV1) CSIDrivers() v1.CSIDriverInterface { 33 | return &FakeCSIDrivers{c} 34 | } 35 | 36 | func (c *FakeStorageV1) CSINodes() v1.CSINodeInterface { 37 | return &FakeCSINodes{c} 38 | } 39 | 40 | func (c *FakeStorageV1) CSIStorageCapacities(namespace string) v1.CSIStorageCapacityInterface { 41 | return &FakeCSIStorageCapacities{c, namespace} 42 | } 43 | 44 | func (c *FakeStorageV1) StorageClasses() v1.StorageClassInterface { 45 | return &FakeStorageClasses{c} 46 | } 47 | 48 | func (c *FakeStorageV1) VolumeAttachments() v1.VolumeAttachmentInterface { 49 | return &FakeVolumeAttachments{c} 50 | } 51 | 52 | // RESTClient returns a RESTClient that is used to communicate 53 | // with API server by this client implementation. 54 | func (c *FakeStorageV1) RESTClient() rest.Interface { 55 | var ret *rest.RESTClient 56 | return ret 57 | } 58 | -------------------------------------------------------------------------------- /util/cloudinit_test.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2025 SUSE. 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 util 18 | 19 | import ( 20 | . "github.com/onsi/ginkgo" 21 | . "github.com/onsi/gomega" 22 | ) 23 | 24 | var _ = Describe("MergeCloudInitStrings", func() { 25 | var cloudinit1 string 26 | var cloudinit2 string 27 | var cloudinit3 string 28 | 29 | BeforeEach(func() { 30 | cloudinit1 = `#cloud-config 31 | package_update: true 32 | packages: 33 | - nginx 34 | runcmd: 35 | - echo "hello world" 36 | ` 37 | cloudinit2 = `ssh_authorized_keys: 38 | - ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAACAA... user@host` 39 | 40 | cloudinit3 = `#cloud-config 41 | package_update: false 42 | packages: 43 | - curl 44 | runcmd: 45 | - echo "hello world 3" 46 | ` 47 | }) 48 | It("Should show the right resulting cloud-init", func() { 49 | mergedCloudInit, err := MergeCloudInitData(cloudinit1, cloudinit2, cloudinit3) 50 | Expect(err).ToNot(HaveOccurred()) 51 | mergedCloudInitString := string(mergedCloudInit) 52 | _, err = GinkgoWriter.Write(mergedCloudInit) 53 | Expect(err).NotTo(HaveOccurred()) 54 | Expect(mergedCloudInitString).To(Equal(`#cloud-config 55 | package_update: false 56 | packages: 57 | - nginx 58 | - curl 59 | runcmd: 60 | - echo "hello world" 61 | - echo "hello world 3" 62 | ssh_authorized_keys: 63 | - ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAACAA... user@host 64 | `)) 65 | }) 66 | }) 67 | -------------------------------------------------------------------------------- /internal/controller/harvestermachine_controller_test.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2025 SUSE. 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 controller 18 | 19 | import ( 20 | . "github.com/onsi/ginkgo/v2" 21 | . "github.com/onsi/gomega" 22 | 23 | kubevirtv1 "kubevirt.io/api/core/v1" 24 | 25 | "github.com/rancher-sandbox/cluster-api-provider-harvester/api/v1alpha1" 26 | ) 27 | 28 | var _ = Describe("Convert HarvesterMachine networks to Kubevirt Networks", func() { 29 | var hvMachineNetworks *v1alpha1.HarvesterMachine 30 | var kvNetworks []kubevirtv1.Network 31 | 32 | BeforeEach(func() { 33 | hvMachineNetworks = &v1alpha1.HarvesterMachine{ 34 | Spec: v1alpha1.HarvesterMachineSpec{ 35 | Networks: []string{"network1", "network2"}, 36 | }, 37 | } 38 | 39 | kvNetworks = []kubevirtv1.Network{ 40 | { 41 | Name: "nic-1", 42 | NetworkSource: kubevirtv1.NetworkSource{ 43 | Multus: &kubevirtv1.MultusNetwork{ 44 | NetworkName: "network1", 45 | }, 46 | }, 47 | }, 48 | { 49 | Name: "nic-2", 50 | NetworkSource: kubevirtv1.NetworkSource{ 51 | Multus: &kubevirtv1.MultusNetwork{ 52 | NetworkName: "network2", 53 | }, 54 | }, 55 | }, 56 | } 57 | }) 58 | Context("When we provide a list of HarvesterMachine networks", func() { 59 | It("Should return a list of Kubevirt Networks", func() { 60 | Expect(getKubevirtNetworksFromHarvesterMachine(hvMachineNetworks)).To(Equal(kvNetworks)) 61 | }) 62 | }) 63 | }) 64 | -------------------------------------------------------------------------------- /util/util_test.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2025 SUSE. 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 util 18 | 19 | import ( 20 | . "github.com/onsi/ginkgo" 21 | . "github.com/onsi/gomega" 22 | ) 23 | 24 | var ( 25 | namespace string 26 | name string 27 | expectedResultingName string 28 | ) 29 | 30 | var _ = Describe("GenerateNameFromFirstComponentWithDigit", func() { 31 | BeforeEach(func() { 32 | namespace = "1test" 33 | name = "test-1" 34 | 35 | expectedResultingName = "a-1test-test-1" 36 | }) 37 | 38 | It("Should return the right name", func() { 39 | name := GenerateRFC1035Name([]string{namespace, name}) 40 | Expect(name).To(Equal(expectedResultingName)) 41 | }) 42 | }) 43 | 44 | var _ = Describe("GenerateNameFromUpperCase", func() { 45 | BeforeEach(func() { 46 | namespace = "TeStNS" 47 | name = "test" 48 | 49 | expectedResultingName = "testns-test" 50 | }) 51 | 52 | It("Should return the right name", func() { 53 | name := GenerateRFC1035Name([]string{namespace, name}) 54 | Expect(name).To(Equal(expectedResultingName)) 55 | }) 56 | }) 57 | 58 | var _ = Describe("GenerateNameLimitedTo63", func() { 59 | BeforeEach(func() { 60 | namespace = "1TeStNS123" 61 | name = "namewith20characters-namewith20characters-namewith20characters" 62 | 63 | expectedResultingName = "a-1testns123-namewith20characters-namewith20characters-namewith" 64 | }) 65 | 66 | It("Should return the right name", func() { 67 | name := GenerateRFC1035Name([]string{namespace, name}) 68 | Expect(name).To(Equal(expectedResultingName)) 69 | }) 70 | }) 71 | -------------------------------------------------------------------------------- /internal/controller/suite_test.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2025 SUSE. 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 controller 18 | 19 | import ( 20 | "testing" 21 | 22 | . "github.com/onsi/ginkgo/v2" 23 | . "github.com/onsi/gomega" 24 | ) 25 | 26 | // These tests use Ginkgo (BDD-style Go testing framework). Refer to 27 | // http://onsi.github.io/ginkgo/ to learn more about Ginkgo. 28 | 29 | // var ( 30 | // cfg *rest.Config 31 | // k8sClient client.Client 32 | // ) 33 | 34 | func TestAPIs(t *testing.T) { 35 | RegisterFailHandler(Fail) 36 | 37 | RunSpecs(t, "Controller Suite") 38 | } 39 | 40 | // var _ = BeforeSuite(func() { 41 | // logf.SetLogger(zap.New(zap.WriteTo(GinkgoWriter), zap.UseDevMode(true))) 42 | 43 | // By("bootstrapping test environment") 44 | // testEnv = &envtest.Environment{ 45 | // CRDDirectoryPaths: []string{filepath.Join("..", "config", "crd", "bases")}, 46 | // ErrorIfCRDPathMissing: true, 47 | // } 48 | 49 | // var err error 50 | // // cfg is defined in this file globally. 51 | // cfg, err = testEnv.Start() 52 | // Expect(err).NotTo(HaveOccurred()) 53 | // Expect(cfg).NotTo(BeNil()) 54 | 55 | // err = infrastructurev1alpha1.AddToScheme(scheme.Scheme) 56 | // Expect(err).NotTo(HaveOccurred()) 57 | 58 | // //+kubebuilder:scaffold:scheme 59 | 60 | // k8sClient, err = client.New(cfg, client.Options{Scheme: scheme.Scheme}) 61 | // Expect(err).NotTo(HaveOccurred()) 62 | // Expect(k8sClient).NotTo(BeNil()) 63 | 64 | // }) 65 | 66 | // var _ = AfterSuite(func() { 67 | // By("tearing down the test environment") 68 | // err := testEnv.Stop() 69 | // Expect(err).NotTo(HaveOccurred()) 70 | // }) 71 | -------------------------------------------------------------------------------- /api/v1alpha1/harvestermachinetemplate_types.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2025 SUSE. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package v1alpha1 18 | 19 | import ( 20 | metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" 21 | ) 22 | 23 | // EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN! 24 | // NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized. 25 | 26 | // HarvesterMachineTemplateSpec defines the desired state of HarvesterMachineTemplate. 27 | type HarvesterMachineTemplateSpec struct { 28 | // Template is the HarvesterMachineTemplate template 29 | Template HarvesterMachineTemplateResource `json:"template,omitempty"` 30 | } 31 | 32 | // HarvesterMachineTemplateResource describes the data needed to create a HarvesterMachine from a template. 33 | type HarvesterMachineTemplateResource struct { 34 | // Spec is the specification of the desired behavior of the machine. 35 | Spec HarvesterMachineSpec `json:"spec"` 36 | } 37 | 38 | //+kubebuilder:object:root=true 39 | 40 | // HarvesterMachineTemplate is the Schema for the harvestermachinetemplates API. 41 | type HarvesterMachineTemplate struct { 42 | metav1.TypeMeta `json:",inline"` 43 | metav1.ObjectMeta `json:"metadata,omitempty"` 44 | 45 | Spec HarvesterMachineTemplateSpec `json:"spec,omitempty"` 46 | } 47 | 48 | //+kubebuilder:object:root=true 49 | 50 | // HarvesterMachineTemplateList contains a list of HarvesterMachineTemplate. 51 | type HarvesterMachineTemplateList struct { 52 | metav1.TypeMeta `json:",inline"` 53 | metav1.ListMeta `json:"metadata,omitempty"` 54 | 55 | Items []HarvesterMachineTemplate `json:"items"` 56 | } 57 | 58 | func init() { 59 | SchemeBuilder.Register(&HarvesterMachineTemplate{}, &HarvesterMachineTemplateList{}) 60 | } 61 | -------------------------------------------------------------------------------- /pkg/clientset/versioned/typed/monitoring.coreos.com/v1/fake/fake_monitoring.coreos.com_client.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2025 SUSE. 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 main. 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 | 25 | v1 "github.com/rancher-sandbox/cluster-api-provider-harvester/pkg/clientset/versioned/typed/monitoring.coreos.com/v1" 26 | ) 27 | 28 | type FakeMonitoringV1 struct { 29 | *testing.Fake 30 | } 31 | 32 | func (c *FakeMonitoringV1) Alertmanagers(namespace string) v1.AlertmanagerInterface { 33 | return &FakeAlertmanagers{c, namespace} 34 | } 35 | 36 | func (c *FakeMonitoringV1) PodMonitors(namespace string) v1.PodMonitorInterface { 37 | return &FakePodMonitors{c, namespace} 38 | } 39 | 40 | func (c *FakeMonitoringV1) Probes(namespace string) v1.ProbeInterface { 41 | return &FakeProbes{c, namespace} 42 | } 43 | 44 | func (c *FakeMonitoringV1) Prometheuses(namespace string) v1.PrometheusInterface { 45 | return &FakePrometheuses{c, namespace} 46 | } 47 | 48 | func (c *FakeMonitoringV1) PrometheusRules(namespace string) v1.PrometheusRuleInterface { 49 | return &FakePrometheusRules{c, namespace} 50 | } 51 | 52 | func (c *FakeMonitoringV1) ServiceMonitors(namespace string) v1.ServiceMonitorInterface { 53 | return &FakeServiceMonitors{c, namespace} 54 | } 55 | 56 | func (c *FakeMonitoringV1) ThanosRulers(namespace string) v1.ThanosRulerInterface { 57 | return &FakeThanosRulers{c, namespace} 58 | } 59 | 60 | // RESTClient returns a RESTClient that is used to communicate 61 | // with API server by this client implementation. 62 | func (c *FakeMonitoringV1) RESTClient() rest.Interface { 63 | var ret *rest.RESTClient 64 | return ret 65 | } 66 | -------------------------------------------------------------------------------- /pkg/clientset/versioned/typed/kubevirt.io/v1/fake/fake_kubevirt.io_client.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2025 SUSE. 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 main. 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 | 25 | v1 "github.com/rancher-sandbox/cluster-api-provider-harvester/pkg/clientset/versioned/typed/kubevirt.io/v1" 26 | ) 27 | 28 | type FakeKubevirtV1 struct { 29 | *testing.Fake 30 | } 31 | 32 | func (c *FakeKubevirtV1) KubeVirts(namespace string) v1.KubeVirtInterface { 33 | return &FakeKubeVirts{c, namespace} 34 | } 35 | 36 | func (c *FakeKubevirtV1) VirtualMachines(namespace string) v1.VirtualMachineInterface { 37 | return &FakeVirtualMachines{c, namespace} 38 | } 39 | 40 | func (c *FakeKubevirtV1) VirtualMachineInstances(namespace string) v1.VirtualMachineInstanceInterface { 41 | return &FakeVirtualMachineInstances{c, namespace} 42 | } 43 | 44 | func (c *FakeKubevirtV1) VirtualMachineInstanceMigrations(namespace string) v1.VirtualMachineInstanceMigrationInterface { 45 | return &FakeVirtualMachineInstanceMigrations{c, namespace} 46 | } 47 | 48 | func (c *FakeKubevirtV1) VirtualMachineInstancePresets(namespace string) v1.VirtualMachineInstancePresetInterface { 49 | return &FakeVirtualMachineInstancePresets{c, namespace} 50 | } 51 | 52 | func (c *FakeKubevirtV1) VirtualMachineInstanceReplicaSets(namespace string) v1.VirtualMachineInstanceReplicaSetInterface { 53 | return &FakeVirtualMachineInstanceReplicaSets{c, namespace} 54 | } 55 | 56 | // RESTClient returns a RESTClient that is used to communicate 57 | // with API server by this client implementation. 58 | func (c *FakeKubevirtV1) RESTClient() rest.Interface { 59 | var ret *rest.RESTClient 60 | return ret 61 | } 62 | -------------------------------------------------------------------------------- /api/v1alpha1/harvesterclustertemplate_types.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2025 SUSE. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package v1alpha1 18 | 19 | import ( 20 | metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" 21 | 22 | clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1" 23 | ) 24 | 25 | // HarvesterClusterTemplateSpec defines the desired state of HarvesterClusterTemplate. 26 | type HarvesterClusterTemplateSpec struct { 27 | Template HarvesterClusterTemplateResource `json:"template"` 28 | } 29 | 30 | // +kubebuilder:object:root=true 31 | // +kubebuilder:resource:path=harvesterclustertemplates,scope=Namespaced,categories=cluster-api,shortName=hvct 32 | // +kubebuilder:storageversion 33 | 34 | // HarvesterClusterTemplate is the Schema for the infraclustertemplates API. 35 | type HarvesterClusterTemplate struct { 36 | metav1.TypeMeta `json:",inline"` 37 | metav1.ObjectMeta `json:"metadata,omitempty"` 38 | 39 | // Spec is the specification for the template resource 40 | Spec HarvesterClusterTemplateSpec `json:"spec,omitempty"` 41 | // Status is the status of the template HarvesterCluster resource 42 | Status HarvesterClusterStatus `json:"status,omitempty"` 43 | } 44 | 45 | // HarvesterClusterTemplateResource defines the template resource for HarvesterCluster. 46 | type HarvesterClusterTemplateResource struct { 47 | // Standard object's metadata. 48 | // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. 49 | // +optional 50 | ObjectMeta clusterv1.ObjectMeta `json:"metadata,omitempty"` 51 | Spec HarvesterClusterSpec `json:"spec"` 52 | } 53 | 54 | //+kubebuilder:object:root=true 55 | 56 | // HarvesterClusterTemplateList contains a list of HarvesterClusterTemplates. 57 | type HarvesterClusterTemplateList struct { 58 | metav1.TypeMeta `json:",inline"` 59 | metav1.ListMeta `json:"metadata,omitempty"` 60 | 61 | Items []HarvesterClusterTemplate `json:"items"` 62 | } 63 | 64 | func init() { 65 | SchemeBuilder.Register(&HarvesterClusterTemplate{}, &HarvesterClusterTemplateList{}) 66 | } 67 | -------------------------------------------------------------------------------- /hack/create-kind-cluster.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -o errexit 3 | 4 | # 1. Create registry container unless it already exists 5 | reg_name='kind-registry' 6 | reg_port='5000' 7 | CAPI_CLUSTER_NAME="${CAPI_CLUSTER_NAME:-'capi-test'}" 8 | if [ "$(docker inspect -f '{{.State.Running}}' "${reg_name}" 2>/dev/null || true)" != 'true' ]; then 9 | docker run \ 10 | -d --restart=always -p "127.0.0.1:${reg_port}:5000" --network bridge --name "${reg_name}" \ 11 | registry:2 12 | fi 13 | 14 | # 2. Create kind cluster with containerd registry config dir enabled 15 | # TODO: kind will eventually enable this by default and this patch will 16 | # be unnecessary. 17 | # 18 | # See: 19 | # https://github.com/kubernetes-sigs/kind/issues/2875 20 | # https://github.com/containerd/containerd/blob/main/docs/cri/config.md#registry-configuration 21 | # See: https://github.com/containerd/containerd/blob/main/docs/hosts.md 22 | cat < /dev/null; then 93 | echo ${{ github.ref_name }} release exists 94 | else 95 | gh release create ${{ github.ref_name }} --draft --generate-notes 96 | fi 97 | gh release upload ${{ github.ref_name }} out/metadata.yaml 98 | gh release upload ${{ github.ref_name }} out/infrastructure-components.yaml -------------------------------------------------------------------------------- /util/cloudinit.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2025 SUSE. 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 util 18 | 19 | import ( 20 | "errors" 21 | "slices" 22 | 23 | "gopkg.in/yaml.v2" 24 | ) 25 | 26 | var cloudInitListSections = []string{"packages", "runcmd", "ssh_authorized_keys", "groups", "users", "write_files", "bootcmd"} 27 | 28 | // MergeCloudInitData merges multiple cloud-init data strings into a single cloud-init data string. 29 | func MergeCloudInitData(cloudInits ...string) ([]byte, error) { 30 | var resultCloudInit []byte 31 | 32 | // resCloudInitObj will be an object that stores the result of merging all the cloud-init objects 33 | resCloudInitObj := make(map[string]interface{}) 34 | 35 | // First of all we iterate over all the cloud-init objects 36 | for _, cloudInit := range cloudInits { 37 | cloudInitObj := make(map[string]interface{}) 38 | 39 | err := yaml.Unmarshal([]byte(cloudInit), &cloudInitObj) 40 | if err != nil { 41 | return nil, errors.Join(errors.New("unable to unmarshall cloud-init, input cloud-init is malformed"), err) 42 | } 43 | 44 | // For each cloud-init object we iterate over all the keys and values 45 | for k, v := range cloudInitObj { 46 | // If the key is a list section, we append the values to the resulting list key 47 | if slices.Contains(cloudInitListSections, k) { 48 | listSection := []interface{}{} 49 | 50 | // Get the current list section from the resulting cloud-init object if it exists 51 | if resCloudInitObj[k] != nil { 52 | var ok bool 53 | 54 | listSection, ok = resCloudInitObj[k].([]interface{}) 55 | if !ok { 56 | return nil, errors.New("unable to cast list section to []interface{}") 57 | } 58 | } 59 | 60 | // Append the values to the resulting list section 61 | value, ok := v.([]interface{}) 62 | if !ok { 63 | return nil, errors.New("unable to cast value to []interface{}") 64 | } 65 | 66 | listSection = append(listSection, value...) 67 | 68 | // Add the resulting list section to the resulting cloud-init object in current key 69 | resCloudInitObj[k] = listSection 70 | } else { 71 | // If the key is not a list section, we just add the key and value to the resulting cloud-init object 72 | resCloudInitObj[k] = v 73 | } 74 | } 75 | } 76 | 77 | resultCloudInit, err := yaml.Marshal(resCloudInitObj) 78 | if err != nil { 79 | return nil, errors.Join(errors.New("unable to marshall cloud-init, input cloud-init is malformed"), err) 80 | } 81 | 82 | resultCloudInit = []byte("#cloud-config\n" + string(resultCloudInit)) 83 | 84 | return resultCloudInit, nil 85 | } 86 | -------------------------------------------------------------------------------- /pkg/clientset/versioned/fake/register.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2025 SUSE. 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 main. DO NOT EDIT. 18 | 19 | package fake 20 | 21 | import ( 22 | harvesterhciv1beta1 "github.com/harvester/harvester/pkg/apis/harvesterhci.io/v1beta1" 23 | k8scnicncfiov1 "github.com/k8snetworkplumbingwg/network-attachment-definition-client/pkg/apis/k8s.cni.cncf.io/v1" 24 | snapshotv1 "github.com/kubernetes-csi/external-snapshotter/client/v4/apis/volumesnapshot/v1" 25 | longhornv1beta2 "github.com/longhorn/longhorn-manager/k8s/pkg/apis/longhorn/v1beta2" 26 | monitoringv1 "github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1" 27 | catalogv1 "github.com/rancher/rancher/pkg/apis/catalog.cattle.io/v1" 28 | managementv3 "github.com/rancher/rancher/pkg/apis/management.cattle.io/v3" 29 | upgradev1 "github.com/rancher/system-upgrade-controller/pkg/apis/upgrade.cattle.io/v1" 30 | kubevirtv1 "kubevirt.io/api/core/v1" 31 | 32 | networkingv1 "k8s.io/api/networking/v1" 33 | storagev1 "k8s.io/api/storage/v1" 34 | v1 "k8s.io/apimachinery/pkg/apis/meta/v1" 35 | runtime "k8s.io/apimachinery/pkg/runtime" 36 | schema "k8s.io/apimachinery/pkg/runtime/schema" 37 | serializer "k8s.io/apimachinery/pkg/runtime/serializer" 38 | utilruntime "k8s.io/apimachinery/pkg/util/runtime" 39 | 40 | clusterv1beta1 "sigs.k8s.io/cluster-api/api/v1beta1" 41 | ) 42 | 43 | var scheme = runtime.NewScheme() 44 | var codecs = serializer.NewCodecFactory(scheme) 45 | 46 | var localSchemeBuilder = runtime.SchemeBuilder{ 47 | catalogv1.AddToScheme, 48 | clusterv1beta1.AddToScheme, 49 | harvesterhciv1beta1.AddToScheme, 50 | k8scnicncfiov1.AddToScheme, 51 | kubevirtv1.AddToScheme, 52 | longhornv1beta2.AddToScheme, 53 | managementv3.AddToScheme, 54 | monitoringv1.AddToScheme, 55 | networkingv1.AddToScheme, 56 | snapshotv1.AddToScheme, 57 | storagev1.AddToScheme, 58 | upgradev1.AddToScheme, 59 | } 60 | 61 | // AddToScheme adds all types of this clientset into the given scheme. This allows composition 62 | // of clientsets, like in: 63 | // 64 | // import ( 65 | // "k8s.io/client-go/kubernetes" 66 | // clientsetscheme "k8s.io/client-go/kubernetes/scheme" 67 | // aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme" 68 | // ) 69 | // 70 | // kclientset, _ := kubernetes.NewForConfig(c) 71 | // _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme) 72 | // 73 | // After this, RawExtensions in Kubernetes types will serialize kube-aggregator types 74 | // correctly. 75 | var AddToScheme = localSchemeBuilder.AddToScheme 76 | 77 | func init() { 78 | v1.AddToGroupVersion(scheme, schema.GroupVersion{Version: "v1"}) 79 | utilruntime.Must(AddToScheme(scheme)) 80 | } 81 | -------------------------------------------------------------------------------- /pkg/clientset/versioned/scheme/register.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2025 SUSE. 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 main. DO NOT EDIT. 18 | 19 | package scheme 20 | 21 | import ( 22 | harvesterhciv1beta1 "github.com/harvester/harvester/pkg/apis/harvesterhci.io/v1beta1" 23 | k8scnicncfiov1 "github.com/k8snetworkplumbingwg/network-attachment-definition-client/pkg/apis/k8s.cni.cncf.io/v1" 24 | snapshotv1 "github.com/kubernetes-csi/external-snapshotter/client/v4/apis/volumesnapshot/v1" 25 | longhornv1beta2 "github.com/longhorn/longhorn-manager/k8s/pkg/apis/longhorn/v1beta2" 26 | monitoringv1 "github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1" 27 | catalogv1 "github.com/rancher/rancher/pkg/apis/catalog.cattle.io/v1" 28 | managementv3 "github.com/rancher/rancher/pkg/apis/management.cattle.io/v3" 29 | upgradev1 "github.com/rancher/system-upgrade-controller/pkg/apis/upgrade.cattle.io/v1" 30 | kubevirtv1 "kubevirt.io/api/core/v1" 31 | 32 | networkingv1 "k8s.io/api/networking/v1" 33 | storagev1 "k8s.io/api/storage/v1" 34 | v1 "k8s.io/apimachinery/pkg/apis/meta/v1" 35 | runtime "k8s.io/apimachinery/pkg/runtime" 36 | schema "k8s.io/apimachinery/pkg/runtime/schema" 37 | serializer "k8s.io/apimachinery/pkg/runtime/serializer" 38 | utilruntime "k8s.io/apimachinery/pkg/util/runtime" 39 | 40 | clusterv1beta1 "sigs.k8s.io/cluster-api/api/v1beta1" 41 | ) 42 | 43 | var Scheme = runtime.NewScheme() 44 | var Codecs = serializer.NewCodecFactory(Scheme) 45 | var ParameterCodec = runtime.NewParameterCodec(Scheme) 46 | var localSchemeBuilder = runtime.SchemeBuilder{ 47 | catalogv1.AddToScheme, 48 | clusterv1beta1.AddToScheme, 49 | harvesterhciv1beta1.AddToScheme, 50 | k8scnicncfiov1.AddToScheme, 51 | kubevirtv1.AddToScheme, 52 | longhornv1beta2.AddToScheme, 53 | managementv3.AddToScheme, 54 | monitoringv1.AddToScheme, 55 | networkingv1.AddToScheme, 56 | snapshotv1.AddToScheme, 57 | storagev1.AddToScheme, 58 | upgradev1.AddToScheme, 59 | } 60 | 61 | // AddToScheme adds all types of this clientset into the given scheme. This allows composition 62 | // of clientsets, like in: 63 | // 64 | // import ( 65 | // "k8s.io/client-go/kubernetes" 66 | // clientsetscheme "k8s.io/client-go/kubernetes/scheme" 67 | // aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme" 68 | // ) 69 | // 70 | // kclientset, _ := kubernetes.NewForConfig(c) 71 | // _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme) 72 | // 73 | // After this, RawExtensions in Kubernetes types will serialize kube-aggregator types 74 | // correctly. 75 | var AddToScheme = localSchemeBuilder.AddToScheme 76 | 77 | func init() { 78 | v1.AddToGroupVersion(Scheme, schema.GroupVersion{Version: "v1"}) 79 | utilruntime.Must(AddToScheme(Scheme)) 80 | } 81 | -------------------------------------------------------------------------------- /pkg/clientset/versioned/typed/harvesterhci.io/v1beta1/fake/fake_harvesterhci.io_client.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2025 SUSE. 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 main. 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 | 25 | v1beta1 "github.com/rancher-sandbox/cluster-api-provider-harvester/pkg/clientset/versioned/typed/harvesterhci.io/v1beta1" 26 | ) 27 | 28 | type FakeHarvesterhciV1beta1 struct { 29 | *testing.Fake 30 | } 31 | 32 | func (c *FakeHarvesterhciV1beta1) Addons(namespace string) v1beta1.AddonInterface { 33 | return &FakeAddons{c, namespace} 34 | } 35 | 36 | func (c *FakeHarvesterhciV1beta1) KeyPairs(namespace string) v1beta1.KeyPairInterface { 37 | return &FakeKeyPairs{c, namespace} 38 | } 39 | 40 | func (c *FakeHarvesterhciV1beta1) Preferences(namespace string) v1beta1.PreferenceInterface { 41 | return &FakePreferences{c, namespace} 42 | } 43 | 44 | func (c *FakeHarvesterhciV1beta1) Settings() v1beta1.SettingInterface { 45 | return &FakeSettings{c} 46 | } 47 | 48 | func (c *FakeHarvesterhciV1beta1) SupportBundles(namespace string) v1beta1.SupportBundleInterface { 49 | return &FakeSupportBundles{c, namespace} 50 | } 51 | 52 | func (c *FakeHarvesterhciV1beta1) Upgrades(namespace string) v1beta1.UpgradeInterface { 53 | return &FakeUpgrades{c, namespace} 54 | } 55 | 56 | func (c *FakeHarvesterhciV1beta1) UpgradeLogs(namespace string) v1beta1.UpgradeLogInterface { 57 | return &FakeUpgradeLogs{c, namespace} 58 | } 59 | 60 | func (c *FakeHarvesterhciV1beta1) Versions(namespace string) v1beta1.VersionInterface { 61 | return &FakeVersions{c, namespace} 62 | } 63 | 64 | func (c *FakeHarvesterhciV1beta1) VirtualMachineBackups(namespace string) v1beta1.VirtualMachineBackupInterface { 65 | return &FakeVirtualMachineBackups{c, namespace} 66 | } 67 | 68 | func (c *FakeHarvesterhciV1beta1) VirtualMachineImages(namespace string) v1beta1.VirtualMachineImageInterface { 69 | return &FakeVirtualMachineImages{c, namespace} 70 | } 71 | 72 | func (c *FakeHarvesterhciV1beta1) VirtualMachineRestores(namespace string) v1beta1.VirtualMachineRestoreInterface { 73 | return &FakeVirtualMachineRestores{c, namespace} 74 | } 75 | 76 | func (c *FakeHarvesterhciV1beta1) VirtualMachineTemplates(namespace string) v1beta1.VirtualMachineTemplateInterface { 77 | return &FakeVirtualMachineTemplates{c, namespace} 78 | } 79 | 80 | func (c *FakeHarvesterhciV1beta1) VirtualMachineTemplateVersions(namespace string) v1beta1.VirtualMachineTemplateVersionInterface { 81 | return &FakeVirtualMachineTemplateVersions{c, namespace} 82 | } 83 | 84 | // RESTClient returns a RESTClient that is used to communicate 85 | // with API server by this client implementation. 86 | func (c *FakeHarvesterhciV1beta1) RESTClient() rest.Interface { 87 | var ret *rest.RESTClient 88 | return ret 89 | } 90 | -------------------------------------------------------------------------------- /pkg/clientset/versioned/typed/upgrade.cattle.io/v1/upgrade.cattle.io_client.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2025 SUSE. 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 main. DO NOT EDIT. 18 | 19 | package v1 20 | 21 | import ( 22 | "net/http" 23 | 24 | v1 "github.com/rancher/system-upgrade-controller/pkg/apis/upgrade.cattle.io/v1" 25 | 26 | rest "k8s.io/client-go/rest" 27 | 28 | "github.com/rancher-sandbox/cluster-api-provider-harvester/pkg/clientset/versioned/scheme" 29 | ) 30 | 31 | type UpgradeV1Interface interface { 32 | RESTClient() rest.Interface 33 | PlansGetter 34 | } 35 | 36 | // UpgradeV1Client is used to interact with features provided by the upgrade.cattle.io group. 37 | type UpgradeV1Client struct { 38 | restClient rest.Interface 39 | } 40 | 41 | func (c *UpgradeV1Client) Plans(namespace string) PlanInterface { 42 | return newPlans(c, namespace) 43 | } 44 | 45 | // NewForConfig creates a new UpgradeV1Client for the given config. 46 | // NewForConfig is equivalent to NewForConfigAndClient(c, httpClient), 47 | // where httpClient was generated with rest.HTTPClientFor(c). 48 | func NewForConfig(c *rest.Config) (*UpgradeV1Client, error) { 49 | config := *c 50 | err := setConfigDefaults(&config) 51 | if err != nil { 52 | return nil, err 53 | } 54 | httpClient, err := rest.HTTPClientFor(&config) 55 | if err != nil { 56 | return nil, err 57 | } 58 | return NewForConfigAndClient(&config, httpClient) 59 | } 60 | 61 | // NewForConfigAndClient creates a new UpgradeV1Client for the given config and http client. 62 | // Note the http client provided takes precedence over the configured transport values. 63 | func NewForConfigAndClient(c *rest.Config, h *http.Client) (*UpgradeV1Client, error) { 64 | config := *c 65 | err := setConfigDefaults(&config) 66 | if err != nil { 67 | return nil, err 68 | } 69 | client, err := rest.RESTClientForConfigAndClient(&config, h) 70 | if err != nil { 71 | return nil, err 72 | } 73 | return &UpgradeV1Client{client}, nil 74 | } 75 | 76 | // NewForConfigOrDie creates a new UpgradeV1Client for the given config and 77 | // panics if there is an error in the config. 78 | func NewForConfigOrDie(c *rest.Config) *UpgradeV1Client { 79 | client, err := NewForConfig(c) 80 | if err != nil { 81 | panic(err) 82 | } 83 | return client 84 | } 85 | 86 | // New creates a new UpgradeV1Client for the given RESTClient. 87 | func New(c rest.Interface) *UpgradeV1Client { 88 | return &UpgradeV1Client{c} 89 | } 90 | 91 | func setConfigDefaults(config *rest.Config) error { 92 | gv := v1.SchemeGroupVersion 93 | config.GroupVersion = &gv 94 | config.APIPath = "/apis" 95 | config.NegotiatedSerializer = scheme.Codecs.WithoutConversion() 96 | 97 | if config.UserAgent == "" { 98 | config.UserAgent = rest.DefaultKubernetesUserAgent() 99 | } 100 | 101 | return nil 102 | } 103 | 104 | // RESTClient returns a RESTClient that is used to communicate 105 | // with API server by this client implementation. 106 | func (c *UpgradeV1Client) RESTClient() rest.Interface { 107 | if c == nil { 108 | return nil 109 | } 110 | return c.restClient 111 | } 112 | -------------------------------------------------------------------------------- /pkg/clientset/versioned/typed/k8s.cni.cncf.io/v1/k8s.cni.cncf.io_client.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2025 SUSE. 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 main. DO NOT EDIT. 18 | 19 | package v1 20 | 21 | import ( 22 | "net/http" 23 | 24 | v1 "github.com/k8snetworkplumbingwg/network-attachment-definition-client/pkg/apis/k8s.cni.cncf.io/v1" 25 | 26 | rest "k8s.io/client-go/rest" 27 | 28 | "github.com/rancher-sandbox/cluster-api-provider-harvester/pkg/clientset/versioned/scheme" 29 | ) 30 | 31 | type K8sCniCncfIoV1Interface interface { 32 | RESTClient() rest.Interface 33 | NetworkAttachmentDefinitionsGetter 34 | } 35 | 36 | // K8sCniCncfIoV1Client is used to interact with features provided by the k8s.cni.cncf.io group. 37 | type K8sCniCncfIoV1Client struct { 38 | restClient rest.Interface 39 | } 40 | 41 | func (c *K8sCniCncfIoV1Client) NetworkAttachmentDefinitions(namespace string) NetworkAttachmentDefinitionInterface { 42 | return newNetworkAttachmentDefinitions(c, namespace) 43 | } 44 | 45 | // NewForConfig creates a new K8sCniCncfIoV1Client for the given config. 46 | // NewForConfig is equivalent to NewForConfigAndClient(c, httpClient), 47 | // where httpClient was generated with rest.HTTPClientFor(c). 48 | func NewForConfig(c *rest.Config) (*K8sCniCncfIoV1Client, error) { 49 | config := *c 50 | err := setConfigDefaults(&config) 51 | if err != nil { 52 | return nil, err 53 | } 54 | httpClient, err := rest.HTTPClientFor(&config) 55 | if err != nil { 56 | return nil, err 57 | } 58 | return NewForConfigAndClient(&config, httpClient) 59 | } 60 | 61 | // NewForConfigAndClient creates a new K8sCniCncfIoV1Client for the given config and http client. 62 | // Note the http client provided takes precedence over the configured transport values. 63 | func NewForConfigAndClient(c *rest.Config, h *http.Client) (*K8sCniCncfIoV1Client, error) { 64 | config := *c 65 | err := setConfigDefaults(&config) 66 | if err != nil { 67 | return nil, err 68 | } 69 | client, err := rest.RESTClientForConfigAndClient(&config, h) 70 | if err != nil { 71 | return nil, err 72 | } 73 | return &K8sCniCncfIoV1Client{client}, nil 74 | } 75 | 76 | // NewForConfigOrDie creates a new K8sCniCncfIoV1Client for the given config and 77 | // panics if there is an error in the config. 78 | func NewForConfigOrDie(c *rest.Config) *K8sCniCncfIoV1Client { 79 | client, err := NewForConfig(c) 80 | if err != nil { 81 | panic(err) 82 | } 83 | return client 84 | } 85 | 86 | // New creates a new K8sCniCncfIoV1Client for the given RESTClient. 87 | func New(c rest.Interface) *K8sCniCncfIoV1Client { 88 | return &K8sCniCncfIoV1Client{c} 89 | } 90 | 91 | func setConfigDefaults(config *rest.Config) error { 92 | gv := v1.SchemeGroupVersion 93 | config.GroupVersion = &gv 94 | config.APIPath = "/apis" 95 | config.NegotiatedSerializer = scheme.Codecs.WithoutConversion() 96 | 97 | if config.UserAgent == "" { 98 | config.UserAgent = rest.DefaultKubernetesUserAgent() 99 | } 100 | 101 | return nil 102 | } 103 | 104 | // RESTClient returns a RESTClient that is used to communicate 105 | // with API server by this client implementation. 106 | func (c *K8sCniCncfIoV1Client) RESTClient() rest.Interface { 107 | if c == nil { 108 | return nil 109 | } 110 | return c.restClient 111 | } 112 | -------------------------------------------------------------------------------- /pkg/clientset/versioned/typed/cluster.x-k8s.io/v1beta1/cluster.x-k8s.io_client.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2025 SUSE. 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 main. DO NOT EDIT. 18 | 19 | package v1beta1 20 | 21 | import ( 22 | "net/http" 23 | 24 | rest "k8s.io/client-go/rest" 25 | 26 | clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1" 27 | 28 | "github.com/rancher-sandbox/cluster-api-provider-harvester/pkg/clientset/versioned/scheme" 29 | ) 30 | 31 | type Clusterv1beta1Interface interface { 32 | RESTClient() rest.Interface 33 | ClustersGetter 34 | MachinesGetter 35 | } 36 | 37 | // Clusterv1beta1Client is used to interact with features provided by the cluster.x-k8s.io group. 38 | type Clusterv1beta1Client struct { 39 | restClient rest.Interface 40 | } 41 | 42 | func (c *Clusterv1beta1Client) Clusters(namespace string) ClusterInterface { 43 | return newClusters(c, namespace) 44 | } 45 | 46 | func (c *Clusterv1beta1Client) Machines(namespace string) MachineInterface { 47 | return newMachines(c, namespace) 48 | } 49 | 50 | // NewForConfig creates a new Clusterv1beta1Client for the given config. 51 | // NewForConfig is equivalent to NewForConfigAndClient(c, httpClient), 52 | // where httpClient was generated with rest.HTTPClientFor(c). 53 | func NewForConfig(c *rest.Config) (*Clusterv1beta1Client, error) { 54 | config := *c 55 | err := setConfigDefaults(&config) 56 | if err != nil { 57 | return nil, err 58 | } 59 | httpClient, err := rest.HTTPClientFor(&config) 60 | if err != nil { 61 | return nil, err 62 | } 63 | return NewForConfigAndClient(&config, httpClient) 64 | } 65 | 66 | // NewForConfigAndClient creates a new Clusterv1beta1Client for the given config and http client. 67 | // Note the http client provided takes precedence over the configured transport values. 68 | func NewForConfigAndClient(c *rest.Config, h *http.Client) (*Clusterv1beta1Client, error) { 69 | config := *c 70 | err := setConfigDefaults(&config) 71 | if err != nil { 72 | return nil, err 73 | } 74 | client, err := rest.RESTClientForConfigAndClient(&config, h) 75 | if err != nil { 76 | return nil, err 77 | } 78 | return &Clusterv1beta1Client{client}, nil 79 | } 80 | 81 | // NewForConfigOrDie creates a new Clusterv1beta1Client for the given config and 82 | // panics if there is an error in the config. 83 | func NewForConfigOrDie(c *rest.Config) *Clusterv1beta1Client { 84 | client, err := NewForConfig(c) 85 | if err != nil { 86 | panic(err) 87 | } 88 | return client 89 | } 90 | 91 | // New creates a new Clusterv1beta1Client for the given RESTClient. 92 | func New(c rest.Interface) *Clusterv1beta1Client { 93 | return &Clusterv1beta1Client{c} 94 | } 95 | 96 | func setConfigDefaults(config *rest.Config) error { 97 | gv := clusterv1.GroupVersion 98 | config.GroupVersion = &gv 99 | config.APIPath = "/apis" 100 | config.NegotiatedSerializer = scheme.Codecs.WithoutConversion() 101 | 102 | if config.UserAgent == "" { 103 | config.UserAgent = rest.DefaultKubernetesUserAgent() 104 | } 105 | 106 | return nil 107 | } 108 | 109 | // RESTClient returns a RESTClient that is used to communicate 110 | // with API server by this client implementation. 111 | func (c *Clusterv1beta1Client) RESTClient() rest.Interface { 112 | if c == nil { 113 | return nil 114 | } 115 | return c.restClient 116 | } 117 | -------------------------------------------------------------------------------- /pkg/clientset/versioned/typed/catalog.cattle.io/v1/catalog.cattle.io_client.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2025 SUSE. 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 main. DO NOT EDIT. 18 | 19 | package v1 20 | 21 | import ( 22 | "net/http" 23 | 24 | v1 "github.com/rancher/rancher/pkg/apis/catalog.cattle.io/v1" 25 | 26 | rest "k8s.io/client-go/rest" 27 | 28 | "github.com/rancher-sandbox/cluster-api-provider-harvester/pkg/clientset/versioned/scheme" 29 | ) 30 | 31 | type CatalogV1Interface interface { 32 | RESTClient() rest.Interface 33 | AppsGetter 34 | ClusterReposGetter 35 | OperationsGetter 36 | } 37 | 38 | // CatalogV1Client is used to interact with features provided by the catalog.cattle.io group. 39 | type CatalogV1Client struct { 40 | restClient rest.Interface 41 | } 42 | 43 | func (c *CatalogV1Client) Apps(namespace string) AppInterface { 44 | return newApps(c, namespace) 45 | } 46 | 47 | func (c *CatalogV1Client) ClusterRepos() ClusterRepoInterface { 48 | return newClusterRepos(c) 49 | } 50 | 51 | func (c *CatalogV1Client) Operations(namespace string) OperationInterface { 52 | return newOperations(c, namespace) 53 | } 54 | 55 | // NewForConfig creates a new CatalogV1Client for the given config. 56 | // NewForConfig is equivalent to NewForConfigAndClient(c, httpClient), 57 | // where httpClient was generated with rest.HTTPClientFor(c). 58 | func NewForConfig(c *rest.Config) (*CatalogV1Client, error) { 59 | config := *c 60 | err := setConfigDefaults(&config) 61 | if err != nil { 62 | return nil, err 63 | } 64 | httpClient, err := rest.HTTPClientFor(&config) 65 | if err != nil { 66 | return nil, err 67 | } 68 | return NewForConfigAndClient(&config, httpClient) 69 | } 70 | 71 | // NewForConfigAndClient creates a new CatalogV1Client for the given config and http client. 72 | // Note the http client provided takes precedence over the configured transport values. 73 | func NewForConfigAndClient(c *rest.Config, h *http.Client) (*CatalogV1Client, error) { 74 | config := *c 75 | err := setConfigDefaults(&config) 76 | if err != nil { 77 | return nil, err 78 | } 79 | client, err := rest.RESTClientForConfigAndClient(&config, h) 80 | if err != nil { 81 | return nil, err 82 | } 83 | return &CatalogV1Client{client}, nil 84 | } 85 | 86 | // NewForConfigOrDie creates a new CatalogV1Client for the given config and 87 | // panics if there is an error in the config. 88 | func NewForConfigOrDie(c *rest.Config) *CatalogV1Client { 89 | client, err := NewForConfig(c) 90 | if err != nil { 91 | panic(err) 92 | } 93 | return client 94 | } 95 | 96 | // New creates a new CatalogV1Client for the given RESTClient. 97 | func New(c rest.Interface) *CatalogV1Client { 98 | return &CatalogV1Client{c} 99 | } 100 | 101 | func setConfigDefaults(config *rest.Config) error { 102 | gv := v1.SchemeGroupVersion 103 | config.GroupVersion = &gv 104 | config.APIPath = "/apis" 105 | config.NegotiatedSerializer = scheme.Codecs.WithoutConversion() 106 | 107 | if config.UserAgent == "" { 108 | config.UserAgent = rest.DefaultKubernetesUserAgent() 109 | } 110 | 111 | return nil 112 | } 113 | 114 | // RESTClient returns a RESTClient that is used to communicate 115 | // with API server by this client implementation. 116 | func (c *CatalogV1Client) RESTClient() rest.Interface { 117 | if c == nil { 118 | return nil 119 | } 120 | return c.restClient 121 | } 122 | -------------------------------------------------------------------------------- /test/e2e/e2e_suite_test.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2025 SUSE. 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 | //notlint:forbidigo 18 | package e2e 19 | 20 | import ( 21 | "fmt" 22 | "os" 23 | "os/exec" 24 | "testing" 25 | 26 | . "github.com/onsi/ginkgo/v2" 27 | . "github.com/onsi/gomega" 28 | 29 | "github.com/rancher-sandbox/cluster-api-provider-harvester/test/utils" 30 | ) 31 | 32 | var ( 33 | // Optional Environment Variables: 34 | // - CERT_MANAGER_INSTALL_SKIP=true: Skips CertManager installation during test setup. 35 | // These variables are useful if CertManager is already installed, avoiding 36 | // re-installation and conflicts. 37 | skipCertManagerInstall = os.Getenv("CERT_MANAGER_INSTALL_SKIP") == "true" 38 | // isCertManagerAlreadyInstalled will be set true when CertManager CRDs be found on the cluster. 39 | isCertManagerAlreadyInstalled = false 40 | 41 | // projectImage is the name of the image which will be build and loaded 42 | // with the code source changes to be tested. 43 | projectImage = "example.com/cluster-api-provider-harvester:v0.0.1" 44 | ) 45 | 46 | // TestE2E runs the end-to-end (e2e) test suite for the project. These tests execute in an isolated, 47 | // temporary environment to validate project changes with the purposed to be used in CI jobs. 48 | // The default setup requires Kind, builds/loads the Manager Docker image locally, and installs 49 | // CertManager. 50 | func TestE2E(t *testing.T) { 51 | RegisterFailHandler(Fail) 52 | 53 | _, _ = fmt.Fprintf(GinkgoWriter, "Starting cluster-api-provider-harvester integration test suite\n") 54 | 55 | RunSpecs(t, "e2e suite") 56 | } 57 | 58 | var _ = BeforeSuite(func() { 59 | By("building the manager(Operator) image") 60 | cmd := exec.Command("make", "docker-build", "IMG="+projectImage) //nolint:gosec 61 | _, err := utils.Run(cmd) 62 | ExpectWithOffset(1, err).NotTo(HaveOccurred(), "Failed to build the manager(Operator) image") 63 | 64 | // NOTE: If you want to change the e2e test vendor from Kind, ensure the image is 65 | // built and available before running the tests. Also, remove the following block. 66 | By("loading the manager(Operator) image on Kind") 67 | err = utils.LoadImageToKindClusterWithName(projectImage) 68 | ExpectWithOffset(1, err).NotTo(HaveOccurred(), "Failed to load the manager(Operator) image into Kind") 69 | 70 | // The tests-e2e are intended to run on a temporary cluster that is created and destroyed for testing. 71 | // To prevent errors when tests run in environments with CertManager already installed, 72 | // we check for its presence before execution. 73 | // Setup CertManager before the suite if not skipped and if not already installed 74 | if !skipCertManagerInstall { 75 | By("checking if cert manager is installed already") 76 | isCertManagerAlreadyInstalled = utils.IsCertManagerCRDsInstalled() 77 | if !isCertManagerAlreadyInstalled { 78 | _, _ = fmt.Fprintf(GinkgoWriter, "Installing CertManager...\n") 79 | Expect(utils.InstallCertManager()).To(Succeed(), "Failed to install CertManager") 80 | } else { 81 | _, _ = fmt.Fprintf(GinkgoWriter, "WARNING: CertManager is already installed. Skipping installation...\n") 82 | } 83 | } 84 | }) 85 | 86 | var _ = AfterSuite(func() { 87 | // Teardown CertManager after the suite if not skipped and if it was not already installed 88 | if !skipCertManagerInstall && !isCertManagerAlreadyInstalled { 89 | _, _ = fmt.Fprintf(GinkgoWriter, "Uninstalling CertManager...\n") 90 | utils.UninstallCertManager() 91 | } 92 | }) 93 | -------------------------------------------------------------------------------- /pkg/clientset/versioned/typed/networking.k8s.io/v1/networking.k8s.io_client.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2025 SUSE. 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 main. DO NOT EDIT. 18 | 19 | package v1 20 | 21 | import ( 22 | "net/http" 23 | 24 | v1 "k8s.io/api/networking/v1" 25 | rest "k8s.io/client-go/rest" 26 | 27 | "github.com/rancher-sandbox/cluster-api-provider-harvester/pkg/clientset/versioned/scheme" 28 | ) 29 | 30 | type NetworkingV1Interface interface { 31 | RESTClient() rest.Interface 32 | IngressesGetter 33 | IngressClassesGetter 34 | NetworkPoliciesGetter 35 | } 36 | 37 | // NetworkingV1Client is used to interact with features provided by the networking.k8s.io group. 38 | type NetworkingV1Client struct { 39 | restClient rest.Interface 40 | } 41 | 42 | func (c *NetworkingV1Client) Ingresses(namespace string) IngressInterface { 43 | return newIngresses(c, namespace) 44 | } 45 | 46 | func (c *NetworkingV1Client) IngressClasses() IngressClassInterface { 47 | return newIngressClasses(c) 48 | } 49 | 50 | func (c *NetworkingV1Client) NetworkPolicies(namespace string) NetworkPolicyInterface { 51 | return newNetworkPolicies(c, namespace) 52 | } 53 | 54 | // NewForConfig creates a new NetworkingV1Client for the given config. 55 | // NewForConfig is equivalent to NewForConfigAndClient(c, httpClient), 56 | // where httpClient was generated with rest.HTTPClientFor(c). 57 | func NewForConfig(c *rest.Config) (*NetworkingV1Client, error) { 58 | config := *c 59 | err := setConfigDefaults(&config) 60 | if err != nil { 61 | return nil, err 62 | } 63 | httpClient, err := rest.HTTPClientFor(&config) 64 | if err != nil { 65 | return nil, err 66 | } 67 | return NewForConfigAndClient(&config, httpClient) 68 | } 69 | 70 | // NewForConfigAndClient creates a new NetworkingV1Client for the given config and http client. 71 | // Note the http client provided takes precedence over the configured transport values. 72 | func NewForConfigAndClient(c *rest.Config, h *http.Client) (*NetworkingV1Client, error) { 73 | config := *c 74 | err := setConfigDefaults(&config) 75 | if err != nil { 76 | return nil, err 77 | } 78 | client, err := rest.RESTClientForConfigAndClient(&config, h) 79 | if err != nil { 80 | return nil, err 81 | } 82 | return &NetworkingV1Client{client}, nil 83 | } 84 | 85 | // NewForConfigOrDie creates a new NetworkingV1Client for the given config and 86 | // panics if there is an error in the config. 87 | func NewForConfigOrDie(c *rest.Config) *NetworkingV1Client { 88 | client, err := NewForConfig(c) 89 | if err != nil { 90 | panic(err) 91 | } 92 | return client 93 | } 94 | 95 | // New creates a new NetworkingV1Client for the given RESTClient. 96 | func New(c rest.Interface) *NetworkingV1Client { 97 | return &NetworkingV1Client{c} 98 | } 99 | 100 | func setConfigDefaults(config *rest.Config) error { 101 | gv := v1.SchemeGroupVersion 102 | config.GroupVersion = &gv 103 | config.APIPath = "/apis" 104 | config.NegotiatedSerializer = scheme.Codecs.WithoutConversion() 105 | 106 | if config.UserAgent == "" { 107 | config.UserAgent = rest.DefaultKubernetesUserAgent() 108 | } 109 | 110 | return nil 111 | } 112 | 113 | // RESTClient returns a RESTClient that is used to communicate 114 | // with API server by this client implementation. 115 | func (c *NetworkingV1Client) RESTClient() rest.Interface { 116 | if c == nil { 117 | return nil 118 | } 119 | return c.restClient 120 | } 121 | -------------------------------------------------------------------------------- /pkg/clientset/versioned/typed/snapshot.storage.k8s.io/v1/snapshot.storage.k8s.io_client.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2025 SUSE. 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 main. DO NOT EDIT. 18 | 19 | package v1 20 | 21 | import ( 22 | "net/http" 23 | 24 | v1 "github.com/kubernetes-csi/external-snapshotter/client/v4/apis/volumesnapshot/v1" 25 | 26 | rest "k8s.io/client-go/rest" 27 | 28 | "github.com/rancher-sandbox/cluster-api-provider-harvester/pkg/clientset/versioned/scheme" 29 | ) 30 | 31 | type SnapshotV1Interface interface { 32 | RESTClient() rest.Interface 33 | VolumeSnapshotsGetter 34 | VolumeSnapshotClassesGetter 35 | VolumeSnapshotContentsGetter 36 | } 37 | 38 | // SnapshotV1Client is used to interact with features provided by the snapshot.storage.k8s.io group. 39 | type SnapshotV1Client struct { 40 | restClient rest.Interface 41 | } 42 | 43 | func (c *SnapshotV1Client) VolumeSnapshots(namespace string) VolumeSnapshotInterface { 44 | return newVolumeSnapshots(c, namespace) 45 | } 46 | 47 | func (c *SnapshotV1Client) VolumeSnapshotClasses() VolumeSnapshotClassInterface { 48 | return newVolumeSnapshotClasses(c) 49 | } 50 | 51 | func (c *SnapshotV1Client) VolumeSnapshotContents() VolumeSnapshotContentInterface { 52 | return newVolumeSnapshotContents(c) 53 | } 54 | 55 | // NewForConfig creates a new SnapshotV1Client for the given config. 56 | // NewForConfig is equivalent to NewForConfigAndClient(c, httpClient), 57 | // where httpClient was generated with rest.HTTPClientFor(c). 58 | func NewForConfig(c *rest.Config) (*SnapshotV1Client, error) { 59 | config := *c 60 | err := setConfigDefaults(&config) 61 | if err != nil { 62 | return nil, err 63 | } 64 | httpClient, err := rest.HTTPClientFor(&config) 65 | if err != nil { 66 | return nil, err 67 | } 68 | return NewForConfigAndClient(&config, httpClient) 69 | } 70 | 71 | // NewForConfigAndClient creates a new SnapshotV1Client for the given config and http client. 72 | // Note the http client provided takes precedence over the configured transport values. 73 | func NewForConfigAndClient(c *rest.Config, h *http.Client) (*SnapshotV1Client, error) { 74 | config := *c 75 | err := setConfigDefaults(&config) 76 | if err != nil { 77 | return nil, err 78 | } 79 | client, err := rest.RESTClientForConfigAndClient(&config, h) 80 | if err != nil { 81 | return nil, err 82 | } 83 | return &SnapshotV1Client{client}, nil 84 | } 85 | 86 | // NewForConfigOrDie creates a new SnapshotV1Client for the given config and 87 | // panics if there is an error in the config. 88 | func NewForConfigOrDie(c *rest.Config) *SnapshotV1Client { 89 | client, err := NewForConfig(c) 90 | if err != nil { 91 | panic(err) 92 | } 93 | return client 94 | } 95 | 96 | // New creates a new SnapshotV1Client for the given RESTClient. 97 | func New(c rest.Interface) *SnapshotV1Client { 98 | return &SnapshotV1Client{c} 99 | } 100 | 101 | func setConfigDefaults(config *rest.Config) error { 102 | gv := v1.SchemeGroupVersion 103 | config.GroupVersion = &gv 104 | config.APIPath = "/apis" 105 | config.NegotiatedSerializer = scheme.Codecs.WithoutConversion() 106 | 107 | if config.UserAgent == "" { 108 | config.UserAgent = rest.DefaultKubernetesUserAgent() 109 | } 110 | 111 | return nil 112 | } 113 | 114 | // RESTClient returns a RESTClient that is used to communicate 115 | // with API server by this client implementation. 116 | func (c *SnapshotV1Client) RESTClient() rest.Interface { 117 | if c == nil { 118 | return nil 119 | } 120 | return c.restClient 121 | } 122 | -------------------------------------------------------------------------------- /pkg/clientset/versioned/typed/storage.k8s.io/v1/storage.k8s.io_client.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2025 SUSE. 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 main. DO NOT EDIT. 18 | 19 | package v1 20 | 21 | import ( 22 | "net/http" 23 | 24 | v1 "k8s.io/api/storage/v1" 25 | rest "k8s.io/client-go/rest" 26 | 27 | "github.com/rancher-sandbox/cluster-api-provider-harvester/pkg/clientset/versioned/scheme" 28 | ) 29 | 30 | type StorageV1Interface interface { 31 | RESTClient() rest.Interface 32 | CSIDriversGetter 33 | CSINodesGetter 34 | CSIStorageCapacitiesGetter 35 | StorageClassesGetter 36 | VolumeAttachmentsGetter 37 | } 38 | 39 | // StorageV1Client is used to interact with features provided by the storage.k8s.io group. 40 | type StorageV1Client struct { 41 | restClient rest.Interface 42 | } 43 | 44 | func (c *StorageV1Client) CSIDrivers() CSIDriverInterface { 45 | return newCSIDrivers(c) 46 | } 47 | 48 | func (c *StorageV1Client) CSINodes() CSINodeInterface { 49 | return newCSINodes(c) 50 | } 51 | 52 | func (c *StorageV1Client) CSIStorageCapacities(namespace string) CSIStorageCapacityInterface { 53 | return newCSIStorageCapacities(c, namespace) 54 | } 55 | 56 | func (c *StorageV1Client) StorageClasses() StorageClassInterface { 57 | return newStorageClasses(c) 58 | } 59 | 60 | func (c *StorageV1Client) VolumeAttachments() VolumeAttachmentInterface { 61 | return newVolumeAttachments(c) 62 | } 63 | 64 | // NewForConfig creates a new StorageV1Client for the given config. 65 | // NewForConfig is equivalent to NewForConfigAndClient(c, httpClient), 66 | // where httpClient was generated with rest.HTTPClientFor(c). 67 | func NewForConfig(c *rest.Config) (*StorageV1Client, error) { 68 | config := *c 69 | err := setConfigDefaults(&config) 70 | if err != nil { 71 | return nil, err 72 | } 73 | httpClient, err := rest.HTTPClientFor(&config) 74 | if err != nil { 75 | return nil, err 76 | } 77 | return NewForConfigAndClient(&config, httpClient) 78 | } 79 | 80 | // NewForConfigAndClient creates a new StorageV1Client for the given config and http client. 81 | // Note the http client provided takes precedence over the configured transport values. 82 | func NewForConfigAndClient(c *rest.Config, h *http.Client) (*StorageV1Client, error) { 83 | config := *c 84 | err := setConfigDefaults(&config) 85 | if err != nil { 86 | return nil, err 87 | } 88 | client, err := rest.RESTClientForConfigAndClient(&config, h) 89 | if err != nil { 90 | return nil, err 91 | } 92 | return &StorageV1Client{client}, nil 93 | } 94 | 95 | // NewForConfigOrDie creates a new StorageV1Client for the given config and 96 | // panics if there is an error in the config. 97 | func NewForConfigOrDie(c *rest.Config) *StorageV1Client { 98 | client, err := NewForConfig(c) 99 | if err != nil { 100 | panic(err) 101 | } 102 | return client 103 | } 104 | 105 | // New creates a new StorageV1Client for the given RESTClient. 106 | func New(c rest.Interface) *StorageV1Client { 107 | return &StorageV1Client{c} 108 | } 109 | 110 | func setConfigDefaults(config *rest.Config) error { 111 | gv := v1.SchemeGroupVersion 112 | config.GroupVersion = &gv 113 | config.APIPath = "/apis" 114 | config.NegotiatedSerializer = scheme.Codecs.WithoutConversion() 115 | 116 | if config.UserAgent == "" { 117 | config.UserAgent = rest.DefaultKubernetesUserAgent() 118 | } 119 | 120 | return nil 121 | } 122 | 123 | // RESTClient returns a RESTClient that is used to communicate 124 | // with API server by this client implementation. 125 | func (c *StorageV1Client) RESTClient() rest.Interface { 126 | if c == nil { 127 | return nil 128 | } 129 | return c.restClient 130 | } 131 | -------------------------------------------------------------------------------- /pkg/clientset/versioned/typed/longhorn.io/v1beta2/fake/fake_longhorn.io_client.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2025 SUSE. 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 main. 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 | 25 | v1beta2 "github.com/rancher-sandbox/cluster-api-provider-harvester/pkg/clientset/versioned/typed/longhorn.io/v1beta2" 26 | ) 27 | 28 | type FakeLonghornV1beta2 struct { 29 | *testing.Fake 30 | } 31 | 32 | func (c *FakeLonghornV1beta2) BackingImages(namespace string) v1beta2.BackingImageInterface { 33 | return &FakeBackingImages{c, namespace} 34 | } 35 | 36 | func (c *FakeLonghornV1beta2) BackingImageDataSources(namespace string) v1beta2.BackingImageDataSourceInterface { 37 | return &FakeBackingImageDataSources{c, namespace} 38 | } 39 | 40 | func (c *FakeLonghornV1beta2) BackingImageManagers(namespace string) v1beta2.BackingImageManagerInterface { 41 | return &FakeBackingImageManagers{c, namespace} 42 | } 43 | 44 | func (c *FakeLonghornV1beta2) Backups(namespace string) v1beta2.BackupInterface { 45 | return &FakeBackups{c, namespace} 46 | } 47 | 48 | func (c *FakeLonghornV1beta2) BackupTargets(namespace string) v1beta2.BackupTargetInterface { 49 | return &FakeBackupTargets{c, namespace} 50 | } 51 | 52 | func (c *FakeLonghornV1beta2) BackupVolumes(namespace string) v1beta2.BackupVolumeInterface { 53 | return &FakeBackupVolumes{c, namespace} 54 | } 55 | 56 | func (c *FakeLonghornV1beta2) Engines(namespace string) v1beta2.EngineInterface { 57 | return &FakeEngines{c, namespace} 58 | } 59 | 60 | func (c *FakeLonghornV1beta2) EngineImages(namespace string) v1beta2.EngineImageInterface { 61 | return &FakeEngineImages{c, namespace} 62 | } 63 | 64 | func (c *FakeLonghornV1beta2) InstanceManagers(namespace string) v1beta2.InstanceManagerInterface { 65 | return &FakeInstanceManagers{c, namespace} 66 | } 67 | 68 | func (c *FakeLonghornV1beta2) Nodes(namespace string) v1beta2.NodeInterface { 69 | return &FakeNodes{c, namespace} 70 | } 71 | 72 | func (c *FakeLonghornV1beta2) Orphans(namespace string) v1beta2.OrphanInterface { 73 | return &FakeOrphans{c, namespace} 74 | } 75 | 76 | func (c *FakeLonghornV1beta2) RecurringJobs(namespace string) v1beta2.RecurringJobInterface { 77 | return &FakeRecurringJobs{c, namespace} 78 | } 79 | 80 | func (c *FakeLonghornV1beta2) Replicas(namespace string) v1beta2.ReplicaInterface { 81 | return &FakeReplicas{c, namespace} 82 | } 83 | 84 | func (c *FakeLonghornV1beta2) Settings(namespace string) v1beta2.SettingInterface { 85 | return &FakeSettings{c, namespace} 86 | } 87 | 88 | func (c *FakeLonghornV1beta2) ShareManagers(namespace string) v1beta2.ShareManagerInterface { 89 | return &FakeShareManagers{c, namespace} 90 | } 91 | 92 | func (c *FakeLonghornV1beta2) Snapshots(namespace string) v1beta2.SnapshotInterface { 93 | return &FakeSnapshots{c, namespace} 94 | } 95 | 96 | func (c *FakeLonghornV1beta2) SupportBundles(namespace string) v1beta2.SupportBundleInterface { 97 | return &FakeSupportBundles{c, namespace} 98 | } 99 | 100 | func (c *FakeLonghornV1beta2) SystemBackups(namespace string) v1beta2.SystemBackupInterface { 101 | return &FakeSystemBackups{c, namespace} 102 | } 103 | 104 | func (c *FakeLonghornV1beta2) SystemRestores(namespace string) v1beta2.SystemRestoreInterface { 105 | return &FakeSystemRestores{c, namespace} 106 | } 107 | 108 | func (c *FakeLonghornV1beta2) Volumes(namespace string) v1beta2.VolumeInterface { 109 | return &FakeVolumes{c, namespace} 110 | } 111 | 112 | // RESTClient returns a RESTClient that is used to communicate 113 | // with API server by this client implementation. 114 | func (c *FakeLonghornV1beta2) RESTClient() rest.Interface { 115 | var ret *rest.RESTClient 116 | return ret 117 | } 118 | -------------------------------------------------------------------------------- /config/manager/manager.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Namespace 3 | metadata: 4 | labels: 5 | control-plane: controller-manager 6 | app.kubernetes.io/name: namespace 7 | app.kubernetes.io/instance: system 8 | app.kubernetes.io/component: manager 9 | app.kubernetes.io/created-by: cluster-api-provider-harvester 10 | app.kubernetes.io/part-of: cluster-api-provider-harvester 11 | app.kubernetes.io/managed-by: kustomize 12 | name: system 13 | --- 14 | apiVersion: apps/v1 15 | kind: Deployment 16 | metadata: 17 | name: controller-manager 18 | namespace: system 19 | labels: 20 | control-plane: controller-manager 21 | app.kubernetes.io/name: deployment 22 | app.kubernetes.io/instance: controller-manager 23 | app.kubernetes.io/component: manager 24 | app.kubernetes.io/created-by: cluster-api-provider-harvester 25 | app.kubernetes.io/part-of: cluster-api-provider-harvester 26 | app.kubernetes.io/managed-by: kustomize 27 | spec: 28 | selector: 29 | matchLabels: 30 | control-plane: controller-manager 31 | replicas: 1 32 | template: 33 | metadata: 34 | annotations: 35 | kubectl.kubernetes.io/default-container: manager 36 | labels: 37 | control-plane: controller-manager 38 | spec: 39 | # TODO(user): Uncomment the following code to configure the nodeAffinity expression 40 | # according to the platforms which are supported by your solution. 41 | # It is considered best practice to support multiple architectures. You can 42 | # build your manager image using the makefile target docker-buildx. 43 | # affinity: 44 | # nodeAffinity: 45 | # requiredDuringSchedulingIgnoredDuringExecution: 46 | # nodeSelectorTerms: 47 | # - matchExpressions: 48 | # - key: kubernetes.io/arch 49 | # operator: In 50 | # values: 51 | # - amd64 52 | # - arm64 53 | # - ppc64le 54 | # - s390x 55 | # - key: kubernetes.io/os 56 | # operator: In 57 | # values: 58 | # - linux 59 | # TODO(user): For common cases that do not require escalating privileges 60 | # it is recommended to ensure that all your Pods/Containers are restrictive. 61 | # More info: https://kubernetes.io/docs/concepts/security/pod-security-standards/#restricted 62 | # Please uncomment the following code if your project does NOT have to work on old Kubernetes 63 | # versions < 1.19 or on vendors versions which do NOT support this field by default (i.e. Openshift < 4.11 ). 64 | # seccompProfile: 65 | # type: RuntimeDefault 66 | containers: 67 | - command: 68 | - /manager 69 | args: 70 | - --leader-elect 71 | image: controller:latest 72 | name: manager 73 | securityContext: 74 | privileged: true 75 | env: 76 | - name: POD_NAMESPACE 77 | valueFrom: 78 | fieldRef: 79 | fieldPath: metadata.namespace 80 | - name: POD_NAME 81 | valueFrom: 82 | fieldRef: 83 | fieldPath: metadata.name 84 | - name: POD_UID 85 | valueFrom: 86 | fieldRef: 87 | fieldPath: metadata.uid 88 | ports: 89 | - containerPort: 8081 90 | protocol: TCP 91 | name: healthz 92 | livenessProbe: 93 | httpGet: 94 | path: /healthz 95 | port: healthz 96 | initialDelaySeconds: 15 97 | periodSeconds: 20 98 | readinessProbe: 99 | httpGet: 100 | path: /readyz 101 | port: healthz 102 | initialDelaySeconds: 5 103 | periodSeconds: 10 104 | # TODO(user): Configure the resources accordingly based on the project requirements. 105 | # More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ 106 | resources: 107 | limits: 108 | cpu: 500m 109 | memory: 1024Mi 110 | requests: 111 | cpu: 10m 112 | memory: 64Mi 113 | serviceAccountName: controller-manager 114 | terminationGracePeriodSeconds: 10 115 | -------------------------------------------------------------------------------- /cmd/main.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2025 SUSE. 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 main is the entry point for the controller manager. 18 | package main 19 | 20 | import ( 21 | "flag" 22 | "os" 23 | 24 | // Import all Kubernetes client auth plugins (e.g. Azure, GCP, OIDC, etc.) 25 | // to ensure that exec-entrypoint and run can make use of them. 26 | _ "k8s.io/client-go/plugin/pkg/client/auth" 27 | 28 | ctrl "sigs.k8s.io/controller-runtime" 29 | "sigs.k8s.io/controller-runtime/pkg/healthz" 30 | "sigs.k8s.io/controller-runtime/pkg/log/zap" 31 | metrics "sigs.k8s.io/controller-runtime/pkg/metrics/server" 32 | "sigs.k8s.io/controller-runtime/pkg/webhook" 33 | 34 | "k8s.io/apimachinery/pkg/runtime" 35 | utilruntime "k8s.io/apimachinery/pkg/util/runtime" 36 | clientgoscheme "k8s.io/client-go/kubernetes/scheme" 37 | 38 | clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1" 39 | 40 | infrastructurev1alpha1 "github.com/rancher-sandbox/cluster-api-provider-harvester/api/v1alpha1" 41 | "github.com/rancher-sandbox/cluster-api-provider-harvester/internal/controller" 42 | ) 43 | 44 | const ( 45 | webhookPort = 9443 46 | ) 47 | 48 | var ( 49 | scheme = runtime.NewScheme() 50 | setupLog = ctrl.Log.WithName("setup") 51 | ) 52 | 53 | func init() { 54 | utilruntime.Must(clientgoscheme.AddToScheme(scheme)) 55 | //+kubebuilder:scaffold:scheme 56 | 57 | utilruntime.Must(infrastructurev1alpha1.AddToScheme(scheme)) 58 | utilruntime.Must(clusterv1.AddToScheme(scheme)) 59 | } 60 | 61 | func main() { 62 | var metricsAddr string 63 | 64 | var metricsOptions metrics.Options 65 | 66 | var enableLeaderElection bool 67 | 68 | var probeAddr string 69 | 70 | flag.StringVar(&metricsAddr, "metrics-bind-address", ":8080", "The address the metric endpoint binds to.") 71 | flag.StringVar(&probeAddr, "health-probe-bind-address", ":9440", "The address the probe endpoint binds to.") 72 | flag.BoolVar(&enableLeaderElection, "leader-elect", false, 73 | "Enable leader election for controller manager. "+ 74 | "Enabling this will ensure there is only one active controller manager.") 75 | 76 | opts := zap.Options{ 77 | Development: true, 78 | } 79 | opts.BindFlags(flag.CommandLine) 80 | flag.Parse() 81 | 82 | ctrl.SetLogger(zap.New(zap.UseFlagOptions(&opts))) 83 | 84 | webhook := webhook.NewServer(webhook.Options{ 85 | Port: webhookPort, 86 | }) 87 | 88 | metricsOptions.BindAddress = metricsAddr 89 | 90 | mgr, err := ctrl.NewManager(ctrl.GetConfigOrDie(), ctrl.Options{ 91 | Scheme: scheme, 92 | Metrics: metricsOptions, 93 | WebhookServer: webhook, 94 | HealthProbeBindAddress: probeAddr, 95 | LeaderElection: enableLeaderElection, 96 | LeaderElectionID: "1e1658d6.cluster.x-k8s.io", 97 | }) 98 | if err != nil { 99 | setupLog.Error(err, "unable to start manager") 100 | os.Exit(1) 101 | } 102 | 103 | // Setup the context to be used for the controller and manager 104 | ctx := ctrl.SetupSignalHandler() 105 | 106 | err = (&controller.HarvesterMachineReconciler{ 107 | Client: mgr.GetClient(), 108 | Scheme: mgr.GetScheme(), 109 | }).SetupWithManager(ctx, mgr) 110 | if err != nil { 111 | setupLog.Error(err, "unable to create controller", "controller", "HarvesterMachine") 112 | os.Exit(1) 113 | } 114 | 115 | err = (&controller.HarvesterClusterReconciler{ 116 | Client: mgr.GetClient(), 117 | Scheme: mgr.GetScheme(), 118 | }).SetupWithManager(ctx, mgr) 119 | if err != nil { 120 | setupLog.Error(err, "unable to create controller", "controller", "HarvesterCluster") 121 | os.Exit(1) 122 | } 123 | //+kubebuilder:scaffold:builder 124 | 125 | err = mgr.AddHealthzCheck("healthz", healthz.Ping) 126 | if err != nil { 127 | setupLog.Error(err, "unable to set up health check") 128 | os.Exit(1) 129 | } 130 | 131 | err = mgr.AddReadyzCheck("readyz", healthz.Ping) 132 | if err != nil { 133 | setupLog.Error(err, "unable to set up ready check") 134 | os.Exit(1) 135 | } 136 | 137 | setupLog.Info("starting manager") 138 | 139 | err = mgr.Start(ctx) 140 | if err != nil { 141 | setupLog.Error(err, "problem running manager") 142 | os.Exit(1) 143 | } 144 | } 145 | -------------------------------------------------------------------------------- /pkg/clientset/versioned/typed/kubevirt.io/v1/kubevirt.io_client.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2025 SUSE. 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 main. DO NOT EDIT. 18 | 19 | package v1 20 | 21 | import ( 22 | "net/http" 23 | 24 | v1 "kubevirt.io/api/core/v1" 25 | 26 | rest "k8s.io/client-go/rest" 27 | 28 | "github.com/rancher-sandbox/cluster-api-provider-harvester/pkg/clientset/versioned/scheme" 29 | ) 30 | 31 | type KubevirtV1Interface interface { 32 | RESTClient() rest.Interface 33 | KubeVirtsGetter 34 | VirtualMachinesGetter 35 | VirtualMachineInstancesGetter 36 | VirtualMachineInstanceMigrationsGetter 37 | VirtualMachineInstancePresetsGetter 38 | VirtualMachineInstanceReplicaSetsGetter 39 | } 40 | 41 | // KubevirtV1Client is used to interact with features provided by the kubevirt.io group. 42 | type KubevirtV1Client struct { 43 | restClient rest.Interface 44 | } 45 | 46 | func (c *KubevirtV1Client) KubeVirts(namespace string) KubeVirtInterface { 47 | return newKubeVirts(c, namespace) 48 | } 49 | 50 | func (c *KubevirtV1Client) VirtualMachines(namespace string) VirtualMachineInterface { 51 | return newVirtualMachines(c, namespace) 52 | } 53 | 54 | func (c *KubevirtV1Client) VirtualMachineInstances(namespace string) VirtualMachineInstanceInterface { 55 | return newVirtualMachineInstances(c, namespace) 56 | } 57 | 58 | func (c *KubevirtV1Client) VirtualMachineInstanceMigrations(namespace string) VirtualMachineInstanceMigrationInterface { 59 | return newVirtualMachineInstanceMigrations(c, namespace) 60 | } 61 | 62 | func (c *KubevirtV1Client) VirtualMachineInstancePresets(namespace string) VirtualMachineInstancePresetInterface { 63 | return newVirtualMachineInstancePresets(c, namespace) 64 | } 65 | 66 | func (c *KubevirtV1Client) VirtualMachineInstanceReplicaSets(namespace string) VirtualMachineInstanceReplicaSetInterface { 67 | return newVirtualMachineInstanceReplicaSets(c, namespace) 68 | } 69 | 70 | // NewForConfig creates a new KubevirtV1Client for the given config. 71 | // NewForConfig is equivalent to NewForConfigAndClient(c, httpClient), 72 | // where httpClient was generated with rest.HTTPClientFor(c). 73 | func NewForConfig(c *rest.Config) (*KubevirtV1Client, error) { 74 | config := *c 75 | err := setConfigDefaults(&config) 76 | if err != nil { 77 | return nil, err 78 | } 79 | httpClient, err := rest.HTTPClientFor(&config) 80 | if err != nil { 81 | return nil, err 82 | } 83 | return NewForConfigAndClient(&config, httpClient) 84 | } 85 | 86 | // NewForConfigAndClient creates a new KubevirtV1Client for the given config and http client. 87 | // Note the http client provided takes precedence over the configured transport values. 88 | func NewForConfigAndClient(c *rest.Config, h *http.Client) (*KubevirtV1Client, error) { 89 | config := *c 90 | err := setConfigDefaults(&config) 91 | if err != nil { 92 | return nil, err 93 | } 94 | client, err := rest.RESTClientForConfigAndClient(&config, h) 95 | if err != nil { 96 | return nil, err 97 | } 98 | return &KubevirtV1Client{client}, nil 99 | } 100 | 101 | // NewForConfigOrDie creates a new KubevirtV1Client for the given config and 102 | // panics if there is an error in the config. 103 | func NewForConfigOrDie(c *rest.Config) *KubevirtV1Client { 104 | client, err := NewForConfig(c) 105 | if err != nil { 106 | panic(err) 107 | } 108 | return client 109 | } 110 | 111 | // New creates a new KubevirtV1Client for the given RESTClient. 112 | func New(c rest.Interface) *KubevirtV1Client { 113 | return &KubevirtV1Client{c} 114 | } 115 | 116 | func setConfigDefaults(config *rest.Config) error { 117 | gv := v1.SchemeGroupVersion 118 | config.GroupVersion = &gv 119 | config.APIPath = "/apis" 120 | config.NegotiatedSerializer = scheme.Codecs.WithoutConversion() 121 | 122 | if config.UserAgent == "" { 123 | config.UserAgent = rest.DefaultKubernetesUserAgent() 124 | } 125 | 126 | return nil 127 | } 128 | 129 | // RESTClient returns a RESTClient that is used to communicate 130 | // with API server by this client implementation. 131 | func (c *KubevirtV1Client) RESTClient() rest.Interface { 132 | if c == nil { 133 | return nil 134 | } 135 | return c.restClient 136 | } 137 | -------------------------------------------------------------------------------- /pkg/clientset/versioned/typed/monitoring.coreos.com/v1/monitoring.coreos.com_client.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2025 SUSE. 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 main. DO NOT EDIT. 18 | 19 | package v1 20 | 21 | import ( 22 | "net/http" 23 | 24 | v1 "github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1" 25 | 26 | rest "k8s.io/client-go/rest" 27 | 28 | "github.com/rancher-sandbox/cluster-api-provider-harvester/pkg/clientset/versioned/scheme" 29 | ) 30 | 31 | type MonitoringV1Interface interface { 32 | RESTClient() rest.Interface 33 | AlertmanagersGetter 34 | PodMonitorsGetter 35 | ProbesGetter 36 | PrometheusesGetter 37 | PrometheusRulesGetter 38 | ServiceMonitorsGetter 39 | ThanosRulersGetter 40 | } 41 | 42 | // MonitoringV1Client is used to interact with features provided by the monitoring.coreos.com group. 43 | type MonitoringV1Client struct { 44 | restClient rest.Interface 45 | } 46 | 47 | func (c *MonitoringV1Client) Alertmanagers(namespace string) AlertmanagerInterface { 48 | return newAlertmanagers(c, namespace) 49 | } 50 | 51 | func (c *MonitoringV1Client) PodMonitors(namespace string) PodMonitorInterface { 52 | return newPodMonitors(c, namespace) 53 | } 54 | 55 | func (c *MonitoringV1Client) Probes(namespace string) ProbeInterface { 56 | return newProbes(c, namespace) 57 | } 58 | 59 | func (c *MonitoringV1Client) Prometheuses(namespace string) PrometheusInterface { 60 | return newPrometheuses(c, namespace) 61 | } 62 | 63 | func (c *MonitoringV1Client) PrometheusRules(namespace string) PrometheusRuleInterface { 64 | return newPrometheusRules(c, namespace) 65 | } 66 | 67 | func (c *MonitoringV1Client) ServiceMonitors(namespace string) ServiceMonitorInterface { 68 | return newServiceMonitors(c, namespace) 69 | } 70 | 71 | func (c *MonitoringV1Client) ThanosRulers(namespace string) ThanosRulerInterface { 72 | return newThanosRulers(c, namespace) 73 | } 74 | 75 | // NewForConfig creates a new MonitoringV1Client for the given config. 76 | // NewForConfig is equivalent to NewForConfigAndClient(c, httpClient), 77 | // where httpClient was generated with rest.HTTPClientFor(c). 78 | func NewForConfig(c *rest.Config) (*MonitoringV1Client, error) { 79 | config := *c 80 | err := setConfigDefaults(&config) 81 | if err != nil { 82 | return nil, err 83 | } 84 | httpClient, err := rest.HTTPClientFor(&config) 85 | if err != nil { 86 | return nil, err 87 | } 88 | return NewForConfigAndClient(&config, httpClient) 89 | } 90 | 91 | // NewForConfigAndClient creates a new MonitoringV1Client for the given config and http client. 92 | // Note the http client provided takes precedence over the configured transport values. 93 | func NewForConfigAndClient(c *rest.Config, h *http.Client) (*MonitoringV1Client, error) { 94 | config := *c 95 | err := setConfigDefaults(&config) 96 | if err != nil { 97 | return nil, err 98 | } 99 | client, err := rest.RESTClientForConfigAndClient(&config, h) 100 | if err != nil { 101 | return nil, err 102 | } 103 | return &MonitoringV1Client{client}, nil 104 | } 105 | 106 | // NewForConfigOrDie creates a new MonitoringV1Client for the given config and 107 | // panics if there is an error in the config. 108 | func NewForConfigOrDie(c *rest.Config) *MonitoringV1Client { 109 | client, err := NewForConfig(c) 110 | if err != nil { 111 | panic(err) 112 | } 113 | return client 114 | } 115 | 116 | // New creates a new MonitoringV1Client for the given RESTClient. 117 | func New(c rest.Interface) *MonitoringV1Client { 118 | return &MonitoringV1Client{c} 119 | } 120 | 121 | func setConfigDefaults(config *rest.Config) error { 122 | gv := v1.SchemeGroupVersion 123 | config.GroupVersion = &gv 124 | config.APIPath = "/apis" 125 | config.NegotiatedSerializer = scheme.Codecs.WithoutConversion() 126 | 127 | if config.UserAgent == "" { 128 | config.UserAgent = rest.DefaultKubernetesUserAgent() 129 | } 130 | 131 | return nil 132 | } 133 | 134 | // RESTClient returns a RESTClient that is used to communicate 135 | // with API server by this client implementation. 136 | func (c *MonitoringV1Client) RESTClient() rest.Interface { 137 | if c == nil { 138 | return nil 139 | } 140 | return c.restClient 141 | } 142 | -------------------------------------------------------------------------------- /pkg/clientset/versioned/typed/storage.k8s.io/v1/fake/fake_csinode.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2025 SUSE. 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 main. DO NOT EDIT. 18 | 19 | package fake 20 | 21 | import ( 22 | "context" 23 | 24 | storagev1 "k8s.io/api/storage/v1" 25 | v1 "k8s.io/apimachinery/pkg/apis/meta/v1" 26 | labels "k8s.io/apimachinery/pkg/labels" 27 | schema "k8s.io/apimachinery/pkg/runtime/schema" 28 | types "k8s.io/apimachinery/pkg/types" 29 | watch "k8s.io/apimachinery/pkg/watch" 30 | testing "k8s.io/client-go/testing" 31 | ) 32 | 33 | // FakeCSINodes implements CSINodeInterface 34 | type FakeCSINodes struct { 35 | Fake *FakeStorageV1 36 | } 37 | 38 | var csinodesResource = schema.GroupVersionResource{Group: "storage.k8s.io", Version: "v1", Resource: "csinodes"} 39 | 40 | var csinodesKind = schema.GroupVersionKind{Group: "storage.k8s.io", Version: "v1", Kind: "CSINode"} 41 | 42 | // Get takes name of the cSINode, and returns the corresponding cSINode object, and an error if there is any. 43 | func (c *FakeCSINodes) Get(ctx context.Context, name string, options v1.GetOptions) (result *storagev1.CSINode, err error) { 44 | obj, err := c.Fake. 45 | Invokes(testing.NewRootGetAction(csinodesResource, name), &storagev1.CSINode{}) 46 | if obj == nil { 47 | return nil, err 48 | } 49 | return obj.(*storagev1.CSINode), err 50 | } 51 | 52 | // List takes label and field selectors, and returns the list of CSINodes that match those selectors. 53 | func (c *FakeCSINodes) List(ctx context.Context, opts v1.ListOptions) (result *storagev1.CSINodeList, err error) { 54 | obj, err := c.Fake. 55 | Invokes(testing.NewRootListAction(csinodesResource, csinodesKind, opts), &storagev1.CSINodeList{}) 56 | if obj == nil { 57 | return nil, err 58 | } 59 | 60 | label, _, _ := testing.ExtractFromListOptions(opts) 61 | if label == nil { 62 | label = labels.Everything() 63 | } 64 | list := &storagev1.CSINodeList{ListMeta: obj.(*storagev1.CSINodeList).ListMeta} 65 | for _, item := range obj.(*storagev1.CSINodeList).Items { 66 | if label.Matches(labels.Set(item.Labels)) { 67 | list.Items = append(list.Items, item) 68 | } 69 | } 70 | return list, err 71 | } 72 | 73 | // Watch returns a watch.Interface that watches the requested cSINodes. 74 | func (c *FakeCSINodes) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { 75 | return c.Fake. 76 | InvokesWatch(testing.NewRootWatchAction(csinodesResource, opts)) 77 | } 78 | 79 | // Create takes the representation of a cSINode and creates it. Returns the server's representation of the cSINode, and an error, if there is any. 80 | func (c *FakeCSINodes) Create(ctx context.Context, cSINode *storagev1.CSINode, opts v1.CreateOptions) (result *storagev1.CSINode, err error) { 81 | obj, err := c.Fake. 82 | Invokes(testing.NewRootCreateAction(csinodesResource, cSINode), &storagev1.CSINode{}) 83 | if obj == nil { 84 | return nil, err 85 | } 86 | return obj.(*storagev1.CSINode), err 87 | } 88 | 89 | // Update takes the representation of a cSINode and updates it. Returns the server's representation of the cSINode, and an error, if there is any. 90 | func (c *FakeCSINodes) Update(ctx context.Context, cSINode *storagev1.CSINode, opts v1.UpdateOptions) (result *storagev1.CSINode, err error) { 91 | obj, err := c.Fake. 92 | Invokes(testing.NewRootUpdateAction(csinodesResource, cSINode), &storagev1.CSINode{}) 93 | if obj == nil { 94 | return nil, err 95 | } 96 | return obj.(*storagev1.CSINode), err 97 | } 98 | 99 | // Delete takes name of the cSINode and deletes it. Returns an error if one occurs. 100 | func (c *FakeCSINodes) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { 101 | _, err := c.Fake. 102 | Invokes(testing.NewRootDeleteActionWithOptions(csinodesResource, name, opts), &storagev1.CSINode{}) 103 | return err 104 | } 105 | 106 | // DeleteCollection deletes a collection of objects. 107 | func (c *FakeCSINodes) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { 108 | action := testing.NewRootDeleteCollectionAction(csinodesResource, listOpts) 109 | 110 | _, err := c.Fake.Invokes(action, &storagev1.CSINodeList{}) 111 | return err 112 | } 113 | 114 | // Patch applies the patch and returns the patched cSINode. 115 | func (c *FakeCSINodes) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *storagev1.CSINode, err error) { 116 | obj, err := c.Fake. 117 | Invokes(testing.NewRootPatchSubresourceAction(csinodesResource, name, pt, data, subresources...), &storagev1.CSINode{}) 118 | if obj == nil { 119 | return nil, err 120 | } 121 | return obj.(*storagev1.CSINode), err 122 | } 123 | -------------------------------------------------------------------------------- /pkg/clientset/versioned/typed/longhorn.io/v1beta2/fake/fake_setting.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2025 SUSE. 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 main. DO NOT EDIT. 18 | 19 | package fake 20 | 21 | import ( 22 | "context" 23 | 24 | v1beta2 "github.com/longhorn/longhorn-manager/k8s/pkg/apis/longhorn/v1beta2" 25 | 26 | v1 "k8s.io/apimachinery/pkg/apis/meta/v1" 27 | labels "k8s.io/apimachinery/pkg/labels" 28 | schema "k8s.io/apimachinery/pkg/runtime/schema" 29 | types "k8s.io/apimachinery/pkg/types" 30 | watch "k8s.io/apimachinery/pkg/watch" 31 | testing "k8s.io/client-go/testing" 32 | ) 33 | 34 | // FakeSettings implements SettingInterface 35 | type FakeSettings struct { 36 | Fake *FakeLonghornV1beta2 37 | ns string 38 | } 39 | 40 | var settingsResource = schema.GroupVersionResource{Group: "longhorn.io", Version: "v1beta2", Resource: "settings"} 41 | 42 | var settingsKind = schema.GroupVersionKind{Group: "longhorn.io", Version: "v1beta2", Kind: "Setting"} 43 | 44 | // Get takes name of the setting, and returns the corresponding setting object, and an error if there is any. 45 | func (c *FakeSettings) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta2.Setting, err error) { 46 | obj, err := c.Fake. 47 | Invokes(testing.NewGetAction(settingsResource, c.ns, name), &v1beta2.Setting{}) 48 | 49 | if obj == nil { 50 | return nil, err 51 | } 52 | return obj.(*v1beta2.Setting), err 53 | } 54 | 55 | // List takes label and field selectors, and returns the list of Settings that match those selectors. 56 | func (c *FakeSettings) List(ctx context.Context, opts v1.ListOptions) (result *v1beta2.SettingList, err error) { 57 | obj, err := c.Fake. 58 | Invokes(testing.NewListAction(settingsResource, settingsKind, c.ns, opts), &v1beta2.SettingList{}) 59 | 60 | if obj == nil { 61 | return nil, err 62 | } 63 | 64 | label, _, _ := testing.ExtractFromListOptions(opts) 65 | if label == nil { 66 | label = labels.Everything() 67 | } 68 | list := &v1beta2.SettingList{ListMeta: obj.(*v1beta2.SettingList).ListMeta} 69 | for _, item := range obj.(*v1beta2.SettingList).Items { 70 | if label.Matches(labels.Set(item.Labels)) { 71 | list.Items = append(list.Items, item) 72 | } 73 | } 74 | return list, err 75 | } 76 | 77 | // Watch returns a watch.Interface that watches the requested settings. 78 | func (c *FakeSettings) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { 79 | return c.Fake. 80 | InvokesWatch(testing.NewWatchAction(settingsResource, c.ns, opts)) 81 | 82 | } 83 | 84 | // Create takes the representation of a setting and creates it. Returns the server's representation of the setting, and an error, if there is any. 85 | func (c *FakeSettings) Create(ctx context.Context, setting *v1beta2.Setting, opts v1.CreateOptions) (result *v1beta2.Setting, err error) { 86 | obj, err := c.Fake. 87 | Invokes(testing.NewCreateAction(settingsResource, c.ns, setting), &v1beta2.Setting{}) 88 | 89 | if obj == nil { 90 | return nil, err 91 | } 92 | return obj.(*v1beta2.Setting), err 93 | } 94 | 95 | // Update takes the representation of a setting and updates it. Returns the server's representation of the setting, and an error, if there is any. 96 | func (c *FakeSettings) Update(ctx context.Context, setting *v1beta2.Setting, opts v1.UpdateOptions) (result *v1beta2.Setting, err error) { 97 | obj, err := c.Fake. 98 | Invokes(testing.NewUpdateAction(settingsResource, c.ns, setting), &v1beta2.Setting{}) 99 | 100 | if obj == nil { 101 | return nil, err 102 | } 103 | return obj.(*v1beta2.Setting), err 104 | } 105 | 106 | // Delete takes name of the setting and deletes it. Returns an error if one occurs. 107 | func (c *FakeSettings) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { 108 | _, err := c.Fake. 109 | Invokes(testing.NewDeleteActionWithOptions(settingsResource, c.ns, name, opts), &v1beta2.Setting{}) 110 | 111 | return err 112 | } 113 | 114 | // DeleteCollection deletes a collection of objects. 115 | func (c *FakeSettings) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { 116 | action := testing.NewDeleteCollectionAction(settingsResource, c.ns, listOpts) 117 | 118 | _, err := c.Fake.Invokes(action, &v1beta2.SettingList{}) 119 | return err 120 | } 121 | 122 | // Patch applies the patch and returns the patched setting. 123 | func (c *FakeSettings) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta2.Setting, err error) { 124 | obj, err := c.Fake. 125 | Invokes(testing.NewPatchSubresourceAction(settingsResource, c.ns, name, pt, data, subresources...), &v1beta2.Setting{}) 126 | 127 | if obj == nil { 128 | return nil, err 129 | } 130 | return obj.(*v1beta2.Setting), err 131 | } 132 | -------------------------------------------------------------------------------- /pkg/clientset/versioned/typed/harvesterhci.io/v1beta1/fake/fake_version.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2025 SUSE. 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 main. DO NOT EDIT. 18 | 19 | package fake 20 | 21 | import ( 22 | "context" 23 | 24 | v1beta1 "github.com/harvester/harvester/pkg/apis/harvesterhci.io/v1beta1" 25 | 26 | v1 "k8s.io/apimachinery/pkg/apis/meta/v1" 27 | labels "k8s.io/apimachinery/pkg/labels" 28 | schema "k8s.io/apimachinery/pkg/runtime/schema" 29 | types "k8s.io/apimachinery/pkg/types" 30 | watch "k8s.io/apimachinery/pkg/watch" 31 | testing "k8s.io/client-go/testing" 32 | ) 33 | 34 | // FakeVersions implements VersionInterface 35 | type FakeVersions struct { 36 | Fake *FakeHarvesterhciV1beta1 37 | ns string 38 | } 39 | 40 | var versionsResource = schema.GroupVersionResource{Group: "harvesterhci.io", Version: "v1beta1", Resource: "versions"} 41 | 42 | var versionsKind = schema.GroupVersionKind{Group: "harvesterhci.io", Version: "v1beta1", Kind: "Version"} 43 | 44 | // Get takes name of the version, and returns the corresponding version object, and an error if there is any. 45 | func (c *FakeVersions) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.Version, err error) { 46 | obj, err := c.Fake. 47 | Invokes(testing.NewGetAction(versionsResource, c.ns, name), &v1beta1.Version{}) 48 | 49 | if obj == nil { 50 | return nil, err 51 | } 52 | return obj.(*v1beta1.Version), err 53 | } 54 | 55 | // List takes label and field selectors, and returns the list of Versions that match those selectors. 56 | func (c *FakeVersions) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.VersionList, err error) { 57 | obj, err := c.Fake. 58 | Invokes(testing.NewListAction(versionsResource, versionsKind, c.ns, opts), &v1beta1.VersionList{}) 59 | 60 | if obj == nil { 61 | return nil, err 62 | } 63 | 64 | label, _, _ := testing.ExtractFromListOptions(opts) 65 | if label == nil { 66 | label = labels.Everything() 67 | } 68 | list := &v1beta1.VersionList{ListMeta: obj.(*v1beta1.VersionList).ListMeta} 69 | for _, item := range obj.(*v1beta1.VersionList).Items { 70 | if label.Matches(labels.Set(item.Labels)) { 71 | list.Items = append(list.Items, item) 72 | } 73 | } 74 | return list, err 75 | } 76 | 77 | // Watch returns a watch.Interface that watches the requested versions. 78 | func (c *FakeVersions) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { 79 | return c.Fake. 80 | InvokesWatch(testing.NewWatchAction(versionsResource, c.ns, opts)) 81 | 82 | } 83 | 84 | // Create takes the representation of a version and creates it. Returns the server's representation of the version, and an error, if there is any. 85 | func (c *FakeVersions) Create(ctx context.Context, version *v1beta1.Version, opts v1.CreateOptions) (result *v1beta1.Version, err error) { 86 | obj, err := c.Fake. 87 | Invokes(testing.NewCreateAction(versionsResource, c.ns, version), &v1beta1.Version{}) 88 | 89 | if obj == nil { 90 | return nil, err 91 | } 92 | return obj.(*v1beta1.Version), err 93 | } 94 | 95 | // Update takes the representation of a version and updates it. Returns the server's representation of the version, and an error, if there is any. 96 | func (c *FakeVersions) Update(ctx context.Context, version *v1beta1.Version, opts v1.UpdateOptions) (result *v1beta1.Version, err error) { 97 | obj, err := c.Fake. 98 | Invokes(testing.NewUpdateAction(versionsResource, c.ns, version), &v1beta1.Version{}) 99 | 100 | if obj == nil { 101 | return nil, err 102 | } 103 | return obj.(*v1beta1.Version), err 104 | } 105 | 106 | // Delete takes name of the version and deletes it. Returns an error if one occurs. 107 | func (c *FakeVersions) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { 108 | _, err := c.Fake. 109 | Invokes(testing.NewDeleteActionWithOptions(versionsResource, c.ns, name, opts), &v1beta1.Version{}) 110 | 111 | return err 112 | } 113 | 114 | // DeleteCollection deletes a collection of objects. 115 | func (c *FakeVersions) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { 116 | action := testing.NewDeleteCollectionAction(versionsResource, c.ns, listOpts) 117 | 118 | _, err := c.Fake.Invokes(action, &v1beta1.VersionList{}) 119 | return err 120 | } 121 | 122 | // Patch applies the patch and returns the patched version. 123 | func (c *FakeVersions) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.Version, err error) { 124 | obj, err := c.Fake. 125 | Invokes(testing.NewPatchSubresourceAction(versionsResource, c.ns, name, pt, data, subresources...), &v1beta1.Version{}) 126 | 127 | if obj == nil { 128 | return nil, err 129 | } 130 | return obj.(*v1beta1.Version), err 131 | } 132 | -------------------------------------------------------------------------------- /pkg/clientset/versioned/typed/monitoring.coreos.com/v1/fake/fake_probe.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2025 SUSE. 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 main. DO NOT EDIT. 18 | 19 | package fake 20 | 21 | import ( 22 | "context" 23 | 24 | monitoringv1 "github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1" 25 | 26 | v1 "k8s.io/apimachinery/pkg/apis/meta/v1" 27 | labels "k8s.io/apimachinery/pkg/labels" 28 | schema "k8s.io/apimachinery/pkg/runtime/schema" 29 | types "k8s.io/apimachinery/pkg/types" 30 | watch "k8s.io/apimachinery/pkg/watch" 31 | testing "k8s.io/client-go/testing" 32 | ) 33 | 34 | // FakeProbes implements ProbeInterface 35 | type FakeProbes struct { 36 | Fake *FakeMonitoringV1 37 | ns string 38 | } 39 | 40 | var probesResource = schema.GroupVersionResource{Group: "monitoring.coreos.com", Version: "v1", Resource: "probes"} 41 | 42 | var probesKind = schema.GroupVersionKind{Group: "monitoring.coreos.com", Version: "v1", Kind: "Probe"} 43 | 44 | // Get takes name of the probe, and returns the corresponding probe object, and an error if there is any. 45 | func (c *FakeProbes) Get(ctx context.Context, name string, options v1.GetOptions) (result *monitoringv1.Probe, err error) { 46 | obj, err := c.Fake. 47 | Invokes(testing.NewGetAction(probesResource, c.ns, name), &monitoringv1.Probe{}) 48 | 49 | if obj == nil { 50 | return nil, err 51 | } 52 | return obj.(*monitoringv1.Probe), err 53 | } 54 | 55 | // List takes label and field selectors, and returns the list of Probes that match those selectors. 56 | func (c *FakeProbes) List(ctx context.Context, opts v1.ListOptions) (result *monitoringv1.ProbeList, err error) { 57 | obj, err := c.Fake. 58 | Invokes(testing.NewListAction(probesResource, probesKind, c.ns, opts), &monitoringv1.ProbeList{}) 59 | 60 | if obj == nil { 61 | return nil, err 62 | } 63 | 64 | label, _, _ := testing.ExtractFromListOptions(opts) 65 | if label == nil { 66 | label = labels.Everything() 67 | } 68 | list := &monitoringv1.ProbeList{ListMeta: obj.(*monitoringv1.ProbeList).ListMeta} 69 | for _, item := range obj.(*monitoringv1.ProbeList).Items { 70 | if label.Matches(labels.Set(item.Labels)) { 71 | list.Items = append(list.Items, item) 72 | } 73 | } 74 | return list, err 75 | } 76 | 77 | // Watch returns a watch.Interface that watches the requested probes. 78 | func (c *FakeProbes) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { 79 | return c.Fake. 80 | InvokesWatch(testing.NewWatchAction(probesResource, c.ns, opts)) 81 | 82 | } 83 | 84 | // Create takes the representation of a probe and creates it. Returns the server's representation of the probe, and an error, if there is any. 85 | func (c *FakeProbes) Create(ctx context.Context, probe *monitoringv1.Probe, opts v1.CreateOptions) (result *monitoringv1.Probe, err error) { 86 | obj, err := c.Fake. 87 | Invokes(testing.NewCreateAction(probesResource, c.ns, probe), &monitoringv1.Probe{}) 88 | 89 | if obj == nil { 90 | return nil, err 91 | } 92 | return obj.(*monitoringv1.Probe), err 93 | } 94 | 95 | // Update takes the representation of a probe and updates it. Returns the server's representation of the probe, and an error, if there is any. 96 | func (c *FakeProbes) Update(ctx context.Context, probe *monitoringv1.Probe, opts v1.UpdateOptions) (result *monitoringv1.Probe, err error) { 97 | obj, err := c.Fake. 98 | Invokes(testing.NewUpdateAction(probesResource, c.ns, probe), &monitoringv1.Probe{}) 99 | 100 | if obj == nil { 101 | return nil, err 102 | } 103 | return obj.(*monitoringv1.Probe), err 104 | } 105 | 106 | // Delete takes name of the probe and deletes it. Returns an error if one occurs. 107 | func (c *FakeProbes) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { 108 | _, err := c.Fake. 109 | Invokes(testing.NewDeleteActionWithOptions(probesResource, c.ns, name, opts), &monitoringv1.Probe{}) 110 | 111 | return err 112 | } 113 | 114 | // DeleteCollection deletes a collection of objects. 115 | func (c *FakeProbes) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { 116 | action := testing.NewDeleteCollectionAction(probesResource, c.ns, listOpts) 117 | 118 | _, err := c.Fake.Invokes(action, &monitoringv1.ProbeList{}) 119 | return err 120 | } 121 | 122 | // Patch applies the patch and returns the patched probe. 123 | func (c *FakeProbes) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *monitoringv1.Probe, err error) { 124 | obj, err := c.Fake. 125 | Invokes(testing.NewPatchSubresourceAction(probesResource, c.ns, name, pt, data, subresources...), &monitoringv1.Probe{}) 126 | 127 | if obj == nil { 128 | return nil, err 129 | } 130 | return obj.(*monitoringv1.Probe), err 131 | } 132 | -------------------------------------------------------------------------------- /pkg/clientset/versioned/typed/storage.k8s.io/v1/fake/fake_csidriver.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2025 SUSE. 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 main. DO NOT EDIT. 18 | 19 | package fake 20 | 21 | import ( 22 | "context" 23 | 24 | storagev1 "k8s.io/api/storage/v1" 25 | v1 "k8s.io/apimachinery/pkg/apis/meta/v1" 26 | labels "k8s.io/apimachinery/pkg/labels" 27 | schema "k8s.io/apimachinery/pkg/runtime/schema" 28 | types "k8s.io/apimachinery/pkg/types" 29 | watch "k8s.io/apimachinery/pkg/watch" 30 | testing "k8s.io/client-go/testing" 31 | ) 32 | 33 | // FakeCSIDrivers implements CSIDriverInterface 34 | type FakeCSIDrivers struct { 35 | Fake *FakeStorageV1 36 | } 37 | 38 | var csidriversResource = schema.GroupVersionResource{Group: "storage.k8s.io", Version: "v1", Resource: "csidrivers"} 39 | 40 | var csidriversKind = schema.GroupVersionKind{Group: "storage.k8s.io", Version: "v1", Kind: "CSIDriver"} 41 | 42 | // Get takes name of the cSIDriver, and returns the corresponding cSIDriver object, and an error if there is any. 43 | func (c *FakeCSIDrivers) Get(ctx context.Context, name string, options v1.GetOptions) (result *storagev1.CSIDriver, err error) { 44 | obj, err := c.Fake. 45 | Invokes(testing.NewRootGetAction(csidriversResource, name), &storagev1.CSIDriver{}) 46 | if obj == nil { 47 | return nil, err 48 | } 49 | return obj.(*storagev1.CSIDriver), err 50 | } 51 | 52 | // List takes label and field selectors, and returns the list of CSIDrivers that match those selectors. 53 | func (c *FakeCSIDrivers) List(ctx context.Context, opts v1.ListOptions) (result *storagev1.CSIDriverList, err error) { 54 | obj, err := c.Fake. 55 | Invokes(testing.NewRootListAction(csidriversResource, csidriversKind, opts), &storagev1.CSIDriverList{}) 56 | if obj == nil { 57 | return nil, err 58 | } 59 | 60 | label, _, _ := testing.ExtractFromListOptions(opts) 61 | if label == nil { 62 | label = labels.Everything() 63 | } 64 | list := &storagev1.CSIDriverList{ListMeta: obj.(*storagev1.CSIDriverList).ListMeta} 65 | for _, item := range obj.(*storagev1.CSIDriverList).Items { 66 | if label.Matches(labels.Set(item.Labels)) { 67 | list.Items = append(list.Items, item) 68 | } 69 | } 70 | return list, err 71 | } 72 | 73 | // Watch returns a watch.Interface that watches the requested cSIDrivers. 74 | func (c *FakeCSIDrivers) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { 75 | return c.Fake. 76 | InvokesWatch(testing.NewRootWatchAction(csidriversResource, opts)) 77 | } 78 | 79 | // Create takes the representation of a cSIDriver and creates it. Returns the server's representation of the cSIDriver, and an error, if there is any. 80 | func (c *FakeCSIDrivers) Create(ctx context.Context, cSIDriver *storagev1.CSIDriver, opts v1.CreateOptions) (result *storagev1.CSIDriver, err error) { 81 | obj, err := c.Fake. 82 | Invokes(testing.NewRootCreateAction(csidriversResource, cSIDriver), &storagev1.CSIDriver{}) 83 | if obj == nil { 84 | return nil, err 85 | } 86 | return obj.(*storagev1.CSIDriver), err 87 | } 88 | 89 | // Update takes the representation of a cSIDriver and updates it. Returns the server's representation of the cSIDriver, and an error, if there is any. 90 | func (c *FakeCSIDrivers) Update(ctx context.Context, cSIDriver *storagev1.CSIDriver, opts v1.UpdateOptions) (result *storagev1.CSIDriver, err error) { 91 | obj, err := c.Fake. 92 | Invokes(testing.NewRootUpdateAction(csidriversResource, cSIDriver), &storagev1.CSIDriver{}) 93 | if obj == nil { 94 | return nil, err 95 | } 96 | return obj.(*storagev1.CSIDriver), err 97 | } 98 | 99 | // Delete takes name of the cSIDriver and deletes it. Returns an error if one occurs. 100 | func (c *FakeCSIDrivers) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { 101 | _, err := c.Fake. 102 | Invokes(testing.NewRootDeleteActionWithOptions(csidriversResource, name, opts), &storagev1.CSIDriver{}) 103 | return err 104 | } 105 | 106 | // DeleteCollection deletes a collection of objects. 107 | func (c *FakeCSIDrivers) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { 108 | action := testing.NewRootDeleteCollectionAction(csidriversResource, listOpts) 109 | 110 | _, err := c.Fake.Invokes(action, &storagev1.CSIDriverList{}) 111 | return err 112 | } 113 | 114 | // Patch applies the patch and returns the patched cSIDriver. 115 | func (c *FakeCSIDrivers) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *storagev1.CSIDriver, err error) { 116 | obj, err := c.Fake. 117 | Invokes(testing.NewRootPatchSubresourceAction(csidriversResource, name, pt, data, subresources...), &storagev1.CSIDriver{}) 118 | if obj == nil { 119 | return nil, err 120 | } 121 | return obj.(*storagev1.CSIDriver), err 122 | } 123 | --------------------------------------------------------------------------------