Skip to content

Commit 1541b9d

Browse files
Merge pull request #61 from almaslennikov/revert-changes-for-ocp
Revert "Deploy configuration daemon DS during config template reconcile"
2 parents b165aaf + bf5e165 commit 1541b9d

File tree

18 files changed

+19
-593
lines changed

18 files changed

+19
-593
lines changed

Dockerfile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ RUN --mount=type=cache,target=/go/pkg/mod/ GO_GCFLAGS=${GCFLAGS} make build-mana
2828
FROM gcr.io/distroless/static:nonroot
2929
WORKDIR /
3030
COPY --from=builder /workspace/build/manager .
31-
COPY bindata /bindata
3231
USER 65532:65532
3332

3433
ENTRYPOINT ["/manager"]

config/rbac/role.yaml

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,6 @@ rules:
1010
- configmaps
1111
verbs:
1212
- get
13-
- list
14-
- watch
15-
- apiGroups:
16-
- ""
17-
resources:
18-
- events
19-
verbs:
20-
- create
2113
- apiGroups:
2214
- ""
2315
resources:
@@ -46,15 +38,6 @@ rules:
4638
- patch
4739
- update
4840
- watch
49-
- apiGroups:
50-
- apps
51-
resources:
52-
- daemonsets
53-
verbs:
54-
- create
55-
- delete
56-
- get
57-
- update
5841
- apiGroups:
5942
- configuration.net.nvidia.com
6043
resources:
@@ -107,14 +90,6 @@ rules:
10790
- get
10891
- patch
10992
- update
110-
- apiGroups:
111-
- coordination.k8s.io
112-
resources:
113-
- leases
114-
verbs:
115-
- create
116-
- get
117-
- update
11893
- apiGroups:
11994
- maintenance.nvidia.com
12095
resources:
@@ -127,11 +102,3 @@ rules:
127102
- patch
128103
- update
129104
- watch
130-
- apiGroups:
131-
- security.openshift.io
132-
resourceNames:
133-
- privileged
134-
resources:
135-
- securitycontextconstraints
136-
verbs:
137-
- use

bindata/manifests/daemon/config-daemon.yaml renamed to deployment/nic-configuration-operator-chart/templates/config-daemon.yaml

Lines changed: 12 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -2,56 +2,37 @@ apiVersion: apps/v1
22
kind: DaemonSet
33
metadata:
44
name: nic-configuration-daemon
5-
namespace: {{.Namespace}}
5+
namespace: {{ .Release.Namespace }}
66
labels:
77
app.kubernetes.io/name: nic-configuration-daemon
88
app.kubernetes.io/created-by: nic-configuration-operator
99
app.kubernetes.io/part-of: nic-configuration-operator
10-
{{- if eq .ClusterType "openshift" }}
11-
annotations:
12-
release.openshift.io/version: "{{.ReleaseVersion}}"
13-
{{- end }}
10+
{{- include "nic-configuration-operator.labels" . | nindent 4 }}
1411
spec:
1512
selector:
1613
matchLabels:
17-
app: nic-configuration-daemon
14+
control-plane: nic-configuration-daemon
15+
{{- include "nic-configuration-operator.selectorLabels" . | nindent 6 }}
1816
template:
1917
metadata:
2018
annotations:
2119
kubectl.kubernetes.io/default-container: nic-configuration-daemon
22-
{{- if eq .ClusterType "openshift" }}
23-
openshift.io/required-scc: privileged
24-
{{- end }}
2520
labels:
26-
app: nic-configuration-daemon
27-
component: network
28-
type: infra
29-
{{- if eq .ClusterType "openshift" }}
30-
openshift.io/component: network
31-
{{- end }}
21+
control-plane: nic-configuration-daemon
22+
{{- include "nic-configuration-operator.selectorLabels" . | nindent 8 }}
3223
spec:
33-
serviceAccountName: {{.ServiceAccountName}}
24+
nodeSelector: {{- toYaml .Values.operator.nodeSelector | nindent 8 }}
25+
serviceAccountName: {{ include "nic-configuration-operator.serviceAccountName" . }}
3426
terminationGracePeriodSeconds: 10
3527
hostNetwork: true
3628
hostPID: true
3729
priorityClassName: system-node-critical
38-
{{- if .ImagePullSecrets }}
39-
imagePullSecrets:
40-
{{- range .ImagePullSecrets }}
41-
- name: {{ . }}
42-
{{- end }}
43-
{{- end }}
44-
{{- if .NodeSelector }}
45-
nodeSelector: {{.NodeSelector}}
46-
{{- end }}
4730
containers:
48-
- image: {{.Image}}
31+
- image: "{{ .Values.configDaemon.image.repository }}/{{ .Values.configDaemon.image.name }}:{{ .Values.configDaemon.image.tag | default .Chart.AppVersion }}"
4932
name: nic-configuration-daemon
5033
securityContext:
5134
privileged: true
52-
{{- if .Resources }}
53-
resources: {{.Resources}}
54-
{{- end }}
35+
resources: {{- toYaml .Values.configDaemon.resources | nindent 12 }}
5536
env:
5637
- name: NODE_NAME
5738
valueFrom:
@@ -61,9 +42,9 @@ spec:
6142
valueFrom:
6243
fieldRef:
6344
fieldPath: metadata.namespace
64-
{{- if .LogLevel }}
45+
{{- if .Values.logLevel}}
6546
- name: LOG_LEVEL
66-
value: {{.LogLevel}}
47+
value: {{ .Values.logLevel }}
6748
{{- end}}
6849
volumeMounts:
6950
- name: sys

deployment/nic-configuration-operator-chart/templates/nic-configuration-operator-configmap.yaml

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

deployment/nic-configuration-operator-chart/templates/operator.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,11 @@ spec:
4040
capabilities:
4141
drop:
4242
- ALL
43+
{{- if .Values.logLevel}}
4344
env:
44-
- name: NAMESPACE
45-
valueFrom:
46-
fieldRef:
47-
fieldPath: metadata.namespace
45+
- name: LOG_LEVEL
46+
value: {{ .Values.logLevel }}
47+
{{- end}}
4848
livenessProbe:
4949
httpGet:
5050
path: /healthz

deployment/nic-configuration-operator-chart/templates/role.yaml

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@ rules:
1111
- configmaps
1212
verbs:
1313
- get
14-
- list
15-
- watch
1614
- apiGroups:
1715
- ""
1816
resources:
@@ -105,15 +103,3 @@ rules:
105103
- patch
106104
- update
107105
- watch
108-
- apiGroups:
109-
- apps
110-
resources:
111-
- daemonsets
112-
verbs:
113-
- create
114-
- delete
115-
- get
116-
- list
117-
- patch
118-
- update
119-
- watch

go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,10 @@ toolchain go1.22.4
77
require (
88
github.com/Mellanox/maintenance-operator/api v0.0.0-20240916123230-810ab7bb25f4
99
github.com/Mellanox/rdmamap v1.1.0
10-
github.com/go-task/slim-sprig/v3 v3.0.0
1110
github.com/jaypipes/ghw v0.12.0
1211
github.com/jaypipes/pcidb v1.0.1
1312
github.com/onsi/ginkgo/v2 v2.20.0
1413
github.com/onsi/gomega v1.34.1
15-
github.com/pkg/errors v0.9.1
1614
github.com/stretchr/testify v1.9.0
1715
github.com/vishvananda/netlink v1.3.0
1816
go.uber.org/zap v1.26.0
@@ -40,6 +38,7 @@ require (
4038
github.com/go-openapi/jsonpointer v0.21.0 // indirect
4139
github.com/go-openapi/jsonreference v0.21.0 // indirect
4240
github.com/go-openapi/swag v0.23.0 // indirect
41+
github.com/go-task/slim-sprig/v3 v3.0.0 // indirect
4342
github.com/gogo/protobuf v1.3.2 // indirect
4443
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
4544
github.com/golang/protobuf v1.5.4 // indirect
@@ -57,6 +56,7 @@ require (
5756
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
5857
github.com/modern-go/reflect2 v1.0.2 // indirect
5958
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
59+
github.com/pkg/errors v0.9.1 // indirect
6060
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
6161
github.com/prometheus/client_golang v1.20.2 // indirect
6262
github.com/prometheus/client_model v0.6.1 // indirect

internal/controller/nicconfigurationtemplate_controller.go

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ package controller
1919
import (
2020
"context"
2121
"fmt"
22-
"os"
2322
"reflect"
2423
"slices"
2524
"strings"
@@ -37,7 +36,6 @@ import (
3736
"sigs.k8s.io/controller-runtime/pkg/reconcile"
3837

3938
v1alpha1 "github.com/Mellanox/nic-configuration-operator/api/v1alpha1"
40-
"github.com/Mellanox/nic-configuration-operator/pkg/syncdaemon"
4139
)
4240

4341
const nicConfigurationTemplateSyncEventName = "nic-configuration-template-sync-event"
@@ -56,14 +54,10 @@ type NicConfigurationTemplateReconciler struct {
5654
//+kubebuilder:rbac:groups=configuration.net.nvidia.com,resources=nicdevices,verbs=get;list;watch;create;update;patch;delete
5755
//+kubebuilder:rbac:groups=configuration.net.nvidia.com,resources=nicdevices/finalizers,verbs=update
5856
//+kubebuilder:rbac:groups="",resources=nodes,verbs=get;list;watch;update;patch
59-
//+kubebuilder:rbac:groups="",resources=configmaps,verbs=get;list;watch
60-
//+kubebuilder:rbac:groups="",resources=events,verbs=create
57+
//+kubebuilder:rbac:groups="",resources=configmaps,verbs=get
6158
//+kubebuilder:rbac:groups="",resources=pods,verbs=list
6259
//+kubebuilder:rbac:groups="",resources=pods/eviction,verbs=create;delete;get;list;patch;update;watch
6360
//+kubebuilder:rbac:groups=maintenance.nvidia.com,resources=nodemaintenances,verbs=get;list;watch;create;update;patch;delete
64-
//+kubebuilder:rbac:groups=coordination.k8s.io,resources=leases,verbs=get;update;create
65-
//+kubebuilder:rbac:groups=apps,resources=daemonsets,verbs=get;create;update;delete
66-
//+kubebuilder:rbac:groups=security.openshift.io,resources=securitycontextconstraints,verbs=use,resourceNames=privileged
6761

6862
// Reconcile reconciles the NicConfigurationTemplate object
6963
func (r *NicConfigurationTemplateReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {
@@ -178,12 +172,6 @@ func (r *NicConfigurationTemplateReconciler) Reconcile(ctx context.Context, req
178172
}
179173
}
180174

181-
err = syncdaemon.SyncConfigDaemonObjs(ctx, r.Client, r.Scheme, os.Getenv("NAMESPACE"))
182-
if err != nil {
183-
log.Log.Error(err, "failed to sync ds")
184-
return ctrl.Result{}, err
185-
}
186-
187175
return ctrl.Result{}, nil
188176
}
189177

pkg/consts/consts.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,4 @@ const (
8282
Mlx5ModuleVersionPath = "/sys/bus/pci/drivers/mlx5_core/module/version"
8383

8484
FwConfigNotAppliedAfterRebootErrorMsg = "firmware configuration failed to apply after reboot"
85-
86-
ConfigDaemonManifestsPath = "./bindata/manifests/daemon"
87-
88-
OperatorConfigMapName = "nic-configuration-operator-config"
8985
)

0 commit comments

Comments
 (0)