Skip to content

Commit

Permalink
Merge pull request #61 from almaslennikov/revert-changes-for-ocp
Browse files Browse the repository at this point in the history
Revert "Deploy configuration daemon DS during config template reconcile"
  • Loading branch information
almaslennikov authored Feb 4, 2025
2 parents b165aaf + bf5e165 commit 1541b9d
Show file tree
Hide file tree
Showing 18 changed files with 19 additions and 593 deletions.
1 change: 0 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ RUN --mount=type=cache,target=/go/pkg/mod/ GO_GCFLAGS=${GCFLAGS} make build-mana
FROM gcr.io/distroless/static:nonroot
WORKDIR /
COPY --from=builder /workspace/build/manager .
COPY bindata /bindata
USER 65532:65532

ENTRYPOINT ["/manager"]
Expand Down
33 changes: 0 additions & 33 deletions config/rbac/role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,6 @@ rules:
- configmaps
verbs:
- get
- list
- watch
- apiGroups:
- ""
resources:
- events
verbs:
- create
- apiGroups:
- ""
resources:
Expand Down Expand Up @@ -46,15 +38,6 @@ rules:
- patch
- update
- watch
- apiGroups:
- apps
resources:
- daemonsets
verbs:
- create
- delete
- get
- update
- apiGroups:
- configuration.net.nvidia.com
resources:
Expand Down Expand Up @@ -107,14 +90,6 @@ rules:
- get
- patch
- update
- apiGroups:
- coordination.k8s.io
resources:
- leases
verbs:
- create
- get
- update
- apiGroups:
- maintenance.nvidia.com
resources:
Expand All @@ -127,11 +102,3 @@ rules:
- patch
- update
- watch
- apiGroups:
- security.openshift.io
resourceNames:
- privileged
resources:
- securitycontextconstraints
verbs:
- use
Original file line number Diff line number Diff line change
Expand Up @@ -2,56 +2,37 @@ apiVersion: apps/v1
kind: DaemonSet
metadata:
name: nic-configuration-daemon
namespace: {{.Namespace}}
namespace: {{ .Release.Namespace }}
labels:
app.kubernetes.io/name: nic-configuration-daemon
app.kubernetes.io/created-by: nic-configuration-operator
app.kubernetes.io/part-of: nic-configuration-operator
{{- if eq .ClusterType "openshift" }}
annotations:
release.openshift.io/version: "{{.ReleaseVersion}}"
{{- end }}
{{- include "nic-configuration-operator.labels" . | nindent 4 }}
spec:
selector:
matchLabels:
app: nic-configuration-daemon
control-plane: nic-configuration-daemon
{{- include "nic-configuration-operator.selectorLabels" . | nindent 6 }}
template:
metadata:
annotations:
kubectl.kubernetes.io/default-container: nic-configuration-daemon
{{- if eq .ClusterType "openshift" }}
openshift.io/required-scc: privileged
{{- end }}
labels:
app: nic-configuration-daemon
component: network
type: infra
{{- if eq .ClusterType "openshift" }}
openshift.io/component: network
{{- end }}
control-plane: nic-configuration-daemon
{{- include "nic-configuration-operator.selectorLabels" . | nindent 8 }}
spec:
serviceAccountName: {{.ServiceAccountName}}
nodeSelector: {{- toYaml .Values.operator.nodeSelector | nindent 8 }}
serviceAccountName: {{ include "nic-configuration-operator.serviceAccountName" . }}
terminationGracePeriodSeconds: 10
hostNetwork: true
hostPID: true
priorityClassName: system-node-critical
{{- if .ImagePullSecrets }}
imagePullSecrets:
{{- range .ImagePullSecrets }}
- name: {{ . }}
{{- end }}
{{- end }}
{{- if .NodeSelector }}
nodeSelector: {{.NodeSelector}}
{{- end }}
containers:
- image: {{.Image}}
- image: "{{ .Values.configDaemon.image.repository }}/{{ .Values.configDaemon.image.name }}:{{ .Values.configDaemon.image.tag | default .Chart.AppVersion }}"
name: nic-configuration-daemon
securityContext:
privileged: true
{{- if .Resources }}
resources: {{.Resources}}
{{- end }}
resources: {{- toYaml .Values.configDaemon.resources | nindent 12 }}
env:
- name: NODE_NAME
valueFrom:
Expand All @@ -61,9 +42,9 @@ spec:
valueFrom:
fieldRef:
fieldPath: metadata.namespace
{{- if .LogLevel }}
{{- if .Values.logLevel}}
- name: LOG_LEVEL
value: {{.LogLevel}}
value: {{ .Values.logLevel }}
{{- end}}
volumeMounts:
- name: sys
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ spec:
capabilities:
drop:
- ALL
{{- if .Values.logLevel}}
env:
- name: NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- name: LOG_LEVEL
value: {{ .Values.logLevel }}
{{- end}}
livenessProbe:
httpGet:
path: /healthz
Expand Down
14 changes: 0 additions & 14 deletions deployment/nic-configuration-operator-chart/templates/role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ rules:
- configmaps
verbs:
- get
- list
- watch
- apiGroups:
- ""
resources:
Expand Down Expand Up @@ -105,15 +103,3 @@ rules:
- patch
- update
- watch
- apiGroups:
- apps
resources:
- daemonsets
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,10 @@ toolchain go1.22.4
require (
github.com/Mellanox/maintenance-operator/api v0.0.0-20240916123230-810ab7bb25f4
github.com/Mellanox/rdmamap v1.1.0
github.com/go-task/slim-sprig/v3 v3.0.0
github.com/jaypipes/ghw v0.12.0
github.com/jaypipes/pcidb v1.0.1
github.com/onsi/ginkgo/v2 v2.20.0
github.com/onsi/gomega v1.34.1
github.com/pkg/errors v0.9.1
github.com/stretchr/testify v1.9.0
github.com/vishvananda/netlink v1.3.0
go.uber.org/zap v1.26.0
Expand Down Expand Up @@ -40,6 +38,7 @@ require (
github.com/go-openapi/jsonpointer v0.21.0 // indirect
github.com/go-openapi/jsonreference v0.21.0 // indirect
github.com/go-openapi/swag v0.23.0 // indirect
github.com/go-task/slim-sprig/v3 v3.0.0 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/protobuf v1.5.4 // indirect
Expand All @@ -57,6 +56,7 @@ require (
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/prometheus/client_golang v1.20.2 // indirect
github.com/prometheus/client_model v0.6.1 // indirect
Expand Down
14 changes: 1 addition & 13 deletions internal/controller/nicconfigurationtemplate_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ package controller
import (
"context"
"fmt"
"os"
"reflect"
"slices"
"strings"
Expand All @@ -37,7 +36,6 @@ import (
"sigs.k8s.io/controller-runtime/pkg/reconcile"

v1alpha1 "github.com/Mellanox/nic-configuration-operator/api/v1alpha1"
"github.com/Mellanox/nic-configuration-operator/pkg/syncdaemon"
)

const nicConfigurationTemplateSyncEventName = "nic-configuration-template-sync-event"
Expand All @@ -56,14 +54,10 @@ type NicConfigurationTemplateReconciler struct {
//+kubebuilder:rbac:groups=configuration.net.nvidia.com,resources=nicdevices,verbs=get;list;watch;create;update;patch;delete
//+kubebuilder:rbac:groups=configuration.net.nvidia.com,resources=nicdevices/finalizers,verbs=update
//+kubebuilder:rbac:groups="",resources=nodes,verbs=get;list;watch;update;patch
//+kubebuilder:rbac:groups="",resources=configmaps,verbs=get;list;watch
//+kubebuilder:rbac:groups="",resources=events,verbs=create
//+kubebuilder:rbac:groups="",resources=configmaps,verbs=get
//+kubebuilder:rbac:groups="",resources=pods,verbs=list
//+kubebuilder:rbac:groups="",resources=pods/eviction,verbs=create;delete;get;list;patch;update;watch
//+kubebuilder:rbac:groups=maintenance.nvidia.com,resources=nodemaintenances,verbs=get;list;watch;create;update;patch;delete
//+kubebuilder:rbac:groups=coordination.k8s.io,resources=leases,verbs=get;update;create
//+kubebuilder:rbac:groups=apps,resources=daemonsets,verbs=get;create;update;delete
//+kubebuilder:rbac:groups=security.openshift.io,resources=securitycontextconstraints,verbs=use,resourceNames=privileged

// Reconcile reconciles the NicConfigurationTemplate object
func (r *NicConfigurationTemplateReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {
Expand Down Expand Up @@ -178,12 +172,6 @@ func (r *NicConfigurationTemplateReconciler) Reconcile(ctx context.Context, req
}
}

err = syncdaemon.SyncConfigDaemonObjs(ctx, r.Client, r.Scheme, os.Getenv("NAMESPACE"))
if err != nil {
log.Log.Error(err, "failed to sync ds")
return ctrl.Result{}, err
}

return ctrl.Result{}, nil
}

Expand Down
4 changes: 0 additions & 4 deletions pkg/consts/consts.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,4 @@ const (
Mlx5ModuleVersionPath = "/sys/bus/pci/drivers/mlx5_core/module/version"

FwConfigNotAppliedAfterRebootErrorMsg = "firmware configuration failed to apply after reboot"

ConfigDaemonManifestsPath = "./bindata/manifests/daemon"

OperatorConfigMapName = "nic-configuration-operator-config"
)
Loading

0 comments on commit 1541b9d

Please sign in to comment.