This repository has been archived by the owner on Mar 16, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 100
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2310 from thedadams/status-adjustments
Adjust status calculations
- Loading branch information
Showing
9 changed files
with
66 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,4 +15,5 @@ | |
/vendor | ||
apiserver.local.config | ||
/.envrc | ||
/depot.json | ||
**/.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package appstatus | ||
|
||
import ( | ||
"fmt" | ||
"strings" | ||
|
||
"github.com/acorn-io/baaah/pkg/typed" | ||
v1 "github.com/acorn-io/runtime/pkg/apis/internal.acorn.io/v1" | ||
"k8s.io/apimachinery/pkg/util/sets" | ||
) | ||
|
||
func isBlocked(dependencies map[string]v1.DependencyStatus, expressionErrors []v1.ExpressionError) (result []string, _ bool) { | ||
groupedByTypeName := map[string][]string{} | ||
|
||
for depName, dep := range dependencies { | ||
var key string | ||
if dep.Missing { | ||
key = string(dep.DependencyType) + " to be created" | ||
} else if !dep.Ready { | ||
key = string(dep.DependencyType) + " to be ready" | ||
} else { | ||
continue | ||
} | ||
groupedByTypeName[key] = append(groupedByTypeName[key], depName) | ||
} | ||
|
||
for _, exprError := range expressionErrors { | ||
if exprError.DependencyNotFound != nil && exprError.DependencyNotFound.SubKey == "" { | ||
key := string(exprError.DependencyNotFound.DependencyType) + " to be created" | ||
groupedByTypeName[key] = append(groupedByTypeName[key], exprError.DependencyNotFound.Name) | ||
} | ||
} | ||
|
||
for _, key := range typed.SortedKeys(groupedByTypeName) { | ||
values := sets.NewString(groupedByTypeName[key]...).List() | ||
msg := fmt.Sprintf("waiting for %s [%s]", key, strings.Join(values, ", ")) | ||
result = append(result, msg) | ||
} | ||
|
||
return result, len(result) > 0 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters