Skip to content

Commit

Permalink
feat: Generate MicrovmTemplate
Browse files Browse the repository at this point in the history
```
kubebuilder create api \
  --group infrastructure \
  --version v1alpha1 \
  --kind MicrovmTemplate
```
  • Loading branch information
Callisto13 committed Dec 1, 2022
1 parent 6236e2b commit 5862526
Show file tree
Hide file tree
Showing 12 changed files with 553 additions and 10 deletions.
8 changes: 8 additions & 0 deletions PROJECT
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,12 @@ resources:
kind: MicrovmReplicaSet
path: github.com/weaveworks-liquidmetal/microvm-operator/api/v1alpha1
version: v1alpha1
- api:
crdVersion: v1
namespaced: true
domain: flintlock.x-k8s.io
group: infrastructure
kind: MicrovmTemplate
path: github.com/weaveworks-liquidmetal/microvm-operator/api/v1alpha1
version: v1alpha1
version: "3"
56 changes: 56 additions & 0 deletions api/v1alpha1/microvmtemplate_types.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
/*
Copyright 2022 Weaveworks.
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"
)

// MicrovmTemplateSpec defines the desired state of MicrovmTemplate
type MicrovmTemplateSpec struct {
metav1.ObjectMeta `json:"metadata,omitempty"`

// Specification of the desired behavior of the Microvm.
// +optional
Spec MicrovmSpec `json:"spec,omitempty"`
}

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

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

// Template defines the Microvm that will be created from this pod template.
// +optional
Template MicrovmTemplateSpec `json:"template,omitempty"`
}

//+kubebuilder:object:root=true

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

func init() {
SchemeBuilder.Register(&MicrovmTemplate{}, &MicrovmTemplateList{})
}
98 changes: 96 additions & 2 deletions api/v1alpha1/zz_generated.deepcopy.go

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

16 changes: 8 additions & 8 deletions config/crd/bases/infrastructure.flintlock.x-k8s.io_microvms.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -293,33 +293,33 @@ spec:
type: array
failureMessage:
description: "FailureMessage will be set in the event that there is
a terminal problem reconciling the Machine and will contain a more
a terminal problem reconciling the Microvm and will contain a more
verbose string suitable for logging and human consumption. \n This
field should not be set for transitive errors that a controller
faces that are expected to be fixed automatically over time (like
service outages), but instead indicate that something is fundamentally
wrong with the Machine's spec or the configuration of the controller,
wrong with the Microvm's spec or the configuration of the controller,
and that manual intervention is required. Examples of terminal errors
would be invalid combinations of settings in the spec, values that
are unsupported by the controller, or the responsible controller
itself being critically misconfigured. \n Any transient errors that
occur during the reconciliation of Machines can be added as events
to the Machine object and/or logged in the controller's output."
occur during the reconciliation of Microvm can be added as events
to the Microvm object and/or logged in the controller's output."
type: string
failureReason:
description: "FailureReason will be set in the event that there is
a terminal problem reconciling the Machine and will contain a succinct
a terminal problem reconciling the Microvm and will contain a succinct
value suitable for machine interpretation. \n This field should
not be set for transitive errors that a controller faces that are
expected to be fixed automatically over time (like service outages),
but instead indicate that something is fundamentally wrong with
the Machine's spec or the configuration of the controller, and that
the Microvm's spec or the configuration of the controller, and that
manual intervention is required. Examples of terminal errors would
be invalid combinations of settings in the spec, values that are
unsupported by the controller, or the responsible controller itself
being critically misconfigured. \n Any transient errors that occur
during the reconciliation of Machines can be added as events to
the Machine object and/or logged in the controller's output."
during the reconciliation of Microvm can be added as events to the
Microvm object and/or logged in the controller's output."
type: string
ready:
default: false
Expand Down
Loading

0 comments on commit 5862526

Please sign in to comment.