mirror of
https://github.com/rancher/os.git
synced 2025-09-15 22:49:08 +00:00
Add TPM and MachineRegister support
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
package v1
|
||||
|
||||
import (
|
||||
"github.com/rancher/fleet/pkg/apis/fleet.cattle.io/v1alpha1"
|
||||
"github.com/rancher/wrangler/pkg/genericcondition"
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
)
|
||||
@@ -8,6 +10,30 @@ import (
|
||||
// +genclient
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
|
||||
type MachineRegistration struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ObjectMeta `json:"metadata,omitempty"`
|
||||
|
||||
Spec MachineRegistrationSpec `json:"spec"`
|
||||
Status MachineRegistrationStatus `json:"status"`
|
||||
}
|
||||
|
||||
type MachineRegistrationSpec struct {
|
||||
MachineName string `json:"machineName,omitempty"`
|
||||
MachineInventoryLabels map[string]string `json:"machineInventoryLabels,omitempty"`
|
||||
MachineInventoryAnnotations map[string]string `json:"machineInventoryAnnotations,omitempty"`
|
||||
CloudConfig *v1alpha1.GenericMap `json:"cloudConfig,omitempty"`
|
||||
}
|
||||
|
||||
type MachineRegistrationStatus struct {
|
||||
Conditions []genericcondition.GenericCondition `json:"conditions,omitempty"`
|
||||
RegistrationURL string `json:"registrationURL,omitempty"`
|
||||
RegistrationToken string `json:"registrationToken,omitempty"`
|
||||
}
|
||||
|
||||
// +genclient
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
|
||||
type MachineInventory struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ObjectMeta `json:"metadata,omitempty"`
|
||||
@@ -17,19 +43,20 @@ type MachineInventory struct {
|
||||
}
|
||||
|
||||
type MachineInventorySpec struct {
|
||||
ClusterName string `json:"clusterName,omitempty"`
|
||||
TPMHash string `json:"tpmHash,omitempty"`
|
||||
SMBIOS *v1alpha1.GenericMap `json:"smbios,omitempty"`
|
||||
ClusterName string `json:"clusterName"`
|
||||
MachineTokenSecretName string `json:"machineTokenSecretName,omitempty"`
|
||||
Config MachineRuntimeConfig `json:"config,omitempty"`
|
||||
}
|
||||
|
||||
type MachineRuntimeConfig struct {
|
||||
Role string `json:"role,omitempty"`
|
||||
Role string `json:"role"`
|
||||
NodeName string `json:"nodeName,omitempty"`
|
||||
Address string `json:"address,omitempty"`
|
||||
InternalAddress string `json:"internalAddress,omitempty"`
|
||||
Taints []corev1.Taint `json:"taints,omitempty"`
|
||||
Labels map[string]string `json:"labels,omitempty"`
|
||||
ConfigValues map[string]string `json:"extraConfig,omitempty"`
|
||||
Labels map[string]string `json:"labels"`
|
||||
}
|
||||
|
||||
type MachineInventoryStatus struct {
|
||||
|
@@ -23,6 +23,7 @@ package v1
|
||||
import (
|
||||
v1alpha1 "github.com/rancher/fleet/pkg/apis/fleet.cattle.io/v1alpha1"
|
||||
upgradecattleiov1 "github.com/rancher/system-upgrade-controller/pkg/apis/upgrade.cattle.io/v1"
|
||||
genericcondition "github.com/rancher/wrangler/pkg/genericcondition"
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||
@@ -92,6 +93,10 @@ func (in *MachineInventoryList) DeepCopyObject() runtime.Object {
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *MachineInventorySpec) DeepCopyInto(out *MachineInventorySpec) {
|
||||
*out = *in
|
||||
if in.SMBIOS != nil {
|
||||
in, out := &in.SMBIOS, &out.SMBIOS
|
||||
*out = (*in).DeepCopy()
|
||||
}
|
||||
in.Config.DeepCopyInto(&out.Config)
|
||||
return
|
||||
}
|
||||
@@ -122,6 +127,122 @@ func (in *MachineInventoryStatus) DeepCopy() *MachineInventoryStatus {
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *MachineRegistration) DeepCopyInto(out *MachineRegistration) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
||||
in.Spec.DeepCopyInto(&out.Spec)
|
||||
in.Status.DeepCopyInto(&out.Status)
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MachineRegistration.
|
||||
func (in *MachineRegistration) DeepCopy() *MachineRegistration {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(MachineRegistration)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *MachineRegistration) 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 *MachineRegistrationList) DeepCopyInto(out *MachineRegistrationList) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ListMeta.DeepCopyInto(&out.ListMeta)
|
||||
if in.Items != nil {
|
||||
in, out := &in.Items, &out.Items
|
||||
*out = make([]MachineRegistration, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MachineRegistrationList.
|
||||
func (in *MachineRegistrationList) DeepCopy() *MachineRegistrationList {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(MachineRegistrationList)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *MachineRegistrationList) 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 *MachineRegistrationSpec) DeepCopyInto(out *MachineRegistrationSpec) {
|
||||
*out = *in
|
||||
if in.MachineInventoryLabels != nil {
|
||||
in, out := &in.MachineInventoryLabels, &out.MachineInventoryLabels
|
||||
*out = make(map[string]string, len(*in))
|
||||
for key, val := range *in {
|
||||
(*out)[key] = val
|
||||
}
|
||||
}
|
||||
if in.MachineInventoryAnnotations != nil {
|
||||
in, out := &in.MachineInventoryAnnotations, &out.MachineInventoryAnnotations
|
||||
*out = make(map[string]string, len(*in))
|
||||
for key, val := range *in {
|
||||
(*out)[key] = val
|
||||
}
|
||||
}
|
||||
if in.CloudConfig != nil {
|
||||
in, out := &in.CloudConfig, &out.CloudConfig
|
||||
*out = (*in).DeepCopy()
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MachineRegistrationSpec.
|
||||
func (in *MachineRegistrationSpec) DeepCopy() *MachineRegistrationSpec {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(MachineRegistrationSpec)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *MachineRegistrationStatus) DeepCopyInto(out *MachineRegistrationStatus) {
|
||||
*out = *in
|
||||
if in.Conditions != nil {
|
||||
in, out := &in.Conditions, &out.Conditions
|
||||
*out = make([]genericcondition.GenericCondition, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MachineRegistrationStatus.
|
||||
func (in *MachineRegistrationStatus) DeepCopy() *MachineRegistrationStatus {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(MachineRegistrationStatus)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *MachineRuntimeConfig) DeepCopyInto(out *MachineRuntimeConfig) {
|
||||
*out = *in
|
||||
@@ -139,13 +260,6 @@ func (in *MachineRuntimeConfig) DeepCopyInto(out *MachineRuntimeConfig) {
|
||||
(*out)[key] = val
|
||||
}
|
||||
}
|
||||
if in.ConfigValues != nil {
|
||||
in, out := &in.ConfigValues, &out.ConfigValues
|
||||
*out = make(map[string]string, len(*in))
|
||||
for key, val := range *in {
|
||||
(*out)[key] = val
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
|
@@ -43,6 +43,23 @@ func NewMachineInventory(namespace, name string, obj MachineInventory) *MachineI
|
||||
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
|
||||
// MachineRegistrationList is a list of MachineRegistration resources
|
||||
type MachineRegistrationList struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ListMeta `json:"metadata"`
|
||||
|
||||
Items []MachineRegistration `json:"items"`
|
||||
}
|
||||
|
||||
func NewMachineRegistration(namespace, name string, obj MachineRegistration) *MachineRegistration {
|
||||
obj.APIVersion, obj.Kind = SchemeGroupVersion.WithKind("MachineRegistration").ToAPIVersionAndKind()
|
||||
obj.Name = name
|
||||
obj.Namespace = namespace
|
||||
return &obj
|
||||
}
|
||||
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
|
||||
// ManagedOSImageList is a list of ManagedOSImage resources
|
||||
type ManagedOSImageList struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
|
@@ -28,8 +28,9 @@ import (
|
||||
)
|
||||
|
||||
var (
|
||||
MachineInventoryResourceName = "machineinventories"
|
||||
ManagedOSImageResourceName = "managedosimages"
|
||||
MachineInventoryResourceName = "machineinventories"
|
||||
MachineRegistrationResourceName = "machineregistrations"
|
||||
ManagedOSImageResourceName = "managedosimages"
|
||||
)
|
||||
|
||||
// SchemeGroupVersion is group version used to register these objects
|
||||
@@ -55,6 +56,8 @@ func addKnownTypes(scheme *runtime.Scheme) error {
|
||||
scheme.AddKnownTypes(SchemeGroupVersion,
|
||||
&MachineInventory{},
|
||||
&MachineInventoryList{},
|
||||
&MachineRegistration{},
|
||||
&MachineRegistrationList{},
|
||||
&ManagedOSImage{},
|
||||
&ManagedOSImageList{},
|
||||
)
|
||||
|
Reference in New Issue
Block a user