Skip to content

Commit 929886d

Browse files
committed
WIP
Signed-off-by: Sebastian Sch <[email protected]>
1 parent 07a7f05 commit 929886d

File tree

7,914 files changed

+2255545
-1331
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

7,914 files changed

+2255545
-1331
lines changed

Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ RUN make _build-manager BIN_PATH=build/_output/cmd
55
RUN make _build-sriov-network-operator-config-cleanup BIN_PATH=build/_output/cmd
66

77
FROM quay.io/centos/centos:stream9
8+
RUN yum -y install delve procps-ng
89
COPY --from=builder /go/src/github.com/k8snetworkplumbingwg/sriov-network-operator/build/_output/cmd/manager /usr/bin/sriov-network-operator
910
COPY --from=builder /go/src/github.com/k8snetworkplumbingwg/sriov-network-operator/build/_output/cmd/sriov-network-operator-config-cleanup /usr/bin/sriov-network-operator-config-cleanup
1011
COPY bindata /bindata

Dockerfile.sriov-network-config-daemon

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ FROM quay.io/centos/centos:stream9
77
ARG MSTFLINT=mstflint
88
# We have to ensure that pciutils is installed. This package is needed for mstfwreset to succeed.
99
# xref pkg/vendors/mellanox/mellanox.go#L150
10-
RUN ARCH_DEP_PKGS=$(if [ "$(uname -m)" != "s390x" ]; then echo -n ${MSTFLINT} ; fi) && yum -y install hwdata pciutils $ARCH_DEP_PKGS && yum clean all
10+
RUN ARCH_DEP_PKGS=$(if [ "$(uname -m)" != "s390x" ]; then echo -n ${MSTFLINT} ; fi) && yum -y install delve procps-ng hwdata pciutils $ARCH_DEP_PKGS && yum clean all
1111
LABEL io.k8s.display-name="sriov-network-config-daemon" \
1212
io.k8s.description="This is a daemon that manage and config sriov network devices in Kubernetes cluster"
1313
COPY --from=builder /go/src/github.com/k8snetworkplumbingwg/sriov-network-operator/build/_output/cmd/sriov-network-config-daemon /usr/bin/

api/v1/helper.go

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ import (
88
"path/filepath"
99
"reflect"
1010
"regexp"
11+
"sigs.k8s.io/controller-runtime/pkg/event"
12+
"sigs.k8s.io/controller-runtime/pkg/predicate"
1113
"slices"
1214
"sort"
1315
"strconv"
@@ -1005,3 +1007,66 @@ func GenerateBridgeName(iface *InterfaceExt) string {
10051007
func NeedToUpdateBridges(bridgeSpec, bridgeStatus *Bridges) bool {
10061008
return !reflect.DeepEqual(bridgeSpec, bridgeStatus)
10071009
}
1010+
1011+
type DrainAnnotationPredicate struct {
1012+
predicate.Funcs
1013+
}
1014+
1015+
func (DrainAnnotationPredicate) Create(e event.CreateEvent) bool {
1016+
if e.Object == nil {
1017+
return false
1018+
}
1019+
1020+
if _, hasAnno := e.Object.GetAnnotations()[consts.NodeDrainAnnotation]; hasAnno {
1021+
return true
1022+
}
1023+
return false
1024+
}
1025+
1026+
func (DrainAnnotationPredicate) Update(e event.UpdateEvent) bool {
1027+
if e.ObjectOld == nil {
1028+
return false
1029+
}
1030+
if e.ObjectNew == nil {
1031+
return false
1032+
}
1033+
1034+
oldAnno, hasOldAnno := e.ObjectOld.GetAnnotations()[consts.NodeDrainAnnotation]
1035+
newAnno, hasNewAnno := e.ObjectNew.GetAnnotations()[consts.NodeDrainAnnotation]
1036+
1037+
if !hasOldAnno && hasNewAnno {
1038+
return true
1039+
}
1040+
1041+
return oldAnno != newAnno
1042+
}
1043+
1044+
type DrainStateAnnotationPredicate struct {
1045+
predicate.Funcs
1046+
}
1047+
1048+
func (DrainStateAnnotationPredicate) Create(e event.CreateEvent) bool {
1049+
if e.Object == nil {
1050+
return false
1051+
}
1052+
1053+
return true
1054+
}
1055+
1056+
func (DrainStateAnnotationPredicate) Update(e event.UpdateEvent) bool {
1057+
if e.ObjectOld == nil {
1058+
return false
1059+
}
1060+
if e.ObjectNew == nil {
1061+
return false
1062+
}
1063+
1064+
oldAnno, hasOldAnno := e.ObjectOld.GetLabels()[consts.NodeStateDrainAnnotationCurrent]
1065+
newAnno, hasNewAnno := e.ObjectNew.GetLabels()[consts.NodeStateDrainAnnotationCurrent]
1066+
1067+
if !hasOldAnno || !hasNewAnno {
1068+
return true
1069+
}
1070+
1071+
return oldAnno != newAnno
1072+
}

bindata/manifests/daemon/daemonset.yaml

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,12 +130,24 @@ spec:
130130
containers:
131131
- name: sriov-network-config-daemon
132132
image: {{.Image}}
133-
command:
134-
- sriov-network-config-daemon
133+
imagePullPolicy: Always
135134
securityContext:
136135
privileged: true
136+
command:
137+
- sriov-network-config-daemon
137138
args:
138139
- "start"
140+
# command:
141+
# - dlv
142+
# - --listen=:2345
143+
# - --headless=true
144+
# - --api-version=2
145+
# - --accept-multiclient
146+
# - --log
147+
# - exec
148+
# - /usr/bin/sriov-network-config-daemon
149+
# - --
150+
# - start
139151
{{- if .UsedSystemdMode}}
140152
- --use-systemd-service
141153
{{- end }}

bindata/manifests/operator-webhook/server.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ spec:
6464
containers:
6565
- name: webhook-server
6666
image: {{.SriovNetworkWebhookImage}}
67+
imagePullPolicy: Always
6768
command:
6869
- webhook
6970
args:

bindata/manifests/plugins/sriov-device-plugin.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ spec:
4242
containers:
4343
- name: sriov-device-plugin
4444
image: {{.SRIOVDevicePluginImage}}
45+
imagePullPolicy: Always
4546
args:
4647
- --log-level=10
4748
- --resource-prefix={{.ResourcePrefix}}

bindata/manifests/sriov-config-service/kubernetes/sriov-config-post-network-service.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ contents: |
66
77
[Service]
88
Type=oneshot
9-
ExecStart=/var/lib/sriov/sriov-network-config-daemon -v 2 --zap-log-level 2 service --phase post
9+
ExecStart=/var/lib/sriov/sriov-network-config-daemon service --phase post
1010
StandardOutput=journal+console
1111
1212
[Install]

bindata/manifests/sriov-config-service/kubernetes/sriov-config-service.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ contents: |
77
88
[Service]
99
Type=oneshot
10-
ExecStart=/var/lib/sriov/sriov-network-config-daemon -v 2 --zap-log-level 2 service --phase pre
10+
ExecStart=/var/lib/sriov/sriov-network-config-daemon service --phase pre
1111
StandardOutput=journal+console
1212
1313
[Install]

bindata/manifests/sriov-config-service/openshift/sriov-config-service.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ spec:
2121
2222
[Service]
2323
Type=oneshot
24-
ExecStart=/var/lib/sriov/sriov-network-config-daemon service -v {{ .LogLevel }} --zap-log-level {{ .LogLevel }} --phase pre
24+
ExecStart=/var/lib/sriov/sriov-network-config-daemon service --phase pre
2525
StandardOutput=journal+console
2626
2727
[Install]
@@ -38,7 +38,7 @@ spec:
3838
3939
[Service]
4040
Type=oneshot
41-
ExecStart=/var/lib/sriov/sriov-network-config-daemon service -v {{ .LogLevel }} --zap-log-level {{ .LogLevel }} --phase post
41+
ExecStart=/var/lib/sriov/sriov-network-config-daemon service --phase post
4242
StandardOutput=journal+console
4343
4444
[Install]

bindata/manifests/webhook/server.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ spec:
6767
containers:
6868
- name: webhook-server
6969
image: {{.NetworkResourcesInjectorImage}}
70+
imagePullPolicy: Always
7071
command:
7172
- webhook
7273
args:

0 commit comments

Comments
 (0)