npm package: @nagarrodevopscoe/my-first-plugin
Description: Your Headlamp plugin
Latest version: 0.1.0

# Nagarro Kubernetes Accelerator (NKA) 🚀

[![Headlamp Plugin](https://img.shields.io/badge/Headlamp-Plugin-blue.svg)](https://headlamp.dev/)
[![TypeScript](https://img.shields.io/badge/TypeScript-007ACC?logo=typescript&logoColor=white)](https://www.typescriptlang.org/)
[![React](https://img.shields.io/badge/React-20232A?logo=react&logoColor=61DAFB)](https://reactjs.org/)
[![Material-UI](https://img.shields.io/badge/Material--UI-0081CB?logo=material-ui&logoColor=white)](https://mui.com/)
[![Kubernetes](https://img.shields.io/badge/Kubernetes-326CE5?logo=kubernetes&logoColor=white)](https://kubernetes.io/)

> **Enterprise-grade Kubernetes Dashboard Plugin** - A comprehensive monitoring, management, and optimization platform for Kubernetes clusters built on Headlamp.

## 🌟 Overview

The **Nagarro Kubernetes Accelerator (NKA)** is a powerful, feature-rich Headlamp plugin that provides enterprise-level Kubernetes cluster management capabilities. It offers real-time monitoring, security analysis, capacity planning, and operational insights through an intuitive, organized dashboard interface.

### ✨ Key Features

- 📊 **Real-time Cluster Monitoring** - Live health metrics, topology visualization, and pod status tracking
- 🔒 **Comprehensive Security Analysis** - RBAC risks, network policies, compliance drift, and vulnerability detection
- ♻️ **Sustainability & Capacity Management** - Resource optimization, orphaned resource detection, and HPA analytics
- ⬆️ **Cluster Upgrade Management** - Version tracking and upgrade planning tools
- 🎛️ **Interactive Dashboards** - Drag-and-drop widgets with customizable layouts
- 📈 **Advanced Analytics** - Pod density analysis, QoS class monitoring, and resource provisioning insights

## 🏗️ Architecture

```
NKA Plugin Structure
├── 📊 Dashboard/
│   ├── 👀 Overview/           # Cluster health & topology
│   ├── 🔒 Security/           # Security analysis & compliance
│   ├── ♻️ Sustainability/     # Resource optimization
│   └── ⬆️ Upgrade/            # Version management
├── 🚀 Provisioning/           # Infrastructure setup
├── 📦 Deployment/             # Application lifecycle
├── ⚡ Optimization/           # Performance tuning
└── 🔧 Troubleshooting/        # Diagnostics & debugging
```

## 🚀 Quick Start

### Prerequisites

- **Headlamp** v0.20.0 or later
- **Kubernetes** cluster access
- **Node.js** 16+ and **npm** 8+

### Installation

1. **Clone the repository**

   ```bash
   git clone <repository-url>
   cd my-first-plugin
   ```

2. **Install dependencies**

   ```bash
   npm install
   ```

3. **Build the plugin**

   ```bash
   npm run build
   ```

4. **Start development server**

   ```bash
   npm start
   ```

5. **Access the plugin**
   - Open Headlamp in your browser
   - Navigate to "Nagarro K8s Accelerator" in the sidebar

## 📋 Features Overview

### 📊 Dashboard Components

#### 👀 Overview Section

- **Cluster Health** - Real-time node and pod statistics with health indicators
- **Cluster Topology** - Interactive SVG visualization of cluster architecture
- **Non-Running Pods** - Automated detection and analysis of problematic pods

#### 🔒 Security Section

- **RBAC Risks** - Role-based access control vulnerability assessment
- **Network Policies** - Network security configuration analysis
- **Exposed Services** - Public service exposure monitoring
- **Compliance Drift** - Security compliance trend tracking
- **Non-Encrypted Secrets** - Unencrypted secret detection

#### ♻️ Sustainability & Capacity Section

- **Orphaned Resources** - Unused resource identification across 6 resource types
- **Pod Density Analysis** - Node utilization and pod distribution metrics
- **QoS Classes** - Quality of Service classification monitoring
- **HPA Statistics** - Horizontal Pod Autoscaler performance analytics
- **Resource Provisioning** - Capacity planning and resource allocation insights
- **Workloads PDB** - Pod Disruption Budget analysis

#### ⬆️ Upgrade Section

- **Cluster Version** - Current version tracking and upgrade recommendations

### 🎛️ Interactive Features

- **Draggable Widgets** - Customizable dashboard layout with drag-and-drop functionality
- **Resizable Components** - Adjustable widget dimensions for optimal viewing
- **Real-time Updates** - Live data refresh with Kubernetes API integration
- **Responsive Design** - Adaptive layout for different screen sizes

## 🛠️ Development

### Project Structure

```
src/
├── components/
│   ├── Dashboard/
│   │   ├── Overview/
│   │   │   ├── ClusterHealth.tsx
│   │   │   ├── ClusterTopology.tsx
│   │   │   └── NonRunningPods.tsx
│   │   ├── Security/
│   │   │   ├── security.tsx
│   │   │   ├── ComplianceDrift.tsx
│   │   │   ├── exposedServices.tsx
│   │   │   ├── NetworkPolicy.tsx
│   │   │   ├── NonEncryptedSecrets.tsx
│   │   │   └── RbacRisks.tsx
│   │   ├── Sustainability and Capacity/
│   │   │   ├── sustainability.tsx
│   │   │   ├── HPAStats.tsx
│   │   │   ├── orphaned.tsx
│   │   │   ├── PodDensity.tsx
│   │   │   ├── QoSClasses.tsx
│   │   │   ├── ResourceProvisioning.tsx
│   │   │   └── WorkloadsPDB.tsx
│   │   └── Upgrade/
│   │       ├── upgrade.tsx
│   │       └── ClusterVersion.tsx
│   ├── Provisioning/
│   ├── Deployment/
│   ├── Optimization/
│   ├── Troubleshooting/
│   └── sections.tsx
├── index.tsx
└── package.json
```

### Available Scripts

```bash
# Development
npm start          # Start development server
npm run build      # Build for production
npm run test       # Run test suite
npm run lint       # Run ESLint
npm run format     # Format code with Prettier

# Plugin Management
npm run package    # Package plugin for distribution
npm run install    # Install plugin in Headlamp
```

### Code Quality

The project maintains high code quality standards with:

- **TypeScript** for type safety
- **ESLint** for code linting
- **Prettier** for code formatting
- **Material-UI** for consistent UI components
- **React Hooks** for state management

## 🔧 Configuration

### Environment Variables

```bash
# Development
REACT_APP_API_URL=http://localhost:8080
REACT_APP_DEBUG=true

# Production
REACT_APP_API_URL=https://your-k8s-api
REACT_APP_DEBUG=false
```

### Plugin Configuration

Customize plugin behavior by editing `src/components/sections.tsx`:

```typescript
// Modify sidebar entries, routes, and component registrations
export const setupNKASidebar = () => {
  registerSidebarEntry({
    parent: null,
    name: 'nka',
    label: 'Nagarro K8s Accelerator',
    url: '/nka',
    icon: 'mdi:kubernetes',
  });
  // ... additional configuration
};
```

## 📊 Monitoring Capabilities

### Supported Kubernetes Resources

| Resource Type        | Monitoring Features          | Analytics                            |
| -------------------- | ---------------------------- | ------------------------------------ |
| **Pods**             | Status, Health, Distribution | Density analysis, QoS classification |
| **Nodes**            | Capacity, Utilization        | Topology mapping, Health scoring     |
| **Services**         | Exposure, Endpoints          | Security assessment, Load balancing  |
| **Secrets**          | Encryption status            | Security compliance                  |
| **ConfigMaps**       | Usage tracking               | Orphaned resource detection          |
| **PVs/PVCs**         | Binding status               | Storage optimization                 |
| **Network Policies** | Rule analysis                | Security posture assessment          |
| **HPAs**             | Scaling metrics              | Performance optimization             |

## 🚀 Deployment

### Production Build

```bash
# Build optimized production bundle
npm run build

# Package for distribution
npm run package
```

### Headlamp Integration

1. **Copy plugin files** to Headlamp plugins directory
2. **Restart Headlamp** to load the plugin
3. **Verify installation** in Headlamp UI

### Kubernetes RBAC

Ensure your cluster user has appropriate permissions:

```yaml
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
  name: nka-plugin-reader
rules:
  - apiGroups: ['']
    resources: ['*']
    verbs: ['get', 'list', 'watch']
  - apiGroups: ['apps', 'networking.k8s.io', 'autoscaling']
    resources: ['*']
    verbs: ['get', 'list', 'watch']
```

## 🤝 Contributing

We welcome contributions! Please see our [Contributing Guidelines](CONTRIBUTING.md) for details.

### Development Workflow

1. **Fork** the repository
2. **Create** a feature branch (`git checkout -b feature/amazing-feature`)
3. **Commit** your changes (`git commit -m 'Add amazing feature'`)
4. **Push** to the branch (`git push origin feature/amazing-feature`)
5. **Open** a Pull Request

### Code Standards

- Follow **TypeScript** best practices
- Maintain **React** component patterns
- Use **Material-UI** components consistently
- Write **comprehensive tests**
- Document **API changes**

## 📝 License

This project is licensed under the **MIT License** - see the [LICENSE](LICENSE) file for details.

## 👥 Authors & Acknowledgments

**Development Team:**

- **Nagarro DevOps COE** - Architecture & Development
- **Contributors** - Feature implementation & testing

**Special Thanks:**

- **Headlamp Team** - For the excellent plugin framework
- **Kubernetes Community** - For the robust container orchestration platform
- **Material-UI Team** - For the comprehensive React UI library

## 📞 Support & Contact

- **Issues**: [GitHub Issues](https://github.com/your-repo/issues)
- **Documentation**: [Wiki](https://github.com/your-repo/wiki)
- **Email**: devops-coe@nagarro.com
- **Slack**: #kubernetes-accelerator

## 🗺️ Roadmap

### Version 2.0 (Planned)

- [ ] **AI-Powered Insights** - Machine learning for predictive analytics
- [ ] **Multi-Cluster Support** - Cross-cluster management capabilities
- [ ] **Advanced Alerting** - Custom notification and alerting system
- [ ] **Cost Analytics** - Resource cost optimization insights
- [ ] **GitOps Integration** - Seamless CI/CD workflow integration

### Version 1.5 (In Progress)

- [ ] **Performance Profiling** - Application performance monitoring
- [ ] **Log Aggregation** - Centralized log analysis
- [ ] **Backup Management** - Automated backup and restore capabilities

---

**Made with ❤️ by Nagarro DevOps COE**

_Accelerating Kubernetes operations through intelligent automation and comprehensive monitoring._