Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add support for packetmachinetemplate types #45

Merged
merged 1 commit into from
May 12, 2020
Merged
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
35 changes: 35 additions & 0 deletions api/v1alpha3/packetmachinetemplate_types.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package v1alpha3

import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

// PacketMachineTemplateSpec defines the desired state of PacketMachineTemplate
type PacketMachineTemplateSpec struct {
Template PacketMachineTemplateResource `json:"template"`
}

// +kubebuilder:object:root=true
// +kubebuilder:resource:path=packetmachinetemplates,scope=Namespaced,categories=cluster-api
// +kubebuilder:storageversion

// PacketMachineTemplate is the Schema for the packetmachinetemplates API
type PacketMachineTemplate struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`

Spec PacketMachineTemplateSpec `json:"spec,omitempty"`
}

// +kubebuilder:object:root=true

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

func init() {
SchemeBuilder.Register(&PacketMachineTemplate{}, &PacketMachineTemplateList{})
}
6 changes: 6 additions & 0 deletions api/v1alpha3/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,9 @@ var (

// Tags defines a slice of tags.
type Tags []string

// PacketMachineTemplateResource describes the data needed to create am PacketMachine from a template
type PacketMachineTemplateResource struct {
// Spec is the specification of the desired behavior of the machine.
Spec PacketMachineSpec `json:"spec"`
}
90 changes: 90 additions & 0 deletions api/v1alpha3/zz_generated.deepcopy.go

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

Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@

---
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.3.0
creationTimestamp: null
name: packetmachinetemplates.infrastructure.cluster.x-k8s.io
spec:
group: infrastructure.cluster.x-k8s.io
names:
categories:
- cluster-api
kind: PacketMachineTemplate
listKind: PacketMachineTemplateList
plural: packetmachinetemplates
singular: packetmachinetemplate
scope: Namespaced
validation:
openAPIV3Schema:
description: PacketMachineTemplate is the Schema for the packetmachinetemplates
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: PacketMachineTemplateSpec defines the desired state of PacketMachineTemplate
properties:
template:
description: PacketMachineTemplateResource describes the data needed
to create am PacketMachine from a template
properties:
spec:
description: Spec is the specification of the desired behavior of
the machine.
properties:
OS:
type: string
billingCycle:
type: string
facility:
items:
type: string
type: array
machineType:
type: string
providerID:
description: ProviderID is the unique identifier as specified
by the cloud provider.
type: string
sshKeys:
items:
type: string
type: array
tags:
description: Tags is an optional set of tags to add to Packet
resources managed by the Packet provider.
items:
type: string
type: array
required:
- OS
- billingCycle
- machineType
type: object
required:
- spec
type: object
required:
- template
type: object
type: object
version: v1alpha3
versions:
- name: v1alpha3
served: true
storage: true
status:
acceptedNames:
kind: ""
plural: ""
conditions: []
storedVersions: []
1 change: 1 addition & 0 deletions config/crd/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ commonLabels:
resources:
- bases/infrastructure.cluster.x-k8s.io_packetclusters.yaml
- bases/infrastructure.cluster.x-k8s.io_packetmachines.yaml
- bases/infrastructure.cluster.x-k8s.io_packetmachinetemplates.yaml
# +kubebuilder:scaffold:crdkustomizeresource

patchesStrategicMerge:
Expand Down