Skip to content

update-agent-example-with-workload-and-readme #48

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 27, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 37 additions & 6 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,27 +107,58 @@ A [Helm chart](../charts/lightrun-operator/) is available in the repository bran
1. Add the Lightrun repository to your Helm repositories:
```sh
helm repo add lightrun-k8s-operator https://lightrun-platform.github.io/lightrun-k8s-operator
helm repo update
```

2. Install the chart:
2. **Initial Installation:**
- Using default [values](../charts/lightrun-operator/values.yaml):
```sh
helm install lightrun-k8s-operator/lightrun-k8s-operator -n lightrun-operator --create-namespace
helm install lightrun-k8s-operator lightrun-k8s-operator/lightrun-k8s-operator -n lightrun-operator --create-namespace
```

- Using custom values file:
```sh
helm install lightrun-k8s-operator/lightrun-k8s-operator -f <values-file> -n lightrun-operator --create-namespace
helm install lightrun-k8s-operator lightrun-k8s-operator/lightrun-k8s-operator -f <values-file> -n lightrun-operator --create-namespace
```

3. **Upgrading the Operator:**

Due to Helm's limitations with CRD management, upgrades require special handling:

**For upgrades that include CRD changes:**
```sh
# Step 1: Update the repository
helm repo update

# Step 2: Apply CRDs manually (if CRDs have changed)
kubectl apply -f https://raw.githubusercontent.com/lightrun-platform/lightrun-k8s-operator/main/config/crd/bases/agents.lightrun.com_lightrunjavaagents

# Step 3: Upgrade the Helm release
helm upgrade lightrun-k8s-operator lightrun-k8s-operator/lightrun-k8s-operator -n lightrun-operator
```

**For upgrades without CRD changes:**
```sh
helm repo update
helm upgrade lightrun-k8s-operator lightrun-k8s-operator/lightrun-k8s-operator -n lightrun-operator
```

> **Important:** Always check the [release notes](https://github.com/lightrun-platform/lightrun-k8s-operator/releases) to determine if CRDs have been updated in the new version.

> **Note:** `helm upgrade --install` or `helm install --dry-run` may not work properly due to limitations with how Helm handles CRDs.
> For more information, see the [Helm documentation](https://helm.sh/docs/chart_best_practices/custom_resource_definitions/).

3. Uninstall the chart:
4. **Uninstall the chart:**
```sh
helm delete lightrun-k8s-operator -n lightrun-operator
```

**Manual CRD cleanup (if needed):**
```sh
helm delete lightrun-k8s-operator
# Warning: This will delete all LightrunJavaAgent custom resources
kubectl delete crd lightrunjavaagents.agents.lightrun.com
```
> **Note:** CRDs will not be deleted due to Helm limitations. See [Helm's documentation on CRD limitations](https://helm.sh/docs/topics/charts/#limitations-on-crds) for more details.
> **Note:** CRDs are not automatically deleted by Helm due to safety reasons. See [Helm's documentation on CRD limitations](https://helm.sh/docs/topics/charts/#limitations-on-crds) for more details.

### Version Compatibility

Expand Down
6 changes: 4 additions & 2 deletions examples/lightrunjavaagent.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@ spec:
###############################################################################################
# Fields that you need to change if you want to try operator with your own deployment
###############################################################################################
# Name of the deployment that you are going to patch.
# Name of the workload that you are going to patch.
# Has to be in the same namespace
deploymentName: sample-deployment
workloadName: sample-deployment
# Type of the workload. Supported values are `Deployment` and `StatefulSet`
workloadType: Deployment
# List of container names inside the pod of the deployment
# If container not mentioned here it will be not patched
containerSelector:
Expand Down
Loading