func()

in pkg/sysched/sysched.go [85:117]


func (sc *SySched) readSPOProfileCR(name string, namespace string) (sets.Set[string], error) {
	syscalls := sets.New[string]()

	if name == "" || namespace == "" {
		return syscalls, nil
	}

	// extract a seccomp SPO profile CR using namespace and cr name
	seccompProfile := &v1beta1.SeccompProfile{}

	err := sc.client.Get(context.TODO(), client.ObjectKey{
		Namespace: namespace,
		Name:      name,
	}, seccompProfile)

	if err != nil {
		return syscalls, err
	}

	syscallCategories := seccompProfile.Spec.Syscalls

	// need to merge the syscalls in the syscall categories
	// from multiple relevant actions, e.g., allow, log, notify
	for _, element := range syscallCategories {
		// NOTE: should we consider the other categories, e.g., notify, trace?
		// SCMP_ACT_TRACE --> ActTrace, seccomp.ActNotify
		if element.Action == seccomp.ActAllow || element.Action == seccomp.ActLog {
			syscalls = syscalls.Union(sets.New[string](element.Names...))
		}
	}

	return syscalls, nil
}