Skip to content

Commit 2d06db3

Browse files
committed
Add ScalewayMachineTemplate
1 parent 9d08b8c commit 2d06db3

11 files changed

+317
-0
lines changed

PROJECT

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,12 @@ resources:
3434
kind: ScalewayClusterTemplate
3535
path: github.com/scaleway/cluster-api-provider-scaleway/api/v1alpha1
3636
version: v1alpha1
37+
- api:
38+
crdVersion: v1
39+
namespaced: true
40+
domain: cluster.x-k8s.io
41+
group: infrastructure
42+
kind: ScalewayMachineTemplate
43+
path: github.com/scaleway/cluster-api-provider-scaleway/api/v1alpha1
44+
version: v1alpha1
3745
version: "3"
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
package v1alpha1
2+
3+
import (
4+
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
5+
)
6+
7+
type ScalewayMachineTemplateResource struct {
8+
// Standard object's metadata.
9+
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
10+
// +optional
11+
ObjectMeta metav1.ObjectMeta `json:"metadata,omitempty"`
12+
Spec ScalewayMachineSpec `json:"spec"`
13+
}
14+
15+
// ScalewayMachineTemplateSpec defines the desired state of ScalewayMachineTemplate.
16+
type ScalewayMachineTemplateSpec struct {
17+
Template ScalewayMachineTemplateResource `json:"template"`
18+
}
19+
20+
// +kubebuilder:object:root=true
21+
// +kubebuilder:resource:path=scalewaymachinetemplates,scope=Namespaced,categories=cluster-api,shortName=smt
22+
// +kubebuilder:storageversion
23+
24+
// ScalewayMachineTemplate is the Schema for the scalewaymachinetemplates API.
25+
type ScalewayMachineTemplate struct {
26+
metav1.TypeMeta `json:",inline"`
27+
metav1.ObjectMeta `json:"metadata,omitempty"`
28+
29+
Spec ScalewayMachineTemplateSpec `json:"spec,omitempty"`
30+
}
31+
32+
// +kubebuilder:object:root=true
33+
34+
// ScalewayMachineTemplateList contains a list of ScalewayMachineTemplate.
35+
type ScalewayMachineTemplateList struct {
36+
metav1.TypeMeta `json:",inline"`
37+
metav1.ListMeta `json:"metadata,omitempty"`
38+
Items []ScalewayMachineTemplate `json:"items"`
39+
}
40+
41+
func init() {
42+
SchemeBuilder.Register(&ScalewayMachineTemplate{}, &ScalewayMachineTemplateList{})
43+
}

api/v1alpha1/zz_generated.deepcopy.go

Lines changed: 91 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
---
2+
apiVersion: apiextensions.k8s.io/v1
3+
kind: CustomResourceDefinition
4+
metadata:
5+
annotations:
6+
controller-gen.kubebuilder.io/version: v0.18.0
7+
name: scalewaymachinetemplates.infrastructure.cluster.x-k8s.io
8+
spec:
9+
group: infrastructure.cluster.x-k8s.io
10+
names:
11+
categories:
12+
- cluster-api
13+
kind: ScalewayMachineTemplate
14+
listKind: ScalewayMachineTemplateList
15+
plural: scalewaymachinetemplates
16+
shortNames:
17+
- smt
18+
singular: scalewaymachinetemplate
19+
scope: Namespaced
20+
versions:
21+
- name: v1alpha1
22+
schema:
23+
openAPIV3Schema:
24+
description: ScalewayMachineTemplate is the Schema for the scalewaymachinetemplates
25+
API.
26+
properties:
27+
apiVersion:
28+
description: |-
29+
APIVersion defines the versioned schema of this representation of an object.
30+
Servers should convert recognized schemas to the latest internal value, and
31+
may reject unrecognized values.
32+
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
33+
type: string
34+
kind:
35+
description: |-
36+
Kind is a string value representing the REST resource this object represents.
37+
Servers may infer this from the endpoint the client submits requests to.
38+
Cannot be updated.
39+
In CamelCase.
40+
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
41+
type: string
42+
metadata:
43+
type: object
44+
spec:
45+
description: ScalewayMachineTemplateSpec defines the desired state of
46+
ScalewayMachineTemplate.
47+
properties:
48+
template:
49+
properties:
50+
metadata:
51+
description: |-
52+
Standard object's metadata.
53+
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
54+
type: object
55+
spec:
56+
description: ScalewayMachineSpec defines the desired state of
57+
ScalewayMachine.
58+
properties:
59+
foo:
60+
description: Foo is an example field of ScalewayMachine. Edit
61+
scalewaymachine_types.go to remove/update
62+
type: string
63+
type: object
64+
required:
65+
- spec
66+
type: object
67+
required:
68+
- template
69+
type: object
70+
type: object
71+
served: true
72+
storage: true

config/crd/kustomization.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ resources:
88
- bases/infrastructure.cluster.x-k8s.io_scalewayclusters.yaml
99
- bases/infrastructure.cluster.x-k8s.io_scalewaymachines.yaml
1010
- bases/infrastructure.cluster.x-k8s.io_scalewayclustertemplates.yaml
11+
- bases/infrastructure.cluster.x-k8s.io_scalewaymachinetemplates.yaml
1112
# +kubebuilder:scaffold:crdkustomizeresource
1213

1314
patches:

config/rbac/kustomization.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ resources:
2222
# default, aiding admins in cluster management. Those roles are
2323
# not used by the {{ .ProjectName }} itself. You can comment the following lines
2424
# if you do not want those helpers be installed with your Project.
25+
- scalewaymachinetemplate_admin_role.yaml
26+
- scalewaymachinetemplate_editor_role.yaml
27+
- scalewaymachinetemplate_viewer_role.yaml
2528
- scalewayclustertemplate_admin_role.yaml
2629
- scalewayclustertemplate_editor_role.yaml
2730
- scalewayclustertemplate_viewer_role.yaml
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# This rule is not used by the project cluster-api-provider-scaleway 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-scaleway
13+
app.kubernetes.io/managed-by: kustomize
14+
name: scalewaymachinetemplate-admin-role
15+
rules:
16+
- apiGroups:
17+
- infrastructure.cluster.x-k8s.io
18+
resources:
19+
- scalewaymachinetemplates
20+
verbs:
21+
- '*'
22+
- apiGroups:
23+
- infrastructure.cluster.x-k8s.io
24+
resources:
25+
- scalewaymachinetemplates/status
26+
verbs:
27+
- get
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# This rule is not used by the project cluster-api-provider-scaleway 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-scaleway
13+
app.kubernetes.io/managed-by: kustomize
14+
name: scalewaymachinetemplate-editor-role
15+
rules:
16+
- apiGroups:
17+
- infrastructure.cluster.x-k8s.io
18+
resources:
19+
- scalewaymachinetemplates
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+
- scalewaymachinetemplates/status
32+
verbs:
33+
- get
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# This rule is not used by the project cluster-api-provider-scaleway 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-scaleway
13+
app.kubernetes.io/managed-by: kustomize
14+
name: scalewaymachinetemplate-viewer-role
15+
rules:
16+
- apiGroups:
17+
- infrastructure.cluster.x-k8s.io
18+
resources:
19+
- scalewaymachinetemplates
20+
verbs:
21+
- get
22+
- list
23+
- watch
24+
- apiGroups:
25+
- infrastructure.cluster.x-k8s.io
26+
resources:
27+
- scalewaymachinetemplates/status
28+
verbs:
29+
- get
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha1
2+
kind: ScalewayMachineTemplate
3+
metadata:
4+
labels:
5+
app.kubernetes.io/name: cluster-api-provider-scaleway
6+
app.kubernetes.io/managed-by: kustomize
7+
name: scalewaymachinetemplate-sample
8+
spec:
9+
# TODO(user): Add fields here

0 commit comments

Comments
 (0)