Skip to content

Commit ebe0510

Browse files
authored
Merge pull request #622 from sthaha/doc-user-guides
docs: restructure user documentation
2 parents 88bc67b + 8f2ae48 commit ebe0510

21 files changed

+4084
-154
lines changed

.markdownlint.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,5 @@ MD013: false
44
# MD046 - Code block style
55
MD046:
66
style: consistent
7+
MD024:
8+
siblings_only: true

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ repos:
2121
hooks:
2222
- id: trailing-whitespace
2323
- id: end-of-file-fixer
24-
exclude: ^docs/api\.md$
24+
exclude: ^docs/user/reference/api\.md$
2525
- id: check-added-large-files
2626
- id: check-merge-conflict
2727

@@ -35,7 +35,7 @@ repos:
3535
rev: v0.44.0
3636
hooks:
3737
- id: markdownlint
38-
exclude: ^docs/api\.md$
38+
exclude: ^docs/user/reference/api\.md$
3939

4040
- repo: https://github.com/codespell-project/codespell
4141
rev: v2.4.1

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ coverage: test ## Run tests and generate coverage report.
144144

145145
.PHONY: docs
146146
docs: crdoc manifests ## Generate docs.
147-
$(CRDOC) --resources config/crd/bases --output docs/api.md
147+
$(CRDOC) --resources config/crd/bases --output docs/user/reference/api.md
148148

149149
##@ Development env
150150
CLUSTER_PROVIDER ?= kind

README.md

Lines changed: 76 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -9,124 +9,123 @@ Kepler Operator is a Kubernetes operator that automates the deployment and manag
99

1010
## 🔍 What is Kepler?
1111

12-
[Kepler](https://github.com/sustainable-computing-io/kepler) (Kubernetes-based Efficient Power Level Exporter) is a Prometheus
13-
exporter. It uses eBPF to probe CPU performance counters and Linux kernel
14-
tracepoints.
15-
16-
These data and stats from cgroup and sysfs can then be fed into ML models to
17-
estimate energy consumption by Pods.
12+
[Kepler](https://github.com/sustainable-computing-io/kepler) (Kubernetes-based Efficient Power Level Exporter) is a Prometheus exporter
13+
that measures energy consumption metrics at the container, pod, and node level in
14+
Kubernetes clusters.
1815

1916
Check out the project on GitHub ➡️ [Kepler](https://github.com/sustainable-computing-io/kepler)
2017

2118
## 🚀 Getting Started
2219

23-
You'll need a Kubernetes or OpenShift cluster. For local testing, use [KIND](https://sigs.k8s.io/kind). Otherwise, connect to a remote cluster.
24-
25-
**Note:** The operator uses the current kubeconfig context (check with `kubectl cluster-info`).
26-
27-
### 💻 Using Kind Cluster
28-
29-
To quickly set up a local environment with Kind:
30-
31-
```sh
32-
make cluster-up
33-
```
20+
### For Users
3421

35-
### 🛠️ Local Development
22+
#### Quick Start (Kubernetes with Helm)
3623

37-
To run the operator locally outside the cluster:
24+
Get Kepler up and running in minutes. For comprehensive installation instructions, prerequisites, configuration options, and troubleshooting, see the **[Kubernetes Installation Guide](docs/user/installation/kubernetes.md)**.
3825

3926
```sh
40-
make tools
41-
make run
42-
kubectl apply -k config/samples/
43-
```
44-
45-
### On Vanilla Kubernetes
46-
47-
Deploy the operator and its dependencies:
48-
49-
```sh
50-
make tools
51-
kubectl create -f https://github.com/prometheus-operator/prometheus-operator/releases/download/v0.76.0/bundle.yaml
52-
kubectl create -f https://github.com/cert-manager/cert-manager/releases/download/v1.18.2/cert-manager.yaml
53-
make deploy
54-
kubectl apply -k config/samples/
55-
```
27+
# 1. Install cert-manager (required for operator webhooks)
28+
# For the latest version, see: https://cert-manager.io/docs/installation/
29+
kubectl apply -f https://github.com/cert-manager/cert-manager/releases/download/v1.18.2/cert-manager.yaml
5630

57-
### 📦 Using Helm Chart
31+
# Wait for cert-manager to be ready
32+
kubectl wait --for=condition=available --timeout=120s deployment -n cert-manager --all
5833

59-
Install the Kepler Operator using Helm:
34+
# 2. Install monitoring stack (Prometheus + Grafana)
35+
# Skip if you already have Prometheus installed
36+
helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
37+
helm install prometheus prometheus-community/kube-prometheus-stack \
38+
--namespace monitoring \
39+
--create-namespace \
40+
--set prometheus.prometheusSpec.serviceMonitorSelectorNilUsesHelmValues=false
6041

61-
```sh
62-
# Install cert-manager (if not already installed)
63-
kubectl apply -f https://github.com/cert-manager/cert-manager/releases/download/v1.18.2/cert-manager.yaml
42+
# Wait for monitoring stack to be ready
43+
kubectl wait --for=condition=ready --timeout=180s pod -n monitoring --all
6444

65-
# Install Kepler Operator from OCI registry
45+
# 3. Install Kepler Operator
6646
helm install kepler-operator \
6747
oci://quay.io/sustainable_computing_io/charts/kepler-operator \
6848
--namespace kepler-operator \
6949
--create-namespace
70-
```
7150

72-
For detailed Helm installation options and configuration, see [Kepler Operator Helm Chart](manifests/helm/kepler-operator/README.md).
51+
# Wait for operator to be ready
52+
kubectl wait --for=condition=available --timeout=120s deployment -n kepler-operator --all
7353

74-
### 📦 Using Pre-published Image
54+
# 4. Deploy Kepler
55+
# Note: PowerMonitor must be named "power-monitor" (enforced by operator)
56+
kubectl apply -f https://raw.githubusercontent.com/sustainable-computing-io/kepler-operator/main/config/samples/kepler.system_v1alpha1_powermonitor.yaml
7557

76-
You can use the pre-built image from quay.io:
58+
# Wait for Kepler pods to be running
59+
kubectl wait --for=condition=ready --timeout=120s pod -n power-monitor --all
7760

78-
```sh
79-
make deploy OPERATOR_IMG=quay.io/sustainable_computing_io/kepler-operator:latest
80-
kubectl apply -k config/samples/
61+
# 5. Verify installation
62+
kubectl get pods -n power-monitor
8163
```
8264

83-
Alternatively, build and use your own image:
65+
**Next Steps:**
8466

85-
```sh
86-
make operator-build operator-push IMG_BASE=<your-registry>
87-
make deploy IMG_BASE=<your-registry>/kepler-operator:<tag>
88-
kubectl apply -k config/samples/
89-
```
67+
To ensure Kepler is working correctly, follow these validation guides:
9068

91-
### On OpenShift
69+
- **[Validate Prometheus Integration](docs/user/guides/validating-prometheus-integration.md)** - Verify metrics are being collected (recommended)
70+
- **[Setup Grafana Dashboards](docs/user/guides/grafana-dashboard.md)** - Visualize power consumption metrics
71+
- [Configuration Options](docs/user/guides/power-monitor.md) - Customize Kepler deployment
9272

93-
Deploy the operator on OpenShift:
73+
**Need Help?**
9474

95-
```sh
96-
make tools
97-
make operator-build operator-push \
98-
bundle bundle-build bundle-push \
99-
IMG_BASE=<your-registry> VERSION=0.0.0-dev
100-
./tmp/bin/operator-sdk run bundle <your-registry>/kepler-operator-bundle:0.0.0-dev \
101-
--install-mode AllNamespaces --namespace openshift-operators --skip-tls
102-
```
75+
- [Kubernetes Installation Guide](docs/user/installation/kubernetes.md) - Detailed prerequisites, configuration options, and installation steps
76+
- [Validate Prometheus Integration](docs/user/guides/validating-prometheus-integration.md) - If Kepler is running but metrics aren't appearing
77+
- [Troubleshooting Guide](docs/user/guides/troubleshooting.md) - Common issues and solutions
10378

104-
## 🗑️ Uninstallation
79+
#### Quick Start (OpenShift)
10580

106-
To list the installed resources before deletion:
81+
Install from OperatorHub via the OpenShift Web Console. See the [OpenShift Installation Guide](docs/user/installation/openshift.md) for details.
10782

108-
```sh
109-
./hack/uninstall-operator.sh
110-
```
83+
#### User Documentation
84+
85+
For detailed installation, configuration, and usage instructions, see the [User Guides](docs/user/README.md):
86+
87+
- **Installation**:
88+
- [Kubernetes Installation (Helm)](docs/user/installation/kubernetes.md)
89+
- [Monitoring Stack Installation](docs/user/installation/monitoring-stack-kubernetes.md)
90+
- [OpenShift Installation (OperatorHub)](docs/user/installation/openshift.md)
91+
- **Usage**:
92+
- [Creating PowerMonitor Resources](docs/user/guides/power-monitor.md)
93+
- [Configuring PowerMonitor](docs/user/guides/power-monitor.md)
94+
- [Setting up Grafana Dashboards](docs/user/guides/grafana-dashboard.md)
95+
- [Validating Prometheus Integration](docs/user/guides/validating-prometheus-integration.md)
96+
- [Upgrading](docs/user/guides/upgrading.md)
97+
- **Reference**:
98+
- [API Reference](docs/user/reference/api.md)
99+
- [Troubleshooting](docs/user/guides/troubleshooting.md)
100+
- [Uninstallation](docs/user/reference/uninstallation.md)
111101

112-
To completely remove the operator and all related resources:
102+
### For Developers
103+
104+
#### Quick Start
113105

114106
```sh
115-
./hack/uninstall-operator.sh --delete
107+
# Setup local Kind cluster with prerequisites
108+
make cluster-up
109+
110+
# Run operator locally
111+
make run
112+
113+
# In another terminal, create a PowerMonitor
114+
kubectl apply -k config/samples/
116115
```
117116

118-
## 📚 Developer Documentation
117+
#### Developer Documentation
119118

120-
[Developer documentation](https://github.com/sustainable-computing-io/kepler-operator/tree/main/docs/developer) is available for those who want to contribute to the codebase or understand its internals.
119+
For contribution guidelines, architecture details, and development workflows, see the [Developer Documentation](docs/developer/README.md)
121120

122121
## 🤝 Contributing
123122

124123
You can contribute by:
125124

126-
* Reporting [issues](https://github.com/sustainable-computing-io/kepler-operator/issues)
127-
* Fixing issues by opening [Pull Requests](https://github.com/sustainable-computing-io/kepler-operator/pulls)
128-
* Improving documentation
129-
* Sharing your success stories with Kepler
125+
- Reporting [issues](https://github.com/sustainable-computing-io/kepler-operator/issues)
126+
- Fixing issues by opening [Pull Requests](https://github.com/sustainable-computing-io/kepler-operator/pulls)
127+
- Improving documentation
128+
- Sharing your success stories with Kepler
130129

131130
## 📝 License
132131

docs/developer/README.md

Lines changed: 78 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,69 +1,95 @@
1+
# Developer Documentation
12

2-
# Code Organization
3+
This documentation is for developers and contributors who want to understand the Kepler Operator codebase, contribute code, or maintain the project.
4+
5+
**Looking to use Kepler Operator?** See the [User Guides](../user/README.md) instead.
6+
7+
## Audience
8+
9+
This documentation is for:
10+
11+
- Contributors adding features or fixing bugs
12+
- Maintainers managing releases and project infrastructure
13+
- Developers wanting to understand internal architecture
14+
- Anyone building on or extending Kepler Operator
15+
16+
## Code Organization
317

418
```sh
519
🏠 kepler-operator
620
7-
├── automation 👈 ⚙️ CI related scripts
8-
│   └── presubmit-tests
21+
├── .github 👈 ⚙️ GitHub Actions workflows and CI/CD
22+
│ └── workflows
23+
24+
├── api 👈 📋 Kubernetes API types
25+
│ └── v1alpha1 CRDs (Kepler, PowerMonitor, etc)
926
10-
├── bundle 👈 📦 Autogenerated and OLM related files
11-
│   ├── manifests
12-
│   ├── metadata
13-
│   └── tests
27+
├── bundle 👈 📦 Autogenerated OLM bundle
28+
│ ├── manifests
29+
│ ├── metadata
30+
│ └── tests
31+
32+
├── cmd 👈 🚀 Main entrypoint
33+
│ └── main.go Operator manager CLI
34+
35+
├── config 👈 ⚙️ Kustomize configs (source of truth for manifests)
36+
│ ├── certmanager Cert-manager for webhooks
37+
│ ├── crd CRD definitions
38+
│ ├── default Main kustomization overlays
39+
│ ├── manager Manager deployment config
40+
│ ├── manifests OLM bundle kustomization
41+
│ ├── network-policy Network policies
42+
│ ├── prometheus ServiceMonitor configs
43+
│ ├── rbac RBAC resources
44+
│ ├── samples 👈 Sample CRs for users
45+
│ ├── scorecard Operator scorecard tests
46+
│ └── webhook Webhook configurations
1447
1548
├── docs
16-
│   ├── developer 👈 developer / contributor (design) docs
17-
│   └── user-guides
49+
│ ├── design 👈 📐 Architecture and design docs
50+
│ ├── developer 👈 👩‍💻 Developer/contributor guides
51+
│ ├── logo Project logos and assets
52+
│ └── user 👈 📖 User guides and documentation
53+
54+
├── hack 👈 🛠️ Development scripts and tools
55+
│ ├── crds CRD utilities
56+
│ ├── dashboard Grafana dashboard assets
57+
│ ├── helm Helm chart tooling and validation
58+
│ ├── monitoring Monitoring setup scripts
59+
│ └── reports Report generation utilities
60+
61+
├── internal 👈 🔒 Private application code
62+
│ ├── config Operator configuration management
63+
│ └── controller Reconciler implementations
64+
65+
├── manifests 👈 📦 Distribution manifests
66+
│ └── helm Helm chart for operator deployment
1867
19-
├── config 👈 configuration is used to generate the bundle
20-
│   ├── crd
21-
│   ├── default
22-
│   ├── manager
23-
│   ├── manifests
24-
│   ├── prometheus
25-
│   ├── rbac
26-
│   ├── samples 👈 contains samples that users can use to deploy kepler
27-
│   └── scorecard
28-
│ 
29-
├── hack 👈 🛠️ scripts to help with development
30-
│   ├── crds
31-
│   └── dashboard
68+
├── must-gather 👈 🔍 Debugging and diagnostics collection
3269
33-
├── cmd 👈 source - for the Manager CLI
34-
│   └── manager
70+
├── pkg 👈 📚 Public reusable packages
71+
│ ├── components Component manifest builders (PowerMonitor, etc)
72+
│ ├── reconciler Generic reconciliation framework
73+
│ ├── utils Utility functions (k8s, test helpers)
74+
│ └── version Version information
3575
36-
├── pkg
37-
│   ├── api
38-
│   │    └── v1alpha1 👈 k8s API types
39-
│   │
40-
│   ├── components 👈 source for creating kepler or other components
41-
│   │   ├── exporter manifests like daemsonsets, service, etc
42-
│   │   └── modelserver
43-
│   │
44-
│   ├── controllers 👈 controller-runtime components
45-
│   │
46-
│   ├── reconciler 👈 single object creator / deletor etc
47-
│   └── utils
48-
│   ├── k8s
49-
│   └── test
50-
├── tests 👈 🧪 end-to-end tests 🏠
51-
│   └── e2e
52-
└── tmp
53-
    └── bin 👈 all binaries are installed to `tmp/bin` (make tools)
76+
└── tests 👈 🧪 Test suites
77+
├── e2e End-to-end tests
78+
├── testdata Test fixtures and data
79+
└── utils Test utilities and helpers
5480
```
5581

56-
# How do I get started ?
82+
## How do I get started?
5783

58-
* Knowledge of Kubernetes
59-
* API
60-
* Controller Generator
84+
- Knowledge of Kubernetes
85+
- API
86+
- Controller Generator
6187

62-
* Kube Builder Book: <https://book.kubebuilder.io/>
63-
* Operator SDK Getting Started: <https://sdk.operatorframework.io/docs/building-operators/golang/tutorial/>
64-
* Kubernetes Programming Book: <https://www.oreilly.com/library/view/programming-kubernetes/9781492047094/>
88+
- Kube Builder Book: <https://book.kubebuilder.io/>
89+
- Operator SDK Getting Started: <https://sdk.operatorframework.io/docs/building-operators/golang/tutorial/>
90+
- Kubernetes Programming Book: <https://www.oreilly.com/library/view/programming-kubernetes/9781492047094/>
6591

66-
# Developer Guides
92+
## Developer Guides
6793

68-
* [Helm Chart Maintenance](helm-chart-maintenance.md) - How to update and maintain the Helm chart
69-
* [Pre-commit Hooks](pre-commit-hooks.md) - Setting up and using pre-commit hooks
94+
- [Helm Chart Maintenance](helm-chart-maintenance.md) - How to update and maintain the Helm chart
95+
- [Pre-commit Hooks](pre-commit-hooks.md) - Setting up and using pre-commit hooks

docs/developer/pre-commit-hooks.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ The following hooks are configured in `.pre-commit-config.yaml`:
4141
### 1. [pre-commit-hooks](https://github.com/pre-commit/pre-commit-hooks)
4242

4343
- `trailing-whitespace`: Removes trailing whitespace from lines.
44-
- `end-of-file-fixer`: Ensures files end with a newline. (Excludes `docs/api.md`)
44+
- `end-of-file-fixer`: Ensures files end with a newline. (Excludes `docs/user/reference/api.md`)
4545
- `check-added-large-files`: Prevents committing large files.
4646
- `check-merge-conflict`: Detects merge conflict markers.
4747

@@ -51,7 +51,7 @@ The following hooks are configured in `.pre-commit-config.yaml`:
5151

5252
### 3. [markdownlint](https://github.com/igorshubovych/markdownlint-cli)
5353

54-
- `markdownlint`: Lints Markdown files (excludes `docs/api.md`).
54+
- `markdownlint`: Lints Markdown files (excludes `docs/user/reference/api.md`).
5555

5656
### 4. [codespell](https://github.com/codespell-project/codespell)
5757

0 commit comments

Comments
 (0)