Skip to content

Commit

Permalink
interface names hook doesn't allow more than one function per interfa…
Browse files Browse the repository at this point in the history
…ce per direction

Signed-off-by: Mohamed Mahmoud <mmahmoud@redhat.com>
  • Loading branch information
msherif1234 committed Nov 4, 2024
1 parent bb8e382 commit a9ef581
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions controllers/bpfman-agent/application-program.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ func (r *BpfApplicationReconciler) Reconcile(ctx context.Context, req ctrl.Reque
for j, p := range a.Spec.Programs {
switch p.Type {
case bpfmaniov1alpha1.ProgTypeFentry:
appProgramId := fmt.Sprintf("%s-%s", strings.ToLower(string(p.Type)), sanitize(p.Fentry.FunctionName))
appProgramId := fmt.Sprintf("%s-%s", strings.ToLower(string(p.Type)), sanitize(p.Fentry.BpfFunctionName))
fentryProgram := bpfmaniov1alpha1.FentryProgram{
ObjectMeta: metav1.ObjectMeta{
Name: buildProgramName(a, p),
Expand All @@ -100,7 +100,7 @@ func (r *BpfApplicationReconciler) Reconcile(ctx context.Context, req ctrl.Reque
complete, res, err = r.reconcileCommon(ctx, rec, fentryObjects)

case bpfmaniov1alpha1.ProgTypeFexit:
appProgramId := fmt.Sprintf("%s-%s", strings.ToLower(string(p.Type)), sanitize(p.Fexit.FunctionName))
appProgramId := fmt.Sprintf("%s-%s", strings.ToLower(string(p.Type)), sanitize(p.Fexit.BpfFunctionName))
fexitProgram := bpfmaniov1alpha1.FexitProgram{
ObjectMeta: metav1.ObjectMeta{
Name: buildProgramName(a, p),
Expand All @@ -123,7 +123,7 @@ func (r *BpfApplicationReconciler) Reconcile(ctx context.Context, req ctrl.Reque

case bpfmaniov1alpha1.ProgTypeKprobe,
bpfmaniov1alpha1.ProgTypeKretprobe:
appProgramId := fmt.Sprintf("%s-%s", strings.ToLower(string(p.Type)), sanitize(p.Kprobe.FunctionName))
appProgramId := fmt.Sprintf("%s-%s", strings.ToLower(string(p.Type)), sanitize(p.Kprobe.BpfFunctionName))
kprobeProgram := bpfmaniov1alpha1.KprobeProgram{
ObjectMeta: metav1.ObjectMeta{
Name: buildProgramName(a, p),
Expand All @@ -146,7 +146,7 @@ func (r *BpfApplicationReconciler) Reconcile(ctx context.Context, req ctrl.Reque

case bpfmaniov1alpha1.ProgTypeUprobe,
bpfmaniov1alpha1.ProgTypeUretprobe:
appProgramId := fmt.Sprintf("%s-%s", strings.ToLower(string(p.Type)), sanitize(p.Uprobe.FunctionName))
appProgramId := fmt.Sprintf("%s-%s", strings.ToLower(string(p.Type)), sanitize(p.Uprobe.BpfFunctionName))
uprobeProgram := bpfmaniov1alpha1.UprobeProgram{
ObjectMeta: metav1.ObjectMeta{
Name: buildProgramName(a, p),
Expand All @@ -168,7 +168,7 @@ func (r *BpfApplicationReconciler) Reconcile(ctx context.Context, req ctrl.Reque
complete, res, err = r.reconcileCommon(ctx, rec, uprobeObjects)

case bpfmaniov1alpha1.ProgTypeTracepoint:
appProgramId := fmt.Sprintf("%s-%s", strings.ToLower(string(p.Type)), sanitize(p.Tracepoint.Names[0]))
appProgramId := fmt.Sprintf("%s-%s-%s", strings.ToLower(string(p.Type)), sanitize(p.Tracepoint.Names[0]), p.Tracepoint.BpfFunctionName)
tracepointProgram := bpfmaniov1alpha1.TracepointProgram{
ObjectMeta: metav1.ObjectMeta{
Name: buildProgramName(a, p),
Expand Down Expand Up @@ -196,7 +196,7 @@ func (r *BpfApplicationReconciler) Reconcile(ctx context.Context, req ctrl.Reque
"app program name", a.Name, "program index", j)
continue
}
appProgramId := fmt.Sprintf("%s-%s-%s", strings.ToLower(string(p.Type)), p.TC.Direction, interfaces[0])
appProgramId := fmt.Sprintf("%s-%s-%s-%s", strings.ToLower(string(p.Type)), p.TC.Direction, interfaces[0], p.TC.BpfFunctionName)
tcProgram := bpfmaniov1alpha1.TcProgram{
ObjectMeta: metav1.ObjectMeta{
Name: buildProgramName(a, p),
Expand Down Expand Up @@ -224,7 +224,7 @@ func (r *BpfApplicationReconciler) Reconcile(ctx context.Context, req ctrl.Reque
"app program name", a.Name, "program index", j)
continue
}
appProgramId := fmt.Sprintf("%s-%s-%s", strings.ToLower(string(p.Type)), p.TCX.Direction, interfaces[0])
appProgramId := fmt.Sprintf("%s-%s-%s-%s", strings.ToLower(string(p.Type)), p.TCX.Direction, interfaces[0], p.TCX.BpfFunctionName)
tcxProgram := bpfmaniov1alpha1.TcxProgram{
ObjectMeta: metav1.ObjectMeta{
Name: buildProgramName(a, p),
Expand Down Expand Up @@ -252,7 +252,7 @@ func (r *BpfApplicationReconciler) Reconcile(ctx context.Context, req ctrl.Reque
"app program name", a.Name, "program index", j)
continue
}
appProgramId := fmt.Sprintf("%s-%s", strings.ToLower(string(p.Type)), interfaces[0])
appProgramId := fmt.Sprintf("%s-%s-%s", strings.ToLower(string(p.Type)), interfaces[0], p.XDP.BpfFunctionName)
xdpProgram := bpfmaniov1alpha1.XdpProgram{
ObjectMeta: metav1.ObjectMeta{
Name: buildProgramName(a, p),
Expand Down

0 comments on commit a9ef581

Please sign in to comment.