diff --git a/apis/v1alpha1/tcxProgram_types.go b/apis/v1alpha1/tcxProgram_types.go index 31f2b223e..08648ae87 100644 --- a/apis/v1alpha1/tcxProgram_types.go +++ b/apis/v1alpha1/tcxProgram_types.go @@ -35,6 +35,7 @@ import ( // +kubebuilder:printcolumn:name="Direction",type=string,JSONPath=`.spec.direction`,priority=1 // +kubebuilder:printcolumn:name="InterfaceSelector",type=string,JSONPath=`.spec.interfaceselector`,priority=1 // +kubebuilder:printcolumn:name="Position",type=string,JSONPath=`.spec.position`,priority=1 +// +kubebuilder:printcolumn:name="Priority",type=string,JSONPath=`.spec.priority`,priority=1 type TcxProgram struct { metav1.TypeMeta `json:",inline"` metav1.ObjectMeta `json:"metadata,omitempty"` diff --git a/bundle/manifests/bpfman.io_tcxprograms.yaml b/bundle/manifests/bpfman.io_tcxprograms.yaml index 4aeb98cd2..e230c0dac 100644 --- a/bundle/manifests/bpfman.io_tcxprograms.yaml +++ b/bundle/manifests/bpfman.io_tcxprograms.yaml @@ -36,6 +36,10 @@ spec: name: Position priority: 1 type: string + - jsonPath: .spec.priority + name: Priority + priority: 1 + type: string name: v1alpha1 schema: openAPIV3Schema: diff --git a/config/crd/bases/bpfman.io_tcxprograms.yaml b/config/crd/bases/bpfman.io_tcxprograms.yaml index 31a6d8480..5b813f761 100644 --- a/config/crd/bases/bpfman.io_tcxprograms.yaml +++ b/config/crd/bases/bpfman.io_tcxprograms.yaml @@ -36,6 +36,10 @@ spec: name: Position priority: 1 type: string + - jsonPath: .spec.priority + name: Priority + priority: 1 + type: string name: v1alpha1 schema: openAPIV3Schema: diff --git a/controllers/bpfman-operator/tcx-program.go b/controllers/bpfman-operator/tcx-program.go index 2de7d297b..05a9925fd 100644 --- a/controllers/bpfman-operator/tcx-program.go +++ b/controllers/bpfman-operator/tcx-program.go @@ -47,7 +47,7 @@ func (r *TcxProgramReconciler) getFinalizer() string { func (r *TcxProgramReconciler) SetupWithManager(mgr ctrl.Manager) error { return ctrl.NewControllerManagedBy(mgr). For(&bpfmaniov1alpha1.TcxProgram{}). - // Watch bpfPrograms which are owned by TcPrograms + // Watch bpfPrograms which are owned by TcxPrograms Watches( &bpfmaniov1alpha1.BpfProgram{}, &handler.EnqueueRequestForObject{}, @@ -65,7 +65,7 @@ func (r *TcxProgramReconciler) Reconcile(ctx context.Context, req ctrl.Request) tcxProgram := &bpfmaniov1alpha1.TcxProgram{} if err := r.Get(ctx, req.NamespacedName, tcxProgram); err != nil { - // list all TcProgram objects with + // list all TcxProgram objects with if errors.IsNotFound(err) { bpfProgram := &bpfmaniov1alpha1.BpfProgram{} if err := r.Get(ctx, req.NamespacedName, bpfProgram); err != nil { @@ -87,7 +87,7 @@ func (r *TcxProgramReconciler) Reconcile(ctx context.Context, req ctrl.Request) if errors.IsNotFound(err) { r.Logger.Info("tcxProgram from ownerRef not found stale reconcile exiting", "Name", req.NamespacedName) } else { - r.Logger.Error(err, "failed getting TcProgram Object from ownerRef", "Name", req.NamespacedName) + r.Logger.Error(err, "failed getting TcxProgram Object from ownerRef", "Name", req.NamespacedName) } return ctrl.Result{}, nil } @@ -102,7 +102,7 @@ func (r *TcxProgramReconciler) Reconcile(ctx context.Context, req ctrl.Request) } func (r *TcxProgramReconciler) updateStatus(ctx context.Context, name string, cond bpfmaniov1alpha1.ProgramConditionType, message string) (ctrl.Result, error) { - // Sometimes we end up with a stale TcProgram due to races, do this + // Sometimes we end up with a stale TcxProgram due to races, do this // get to ensure we're up to date before attempting a finalizer removal. prog := &bpfmaniov1alpha1.TcxProgram{} if err := r.Get(ctx, types.NamespacedName{Namespace: corev1.NamespaceAll, Name: name}, prog); err != nil { diff --git a/test/integration/common.go b/test/integration/common.go index 9b76c6958..56efdf241 100644 --- a/test/integration/common.go +++ b/test/integration/common.go @@ -48,6 +48,14 @@ func doAppTcCheck(t *testing.T, output *bytes.Buffer) bool { return false } +func doTcxCheck(t *testing.T, output *bytes.Buffer) bool { + if strings.Contains(output.String(), "packets received") && strings.Contains(output.String(), "bytes received") { + t.Log("TCX BPF program is functioning") + return true + } + return false +} + func doAppTcxCheck(t *testing.T, output *bytes.Buffer) bool { str := `TCX: received (\d+) packets` if ok, count := doProbeCommonCheck(t, output, str); ok { diff --git a/test/integration/tcx_test.go b/test/integration/tcx_test.go index 609dbca3b..e6648f5dd 100644 --- a/test/integration/tcx_test.go +++ b/test/integration/tcx_test.go @@ -41,9 +41,9 @@ func TestTcxGoCounter(t *testing.T) { pods, err := env.Cluster().Client().CoreV1().Pods(tcxGoCounterUserspaceNs).List(ctx, metav1.ListOptions{LabelSelector: "name=go-tcx-counter"}) require.NoError(t, err) - gotcCounterPod := pods.Items[0] + gotcxCounterPod := pods.Items[0] - req := env.Cluster().Client().CoreV1().Pods(tcxGoCounterUserspaceNs).GetLogs(gotcCounterPod.Name, &corev1.PodLogOptions{}) + req := env.Cluster().Client().CoreV1().Pods(tcxGoCounterUserspaceNs).GetLogs(gotcxCounterPod.Name, &corev1.PodLogOptions{}) require.Eventually(t, func() bool { logs, err := req.Stream(ctx) @@ -54,6 +54,6 @@ func TestTcxGoCounter(t *testing.T) { require.NoError(t, err) t.Logf("counter pod log %s", output.String()) - return doTcCheck(t, output) + return doTcxCheck(t, output) }, 30*time.Second, time.Second) }