-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: added cluster and machine api definitions
The initial api definitions for the capi infrastructure implementations of cluster, machine and machinetemplate have been added. The type follow the capi requirements: *[cluster](https://cluster-api.sigs.k8s.io/developer/providers/cluster-infrastructure.html) *[machine](https://cluster-api.sigs.k8s.io/developer/providers/machine-infrastructure.html) The api types are based on a simplified version of the flintlock grpc api. In capi provider we will make some assumptions/defaults. Signed-off-by: Richard Case <[email protected]>
- Loading branch information
1 parent
d8a96a7
commit 1014a50
Showing
22 changed files
with
1,342 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// Copyright 2021 Weaveworks or its affiliates. All Rights Reserved. | ||
// SPDX-License-Identifier: MPL-2.0 | ||
|
||
package v1alpha1 | ||
|
||
import ( | ||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
) | ||
|
||
// MicrovmMachineTemplateSpec defines the desired state of MicrovmMachineTemplate. | ||
type MicrovmMachineTemplateSpec struct { | ||
Template MicrovmMachineTemplateResource `json:"template"` | ||
} | ||
|
||
// +kubebuilder:object:root=true | ||
// +kubebuilder:storageversion | ||
// +kubebuilder:resource:path=microvmmachinetemplates,scope=Namespaced,categories=cluster-api,shortName=mvmmt | ||
// +k8s:defaulter-gen=true | ||
|
||
// MicrovmMachineTemplate is the Schema for the microvmmachinetemplates API. | ||
type MicrovmMachineTemplate struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ObjectMeta `json:"metadata,omitempty"` | ||
|
||
Spec MicrovmMachineTemplateSpec `json:"spec,omitempty"` | ||
} | ||
|
||
//+kubebuilder:object:root=true | ||
|
||
// MicrovmMachineTemplateList contains a list of MicrovmMachineTemplate. | ||
type MicrovmMachineTemplateList struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ListMeta `json:"metadata,omitempty"` | ||
Items []MicrovmMachineTemplate `json:"items"` | ||
} | ||
|
||
func init() { | ||
SchemeBuilder.Register(&MicrovmMachineTemplate{}, &MicrovmMachineTemplateList{}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// Copyright 2021 Weaveworks or its affiliates. All Rights Reserved. | ||
// SPDX-License-Identifier: MPL-2.0 | ||
|
||
package v1alpha1 | ||
|
||
import ( | ||
"k8s.io/apimachinery/pkg/runtime" | ||
ctrl "sigs.k8s.io/controller-runtime" | ||
logf "sigs.k8s.io/controller-runtime/pkg/log" | ||
"sigs.k8s.io/controller-runtime/pkg/webhook" | ||
) | ||
|
||
var _ = logf.Log.WithName("microvmmachinetemplate-resource") | ||
|
||
func (r *MicrovmMachineTemplate) SetupWebhookWithManager(mgr ctrl.Manager) error { | ||
return ctrl.NewWebhookManagedBy(mgr). | ||
For(r). | ||
Complete() | ||
} | ||
|
||
// +kubebuilder:webhook:verbs=create;update,path=/validate-infrastructure-cluster-x-k8s-io-v1alpha1-microvmmachinetemplate,mutating=false,failurePolicy=fail,matchPolicy=Equivalent,groups=infrastructure.cluster.x-k8s.io,resources=microvmmachinetemplates,versions=v1alpha1,name=validation.microvmmachinetemplate.infrastructure.cluster.x-k8s.io,sideEffects=None,admissionReviewVersions=v1beta1 | ||
|
||
var _ webhook.Validator = &MicrovmMachineTemplate{} | ||
|
||
// ValidateCreate implements webhook.Validator so a webhook will be registered for the type. | ||
func (r *MicrovmMachineTemplate) ValidateCreate() error { | ||
return nil | ||
} | ||
|
||
// ValidateDelete implements webhook.Validator so a webhook will be registered for the type. | ||
func (r *MicrovmMachineTemplate) ValidateDelete() error { | ||
return nil | ||
} | ||
|
||
// ValidateUpdate implements webhook.Validator so a webhook will be registered for the type. | ||
func (r *MicrovmMachineTemplate) ValidateUpdate(old runtime.Object) error { | ||
return nil | ||
} |
Oops, something went wrong.