diff --git a/PROJECT b/PROJECT index ccff75232..d87680376 100644 --- a/PROJECT +++ b/PROJECT @@ -26,4 +26,20 @@ resources: kind: LinodeMachine path: github.com/linode/cluster-api-provider-linode/api/v1alpha1 version: v1alpha1 +- api: + crdVersion: v1 + namespaced: true + domain: cluster.x-k8s.io + group: infrastructure + kind: LinodeClusterTemplate + path: github.com/linode/cluster-api-provider-linode/api/v1alpha1 + version: v1alpha1 +- api: + crdVersion: v1 + namespaced: true + domain: cluster.x-k8s.io + group: infrastructure + kind: LinodeMachineTemplate + path: github.com/linode/cluster-api-provider-linode/api/v1alpha1 + version: v1alpha1 version: "3" diff --git a/api/v1alpha1/linodeclustertemplate_types.go b/api/v1alpha1/linodeclustertemplate_types.go new file mode 100644 index 000000000..983005ef0 --- /dev/null +++ b/api/v1alpha1/linodeclustertemplate_types.go @@ -0,0 +1,55 @@ +/* +Copyright 2023 Akamai Technologies, Inc. + +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 v1alpha1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// LinodeClusterTemplateSpec defines the desired state of LinodeClusterTemplate +type LinodeClusterTemplateSpec struct { + Template LinodeClusterTemplateResource `json:"template"` +} + +// LinodeClusterTemplateResource describes the data needed to create a LinodeCluster from a template. +type LinodeClusterTemplateResource struct { + Spec LinodeClusterSpec `json:"spec"` +} + +// +kubebuilder:object:root=true +// +kubebuilder:resource:path=linodeclustertemplates,scope=Namespaced,categories=cluster-api,shortName=lct + +// LinodeClusterTemplate is the Schema for the linodeclustertemplates API +type LinodeClusterTemplate struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec LinodeClusterTemplateSpec `json:"spec,omitempty"` +} + +//+kubebuilder:object:root=true + +// LinodeClusterTemplateList contains a list of LinodeClusterTemplate +type LinodeClusterTemplateList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []LinodeClusterTemplate `json:"items"` +} + +func init() { + SchemeBuilder.Register(&LinodeClusterTemplate{}, &LinodeClusterTemplateList{}) +} diff --git a/api/v1alpha1/linodemachinetemplate_types.go b/api/v1alpha1/linodemachinetemplate_types.go new file mode 100644 index 000000000..5f537d6c3 --- /dev/null +++ b/api/v1alpha1/linodemachinetemplate_types.go @@ -0,0 +1,55 @@ +/* +Copyright 2023 Akamai Technologies, Inc. + +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 v1alpha1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// LinodeMachineTemplateSpec defines the desired state of LinodeMachineTemplate +type LinodeMachineTemplateSpec struct { + Template LinodeMachineTemplateResource `json:"template"` +} + +// LinodeMachineTemplateResource describes the data needed to create a LinodeMachine from a template. +type LinodeMachineTemplateResource struct { + Spec LinodeMachineSpec `json:"spec"` +} + +// +kubebuilder:object:root=true +// +kubebuilder:resource:path=linodemachinetemplates,scope=Namespaced,categories=cluster-api,shortName=lmt + +// LinodeMachineTemplate is the Schema for the linodemachinetemplates API +type LinodeMachineTemplate struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec LinodeMachineTemplateSpec `json:"spec,omitempty"` +} + +//+kubebuilder:object:root=true + +// LinodeMachineTemplateList contains a list of LinodeMachineTemplate +type LinodeMachineTemplateList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []LinodeMachineTemplate `json:"items"` +} + +func init() { + SchemeBuilder.Register(&LinodeMachineTemplate{}, &LinodeMachineTemplateList{}) +} diff --git a/api/v1alpha1/zz_generated.deepcopy.go b/api/v1alpha1/zz_generated.deepcopy.go index 29963df12..117c52bfb 100644 --- a/api/v1alpha1/zz_generated.deepcopy.go +++ b/api/v1alpha1/zz_generated.deepcopy.go @@ -180,6 +180,96 @@ func (in *LinodeClusterStatus) DeepCopy() *LinodeClusterStatus { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *LinodeClusterTemplate) DeepCopyInto(out *LinodeClusterTemplate) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + out.Spec = in.Spec +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LinodeClusterTemplate. +func (in *LinodeClusterTemplate) DeepCopy() *LinodeClusterTemplate { + if in == nil { + return nil + } + out := new(LinodeClusterTemplate) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *LinodeClusterTemplate) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *LinodeClusterTemplateList) DeepCopyInto(out *LinodeClusterTemplateList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]LinodeClusterTemplate, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LinodeClusterTemplateList. +func (in *LinodeClusterTemplateList) DeepCopy() *LinodeClusterTemplateList { + if in == nil { + return nil + } + out := new(LinodeClusterTemplateList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *LinodeClusterTemplateList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *LinodeClusterTemplateResource) DeepCopyInto(out *LinodeClusterTemplateResource) { + *out = *in + out.Spec = in.Spec +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LinodeClusterTemplateResource. +func (in *LinodeClusterTemplateResource) DeepCopy() *LinodeClusterTemplateResource { + if in == nil { + return nil + } + out := new(LinodeClusterTemplateResource) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *LinodeClusterTemplateSpec) DeepCopyInto(out *LinodeClusterTemplateSpec) { + *out = *in + out.Template = in.Template +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LinodeClusterTemplateSpec. +func (in *LinodeClusterTemplateSpec) DeepCopy() *LinodeClusterTemplateSpec { + if in == nil { + return nil + } + out := new(LinodeClusterTemplateSpec) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *LinodeMachine) DeepCopyInto(out *LinodeMachine) { *out = *in @@ -340,6 +430,96 @@ func (in *LinodeMachineStatus) DeepCopy() *LinodeMachineStatus { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *LinodeMachineTemplate) DeepCopyInto(out *LinodeMachineTemplate) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LinodeMachineTemplate. +func (in *LinodeMachineTemplate) DeepCopy() *LinodeMachineTemplate { + if in == nil { + return nil + } + out := new(LinodeMachineTemplate) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *LinodeMachineTemplate) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *LinodeMachineTemplateList) DeepCopyInto(out *LinodeMachineTemplateList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]LinodeMachineTemplate, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LinodeMachineTemplateList. +func (in *LinodeMachineTemplateList) DeepCopy() *LinodeMachineTemplateList { + if in == nil { + return nil + } + out := new(LinodeMachineTemplateList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *LinodeMachineTemplateList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *LinodeMachineTemplateResource) DeepCopyInto(out *LinodeMachineTemplateResource) { + *out = *in + in.Spec.DeepCopyInto(&out.Spec) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LinodeMachineTemplateResource. +func (in *LinodeMachineTemplateResource) DeepCopy() *LinodeMachineTemplateResource { + if in == nil { + return nil + } + out := new(LinodeMachineTemplateResource) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *LinodeMachineTemplateSpec) DeepCopyInto(out *LinodeMachineTemplateSpec) { + *out = *in + in.Template.DeepCopyInto(&out.Template) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LinodeMachineTemplateSpec. +func (in *LinodeMachineTemplateSpec) DeepCopy() *LinodeMachineTemplateSpec { + if in == nil { + return nil + } + out := new(LinodeMachineTemplateSpec) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *NetworkSpec) DeepCopyInto(out *NetworkSpec) { *out = *in diff --git a/config/crd/bases/infrastructure.cluster.x-k8s.io_linodeclustertemplates.yaml b/config/crd/bases/infrastructure.cluster.x-k8s.io_linodeclustertemplates.yaml new file mode 100644 index 000000000..9e4b85d41 --- /dev/null +++ b/config/crd/bases/infrastructure.cluster.x-k8s.io_linodeclustertemplates.yaml @@ -0,0 +1,88 @@ +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.13.0 + name: linodeclustertemplates.infrastructure.cluster.x-k8s.io +spec: + group: infrastructure.cluster.x-k8s.io + names: + categories: + - cluster-api + kind: LinodeClusterTemplate + listKind: LinodeClusterTemplateList + plural: linodeclustertemplates + shortNames: + - lct + singular: linodeclustertemplate + scope: Namespaced + versions: + - name: v1alpha1 + schema: + openAPIV3Schema: + description: LinodeClusterTemplate is the Schema for the linodeclustertemplates + API + properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this representation + of an object. Servers should convert recognized schemas to the latest + internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string + kind: + description: 'Kind is a string value representing the REST resource this + object represents. Servers may infer this from the endpoint the client + submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + metadata: + type: object + spec: + description: LinodeClusterTemplateSpec defines the desired state of LinodeClusterTemplate + properties: + template: + description: LinodeClusterTemplateResource describes the data needed + to create a LinodeCluster from a template. + properties: + spec: + description: LinodeClusterSpec defines the desired state of LinodeCluster + properties: + controlPlaneEndpoint: + description: ControlPlaneEndpoint represents the endpoint + used to communicate with the LinodeCluster control plane. + If ControlPlaneEndpoint is unset then the Nodebalancer ip + will be used. + properties: + host: + description: The hostname on which the API server is serving. + type: string + port: + description: The port on which the API server is serving. + format: int32 + type: integer + required: + - host + - port + type: object + network: + description: NetworkSpec encapsulates all things related to + Linode network. + properties: + nodebalancerID: + description: NodebalancerID is the id of apiserver Nodebalancer. + type: integer + type: object + region: + description: The Linode Region the LinodeCluster lives in. + type: string + required: + - region + type: object + required: + - spec + type: object + required: + - template + type: object + type: object + served: true + storage: true diff --git a/config/crd/bases/infrastructure.cluster.x-k8s.io_linodemachinetemplates.yaml b/config/crd/bases/infrastructure.cluster.x-k8s.io_linodemachinetemplates.yaml new file mode 100644 index 000000000..eb65b1b73 --- /dev/null +++ b/config/crd/bases/infrastructure.cluster.x-k8s.io_linodemachinetemplates.yaml @@ -0,0 +1,197 @@ +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.13.0 + name: linodemachinetemplates.infrastructure.cluster.x-k8s.io +spec: + group: infrastructure.cluster.x-k8s.io + names: + categories: + - cluster-api + kind: LinodeMachineTemplate + listKind: LinodeMachineTemplateList + plural: linodemachinetemplates + shortNames: + - lmt + singular: linodemachinetemplate + scope: Namespaced + versions: + - name: v1alpha1 + schema: + openAPIV3Schema: + description: LinodeMachineTemplate is the Schema for the linodemachinetemplates + API + properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this representation + of an object. Servers should convert recognized schemas to the latest + internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string + kind: + description: 'Kind is a string value representing the REST resource this + object represents. Servers may infer this from the endpoint the client + submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + metadata: + type: object + spec: + description: LinodeMachineTemplateSpec defines the desired state of LinodeMachineTemplate + properties: + template: + description: LinodeMachineTemplateResource describes the data needed + to create a LinodeMachine from a template. + properties: + spec: + description: LinodeMachineSpec defines the desired state of LinodeMachine + properties: + authorizedKeys: + items: + type: string + type: array + x-kubernetes-validations: + - message: Value is immutable + rule: self == oldSelf + authorizedUsers: + items: + type: string + type: array + x-kubernetes-validations: + - message: Value is immutable + rule: self == oldSelf + backupId: + type: integer + x-kubernetes-validations: + - message: Value is immutable + rule: self == oldSelf + backupsEnabled: + type: boolean + x-kubernetes-validations: + - message: Value is immutable + rule: self == oldSelf + firewallId: + type: integer + x-kubernetes-validations: + - message: Value is immutable + rule: self == oldSelf + group: + type: string + x-kubernetes-validations: + - message: Value is immutable + rule: self == oldSelf + image: + type: string + x-kubernetes-validations: + - message: Value is immutable + rule: self == oldSelf + instanceID: + description: InstanceID is the Linode instance ID for this + machine. + type: integer + interfaces: + items: + description: InstanceConfigInterfaceCreateOptions defines + network interface config + properties: + ipRanges: + items: + type: string + type: array + ipamAddress: + type: string + ipv4: + description: VPCIPv4 defines VPC IPV4 settings + properties: + nat1to1: + type: string + vpc: + type: string + type: object + label: + type: string + primary: + type: boolean + purpose: + description: ConfigInterfacePurpose options start with + InterfacePurpose and include all known interface purpose + types + type: string + subnetId: + type: integer + type: object + type: array + x-kubernetes-validations: + - message: Value is immutable + rule: self == oldSelf + label: + type: string + x-kubernetes-validations: + - message: Value is immutable + rule: self == oldSelf + metadata: + description: InstanceMetadataOptions defines metadata of instance + properties: + userData: + description: UserData expects a Base64-encoded string + type: string + type: object + x-kubernetes-validations: + - message: Value is immutable + rule: self == oldSelf + privateIp: + type: boolean + x-kubernetes-validations: + - message: Value is immutable + rule: self == oldSelf + providerID: + description: ProviderID is the unique identifier as specified + by the cloud provider. + type: string + region: + type: string + x-kubernetes-validations: + - message: Value is immutable + rule: self == oldSelf + rootPass: + type: string + x-kubernetes-validations: + - message: Value is immutable + rule: self == oldSelf + stackscriptData: + additionalProperties: + type: string + type: object + x-kubernetes-validations: + - message: Value is immutable + rule: self == oldSelf + stackscriptId: + type: integer + x-kubernetes-validations: + - message: Value is immutable + rule: self == oldSelf + tags: + items: + type: string + type: array + x-kubernetes-validations: + - message: Value is immutable + rule: self == oldSelf + type: + type: string + x-kubernetes-validations: + - message: Value is immutable + rule: self == oldSelf + required: + - region + - type + type: object + required: + - spec + type: object + required: + - template + type: object + type: object + served: true + storage: true diff --git a/config/crd/kustomization.yaml b/config/crd/kustomization.yaml index 78afaaaa9..9fa6c1346 100644 --- a/config/crd/kustomization.yaml +++ b/config/crd/kustomization.yaml @@ -4,6 +4,8 @@ resources: - bases/infrastructure.cluster.x-k8s.io_linodeclusters.yaml - bases/infrastructure.cluster.x-k8s.io_linodemachines.yaml +- bases/infrastructure.cluster.x-k8s.io_linodemachinetemplates.yaml +- bases/infrastructure.cluster.x-k8s.io_linodeclustertemplates.yaml #+kubebuilder:scaffold:crdkustomizeresource patches: @@ -11,12 +13,16 @@ patches: # patches here are for enabling the conversion webhook for each CRD #- path: patches/webhook_in_linodeclusters.yaml #- path: patches/webhook_in_linodemachines.yaml +#- path: patches/webhook_in_linodemachinetemplates.yaml +#- path: patches/webhook_in_linodeclustertemplates.yaml #+kubebuilder:scaffold:crdkustomizewebhookpatch # [CERTMANAGER] To enable cert-manager, uncomment all the sections with [CERTMANAGER] prefix. # patches here are for enabling the CA injection for each CRD #- path: patches/cainjection_in_linodeclusters.yaml #- path: patches/cainjection_in_linodemachines.yaml +#- path: patches/cainjection_in_linodemachinetemplates.yaml +#- path: patches/cainjection_in_linodeclustertemplates.yaml #+kubebuilder:scaffold:crdkustomizecainjectionpatch # the following config is for teaching kustomize how to do kustomization for CRDs. diff --git a/config/crd/patches/cainjection_in_linodeclustertemplates.yaml b/config/crd/patches/cainjection_in_linodeclustertemplates.yaml new file mode 100644 index 000000000..b22794d2b --- /dev/null +++ b/config/crd/patches/cainjection_in_linodeclustertemplates.yaml @@ -0,0 +1,7 @@ +# The following patch adds a directive for certmanager to inject CA into the CRD +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + cert-manager.io/inject-ca-from: CERTIFICATE_NAMESPACE/CERTIFICATE_NAME + name: linodeclustertemplates.infrastructure.cluster.x-k8s.io diff --git a/config/crd/patches/cainjection_in_linodemachinetemplates.yaml b/config/crd/patches/cainjection_in_linodemachinetemplates.yaml new file mode 100644 index 000000000..be4680500 --- /dev/null +++ b/config/crd/patches/cainjection_in_linodemachinetemplates.yaml @@ -0,0 +1,7 @@ +# The following patch adds a directive for certmanager to inject CA into the CRD +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + cert-manager.io/inject-ca-from: CERTIFICATE_NAMESPACE/CERTIFICATE_NAME + name: linodemachinetemplates.infrastructure.cluster.x-k8s.io diff --git a/config/crd/patches/webhook_in_linodeclustertemplates.yaml b/config/crd/patches/webhook_in_linodeclustertemplates.yaml new file mode 100644 index 000000000..29e162195 --- /dev/null +++ b/config/crd/patches/webhook_in_linodeclustertemplates.yaml @@ -0,0 +1,16 @@ +# The following patch enables a conversion webhook for the CRD +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + name: linodeclustertemplates.infrastructure.cluster.x-k8s.io +spec: + conversion: + strategy: Webhook + webhook: + clientConfig: + service: + namespace: system + name: webhook-service + path: /convert + conversionReviewVersions: + - v1 diff --git a/config/crd/patches/webhook_in_linodemachinetemplates.yaml b/config/crd/patches/webhook_in_linodemachinetemplates.yaml new file mode 100644 index 000000000..d21dd8642 --- /dev/null +++ b/config/crd/patches/webhook_in_linodemachinetemplates.yaml @@ -0,0 +1,16 @@ +# The following patch enables a conversion webhook for the CRD +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + name: linodemachinetemplates.infrastructure.cluster.x-k8s.io +spec: + conversion: + strategy: Webhook + webhook: + clientConfig: + service: + namespace: system + name: webhook-service + path: /convert + conversionReviewVersions: + - v1 diff --git a/config/rbac/linodeclustertemplate_editor_role.yaml b/config/rbac/linodeclustertemplate_editor_role.yaml new file mode 100644 index 000000000..50de41de2 --- /dev/null +++ b/config/rbac/linodeclustertemplate_editor_role.yaml @@ -0,0 +1,31 @@ +# permissions for end users to edit linodeclustertemplates. +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + labels: + app.kubernetes.io/name: clusterrole + app.kubernetes.io/instance: linodeclustertemplate-editor-role + app.kubernetes.io/component: rbac + app.kubernetes.io/created-by: cluster-api-provider-linode + app.kubernetes.io/part-of: cluster-api-provider-linode + app.kubernetes.io/managed-by: kustomize + name: linodeclustertemplate-editor-role +rules: +- apiGroups: + - infrastructure.cluster.x-k8s.io + resources: + - linodeclustertemplates + verbs: + - create + - delete + - get + - list + - patch + - update + - watch +- apiGroups: + - infrastructure.cluster.x-k8s.io + resources: + - linodeclustertemplates/status + verbs: + - get diff --git a/config/rbac/linodeclustertemplate_viewer_role.yaml b/config/rbac/linodeclustertemplate_viewer_role.yaml new file mode 100644 index 000000000..a07055373 --- /dev/null +++ b/config/rbac/linodeclustertemplate_viewer_role.yaml @@ -0,0 +1,27 @@ +# permissions for end users to view linodeclustertemplates. +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + labels: + app.kubernetes.io/name: clusterrole + app.kubernetes.io/instance: linodeclustertemplate-viewer-role + app.kubernetes.io/component: rbac + app.kubernetes.io/created-by: cluster-api-provider-linode + app.kubernetes.io/part-of: cluster-api-provider-linode + app.kubernetes.io/managed-by: kustomize + name: linodeclustertemplate-viewer-role +rules: +- apiGroups: + - infrastructure.cluster.x-k8s.io + resources: + - linodeclustertemplates + verbs: + - get + - list + - watch +- apiGroups: + - infrastructure.cluster.x-k8s.io + resources: + - linodeclustertemplates/status + verbs: + - get diff --git a/config/rbac/linodemachinetemplate_editor_role.yaml b/config/rbac/linodemachinetemplate_editor_role.yaml new file mode 100644 index 000000000..d79aab068 --- /dev/null +++ b/config/rbac/linodemachinetemplate_editor_role.yaml @@ -0,0 +1,31 @@ +# permissions for end users to edit linodemachinetemplates. +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + labels: + app.kubernetes.io/name: clusterrole + app.kubernetes.io/instance: linodemachinetemplate-editor-role + app.kubernetes.io/component: rbac + app.kubernetes.io/created-by: cluster-api-provider-linode + app.kubernetes.io/part-of: cluster-api-provider-linode + app.kubernetes.io/managed-by: kustomize + name: linodemachinetemplate-editor-role +rules: +- apiGroups: + - infrastructure.cluster.x-k8s.io + resources: + - linodemachinetemplates + verbs: + - create + - delete + - get + - list + - patch + - update + - watch +- apiGroups: + - infrastructure.cluster.x-k8s.io + resources: + - linodemachinetemplates/status + verbs: + - get diff --git a/config/rbac/linodemachinetemplate_viewer_role.yaml b/config/rbac/linodemachinetemplate_viewer_role.yaml new file mode 100644 index 000000000..69a4fd483 --- /dev/null +++ b/config/rbac/linodemachinetemplate_viewer_role.yaml @@ -0,0 +1,27 @@ +# permissions for end users to view linodemachinetemplates. +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + labels: + app.kubernetes.io/name: clusterrole + app.kubernetes.io/instance: linodemachinetemplate-viewer-role + app.kubernetes.io/component: rbac + app.kubernetes.io/created-by: cluster-api-provider-linode + app.kubernetes.io/part-of: cluster-api-provider-linode + app.kubernetes.io/managed-by: kustomize + name: linodemachinetemplate-viewer-role +rules: +- apiGroups: + - infrastructure.cluster.x-k8s.io + resources: + - linodemachinetemplates + verbs: + - get + - list + - watch +- apiGroups: + - infrastructure.cluster.x-k8s.io + resources: + - linodemachinetemplates/status + verbs: + - get diff --git a/config/samples/infrastructure_v1alpha1_linodeclustertemplate.yaml b/config/samples/infrastructure_v1alpha1_linodeclustertemplate.yaml new file mode 100644 index 000000000..b099111f5 --- /dev/null +++ b/config/samples/infrastructure_v1alpha1_linodeclustertemplate.yaml @@ -0,0 +1,12 @@ +apiVersion: infrastructure.cluster.x-k8s.io/v1alpha1 +kind: LinodeClusterTemplate +metadata: + labels: + app.kubernetes.io/name: linodeclustertemplate + app.kubernetes.io/instance: linodeclustertemplate-sample + app.kubernetes.io/part-of: cluster-api-provider-linode + app.kubernetes.io/managed-by: kustomize + app.kubernetes.io/created-by: cluster-api-provider-linode + name: linodeclustertemplate-sample +spec: + # TODO(user): Add fields here diff --git a/config/samples/infrastructure_v1alpha1_linodemachinetemplate.yaml b/config/samples/infrastructure_v1alpha1_linodemachinetemplate.yaml new file mode 100644 index 000000000..571e145cb --- /dev/null +++ b/config/samples/infrastructure_v1alpha1_linodemachinetemplate.yaml @@ -0,0 +1,12 @@ +apiVersion: infrastructure.cluster.x-k8s.io/v1alpha1 +kind: LinodeMachineTemplate +metadata: + labels: + app.kubernetes.io/name: linodemachinetemplate + app.kubernetes.io/instance: linodemachinetemplate-sample + app.kubernetes.io/part-of: cluster-api-provider-linode + app.kubernetes.io/managed-by: kustomize + app.kubernetes.io/created-by: cluster-api-provider-linode + name: linodemachinetemplate-sample +spec: + # TODO(user): Add fields here diff --git a/config/samples/kustomization.yaml b/config/samples/kustomization.yaml index 3e6530da2..db7d2f6fa 100644 --- a/config/samples/kustomization.yaml +++ b/config/samples/kustomization.yaml @@ -2,4 +2,6 @@ resources: - infrastructure_v1alpha1_linodecluster.yaml - infrastructure_v1alpha1_linodemachine.yaml +- infrastructure_v1alpha1_linodemachinetemplate.yaml +- infrastructure_v1alpha1_linodeclustertemplate.yaml #+kubebuilder:scaffold:manifestskustomizesamples