diff --git a/.vela/template.yml b/.vela/template.yml index e837e08..a807145 100644 --- a/.vela/template.yml +++ b/.vela/template.yml @@ -9,6 +9,7 @@ # - .cluster: (default: "") # - .context: (default: "") # - .namespace: (default: "") +# - .path: (default: "") # - .dry_run: (default: false) # - .files: (default: "[]") # - .containers: (default: "{}") @@ -29,6 +30,7 @@ steps: cluster: {{ default "" .cluster }} context: {{ default "" .context }} namespace: {{ default "" .namespace }} + path: {{ default "" .path }} dry_run: {{ default "false" .dry_run }} files: {{ default "[]" .files }} containers: {{ default "{}" .containers }} diff --git a/DOCS.md b/DOCS.md index a16b074..a83d695 100644 --- a/DOCS.md +++ b/DOCS.md @@ -101,14 +101,15 @@ steps: The following parameters are used to configure the image: -| Name | Description | Required | Default | -| ----------- | ---------------------------------------------------- | -------- | ------- | -| `action` | action to perform against Kubernetes | `true` | `N/A` | -| `cluster` | Kubernetes cluster from the configuration file | `false` | `N/A` | -| `context` | Kubernetes context from the configuration file | `false` | `N/A` | -| `file` | configuration file for communication with Kubernetes | `true` | `N/A` | -| `log_level` | set the log level for the plugin | `true` | `info` | -| `namespace` | Kubernetes namespace from the configuration file | `false` | `N/A` | +| Name | Description | Required | Default | +| ----------- | ---------------------------------------------------- | -------- | ----------------- | +| `action` | action to perform against Kubernetes | `true` | `N/A` | +| `cluster` | Kubernetes cluster from the configuration file | `false` | `N/A` | +| `context` | Kubernetes context from the configuration file | `false` | `N/A` | +| `file` | configuration file for communication with Kubernetes | `true` | `N/A` | +| `log_level` | set the log level for the plugin | `true` | `info` | +| `namespace` | Kubernetes namespace from the configuration file | `false` | `N/A` | +| `path` | path to Kubernetes configuration file | `false` | **set by Vela** | #### Apply diff --git a/cmd/vela-kubernetes/main.go b/cmd/vela-kubernetes/main.go index 01edec5..f4e95bf 100644 --- a/cmd/vela-kubernetes/main.go +++ b/cmd/vela-kubernetes/main.go @@ -171,9 +171,9 @@ func run(c *cli.Context) error { } logrus.WithFields(logrus.Fields{ - "code": "https://github.com/go-vela/vela-kubernetes", - "docs": "https://go-vela.github.io/docs/plugins/registry/kubernetes", - "time": time.Now(), + "code": "https://github.com/go-vela/vela-kubernetes", + "docs": "https://go-vela.github.io/docs/plugins/registry/kubernetes", + "registry": "https://hub.docker.com/r/target/vela-kubernetes", }).Info("Vela Kubernetes Plugin") // create the plugin diff --git a/cmd/vela-kubernetes/patch.go b/cmd/vela-kubernetes/patch.go index 9b50d35..711c2e2 100644 --- a/cmd/vela-kubernetes/patch.go +++ b/cmd/vela-kubernetes/patch.go @@ -17,15 +17,27 @@ const patchAction = "patch" // patchPattern represents the pattern needed to // patch a Kubernetes container with a new image. // -// spec: (pod) -// containers: -// - name: -// image +// spec: (replica set) +// template: +// spec: (pod) +// containers: +// - name: +// image: const patchPattern = ` -spec: - containers: - - name: %s - image: %s +{ + "spec": { + "template": { + "spec": { + "containers": [ + { + "name": "%s", + "image": "%s" + } + ] + } + } + } +} ` // Patch represents the plugin configuration for Patch config information.