Skip to content

Commit

Permalink
Refactored the examples and rendered directories into one for better …
Browse files Browse the repository at this point in the history
…usability, (#658)

This refactor combines the rendered and example directories so they are one. Also added more examples for the most popular use cases.

- All examples will now be rendered and updated as this project grows.
- The examples are rendered in parallel.
- This will help users understand the examples without even downloading the source code and using Helm commands.
- This can help users understand the differences in each release, especially for some of our more unique Helm value configurations (especially Openshift Security Constraints).
  • Loading branch information
jvoravong authored Feb 9, 2023
1 parent 078da4d commit 79af98d
Show file tree
Hide file tree
Showing 203 changed files with 7,349 additions and 936 deletions.
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@ repos:
- repo: local
hooks:
- id: render
name: Pre-render Kubernetes resources
name: Create the rendered Kubernetes manifest resources for the project examples
entry: make render
language: system
pass_filenames: false
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.2.0
hooks:
- id: trailing-whitespace
exclude: "^rendered|^test"
exclude: "^examples|^test"
- id: end-of-file-fixer
exclude: "^rendered|^test"
exclude: "^examples|^test"
- id: check-yaml
# Can't check source yaml since it has go templates in it.
exclude: "^helm-charts|^test"
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

## Unreleased

### Added

- Refactored the examples and rendered directories into one for better usability ([#658](https://github.com/signalfx/splunk-otel-collector-chart/pull/658)

## [0.70.0] - 2022-01-31

### Added
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ any 'help wanted' issues is a great place to start.

## Building

When changing the helm chart the files under `rendered` need to be rebuilt with `make render`. It's strongly recommended to use [pre-commit](https://pre-commit.com/) which will do this automatically for each commit (as well as run some linting).
When changing the helm chart the files under `examples/*/rendered_manifests` need to be rebuilt with `make render`. It's strongly recommended to use [pre-commit](https://pre-commit.com/) which will do this automatically for each commit (as well as run some linting).

## Running locally

Expand Down
86 changes: 1 addition & 85 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,87 +1,3 @@
.PHONY: render
render:
rm -rf rendered/manifests
# Set for one of each telemetry type.
for i in metrics traces logs; do \
dir=rendered/manifests/"$$i-only"; \
mkdir -p "$$dir"; \
helm template \
--namespace default \
--values rendered/values.yaml \
--set splunkObservability.metricsEnabled=false,splunkObservability.tracesEnabled=false,splunkObservability.logsEnabled=false,splunkObservability.$${i}Enabled=true \
--output-dir "$$dir" \
default helm-charts/splunk-otel-collector; \
mv "$$dir"/splunk-otel-collector/templates/* "$$dir"; \
rm -rf "$$dir"/splunk-otel-collector; \
done

# Default configuration deployment.
dir=rendered/manifests/agent-only; \
mkdir -p "$$dir"; \
helm template \
--namespace default \
--values rendered/values.yaml \
--output-dir "$$dir" \
default helm-charts/splunk-otel-collector; \
mv "$$dir"/splunk-otel-collector/templates/* "$$dir"; \
rm -rf "$$dir"/splunk-otel-collector

# Gateway mode deployment only.
dir=rendered/manifests/gateway-only; \
mkdir -p "$$dir"; \
helm template \
--namespace default \
--values rendered/values.yaml \
--output-dir "$$dir" \
--set agent.enabled=false,gateway.enabled=true,clusterReceiver.enabled=false \
default helm-charts/splunk-otel-collector; \
mv "$$dir"/splunk-otel-collector/templates/* "$$dir"; \
rm -rf "$$dir"/splunk-otel-collector

# Native OTel logs collection instead of fluentd.
dir=rendered/manifests/otel-logs; \
mkdir -p "$$dir"; \
helm template \
--namespace default \
--values rendered/values.yaml \
--output-dir "$$dir" \
--set logsEngine=otel,splunkObservability.logsEnabled=true \
default helm-charts/splunk-otel-collector; \
mv "$$dir"/splunk-otel-collector/templates/* "$$dir"; \
rm -rf "$$dir"/splunk-otel-collector

# eks/fargate deployment (with recommended gateway)
dir=rendered/manifests/eks-fargate; \
mkdir -p "$$dir"; \
helm template \
--namespace default \
--values rendered/values.yaml \
--output-dir "$$dir" \
--set distribution=eks/fargate,gateway.enabled=true,cloudProvider=aws \
default helm-charts/splunk-otel-collector; \
mv "$$dir"/splunk-otel-collector/templates/* "$$dir"; \
rm -rf "$$dir"/splunk-otel-collector

# network-explorer deployment (with recommended gateway)
dir=rendered/manifests/network-explorer; \
mkdir -p "$$dir"; \
helm template \
--namespace default \
--values rendered/values.yaml \
--output-dir "$$dir" \
--set networkExplorer.enabled=true,agent.enabled=false \
default helm-charts/splunk-otel-collector; \
mv "$$dir"/splunk-otel-collector/templates/* "$$dir"; \
rm -rf "$$dir"/splunk-otel-collector

# cluster-receiver objects collection enabled
dir=rendered/manifests/cluster-receiver-objects; \
mkdir -p "$$dir"; \
helm template \
--namespace default \
--values rendered/values.yaml \
--output-dir "$$dir" \
--set logsEngine=otel,splunkObservability.logsEnabled=true,clusterReceiver.k8sObjects[0].name=pods,clusterReceiver.k8sObjects[0].mode=pull,clusterReceiver.k8sObjects[0].interval=20,clusterReceiver.k8sObjects[1].name=events,clusterReceiver.k8sObjects[1].mode=watch \
default helm-charts/splunk-otel-collector; \
mv "$$dir"/splunk-otel-collector/templates/* "$$dir"; \
rm -rf "$$dir"/splunk-otel-collector
bash ./examples/render-examples.sh
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ Instead of setting helm values as arguments a YAML file can be provided:
helm install my-splunk-otel-collector --values my_values.yaml splunk-otel-collector-chart/splunk-otel-collector
```

The [rendered directory](rendered) contains pre-rendered Kubernetes resource manifests.
The [examples directory](examples) contains examples of typical use cases with pre-rendered Kubernetes resource manifests for each example.

### How to upgrade

Expand Down
2 changes: 1 addition & 1 deletion RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ of `version` field.

To make a new release of the helm chart:
1. Bump the `version` in [Chart.yaml](helm-charts/splunk-otel-collector/Chart.yaml)
2. Run `make render` to re-render the yaml rendered files.
2. Run `make render` to render all the examples with the latest changes.
3. Create PR and request review from the team.
4. When the PR gets merged, the release will automatically be made and the helm repo updated.
5. Release notes are not populated automatically. So make sure to update them manually using the notes from
Expand Down
Loading

0 comments on commit 79af98d

Please sign in to comment.