Skip to content

Commit

Permalink
docs: podDisruptionBudget.minAvailable should be numeric (#10715)
Browse files Browse the repository at this point in the history
Signed-off-by: Yuan Tang <[email protected]>
  • Loading branch information
terrytangyuan authored Mar 21, 2023
1 parent 12003ca commit d3eab6f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion examples/default-pdb-support.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ spec:
entrypoint: pdbcreate
serviceAccountName: default
podDisruptionBudget:
minAvailable: "9999" # Provide arbitrary big number if you don't know how many pods workflow creates
minAvailable: 9999 # Provide arbitrary big number if you don't know how many pods workflow creates
templates:
- name: pdbcreate
container:
Expand Down
9 changes: 5 additions & 4 deletions examples/validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"fmt"
"io/ioutil"
"os"
"strings"
"path/filepath"
"strings"

"github.com/xeipuuv/gojsonschema"
"sigs.k8s.io/yaml"
Expand Down Expand Up @@ -67,15 +67,16 @@ func ValidateArgoYamlRecursively(fromPath string, skipFileNames []string) (map[s
errorDescriptions := []string{}
for _, err := range result.Errors() {
// port should be port number or port reference string, using string port number will cause issue
// due swagger 2.0 limitation, we can only specify one data type (we use string, same as k8s api swagger)
if strings.HasSuffix(err.Field(), "httpGet.port") && err.Description() == "Invalid type. Expected: string, given: integer" {
// due swagger 2.0 limitation, we can only specify one data type (we use string, same as k8s api swagger).
// Similarly, we cannot use string minAvailable either.
if (strings.HasSuffix(err.Field(), "httpGet.port") || strings.HasSuffix(err.Field(), "podDisruptionBudget.minAvailable")) && err.Description() == "Invalid type. Expected: string, given: integer" {
incorrectError = true
continue
} else {
errorDescriptions = append(errorDescriptions, fmt.Sprintf("%s in %s", err.Description(), err.Context().String()))
}
}

if !(incorrectError && len(errorDescriptions) == 1) {
failed[path] = errorDescriptions
}
Expand Down

0 comments on commit d3eab6f

Please sign in to comment.