# OpenShift Project Pause Plugin This OpenShift Console plugin adds the ability to pause and unpause projects (namespaces) directly from the project overview page. When a project is paused, a custom operator scales down workloads and prevents new workloads from starting. ## Features - Adds pause/unpause button to the project overview actions menu (⋮) - Visual indication of project pause status - Integration with custom project operator - Internationalization support (English, German, French, Italian) ## Development ### Prerequisites - Node.js >=14 - yarn v1 - OpenShift cluster with admin access - [OpenShift Console](https://github.com/openshift/console) repository checked out locally ### Quick Start 1. Install dependencies: ```bash yarn install ``` 2. Start the development server: ```bash yarn run start ``` 3. In another terminal, start the console: ```bash # Login to your cluster first oc login --server= -u -p # Start the console yarn run start-console ``` 4. Open http://localhost:9000 in your browser 5. Navigate to: - Home → Projects - Click on any project - Look for the Actions menu (⋮) in the top-right corner - You should see "Pause project" or "Resume project" option ### Project Structure ``` project-pause-plugin/ ├── src/ │ ├── components/ │ │ ├── PauseButton.tsx # Pause/unpause button component │ │ └── project-actions.tsx # Project actions provider │ └── utils/ │ ├── project-utils.ts # Project state utilities │ └── operator-utils.ts # Operator interaction utilities ├── locales/ # i18n translation files ├── console-extensions.json # Plugin extension definitions └── package.json ``` ### Building for Production 1. Build the plugin: ```bash yarn build ``` 2. Build the image: ```bash docker build -t quay.io/my-repository/project-pause-plugin:latest . ``` 3. Push the image: ```bash docker push quay.io/my-repository/project-pause-plugin:latest ``` ## Deployment ### Using Helm Deploy the plugin using the provided Helm chart: ```bash helm upgrade -i project-pause-plugin charts/openshift-console-plugin \ --set plugin.image=quay.io/my-repository/project-pause-plugin:latest \ -n plugin__project-pause-plugin \ --create-namespace ``` ### Required Operator This plugin requires a custom project operator that: 1. Watches for the annotation `project-pause-operator.openshift.io/paused` 2. When a project is paused: - Scales down deployments - Stops running pods - Prevents new workloads from starting 3. Exposes its status through a ProjectPauseConfig custom resource ### RBAC Requirements The plugin requires the following permissions: ```yaml apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole metadata: name: project-pause-plugin rules: - apiGroups: [""] resources: ["namespaces"] verbs: ["get", "list", "patch"] - apiGroups: ["projectpause.openshift.io"] resources: ["projectpauseconfigs"] verbs: ["get", "list"] ``` ### Troubleshooting If you don't see the pause button: 1. Check the browser console for plugin loading errors 2. Verify you have the necessary permissions 3. Ensure you're looking in the project overview actions menu (⋮) 4. Check that the operator is installed and running Common issues: - Plugin not loading: Check the webpack dev server is running - Button not appearing: Verify console-extensions.json has correct contextId - Actions not working: Check RBAC permissions and operator status ## Contributing 1. Fork the repository 2. Create a feature branch 3. Submit a Pull Request ## License Apache License 2.0 ## Translations Translations for the plugin are located in the `locales` directory. Each language has its own subdirectory (e.g., `locales/en` for English). The translation files are named according to the plugin's namespace: `plugin__project-pause-plugin.json`. To add a new translation: 1. Create a new directory for the language code in `locales/` 2. Copy the template from `locales/en/plugin__project-pause-plugin.json` 3. Translate the strings in the new file