This document presents some guidleines and best-practices to remember while contributing to managed-scripts.
Managed-Scripts enable backplane users to execute predefined scripts while adhering to the permissions defined within the script's scope.
A script file and its associated metadata file, stored in the managed-scripts repository.
A running instance of the Managed Script in an OSD/ROSA cluster.
Before creating, testing, or deploying new scripts, ensure you have the following:
- VPN connectivity
- OCM CLI Binary
- Backplane CLI Binary
- Access to the Stage API
All pre-existing scripts can be found here for reference.
-
Fork the Managed Scripts Repository
- Create your fork of the Managed Scripts Repository.
-
Create a new branch
- Do not use the
mainormasterbranch for PRs. - Name the branch based on the JIRA card, feature or subject matter.
- Refer to GitHub's guide on creating branches.
- Do not use the
-
Clone the Repository
git clone https://github.com/<git_user>/managed-scripts.git
-
Create a New Folder for the Script
cd <path-to-folder>/managed-scripts/scripts/CEE mkdir -p new-script
-
Add Metadata File (
metadata.yaml)- Follow the metadata schema.
- Example metadata file: etcd-health-check.
- Define
allowedGroups(e.g.,CEE,SREP) with applicable RBAC permissions.
-
Create the Script File (
script.sh)tree new-script new-script ├── metadata.yaml └── script.sh
-
Ensure You Are Using the Stage API
ocm backplane config set url https://api.stage.backplane.openshift.com ocm backplane config get urlOutput:
url: https://api.stage.backplane.openshift.com -
Connect to a Stage Cluster
ocm backplane login <stage-cluster-id>
-
Run a Test Job
ocm backplane testjob create [-p var1=val1]Example Output:
Test job openshift-job-dev-7m755 created successfully Run "ocm backplane testjob get openshift-job-dev-7m755" for details Run "ocm backplane testjob logs openshift-job-dev-7m755" for job logs -
Check Job Status
ocm backplane testjob get openshift-job-dev-7m755
Example Output:
TestId: openshift-job-dev-7m755, Status: Succeeded -
View Logs
ocm backplane testjob logs openshift-job-dev-7m755
-
PR Review & Merge Process
- Once your changes are well tested and pushed, create a PR containing a brief information about the script's utility and usage.
- The script must be reviewed and approved by the SRE team.
- Use Slack channel
#sre-operatorsor#sd-ims-backplaneand tag@managed-scriptsfor discussions.
-
**Promote the script using ops-sop/v4/util/promote-managed-scripts.sh
-
Validate Production Deployment
- Connect to the Backplane Production API.
- Log in to a production cluster.
- List available managed scripts:
ocm backplane script list