Skip to content

Commit

Permalink
Run nfd-master as Deployment
Browse files Browse the repository at this point in the history
Signed-off-by: Carlos Eduardo Arango Gutierrez <carangog@redhat.com>
  • Loading branch information
ArangoGutierrez committed Apr 19, 2022
1 parent cc4bca7 commit 539372d
Show file tree
Hide file tree
Showing 12 changed files with 254 additions and 131 deletions.
37 changes: 0 additions & 37 deletions build/assets/master/0400_master_daemonset.yaml

This file was deleted.

86 changes: 86 additions & 0 deletions build/assets/master/0400_master_deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: nfd-master
name: nfd-master
spec:
replicas: 1
selector:
matchLabels:
app: nfd-master
template:
metadata:
labels:
app: nfd-master
spec:
serviceAccount: nfd-master
serviceAccountName: nfd-master
dnsPolicy: ClusterFirstWithHostNet
restartPolicy: Always
tolerations:
- effect: NoSchedule
key: node-role.kubernetes.io/master
operator: Equal
- effect: NoSchedule
key: node-role.kubernetes.io/control-plane
operator: Equal
affinity:
nodeAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- preference:
matchExpressions:
- key: node-role.kubernetes.io/master
operator: In
values:
- ""
weight: 1
- preference:
matchExpressions:
- key: node-role.kubernetes.io/control-plane
operator: In
values:
- ""
weight: 1
containers:
- name: nfd-master
env:
- name: NODE_NAME
valueFrom:
fieldRef:
apiVersion: v1
fieldPath: spec.nodeName
image: $(NODE_FEATURE_DISCOVERY_IMAGE)
imagePullPolicy: Always
command:
- "nfd-master"
args: []
securityContext:
allowPrivilegeEscalation: false
capabilities:
drop:
- ALL
readOnlyRootFilesystem: true
runAsNonRoot: true
volumeMounts: []
livenessProbe:
exec:
command:
- /usr/bin/grpc_health_probe
- -addr=:12000
failureThreshold: 3
initialDelaySeconds: 10
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 1
readinessProbe:
exec:
command:
- /usr/bin/grpc_health_probe
- -addr=:12000
failureThreshold: 10
initialDelaySeconds: 5
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 1
volumes: []
5 changes: 1 addition & 4 deletions build/assets/master/0500_service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,9 @@ kind: Service
metadata:
name: nfd-master
spec:
type: ClusterIP
selector:
app: nfd-master
ports:
- protocol: TCP
port: 12000
targetPort: 12000
name: nfd

type: ClusterIP
2 changes: 1 addition & 1 deletion config/manager/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ kind: Kustomization
images:
- name: controller
newName: k8s.gcr.io/nfd/node-feature-discovery-operator
newTag: 0.4.0
newTag: 0.4.1
24 changes: 0 additions & 24 deletions config/manifests/bases/nfd-operator.clusterserviceversion.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -308,30 +308,6 @@ spec:
- patch
- update
- watch
- apiGroups:
- monitoring.coreos.com
resources:
- prometheusrules
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
- monitoring.coreos.com
resources:
- servicemonitors
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
- nfd.kubernetes.io
resources:
Expand Down
1 change: 0 additions & 1 deletion config/manifests/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,5 @@ kind: Kustomization
resources:
- bases/nfd-operator.clusterserviceversion.yaml
- ../default
- ../prometheus
- ../samples
- ../scorecard
1 change: 0 additions & 1 deletion config/rbac/role.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
Expand Down
11 changes: 6 additions & 5 deletions controllers/nodefeaturediscovery_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ func validateUpdateEvent(e *event.UpdateEvent) bool {
// +kubebuilder:rbac:groups=core,resources=pods,verbs=get;list;watch;create;update;patch;delete
// +kubebuilder:rbac:groups=core,resources=pods/log,verbs=get
// +kubebuilder:rbac:groups=apps,resources=daemonsets,verbs=get;list;watch;create;update;patch;delete
// +kubebuilder:rbac:groups=apps,resources=deployments,verbs=get;list;watch;create;update;patch;delete
// +kubebuilder:rbac:groups=core,resources=namespaces,verbs=get;list;watch;create;update;patch;delete
// +kubebuilder:rbac:groups=core,resources=nodes,verbs=get;list;watch;create;update;patch;delete
// +kubebuilder:rbac:groups=core,resources=configmaps,verbs=get;list;watch;create;update;patch;delete
Expand Down Expand Up @@ -235,13 +236,13 @@ func (r *NodeFeatureDiscoveryReconciler) Reconcile(ctx context.Context, req ctrl
return r.updateDegradedCondition(instance, err.Error(), "nfd-worker Daemonset has been degraded")
}

// Check the status of the NFD Operator Master DaemonSet
if rstatus, err := r.getMasterDaemonSetConditions(ctx, instance); err != nil {
return r.updateDegradedCondition(instance, conditionFailedGettingNFDMasterDaemonSet, err.Error())
// Check the status of the NFD Operator Master Deployment
if rstatus, err := r.getMasterDeploymentConditions(ctx, instance); err != nil {
return r.updateDegradedCondition(instance, conditionFailedGettingNFDMasterDeployment, err.Error())
} else if rstatus.isProgressing {
return r.updateProgressingCondition(instance, err.Error(), "nfd-master Daemonset is progressing")
return r.updateProgressingCondition(instance, err.Error(), "nfd-master Deployment is progressing")
} else if rstatus.isDegraded {
return r.updateDegradedCondition(instance, err.Error(), "nfd-master Daemonset has been degraded")
return r.updateDegradedCondition(instance, err.Error(), "nfd-master Deployment has been degraded")
}

// Check if nfd-topology-updater is needed, if not, skip
Expand Down
Loading

0 comments on commit 539372d

Please sign in to comment.