# 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
- 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

### 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
│   └── index.ts                   # Plugin entry point
├── locales/                       # i18n translation files
│   ├── de/                        # German translations
│   ├── fr/                        # French translations
│   └── it/                        # Italian translations
├── console-extensions.json        # Plugin extension definitions
└── package.json
```

### Getting Started

1. Install dependencies:
```bash
yarn install
```

2. Start the development server:
```bash
yarn run start
```

3. In another terminal, start the console:
```bash
yarn run start-console
```

### 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:

- Read/write access to namespace annotations
- Read access to ProjectPauseConfig custom resources
- Access to project/namespace resources

## Contributing

1. Fork the repository
2. Create a feature branch
3. Submit a Pull Request

## License

Apache License 2.0
