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

Add support for clusters #177

Closed
bobcatfish opened this issue Oct 22, 2018 · 4 comments
Closed

Add support for clusters #177

bobcatfish opened this issue Oct 22, 2018 · 4 comments
Labels
design This task is about creating and discussing a design help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. meaty-juicy-coding-work This task is mostly about implementation!!! And docs and tests of course but that's a given

Comments

@bobcatfish
Copy link
Collaborator

Expected Behavior

It should be possible to deploy to the clusters in PipelineParams:

https://github.com/knative/build-pipeline/blob/fc4775ae44546a68fad8c951073904e5dd51fca3/examples/pipelineparams.yaml#L8-L14

For example, I should be able to make a task like this:

apiVersion: pipeline.knative.dev/v1beta1
kind: Task
metadata:
  name: helm
  namespace: default
spec:
    inputs:
        resources:
            - name: workspace
              type: github
            - name: imageToDeploy
              type: image
        params:
            - name: pathToHelmCharts
              value: string
            - name: helmArgs
              value: string
        cluster:
            - name: clusterToDeployTo
    buildSpec:
        steps:
        - name: deploy
          image: kubernetes-helm
          args: ['deploy', '--path=${pathToHelmChart}', '--set image=${imageToDeploy.Url}.${imageToDeploy.Name}', '${helmArgs}', '--kubeconfig=${clusterToDeployTo.somemagickubeconfigpath}']

I think the best way to make this work generically for any deployment tool is to create and mount a kubeconfig automatically (e.g. so we can use helm's --kubeconfig arg) but definitely option to other options!

It's crucial this works for more than just helm.

Bonus: we actually want clusters to be in a resource, so you could also move them out of PipelineParams into a Resource type! Note that in #68 we want to make a Deployment type as well, which would probably also include the helm / kubectl /tool of choice functionality but that's a ways off

Actual Behavior

At the moment the clusters in PipelineParams are ignored, so you can only really deploy to the cluster running the Pipeline CRD.

You could also hardcode the info for another cluster into your Task, but that's less than ideal!

Steps to Reproduce the Problem

  1. Create a PipelineParams that includes a cluster
  2. Create a deploy task that deploys using Helm, and give it a cluster parameter
  3. Note that you have pretty much no way to link the actual helm command in the Task with the Cluster

Additional Info

In #63 we added an integration test that does a deployment, but it only deploys to the cluster that the Pipeline CRD is running in - we need to udpate the test to actually use the cluster config, even if it's still the same cluster.

@bobcatfish bobcatfish added help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. design This task is about creating and discussing a design meaty-juicy-coding-work This task is mostly about implementation!!! And docs and tests of course but that's a given labels Oct 22, 2018
@nader-ziada
Copy link
Member

nader-ziada commented Oct 23, 2018

/assign @pivotal-nader-ziada

@shashwathi
Copy link
Contributor

/assign pivotal-nader-ziada

@nader-ziada
Copy link
Member

@bobcatfish how do you expect to connect to this other cluster? put cert/token info in pipelineparams?

@bobcatfish
Copy link
Collaborator Author

@bobcatfish how do you expect to connect to this other cluster? put cert/token info in pipelineparams?

That's a great question! I don't have a clear idea yet, but could we put them in a service account, and specify the service account in the cluster resource?

bobcatfish added a commit to bobcatfish/pipeline that referenced this issue Oct 29, 2018
@pivotal-nader-ziada was looking into adding support for clusters in tektoncd#177
when he realized that if the cluster is moved out of PipelineParams into
a Resource, this means that to use 1 Pipeline with 2 different clusters,
you'd have to change the Pipeline itself. This actually applies to all
Resources, and goes against the design principle of Decoupling that we
were aiming for.

In this commit we brainstormed solutions to this problem (one of which
is to accept it) and prototyped solutions in yaml in
`examples_pipeline_reuse`.

Co-authored-by: Nader Ziada <nziada@pivotal.io>
nader-ziada added a commit to nader-ziada/pipeline that referenced this issue Oct 30, 2018
To enable tasks to connect to an external cluster other than the host
cluster, for example to deploy a app. tektoncd#177
nader-ziada added a commit to nader-ziada/pipeline that referenced this issue Oct 30, 2018
To enable tasks to connect to an external cluster other than the host
cluster, for example to deploy a app. tektoncd#177
nader-ziada added a commit to nader-ziada/pipeline that referenced this issue Oct 30, 2018
To enable tasks to connect to an external cluster other than the host
cluster, for example to deploy a app. tektoncd#177
nader-ziada added a commit to nader-ziada/pipeline that referenced this issue Nov 2, 2018
To enable tasks to connect to an external cluster other than the host
cluster, for example to deploy a app. tektoncd#177
@bobcatfish bobcatfish added this to the 0.0.1 Alpha release milestone Nov 3, 2018
nader-ziada added a commit to nader-ziada/pipeline that referenced this issue Nov 6, 2018
To enable tasks to connect to an external cluster other than the host
cluster, for example to deploy a app. tektoncd#177
nader-ziada added a commit to nader-ziada/pipeline that referenced this issue Nov 7, 2018
To enable tasks to connect to an external cluster other than the host
cluster, for example to deploy a app. tektoncd#177
nader-ziada added a commit to nader-ziada/pipeline that referenced this issue Nov 7, 2018
To enable tasks to connect to an external cluster other than the host
cluster, for example to deploy a app. tektoncd#177
knative-prow-robot pushed a commit that referenced this issue Nov 9, 2018
To enable tasks to connect to an external cluster other than the host
cluster, for example to deploy a app. #177
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
design This task is about creating and discussing a design help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. meaty-juicy-coding-work This task is mostly about implementation!!! And docs and tests of course but that's a given
Projects
None yet
Development

No branches or pull requests

3 participants