import requests
url = "https://platform.ankra.app/api/v1/org/clusters/imported/{cluster_id}/stacks"
payload = { "spec": {
"argo_cd": {
"namespace": "<string>",
"version": "<string>"
},
"git_repository": {
"branch": "<string>",
"credential_name": "<string>",
"repository": "<string>",
"provider": "github"
},
"helm_registries": [
{
"name": "<string>",
"url": "<string>",
"credential_name": "<string>",
"exclude_charts": ["<string>"]
}
],
"kubernetes": { "version": "0.0.0" },
"prometheus_credential": {
"name": "<string>",
"password": "<string>",
"token": "<string>",
"username": "<string>"
},
"prometheus_metrics": {
"endpoint": "<string>",
"credential_name": "<string>",
"flavor": "<string>",
"tenant_id": "<string>"
},
"provider": "imported",
"stacks": []
} }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
spec: {
argo_cd: {namespace: '<string>', version: '<string>'},
git_repository: {
branch: '<string>',
credential_name: '<string>',
repository: '<string>',
provider: 'github'
},
helm_registries: [
{
name: '<string>',
url: '<string>',
credential_name: '<string>',
exclude_charts: ['<string>']
}
],
kubernetes: {version: '0.0.0'},
prometheus_credential: {
name: '<string>',
password: '<string>',
token: '<string>',
username: '<string>'
},
prometheus_metrics: {
endpoint: '<string>',
credential_name: '<string>',
flavor: '<string>',
tenant_id: '<string>'
},
provider: 'imported',
stacks: []
}
})
};
fetch('https://platform.ankra.app/api/v1/org/clusters/imported/{cluster_id}/stacks', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request POST \
--url https://platform.ankra.app/api/v1/org/clusters/imported/{cluster_id}/stacks \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"spec": {
"argo_cd": {
"namespace": "<string>",
"version": "<string>"
},
"git_repository": {
"branch": "<string>",
"credential_name": "<string>",
"repository": "<string>",
"provider": "github"
},
"helm_registries": [
{
"name": "<string>",
"url": "<string>",
"credential_name": "<string>",
"exclude_charts": [
"<string>"
]
}
],
"kubernetes": {
"version": "0.0.0"
},
"prometheus_credential": {
"name": "<string>",
"password": "<string>",
"token": "<string>",
"username": "<string>"
},
"prometheus_metrics": {
"endpoint": "<string>",
"credential_name": "<string>",
"flavor": "<string>",
"tenant_id": "<string>"
},
"provider": "imported",
"stacks": []
}
}
'{
"stack_name": "<string>",
"commit_sha": "<string>",
"commit_url": "<string>",
"errors": [],
"job_count": 0,
"noop_count": 0,
"operation_id": "<string>",
"settings_only_count": 0,
"warnings": []
}{
"detail": "Cluster not found"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Create a cluster stack
Creates a stack on the cluster from a specification holding exactly one stack, deploys it, and commits it to the cluster’s GitOps repository when one is connected. The response carries validation errors and warnings, the commit, and the operation_id of the deployment; a failed Git push answers 422. A stack that names a draft_id is that draft’s promotion: when the draft holds no stack of the requested name (it was started for another stack, or its stack row is gone), the create is refused with 422, error_code draft_holds_no_such_stack, a detail naming the draft and the stack, and a refusal listing the stacks the draft does hold; nothing is written. Every other draft integrity refusal is a 422 with a detail too. On a sandbox cluster the deployment is simulated and settled before the response, so the operation has already succeeded. Requires stacks.write on the cluster; a caller without it is refused with 403.
import requests
url = "https://platform.ankra.app/api/v1/org/clusters/imported/{cluster_id}/stacks"
payload = { "spec": {
"argo_cd": {
"namespace": "<string>",
"version": "<string>"
},
"git_repository": {
"branch": "<string>",
"credential_name": "<string>",
"repository": "<string>",
"provider": "github"
},
"helm_registries": [
{
"name": "<string>",
"url": "<string>",
"credential_name": "<string>",
"exclude_charts": ["<string>"]
}
],
"kubernetes": { "version": "0.0.0" },
"prometheus_credential": {
"name": "<string>",
"password": "<string>",
"token": "<string>",
"username": "<string>"
},
"prometheus_metrics": {
"endpoint": "<string>",
"credential_name": "<string>",
"flavor": "<string>",
"tenant_id": "<string>"
},
"provider": "imported",
"stacks": []
} }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
spec: {
argo_cd: {namespace: '<string>', version: '<string>'},
git_repository: {
branch: '<string>',
credential_name: '<string>',
repository: '<string>',
provider: 'github'
},
helm_registries: [
{
name: '<string>',
url: '<string>',
credential_name: '<string>',
exclude_charts: ['<string>']
}
],
kubernetes: {version: '0.0.0'},
prometheus_credential: {
name: '<string>',
password: '<string>',
token: '<string>',
username: '<string>'
},
prometheus_metrics: {
endpoint: '<string>',
credential_name: '<string>',
flavor: '<string>',
tenant_id: '<string>'
},
provider: 'imported',
stacks: []
}
})
};
fetch('https://platform.ankra.app/api/v1/org/clusters/imported/{cluster_id}/stacks', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request POST \
--url https://platform.ankra.app/api/v1/org/clusters/imported/{cluster_id}/stacks \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"spec": {
"argo_cd": {
"namespace": "<string>",
"version": "<string>"
},
"git_repository": {
"branch": "<string>",
"credential_name": "<string>",
"repository": "<string>",
"provider": "github"
},
"helm_registries": [
{
"name": "<string>",
"url": "<string>",
"credential_name": "<string>",
"exclude_charts": [
"<string>"
]
}
],
"kubernetes": {
"version": "0.0.0"
},
"prometheus_credential": {
"name": "<string>",
"password": "<string>",
"token": "<string>",
"username": "<string>"
},
"prometheus_metrics": {
"endpoint": "<string>",
"credential_name": "<string>",
"flavor": "<string>",
"tenant_id": "<string>"
},
"provider": "imported",
"stacks": []
}
}
'{
"stack_name": "<string>",
"commit_sha": "<string>",
"commit_url": "<string>",
"errors": [],
"job_count": 0,
"noop_count": 0,
"operation_id": "<string>",
"settings_only_count": 0,
"warnings": []
}{
"detail": "Cluster not found"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Authorizations
Body
The change-set digest the caller reviewed, as GET /drafts/stacks/{draft_id}/diff reports it for the draft_id the spec's stack names. Optional: omit it and the write behaves exactly as before. When sent, the server recomputes the change set inside the write transaction, under the cluster lock, ships the draft as it stands there, and refuses with 422 CHANGE_SET_DRIFTED if it no longer matches - so an approval cannot ship a draft that moved since it was read.
Response
Successful Response