Skip to content

Commit

Permalink
Add installation manifests. Initial stubs for controller configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
jessesuen committed Oct 26, 2017
1 parent 1037209 commit 7144567
Show file tree
Hide file tree
Showing 8 changed files with 98 additions and 18 deletions.
7 changes: 5 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ BRANCH=$(shell git rev-parse --abbrev-ref HEAD)
LDFLAGS = -ldflags "-X ${PACKAGE}.Version=${VERSION} -X ${PACKAGE}.Revision=${REVISION} -X ${PACKAGE}.Branch=${BRANCH}"

BUILDER_IMAGE=argo-builder
BUILDER_CMD=docker run --rm -v ${BUILD_DIR}:/root/go/src/${PACKAGE} -w /root/go/src/${PACKAGE} ${BUILDER_IMAGE}
BUILDER_CMD=docker run --rm \
-v ${BUILD_DIR}:/root/go/src/${PACKAGE} \
-v ${BUILD_DIR}/dist/cache:/root/go/pkg \
-w /root/go/src/${PACKAGE} ${BUILDER_IMAGE}

# docker image publishing options
DOCKER_PUSH=false
Expand All @@ -25,7 +28,7 @@ $(error IMAGE_NAMESPACE must be set to push images (e.g. IMAGE_NAMESPACE=argopro
endif
endif

ifneq ($(IMAGE_NAMESPACE),"")
ifdef IMAGE_NAMESPACE
IMAGE_PREFIX=${IMAGE_NAMESPACE}/
endif

Expand Down
16 changes: 11 additions & 5 deletions api/workflow/v1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,14 +154,20 @@ func (n NodeStatus) Successful() bool {
return n.Status == NodeStatusSucceeded
}

type S3ArtifactSource struct {
type S3Bucket struct {
Endpoint string `json:"endpoint"`
Bucket string `json:"bucket"`
Key string `json:"key"`
AccessKeySecret corev1.SecretKeySelector `json:"accessKeySecret"`
SecretKey corev1.SecretKeySelector `json:"secretKeySecret"`
SecretKeySecret corev1.SecretKeySelector `json:"secretKeySecret"`
}

type S3ArtifactSource struct {
S3Bucket `json:",inline"`
Key string `json:"key"`
}

type S3ArtifactDestination S3ArtifactSource

type GitArtifactSource struct {
URL string `json:"url"`
UsernameSecret *corev1.SecretKeySelector `json:"usernameSecret"`
Expand All @@ -174,6 +180,6 @@ type HTTPArtifactSource struct {

type ArtifactDestination struct {
S3 *S3ArtifactDestination `json:"s3,omitempty"`
// Future artifact destinations go here
// * artifactory, nexus
}

type S3ArtifactDestination S3ArtifactSource
6 changes: 4 additions & 2 deletions cmd/workflow-controller/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,20 @@ var RootCmd = &cobra.Command{
type rootFlags struct {
argoExecImage string // --argoexec-image
kubeConfig string // --kubeconfig
configMap string // --configmap
}

var (
rootArgs rootFlags
)

func init() {
RootCmd.Flags().StringVar(&rootArgs.kubeConfig, "kubeconfig", "", "Kubernetes config (outside of cluster)")
RootCmd.Flags().StringVar(&rootArgs.kubeConfig, "kubeconfig", "", "Kubernetes config (used when running outside of cluster)")
RootCmd.Flags().StringVar(&rootArgs.argoExecImage, "argoexec-image", "", "argoexec image to use as container sidecars")
RootCmd.Flags().StringVar(&rootArgs.configMap, "configmap", "", "Name of K8s configmap to retrieve workflow controller configuration")
}

// return rest config, if path not specified assume in cluster config
// GetClientConfig return rest config, if path not specified, assume in cluster config
func GetClientConfig(kubeconfig string) (*rest.Config, error) {
if kubeconfig != "" {
return clientcmd.BuildConfigFromFlags("", kubeconfig)
Expand Down
2 changes: 1 addition & 1 deletion examples/git-artifact.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ spec:
CODE:
path: /src
git:
url: https://github.com/argoproj/argo
url: https://github.com/argoproj/argo.git
image: golang:1.8
command: [sh, -c]
args: ["cd /src; git status"]
17 changes: 17 additions & 0 deletions examples/input-parameters.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
apiVersion: argoproj.io/v1
kind: Workflow
metadata:
generateName: argo-wf-
spec:
entrypoint: cowsay
arguments:
parameters.MESSAGE: "hello world"
templates:
- name: cowsay
type: container
inputs:
parameters:
MESSAGE:
image: docker/whalesay:latest
command: [cowsay]
args: ["{{inputs.parameters.MESSAGE}}"]
46 changes: 46 additions & 0 deletions examples/install.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: workflow-controller-configmap
data:
config: |
executorImage: argoproj/argoexec:latest
artifactRepository:
s3:
bucket: my-bucket
endpoint: https://storage.googleapis.com
accessKeySecret:
name: artifacts-s3-credentials
key: accessKey
secretKeySecret:
name: artifacts-s3-credentials
key: secretKey
---
apiVersion: apps/v1beta1
kind: Deployment
metadata:
name: workflow-controller-deployment
spec:
selector:
matchLabels:
app: workflow-controller
template:
metadata:
labels:
app: workflow-controller
spec:
containers:
- name: workflow-controller
image: argoproj/workflow-controller:latest
command: [/bin/workflow-controller]
args: [--configmap, workflow-controller-configmap]

---
apiVersion: v1
kind: Secret
metadata:
name: artifacts-s3-credentials
data:
accessKey: AAABBBCCC01234567890
secretKey: abc123XYZ456ABC123aaabbbcccddd1112223334
3 changes: 0 additions & 3 deletions workflow/common/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,6 @@ const (
// Each artifact will be named according to its input name (e.g: /argo/inputs/artifacts/CODE)
ExecutorArtifactBaseDir = "/argo/inputs/artifacts"

// EnvVarHostIP is th environment variable in which the executor can obtain the IP of the node it is executing on.
// argoexec uses this to construct the kubelet client, in order to retrieve the main container's container id.

// Various environment variables containing pod information exposed to the executor container(s)

// EnvVarHostIP contains the host IP which the container is executing on.
Expand Down
19 changes: 14 additions & 5 deletions workflow/controller/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,26 @@ type WorkflowController struct {
WorkflowClient *workflowclient.WorkflowClient
WorkflowScheme *runtime.Scheme
podCl corev1.PodInterface
podClient *rest.RESTClient
wfUpdates chan *wfv1.Workflow
podUpdates chan *apiv1.Pod
ArgoExecImage string
Config WorkflowControllerConfig
}

var (
DefaultArgoExecImage = fmt.Sprintf("argoproj/argoexec:%s", argo.Version)
)

type WorkflowControllerConfig struct {
ExecutorImage string `json:"executorImage,omitempty"`
ArtifactRepository ArtifactRepository `json:"artifactRepository,omitempty"`
}

type ArtifactRepository struct {
S3 *wfv1.S3Bucket `json:"s3,omitempty"`
// Future artifact repository support here
}

// NewWorkflowController instantiates a new WorkflowController
func NewWorkflowController(config *rest.Config) *WorkflowController {
// make a new config for our extension's API group, using the first config as a baseline
Expand All @@ -51,10 +61,9 @@ func NewWorkflowController(config *rest.Config) *WorkflowController {
WorkflowClient: wfClient,
WorkflowScheme: wfScheme,
podCl: clientset.CoreV1().Pods(apiv1.NamespaceDefault),
//podClient: newPodClient(config),
wfUpdates: make(chan *wfv1.Workflow),
podUpdates: make(chan *apiv1.Pod),
ArgoExecImage: DefaultArgoExecImage,
wfUpdates: make(chan *wfv1.Workflow),
podUpdates: make(chan *apiv1.Pod),
ArgoExecImage: DefaultArgoExecImage,
}
return &wfc
}
Expand Down

0 comments on commit 7144567

Please sign in to comment.