Skip to content
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
2 changes: 1 addition & 1 deletion docs/KubeletConfigDesign.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ The KubeletConfigController would perform the following steps:

4. Use mergo to merge the two structures

5. Serialize the KubeletConfig to yaml
5. Serialize the KubeletConfig to json

6. Create or Update an ignition /etc/kubernetes/kubelet.conf file within a 99-[role]-kubelet-managed MachineConfig

Expand Down
2 changes: 1 addition & 1 deletion docs/MachineConfigController.md
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ The MachineConfigController performs the following operations:
1. Renders the current MachineConfig (storage.files.contents[kubelet.conf]) into the KubeletConfiguration structure
1. Loads the user's KubeletConfig instance
1. Uses mergo to merge the two structures
1. Serialize the KubeletConfig to yaml
1. Serialize the KubeletConfig to json
1. Create or Update a MachineConfig (called `99-[role]-kubelet-managed`) with a new (/etc/kubernetes/kubelet.conf)

The machine will subseqently reboot by the MachineConfigDaemon to apply the new config.
4 changes: 0 additions & 4 deletions pkg/apis/apis.go

This file was deleted.

15 changes: 15 additions & 0 deletions pkg/apis/machineconfiguration.openshift.io/install.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package machineconfiguration

import (
machineconfigurationv1 "github.com/openshift/machine-config-operator/pkg/apis/machineconfiguration.openshift.io/v1"
"k8s.io/apimachinery/pkg/runtime"
)

// GroupName defines the API group for machineconfiguration.
const GroupName = "machineconfiguration.openshift.io"

var (
SchemeBuilder = runtime.NewSchemeBuilder(machineconfigurationv1.Install)
// Install is a function which adds every version of this group to a scheme
Install = SchemeBuilder.AddToScheme
)
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package apis
package machineconfiguration

import (
"testing"
Expand Down
56 changes: 26 additions & 30 deletions pkg/apis/machineconfiguration.openshift.io/v1/register.go
Original file line number Diff line number Diff line change
@@ -1,44 +1,29 @@
package v1

import (
"github.com/openshift/machine-config-operator/pkg/apis"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
)

const (
// GroupName defines the API group for machineconfigpools.
GroupName = apis.GroupName
)

// SchemeGroupVersion is group version used to register these objects
var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1"}

// Resource takes an unqualified resource and returns a Group qualified GroupResource
func Resource(resource string) schema.GroupResource {
return SchemeGroupVersion.WithResource(resource).GroupResource()
}

var (
// SchemeBuilder is the scheme builder for MachineConfigPools
SchemeBuilder runtime.SchemeBuilder
// localSchemeBuilder and AddToScheme will stay in k8s.io/kubernetes.
localSchemeBuilder = &SchemeBuilder
// AddToScheme is the function alias for AddtoScheme
AddToScheme = localSchemeBuilder.AddToScheme
// GroupName is the group name of this api
GroupName = "machineconfiguration.openshift.io"
// GroupVersion is the version of this api group
GroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1"}
schemeBuilder = runtime.NewSchemeBuilder(addKnownTypes)
// Install is a function which adds this version to a scheme
Install = schemeBuilder.AddToScheme

// SchemeGroupVersion is DEPRECATED
SchemeGroupVersion = GroupVersion
// AddToScheme is DEPRECATED
AddToScheme = Install
)

func init() {
// We only register manually written functions here. The registration of the
// generated functions takes place in the generated files. The separation
// makes the code compile even when the generated files are missing.
localSchemeBuilder.Register(addKnownTypes)
}

// Adds the list of known types to api.Scheme.
// addKnownTypes adds types to API group
func addKnownTypes(scheme *runtime.Scheme) error {
scheme.AddKnownTypes(SchemeGroupVersion,
scheme.AddKnownTypes(GroupVersion,
&MCOConfig{},
&ContainerRuntimeConfig{},
&ContainerRuntimeConfigList{},
Expand All @@ -52,6 +37,17 @@ func addKnownTypes(scheme *runtime.Scheme) error {
&MachineConfigPoolList{},
)

metav1.AddToGroupVersion(scheme, SchemeGroupVersion)
metav1.AddToGroupVersion(scheme, GroupVersion)

return nil
}

// Resource is used to validate existence of a resource in this API group
func Resource(resource string) schema.GroupResource {
return schema.GroupResource{Group: GroupName, Resource: resource}
}

// Kind is used to validate existence of a resource kind in this API group
func Kind(kind string) schema.GroupKind {
return schema.GroupKind{Group: GroupName, Kind: kind}
}
Loading