Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add plugin template #22

Merged
merged 2 commits into from
Feb 18, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions .vela/template.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Copyright (c) 2020 Target Brands, Inc. All rights reserved.
#
# Use of this source code is governed by the LICENSE file in this repository.

## Template Variables
# - .image (default: "target/vela-kubernetes:latest")
# - .pull (default: true)
# - .log_level (default: "info")
# - .cluster: (default: "")
# - .context: (default: "")
# - .namespace: (default: "")
# - .files: (default: "[]")
# - .containers: (default: "{}")
# - .output: (default: "json")
# - .resources: (default: "[]")
# - .timeout: (default: "5m")
# - .watch: (default: true)

metadata:
template: true

steps:
- name: kubernetes_plugin_template
image: {{ default "target/vela-kubernetes:latest" .image }}
pull: {{ default "true" .pull }}
parameters:
log_level: {{ default "info" .log_level }}
cluster: {{ default "" .cluster }}
context: {{ default "" .context }}
namespace: {{ default "" .namespace }}
files: {{ default "[]" .files }}
containers: {{ default "{}" .containers }}
output: {{ default "json" .output }}
resources: {{ default "[]" .resources }}
timeout: {{ default "5m" .timeout }}
watch: {{ default "true" .watch }}
12 changes: 9 additions & 3 deletions cmd/vela-kubernetes/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,17 +65,22 @@ func main() {
cli.StringFlag{
EnvVar: "PARAMETER_CONFIG,CONFIG_FILE,KUBE_CONFIG",
Name: "config.file",
Usage: "kubernetes cluster configuration",
Usage: "kubectl configuration for interacting with Kubernetes",
},
cli.StringFlag{
EnvVar: "PARAMETER_CLUSTER,CONFIG_CLUSTER,KUBE_CLUSTER",
Name: "config.cluster",
Usage: "kubectl cluster for interacting with Kubernetes",
},
cli.StringFlag{
EnvVar: "PARAMETER_CONTEXT,CONFIG_CONTEXT,KUBE_CONTEXT",
Name: "config.context",
Usage: "kubernetes cluster context to interact with",
Usage: "kubectl context for interacting with Kubernetes",
},
cli.StringFlag{
EnvVar: "PARAMETER_NAMESPACE,CONFIG_NAMESPACE,KUBE_NAMESPACE",
Name: "config.namespace",
Usage: "kubernetes cluster namespace to interact with",
Usage: "kubectl namespace for interacting with Kubernetes",
},

// Patch Flags
Expand Down Expand Up @@ -156,6 +161,7 @@ func run(c *cli.Context) error {
// config configuration
Config: &Config{
File: c.String("config.file"),
Cluster: c.String("config.cluster"),
Context: c.String("config.context"),
Namespace: c.String("config.namespace"),
},
Expand Down