Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions PROJECT
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,16 @@ resources:
defaulting: true
validation: true
webhookVersion: v1
- api:
crdVersion: v1
namespaced: true
domain: cluster.x-k8s.io
group: infrastructure
kind: CloudscaleClusterTemplate
path: github.com/cloudscale-ch/cluster-api-provider-cloudscale/api/v1beta2
version: v1beta2
webhooks:
defaulting: true
validation: true
webhookVersion: v1
version: "3"
69 changes: 69 additions & 0 deletions api/v1beta2/cloudscaleclustertemplate_types.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
/*
Copyright 2026 cloudscale.ch.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package v1beta2

import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
clusterv1 "sigs.k8s.io/cluster-api/api/core/v1beta2"
)

// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN!
// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.

// CloudscaleClusterTemplateSpec defines the desired state of CloudscaleClusterTemplate
type CloudscaleClusterTemplateSpec struct {
Template CloudscaleClusterTemplateResource `json:"template"`
}

// CloudscaleClusterTemplateResource contains spec for CloudscaleClusterSpec.
type CloudscaleClusterTemplateResource struct {
// +optional
ObjectMeta clusterv1.ObjectMeta `json:"metadata,omitempty"`
Spec CloudscaleClusterSpec `json:"spec"`
}

// +kubebuilder:object:root=true
// +kubebuilder:subresource:status

// CloudscaleClusterTemplate is the Schema for the cloudscaleclustertemplates API
type CloudscaleClusterTemplate struct {
metav1.TypeMeta `json:",inline"`

// metadata is a standard object metadata
// +optional
metav1.ObjectMeta `json:"metadata,omitzero"`

// spec defines the desired state of CloudscaleClusterTemplate
// +required
Spec CloudscaleClusterTemplateSpec `json:"spec"`
}

// +kubebuilder:object:root=true

// CloudscaleClusterTemplateList contains a list of CloudscaleClusterTemplate
type CloudscaleClusterTemplateList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitzero"`
Items []CloudscaleClusterTemplate `json:"items"`
}

func init() {
objectTypes = append(objectTypes,
&CloudscaleClusterTemplate{},
&CloudscaleClusterTemplateList{},
)
}
91 changes: 91 additions & 0 deletions api/v1beta2/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,10 @@ func main() {
setupLog.Error(err, "Failed to create webhook", "webhook", "CloudscaleMachineTemplate")
os.Exit(1)
}
if err := webhookv1beta2.SetupCloudscaleClusterTemplateWebhookWithManager(mgr, regionInfo); err != nil {
setupLog.Error(err, "Failed to create webhook", "webhook", "CloudscaleClusterTemplate")
os.Exit(1)
}
}
// +kubebuilder:scaffold:builder

Expand Down
Loading