func()

in pkg/cmd/serviceaccount/phases/workflow/runner.go [156:176]


func (r *runner) computeSkipPhases() (map[string]bool, error) {
	currentPhases := make(map[string]bool)
	for _, phase := range r.phases {
		currentPhases[phase.Name] = true
	}

	skipPhases := make(map[string]bool)
	for _, p := range r.skipPhases {
		// check if the phases specified in skip-phases are valid
		if _, ok := currentPhases[p]; !ok {
			validPhases := make([]string, 0, len(currentPhases))
			for _, pp := range r.phases {
				validPhases = append(validPhases, pp.Name)
			}
			return nil, errors.Errorf("phase '%s' not found. Valid phases are: %v", p, validPhases)
		}
		skipPhases[p] = true
	}

	return skipPhases, nil
}