Skip to content

Commit b5c14de

Browse files
Merge pull request #41 from jmencak/crd-v1
Moving Tuned to API v1.
2 parents e5b0fbc + 634110b commit b5c14de

File tree

12 files changed

+53
-43
lines changed

12 files changed

+53
-43
lines changed

assets/tuned/07-cr-tuned.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
apiVersion: tuned.openshift.io/v1alpha1
1+
apiVersion: tuned.openshift.io/v1
22
kind: Tuned
33
metadata:
44
name: default

manifests/02-crd.yaml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,21 @@ kind: CustomResourceDefinition
33
metadata:
44
name: tuneds.tuned.openshift.io
55
spec:
6+
# group name to use for REST API: /apis/<group>/<version>
67
group: tuned.openshift.io
78
names:
9+
# kind is normally the CamelCased singular type. Your resource manifests use this.
810
kind: Tuned
911
listKind: TunedList
12+
# plural name to be used in the URL: /apis/<group>/<version>/<plural>
1013
plural: tuneds
14+
# singular name to be used as an alias on the CLI and for display
1115
singular: tuned
1216
scope: Namespaced
13-
version: v1alpha1
17+
# list of versions supported by this CustomResourceDefinition
18+
versions:
19+
- name: v1
20+
# Each version can be enabled/disabled by Served flag.
21+
served: true
22+
# One and only one version must be marked as the storage version.
23+
storage: true
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
package apis
22

33
import (
4-
"github.com/openshift/cluster-node-tuning-operator/pkg/apis/tuned/v1alpha1"
4+
"github.com/openshift/cluster-node-tuning-operator/pkg/apis/tuned/v1"
55
)
66

77
func init() {
88
// Register the types with the Scheme so the components can map objects to GroupVersionKinds and back
9-
AddToSchemes = append(AddToSchemes, v1alpha1.SchemeBuilder.AddToScheme)
9+
AddToSchemes = append(AddToSchemes, v1.SchemeBuilder.AddToScheme)
1010
}

pkg/apis/tuned/v1/doc.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// Package v1 contains API Schema definitions for the tuned v1 API group
2+
// +k8s:deepcopy-gen=package,register
3+
// +groupName=tuned.openshift.io
4+
package v1

pkg/apis/tuned/v1alpha1/register.go renamed to pkg/apis/tuned/v1/register.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
// NOTE: Boilerplate only. Ignore this file.
22

3-
// Package v1alpha1 contains API Schema definitions for the tuned v1alpha1 API group
3+
// Package v1 contains API Schema definitions for the tuned v1 API group
44
// +k8s:deepcopy-gen=package,register
55
// +groupName=tuned.openshift.io
6-
package v1alpha1
6+
package v1
77

88
import (
99
"k8s.io/apimachinery/pkg/runtime/schema"
@@ -12,7 +12,7 @@ import (
1212

1313
var (
1414
// SchemeGroupVersion is group version used to register these objects
15-
SchemeGroupVersion = schema.GroupVersion{Group: "tuned.openshift.io", Version: "v1alpha1"}
15+
SchemeGroupVersion = schema.GroupVersion{Group: "tuned.openshift.io", Version: "v1"}
1616

1717
// SchemeBuilder is used to add go types to the GroupVersionKind scheme
1818
SchemeBuilder = &scheme.Builder{GroupVersion: SchemeGroupVersion}

pkg/apis/tuned/v1alpha1/tuned_types.go renamed to pkg/apis/tuned/v1/tuned_types.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Important: Run "operator-sdk generate k8s" to regenerate code after modifying this file
2-
package v1alpha1
2+
package v1
33

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

pkg/apis/tuned/v1alpha1/zz_generated.deepcopy.go renamed to pkg/apis/tuned/v1/zz_generated.deepcopy.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/apis/tuned/v1alpha1/doc.go

Lines changed: 0 additions & 4 deletions
This file was deleted.

pkg/controller/tuned/tuned_controller.go

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import (
66
"time"
77

88
configv1client "github.com/openshift/client-go/config/clientset/versioned/typed/config/v1"
9-
tunedv1alpha1 "github.com/openshift/cluster-node-tuning-operator/pkg/apis/tuned/v1alpha1"
9+
tunedv1 "github.com/openshift/cluster-node-tuning-operator/pkg/apis/tuned/v1"
1010
ntoconfig "github.com/openshift/cluster-node-tuning-operator/pkg/config"
1111
"github.com/openshift/cluster-node-tuning-operator/pkg/manifests"
1212

@@ -50,15 +50,15 @@ func add(mgr manager.Manager, r reconcile.Reconciler) error {
5050
}
5151

5252
// Watch for changes to primary resource Tuned
53-
err = c.Watch(&source.Kind{Type: &tunedv1alpha1.Tuned{}}, &handler.EnqueueRequestForObject{})
53+
err = c.Watch(&source.Kind{Type: &tunedv1.Tuned{}}, &handler.EnqueueRequestForObject{})
5454
if err != nil {
5555
return err
5656
}
5757

5858
// Watch for changes to secondary resource DaemonSet and requeue the owner Tuned
5959
err = c.Watch(&source.Kind{Type: &appsv1.DaemonSet{}}, &handler.EnqueueRequestForOwner{
6060
IsController: true,
61-
OwnerType: &tunedv1alpha1.Tuned{},
61+
OwnerType: &tunedv1.Tuned{},
6262
})
6363
if err != nil {
6464
return err
@@ -85,7 +85,7 @@ type ReconcileTuned struct {
8585
cfgv1client *configv1client.ConfigV1Client
8686
}
8787

88-
func (r *ReconcileTuned) syncServiceAccount(tuned *tunedv1alpha1.Tuned) error {
88+
func (r *ReconcileTuned) syncServiceAccount(tuned *tunedv1.Tuned) error {
8989
glog.V(1).Infof("syncServiceAccount()")
9090
saManifest, err := r.manifestFactory.TunedServiceAccount()
9191
if err != nil {
@@ -116,7 +116,7 @@ func (r *ReconcileTuned) syncServiceAccount(tuned *tunedv1alpha1.Tuned) error {
116116
return nil
117117
}
118118

119-
func (r *ReconcileTuned) syncClusterRole(tuned *tunedv1alpha1.Tuned) error {
119+
func (r *ReconcileTuned) syncClusterRole(tuned *tunedv1.Tuned) error {
120120
glog.V(1).Infof("syncClusterRole()")
121121
crManifest, err := r.manifestFactory.TunedClusterRole()
122122
if err != nil {
@@ -147,7 +147,7 @@ func (r *ReconcileTuned) syncClusterRole(tuned *tunedv1alpha1.Tuned) error {
147147
return nil
148148
}
149149

150-
func (r *ReconcileTuned) syncClusterRoleBinding(tuned *tunedv1alpha1.Tuned) error {
150+
func (r *ReconcileTuned) syncClusterRoleBinding(tuned *tunedv1.Tuned) error {
151151
glog.V(1).Infof("syncClusterRoleBinding()")
152152
crbManifest, err := r.manifestFactory.TunedClusterRoleBinding()
153153
if err != nil {
@@ -178,9 +178,9 @@ func (r *ReconcileTuned) syncClusterRoleBinding(tuned *tunedv1alpha1.Tuned) erro
178178
return nil
179179
}
180180

181-
func (r *ReconcileTuned) syncClusterConfigMap(f func(tuned []tunedv1alpha1.Tuned) (*corev1.ConfigMap, error), tuned *tunedv1alpha1.Tuned) error {
181+
func (r *ReconcileTuned) syncClusterConfigMap(f func(tuned []tunedv1.Tuned) (*corev1.ConfigMap, error), tuned *tunedv1.Tuned) error {
182182
glog.V(1).Infof("syncClusterConfigMap()")
183-
tunedList := &tunedv1alpha1.TunedList{}
183+
tunedList := &tunedv1.TunedList{}
184184
listOps := &client.ListOptions{Namespace: tuned.Namespace}
185185
err := r.client.List(context.TODO(), listOps, tunedList)
186186
if err != nil {
@@ -216,7 +216,7 @@ func (r *ReconcileTuned) syncClusterConfigMap(f func(tuned []tunedv1alpha1.Tuned
216216
return nil
217217
}
218218

219-
func (r *ReconcileTuned) syncDaemonSet(tuned *tunedv1alpha1.Tuned) error {
219+
func (r *ReconcileTuned) syncDaemonSet(tuned *tunedv1.Tuned) error {
220220
glog.V(1).Infof("syncDaemonSet()")
221221
dsManifest, err := r.manifestFactory.TunedDaemonSet()
222222
if err != nil {
@@ -267,7 +267,7 @@ func createCustomResource(mgr manager.Manager) error {
267267
return nil
268268
}
269269

270-
func addOwnerReference(meta *metav1.ObjectMeta, tuned *tunedv1alpha1.Tuned) []metav1.OwnerReference {
270+
func addOwnerReference(meta *metav1.ObjectMeta, tuned *tunedv1.Tuned) []metav1.OwnerReference {
271271
var isController bool
272272
if tuned.Name == "default" {
273273
isController = true
@@ -285,7 +285,7 @@ func addOwnerReference(meta *metav1.ObjectMeta, tuned *tunedv1alpha1.Tuned) []me
285285
}
286286

287287
ownerReference := metav1.OwnerReference{
288-
APIVersion: tunedv1alpha1.SchemeGroupVersion.String(),
288+
APIVersion: tunedv1.SchemeGroupVersion.String(),
289289
Kind: "Tuned",
290290
Name: tuned.Name,
291291
UID: tuned.UID,
@@ -309,7 +309,7 @@ func (r *ReconcileTuned) Reconcile(request reconcile.Request) (reconcile.Result,
309309
reconcileResult := reconcile.Result{RequeueAfter: reconcilePeriod}
310310

311311
// Fetch the Tuned instance
312-
tunedInstance := &tunedv1alpha1.Tuned{}
312+
tunedInstance := &tunedv1.Tuned{}
313313
err := r.client.Get(context.TODO(), request.NamespacedName, tunedInstance)
314314
if err != nil {
315315
glog.Errorf("Couldn't get tunedInstance(): %v", err)

pkg/manifests/bindata.go

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)