Skip to content

Commit

Permalink
docs: example wf, port data format and missing command (#9207)
Browse files Browse the repository at this point in the history
* fix: example port format

Signed-off-by: Tianchu Zhao <evantczhao@gmail.com>

* fix: temp fix validator until swagger 3.0?

Signed-off-by: Tianchu Zhao <evantczhao@gmail.com>
  • Loading branch information
tczhao authored Jul 22, 2022
1 parent 769896e commit 3a32b1b
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 6 deletions.
1 change: 1 addition & 0 deletions docs/walk-through/sidecars.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ spec:
sidecars:
- name: nginx
image: nginx:1.13
command: [nginx, -g, daemon off;]
```
In the above example, we create a sidecar container that runs Nginx as a simple web server. The order in which containers come up is random, so in this example the main container polls the Nginx container until it is ready to service requests. This is a good design pattern when designing multi-container systems: always wait for any services you need to come up before running your main code.
2 changes: 1 addition & 1 deletion examples/daemon-nginx.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ spec:
readinessProbe:
httpGet:
path: /
port: "80"
port: 80
initialDelaySeconds: 2
timeoutSeconds: 1

Expand Down
2 changes: 1 addition & 1 deletion examples/daemon-step.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ spec:
readinessProbe:
httpGet:
path: /ping
port: "8086"
port: 8086
initialDelaySeconds: 5
timeoutSeconds: 1

Expand Down
2 changes: 1 addition & 1 deletion examples/dag-daemon-task.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ spec:
readinessProbe:
httpGet:
path: /ping
port: "8086"
port: 8086
initialDelaySeconds: 5
timeoutSeconds: 1

Expand Down
2 changes: 1 addition & 1 deletion examples/influxdb-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ spec:
readinessProbe:
httpGet:
path: /ping
port: "8086"
port: 8086
initialDelaySeconds: 5
timeoutSeconds: 1
command: ["/bin/sh", "-c"]
Expand Down
16 changes: 14 additions & 2 deletions examples/validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"fmt"
"io/ioutil"
"os"
"strings"
"path/filepath"

"github.com/xeipuuv/gojsonschema"
Expand Down Expand Up @@ -61,12 +62,23 @@ func ValidateArgoYamlRecursively(fromPath string, skipFileNames []string) (map[s
return err
}

incorrectError := false
if !result.Valid() {
errorDescriptions := []string{}
for _, err := range result.Errors() {
errorDescriptions = append(errorDescriptions, fmt.Sprintf("%s in %s", err.Description(), err.Context().String()))
// 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" {
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
}
failed[path] = errorDescriptions
}
return nil
})
Expand Down

0 comments on commit 3a32b1b

Please sign in to comment.