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

[Platform] Add ability to schedule external scripts in platform #8637

Open
ajcaldera1 opened this issue May 26, 2021 · 2 comments
Open

[Platform] Add ability to schedule external scripts in platform #8637

ajcaldera1 opened this issue May 26, 2021 · 2 comments
Assignees
Labels
area/platform Yugabyte Platform
Projects
Milestone

Comments

@ajcaldera1
Copy link
Contributor

In order to support custom scripts that need to be run from platform, an API should be added to collect the schedule desired as well as any parameters for a script / program that needs to be run by platform's scheduler. An example of this would be a script that would synchronize universes on that platform to be updated with new users as the result of a LDAP server scrape.

@ajcaldera1 ajcaldera1 added the area/platform Yugabyte Platform label May 26, 2021
@ajcaldera1 ajcaldera1 added this to the 2.7.x milestone May 26, 2021
@hsu880 hsu880 added this to Backlog in Platform Jun 15, 2021
@hsu880
Copy link

hsu880 commented Jun 15, 2021

Need to be careful about this because platform runs as a high privileged user.

@ymahajan
Copy link
Contributor

This needs to be delivered as part of satisfying this requirement for LDAP in YCQL.

@ymahajan ymahajan moved this from Backlog to To do in Platform Jun 16, 2021
@hkandala hkandala moved this from To do to In Review in Platform Jul 23, 2021
vipul-yb added a commit that referenced this issue Aug 19, 2021
…pts.

Summary:
  - Added APIs to schedule/stop/modify external scripts in Platform
  - Scripts are defined on the universe level and a universe can only have a single external script scheduled.
  - These scripts are stored in RunTimeConfig DB in this phase but will be shifted to a more secured DB in the next phase.
  - These APIs are highly sensitive and can be exploited to affect the Platform, Currently, only ATS will be accessing these APIs.

These APIs send data in Multipart/From data format and this API can be accessed using X-AUTH-TOKEN as well as X-AUTH-YW-API-TOKEN.

Schedule external script:

```
POST /api/v1/customers/:cUUID/universes/:uniUUID/scheduleScript

{
	script: FileUpload,
	cornExpression: ${cornExpression}
	scriptParameter: {"param1": "va1l", "param2": "val2"}
        timeLimitMins: ${timeLimitMins}
}

```
example
```
{
	script: FileUpload,
	cronExperssion: 5 * * * *,
	scriptParameter: {"restore_time": "2021-08-08 12:00:00", "platform_version": "2.6.7"}
	timeLimitMins: 4
}
```

Update existing external scheduled script

```
PUT /api/v1/customers/:cUUID/universes/:uniUUID/updateScheduledScript

{
	script: FileUpload,
	cornExpression: ${cornExpression}
	scriptParameter: {"param1": "val1", "param2": "val2"}
        timeLimitMins: ${timeLimitMins}
}
```

stop scheduled external scheduled script

```

PUT /api/v1/customers/:cUUID/universes/:uniUUID/stopScheduledScript
```

Test Plan:
  - Added unit tests.
  - Tested on a local setup by running self-generated scripts and an infinitely long-running script

Reviewers: arnav, sanketh, hkandala

Reviewed By: sanketh, hkandala

Subscribers: hsu, jenkins-bot, yugaware

Differential Revision: https://phabricator.dev.yugabyte.com/D12324
@kkg-yb kkg-yb moved this from In Review to Needs QA/Docs in Platform Aug 24, 2021
vipul-yb added a commit that referenced this issue Sep 21, 2021
…er-defined scripts.

Summary:
  - Added APIs to schedule/stop/modify external scripts in Platform
  - Scripts are defined on the universe level and a universe can only have a single external script scheduled.
  - These scripts are stored in RunTimeConfig DB in this phase but will be shifted to a more secured DB in the next phase.
  - These APIs are highly sensitive and can be exploited to affect the Platform, Currently, only ATS will be accessing these APIs.

These APIs send data in Multipart/From data format and this API can be accessed using X-AUTH-TOKEN as well as X-AUTH-YW-API-TOKEN.

Schedule external script:

```
POST /api/v1/customers/:cUUID/universes/:uniUUID/schedule_script

{
	script: FileUpload,
	cornExpression: ${cornExpression}
	scriptParameter: {"param1": "va1l", "param2": "val2"}
        timeLimitMins: ${timeLimitMins}
}

```
example
```
{
	script: FileUpload,
	cronExperssion: 5 * * * *,
	scriptParameter: {"restore_time": "2021-08-08 12:00:00", "platform_version": "2.6.7"}
	timeLimitMins: 4
}
```

Update existing external scheduled script

```
PUT /api/v1/customers/:cUUID/universes/:uniUUID/update_scheduled_script

{
	script: FileUpload,
	cornExpression: ${cornExpression}
	scriptParameter: {"param1": "val1", "param2": "val2"}
        timeLimitMins: ${timeLimitMins}
}
```

stop scheduled external scheduled script

```

PUT /api/v1/customers/:cUUID/universes/:uniUUID/stop_scheduled_script
```

Original commit: D12324 / 717ef62

Test Plan:
Jenkins: rebase: 2.6

  - Added unit tests.
  - Tested on a local setup by running self-generated scripts and an infinitely long-running script

Reviewers: arnav, hkandala, sanketh

Reviewed By: hkandala, sanketh

Subscribers: yugaware, jenkins-bot, hsu

Differential Revision: https://phabricator.dev.yugabyte.com/D12981
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/platform Yugabyte Platform
Projects
Platform
  
Needs QA/Docs
Development

No branches or pull requests

6 participants