Skip to content

Commit 5aabd28

Browse files
operator-sdk upgrade working
Signed-off-by: Carlos Eduardo Arango Gutierrez <[email protected]>
1 parent 4caf843 commit 5aabd28

15 files changed

+152
-245
lines changed

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ BUNDLE_METADATA_OPTS ?= $(BUNDLE_CHANNELS) $(BUNDLE_DEFAULT_CHANNEL)
2929
BUNDLE_IMG ?= controller-bundle:$(VERSION)
3030

3131
# Image URL to use all building/pushing image targets
32-
IMAGE_BUILD_CMD ?= "docker build"
33-
IMAGE_PUSH_CMD ?= "docker push"
32+
IMAGE_BUILD_CMD ?= docker build
33+
IMAGE_PUSH_CMD ?= docker push
3434
IMAGE_BUILD_EXTRA_OPTS ?=
3535
IMAGE_REGISTRY ?= k8s.gcr.io/nfd
3636
IMAGE_NAME := node-feature-discovery-operator
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
apiVersion: v1
22
kind: ServiceAccount
33
metadata:
4-
name: nfd-master
4+
name: nfd-operator
55

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
apiVersion: rbac.authorization.k8s.io/v1
22
kind: ClusterRole
33
metadata:
4-
name: nfd-master
4+
name: nfd-operator
55
rules:
66
- apiGroups:
77
- ""
@@ -11,4 +11,4 @@ rules:
1111
verbs:
1212
- get
1313
- patch
14-
- update
14+
- update
Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
apiVersion: rbac.authorization.k8s.io/v1
22
kind: ClusterRoleBinding
33
metadata:
4-
name: nfd-master
4+
name: nfd-operator
55
roleRef:
66
apiGroup: rbac.authorization.k8s.io
77
kind: ClusterRole
8-
name: nfd-master
8+
name: nfd-operator
99
subjects:
1010
- kind: ServiceAccount
11-
name: nfd-master
11+
name: nfd-operator
1212
namespace: node-feature-discovery-operator-devel
13-
userNames:
14-
- system:serviceaccount:node-feature-discovery-operator:nfd-master
13+

build/assets/master/0400_master_daemonset.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ spec:
1313
labels:
1414
app: nfd-master
1515
spec:
16-
serviceAccount: nfd-master
16+
serviceAccount: nfd-operator
1717
nodeSelector:
1818
node-role.kubernetes.io/master: ""
1919
tolerations:

build/assets/worker/0100_service_account.yaml

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

build/assets/worker/0200_role.yaml

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

build/assets/worker/0700_worker_daemonset.yaml renamed to build/assets/worker/0200_worker_daemonset.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ spec:
2828
operator: Exists
2929
hostNetwork: true
3030
dnsPolicy: ClusterFirstWithHostNet
31-
serviceAccount: nfd-worker
31+
serviceAccount: nfd-operator
3232
readOnlyRootFilesystem: true
3333
containers:
3434
- env:

build/assets/worker/0300_role_binding.yaml

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

config/manager/kustomization.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@ kind: Kustomization
1313
images:
1414
- name: controller
1515
newName: quay.io/eduardoarango/node-feature-discovery-operator
16-
newTag: v0.2.0-9-g3baab694-dirty
16+
newTag: sdk

controllers/nodefeaturediscovery_controller.go

Lines changed: 10 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,6 @@ import (
3939

4040
var log = logf.Log.WithName("controller_nodefeaturediscovery")
4141

42-
const finalizer = "foreground-deletion"
43-
4442
var nfd NFD
4543

4644
// NodeFeatureDiscoveryReconciler reconciles a NodeFeatureDiscovery object
@@ -58,10 +56,7 @@ func (r *NodeFeatureDiscoveryReconciler) SetupWithManager(mgr ctrl.Manager) erro
5856
// we want to initate reconcile loop only on spec change of the object
5957
p := predicate.Funcs{
6058
UpdateFunc: func(e event.UpdateEvent) bool {
61-
if !validateUpdateEvent(&e) {
62-
return false
63-
}
64-
return true
59+
return validateUpdateEvent(&e)
6560
},
6661
}
6762

@@ -141,46 +136,6 @@ func (r *NodeFeatureDiscoveryReconciler) Reconcile(ctx context.Context, req ctrl
141136
return ctrl.Result{Requeue: true}, err
142137
}
143138

144-
//// Handle managed deletion
145-
//if instance.DeletionTimestamp != nil {
146-
// r.Log.Info("Handle managed deletion")
147-
// // delete components
148-
// if err := r.deleteComponents(instance); err != nil {
149-
// klog.Errorf("failed to delete components: %v", err)
150-
// r.Recorder.Eventf(instance, corev1.EventTypeWarning, "Deletion failed", "Failed to delete components: %v", err)
151-
// return reconcile.Result{}, err
152-
// }
153-
// r.Recorder.Eventf(instance, corev1.EventTypeNormal, "Deletion succeeded", "Succeeded to delete all components")
154-
//
155-
// if r.isComponentsExist(instance) {
156-
// return reconcile.Result{RequeueAfter: 10 * time.Second}, nil
157-
// }
158-
//
159-
// // remove finalizer
160-
// if hasFinalizer(instance, finalizer) {
161-
// controllerutil.RemoveFinalizer(instance, finalizer)
162-
// if err := r.Update(context.TODO(), instance); err != nil {
163-
// klog.Error("Could not remove finalizer after running finalization logic", "error", fmt.Sprintf("%v", err))
164-
// return reconcile.Result{}, err
165-
// }
166-
//
167-
// return reconcile.Result{}, nil
168-
// }
169-
//}
170-
//
171-
//// add finalizer
172-
//r.Log.Info("add finalizer")
173-
//if !hasFinalizer(instance, finalizer) {
174-
// instance.Finalizers = append(instance.Finalizers, finalizer)
175-
// instance.Status.Conditions = r.getProgressingConditions("DeploymentStarting", "Deployment is starting")
176-
// if err := r.Update(context.TODO(), instance); err != nil {
177-
// return reconcile.Result{}, err
178-
// }
179-
//
180-
// // we exit reconcile loop because we will have additional update reconcile
181-
// return reconcile.Result{}, nil
182-
//}
183-
184139
// apply components
185140
r.Log.Info("Ready to apply components")
186141

@@ -199,21 +154,12 @@ func (r *NodeFeatureDiscoveryReconciler) Reconcile(ctx context.Context, req ctrl
199154
return ctrl.Result{}, nil
200155
}
201156

202-
func (r *NodeFeatureDiscoveryReconciler) deleteComponents(cr *nfdv1.NodeFeatureDiscovery) error {
203-
204-
return nil
205-
}
206-
207-
func hasFinalizer(cr *nfdv1.NodeFeatureDiscovery, finalizer string) bool {
208-
for _, f := range cr.Finalizers {
209-
if f == finalizer {
210-
return true
211-
}
212-
}
213-
return false
214-
}
215-
216-
func (r *NodeFeatureDiscoveryReconciler) isComponentsExist(cr *nfdv1.NodeFeatureDiscovery) bool {
217-
218-
return false
219-
}
157+
//func (r *NodeFeatureDiscoveryReconciler) deleteComponents(cr *nfdv1.NodeFeatureDiscovery) error {
158+
//
159+
// return nil
160+
//}
161+
//
162+
//func (r *NodeFeatureDiscoveryReconciler) isComponentsExist(cr *nfdv1.NodeFeatureDiscovery) bool {
163+
//
164+
// return false
165+
//}

controllers/nodefeaturediscovery_controls.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ func Namespace(n NFD) (ResourceStatus, error) {
7070
return NotReady, err
7171
}
7272

73-
logger.Info("Found, skpping update")
73+
logger.Info("Found, skipping update")
7474

7575
return Ready, nil
7676
}
@@ -104,7 +104,7 @@ func ServiceAccount(n NFD) (ResourceStatus, error) {
104104
return NotReady, err
105105
}
106106

107-
logger.Info("Found, skpping update")
107+
logger.Info("Found, skipping update")
108108

109109
return Ready, nil
110110
}

0 commit comments

Comments
 (0)