Neil
Neil

Reputation: 2610

How can I script the provisioning Spinnaker resources?

We are evaluating adoption of Spinnaker and would like to understand what API, if any, is available for creating Spinnaker resources? If I want to script/templatize the creation of my App within Spinnaker, what is the best way to do this?

As best as I can see at the moment is script the creation of your infrastructure outside of Spinnaker (e.g. CloudFormation), load that in from your AWS account, and then keep a library of pipeline JSON files that can be copy/pasted into the JSON form for pipelines that will be added afterwords.

Upvotes: 2

Views: 1594

Answers (2)

Ashish Thakur
Ashish Thakur

Reputation: 1

The documentation seems to be outdated. I had a similar problem creating pipeline using pipelines-templates. It worked fine using Deck(UI) where as the pipeline json as described in https://www.spinnaker.io/reference/pipeline/templates/#pipeline-json did not work.

After creating a pipeline from pipeline-template using UI, i analysed the payload and realised the documentation is missing some of the fields in the payload. The payload given below worked fine for me. I would suggest the same, that you should analyse the payload via UI in the browser and use that as reference.

{
  "schema": "v2",
  "template": {
    "artifactAccount": "front50ArtifactCredentials",
    "reference": "spinnaker://k8s-bake-approve-deploy-s3-23-oct:latest",
    "type": "front50/pipelineTemplate"
  },
  "application": "v2poc",
  "name": "test-6",
  "triggers": [],
  "type": "templatedPipeline",
  "stages": [],
  "variables": {
    "namespace": "default",
    "docker_registry": "docker.io",
    "k8s_account": "my-k8-account",
    "helm_package_s3_object_path": "s3://spin-helm/node-1.0.0.tgz",
    "helm_override_file_s3_object_path": "s3://spin-helm/values.yaml",
    "docker_registry_org": "athakur",
    "docker_repository": "athakur/node",
    "hal_s3_account": "my-s3-account",
    "hal_docker_registry_account": "my-docker-registry",
    "docker_image_tag": "0.1.0",
    "spinnaker_application": "v2poc"
  },
  "exclude": [],
  "parameterConfig": [],
  "notifications": []
}

Upvotes: 0

cfieber
cfieber

Reputation: 438

All of the items that you can manage via the Spinnaker UI (Server Groups, Load Balancers, Security Groups, Applications, Projects, Pipelines) are scriptable via Spinnaker's REST API. The API documentation is a lacking at the moment (but coming soon, stay tuned). For now you can watch the UI's network interaction with the API via developer tools to get example payloads.

For other more static cloud infrastructure (VPCs, subnets, etc) we don't really have a story via Spinnaker's API and would recommend looking at Terraform or CloudFormation

Upvotes: 5

Related Questions