Skip to content

Commit

Permalink
PLT1261: support clusterscope in step template (#78)
Browse files Browse the repository at this point in the history
  • Loading branch information
tczhao authored and louisnow committed Apr 16, 2024
1 parent fc92839 commit 33ade7c
Show file tree
Hide file tree
Showing 10 changed files with 523 additions and 217 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ jobs:
file: ./Dockerfile
push: true
tags: |
ghcr.io/atlanhq/${{ github.event.repository.name }}:v0.10.8
ghcr.io/atlanhq/${{ github.event.repository.name }}:v0.10.9
build-args: |
ACCESS_TOKEN_USR=$GITHUB_ACTOR
ACCESS_TOKEN_PWD=${{ secrets.MY_PAT }}
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
20
9 changes: 9 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,15 @@ email, or any other method with the owners of this repository before making a ch

Please note we have a code of conduct, please follow it in all your interactions with the project.

## Developing locally

To set up dev environment

```bash
nvm install && nvm use
npm install
```

## Pull Request Process

1. Ensure any install or build dependencies are removed before the end of the layer when doing a
Expand Down
40 changes: 27 additions & 13 deletions lib/k8s.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,32 @@ function checkExistingResource(resource, name, kind, newVersion, forceUpdate) {
return { shouldUpdate, msgPrefix };
}

function enableClusterScope(yamlObject) {
const templates = yamlObject["spec"]["templates"];
if (templates) {
templates.forEach((template) => {
if (template["dag"]) {
const tasks = template["dag"]["tasks"];
tasks.forEach((task) => {
if (task["templateRef"]) {
task["templateRef"]["clusterScope"] = true;
}
});
}
if (template["steps"]) {
const steps = template["steps"];
steps.forEach((sub_steps) => {
sub_steps.forEach((sub_step) => {
if (sub_step["templateRef"]) {
sub_step["templateRef"]["clusterScope"] = true;
}
});
});
}
});
}
}

class K8sInstaller {
/**
* Installs the given package to Argo K8s deployment
Expand Down Expand Up @@ -474,19 +500,7 @@ K8sInstaller.upsertTemplate = function (packageName, namespace, kind, group, yam
// cron workflows have no concept of clusterInstall
clusterInstall = false;
} else {
const templates = yamlObject["spec"]["templates"];
if (templates) {
templates.forEach((template) => {
if (template["dag"]) {
const tasks = template["dag"]["tasks"];
tasks.forEach((task) => {
if (task["templateRef"]) {
task["templateRef"]["clusterScope"] = true;
}
});
}
});
}
enableClusterScope(yamlObject);
}
return K8sInstaller.handleUpsertWithTemplateResponse(
response,
Expand Down
Loading

0 comments on commit 33ade7c

Please sign in to comment.