Skip to content

Commit

Permalink
Move the feature charts as directories inside of the k8s-monitoring c…
Browse files Browse the repository at this point in the history
…hart (#1046)

* Move the feature charts as directories inside of the k8s-monitoring chart.

Signed-off-by: Pete Wall <[email protected]>

* Fix changed files and tests

* remove extra subcharts that were added during a rebase

Signed-off-by: Pete Wall <[email protected]>

* Use local helm-schema-gen if it's available

Signed-off-by: Pete Wall <[email protected]>

---------

Signed-off-by: Pete Wall <[email protected]>
  • Loading branch information
petewall authored Jan 2, 2025
1 parent cfa04f1 commit c22f4cc
Show file tree
Hide file tree
Showing 291 changed files with 275 additions and 264 deletions.
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ Each component has its own guide for contributing:
<!-- [Main Helm chart](./charts/k8s-monitoring/README.md#Contributing) -->

- [Feature subcharts](./charts/k8s-monitoring/docs/Features.md#Contributing)
- [Integrations](./charts/feature-integrations/README.md#Contributing)
- [Integrations](charts/k8s-monitoring/charts/feature-integrations/README.md#Contributing)
- [Destinations](./charts/k8s-monitoring/docs/destinations/README.md#Contributing)

## Building
Expand Down
18 changes: 5 additions & 13 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,36 +2,28 @@ SHELL := /bin/bash
UNAME := $(shell uname)

CHARTS = $(shell ls charts)
FEATURE_CHARTS = $(shell ls charts | grep -v k8s-monitoring)

.PHONY: clean
clean:
rm -rf node_modules
set -e && \
for chart in $(CHARTS); do \
make -C charts/$$chart clean; \
make -C charts/$$chart $@; \
done

.PHONY: build
build:
set -e && \
for chart in $(FEATURE_CHARTS); do \
make -C charts/$$chart build; \
for chart in $(CHARTS); do \
make -C charts/$$chart $@; \
done
make -C charts/k8s-monitoring build
make -C charts/k8s-monitoring-test build
make -C charts/k8s-monitoring-v1 build

.PHONY: test
test: build lint
helm repo update
set -e && \
for chart in $(FEATURE_CHARTS); do \
make -C charts/$$chart test; \
for chart in $(CHARTS); do \
make -C charts/$$chart $@; \
done
make -C charts/k8s-monitoring test
make -C charts/k8s-monitoring-test test
make -C charts/k8s-monitoring-v1 test

####################################################################
# Installation / Setup #
Expand Down
38 changes: 0 additions & 38 deletions charts/feature-pod-logs/Makefile

This file was deleted.

38 changes: 0 additions & 38 deletions charts/feature-profiling/Makefile

This file was deleted.

44 changes: 22 additions & 22 deletions charts/k8s-monitoring/Chart.lock
Original file line number Diff line number Diff line change
@@ -1,33 +1,33 @@
dependencies:
- name: k8s-monitoring-feature-annotation-autodiscovery
repository: file://../feature-annotation-autodiscovery
- name: feature-annotation-autodiscovery
repository: ""
version: 1.0.0
- name: k8s-monitoring-feature-application-observability
repository: file://../feature-application-observability
- name: feature-application-observability
repository: ""
version: 1.0.0
- name: k8s-monitoring-feature-auto-instrumentation
repository: file://../feature-auto-instrumentation
- name: feature-auto-instrumentation
repository: ""
version: 1.0.0
- name: k8s-monitoring-feature-cluster-events
repository: file://../feature-cluster-events
- name: feature-cluster-events
repository: ""
version: 1.0.0
- name: k8s-monitoring-feature-cluster-metrics
repository: file://../feature-cluster-metrics
- name: feature-cluster-metrics
repository: ""
version: 1.0.0
- name: k8s-monitoring-feature-integrations
repository: file://../feature-integrations
- name: feature-integrations
repository: ""
version: 1.0.0
- name: k8s-monitoring-feature-node-logs
repository: file://../feature-node-logs
- name: feature-node-logs
repository: ""
version: 1.0.0
- name: k8s-monitoring-feature-pod-logs
repository: file://../feature-pod-logs
- name: feature-pod-logs
repository: ""
version: 1.0.0
- name: k8s-monitoring-feature-profiling
repository: file://../feature-profiling
- name: feature-profiling
repository: ""
version: 1.0.0
- name: k8s-monitoring-feature-prometheus-operator-objects
repository: file://../feature-prometheus-operator-objects
- name: feature-prometheus-operator-objects
repository: ""
version: 1.0.0
- name: alloy
repository: https://grafana.github.io/helm-charts
Expand All @@ -44,5 +44,5 @@ dependencies:
- name: alloy
repository: https://grafana.github.io/helm-charts
version: 0.10.1
digest: sha256:e2eab36a3b814d7ec09942c3fe46a5c76d606f7c3022628905c41fba7a47b405
generated: "2025-01-02T09:01:47.125267-06:00"
digest: sha256:705d452b9e031cd2f9b4e02782bf54bc6f33eae016c02e9bfa77479177fdf6bd
generated: "2025-01-02T11:08:35.433212-06:00"
41 changes: 21 additions & 20 deletions charts/k8s-monitoring/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,54 +13,55 @@ maintainers:
name: petewall
dependencies:
- alias: annotationAutodiscovery
name: k8s-monitoring-feature-annotation-autodiscovery
repository: file://../feature-annotation-autodiscovery
name: feature-annotation-autodiscovery
repository: ""
version: 1.0.0
condition: annotationAutodiscovery.enabled
- alias: applicationObservability
name: k8s-monitoring-feature-application-observability
repository: file://../feature-application-observability
name: feature-application-observability
repository: ""
version: 1.0.0
condition: applicationObservability.enabled
- alias: autoInstrumentation
name: k8s-monitoring-feature-auto-instrumentation
repository: file://../feature-auto-instrumentation
name: feature-auto-instrumentation
repository: ""
version: 1.0.0
condition: autoInstrumentation.enabled
- alias: clusterEvents
name: k8s-monitoring-feature-cluster-events
repository: file://../feature-cluster-events
name: feature-cluster-events
repository: ""
version: 1.0.0
condition: clusterEvents.enabled
- alias: clusterMetrics
name: k8s-monitoring-feature-cluster-metrics
repository: file://../feature-cluster-metrics
name: feature-cluster-metrics
repository: ""
version: 1.0.0
condition: clusterMetrics.enabled
- alias: integrations
name: k8s-monitoring-feature-integrations
repository: file://../feature-integrations
name: feature-integrations
repository: ""
version: 1.0.0
- alias: nodeLogs
name: k8s-monitoring-feature-node-logs
repository: file://../feature-node-logs
name: feature-node-logs
repository: ""
version: 1.0.0
condition: nodeLogs.enabled
- alias: podLogs
name: k8s-monitoring-feature-pod-logs
repository: file://../feature-pod-logs
name: feature-pod-logs
repository: ""
version: 1.0.0
condition: podLogs.enabled
- alias: profiling
name: k8s-monitoring-feature-profiling
repository: file://../feature-profiling
name: feature-profiling
repository: ""
version: 1.0.0
condition: profiling.enabled
- alias: prometheusOperatorObjects
name: k8s-monitoring-feature-prometheus-operator-objects
repository: file://../feature-prometheus-operator-objects
name: feature-prometheus-operator-objects
repository: ""
version: 1.0.0
condition: prometheusOperatorObjects.enabled

- alias: alloy-metrics
name: alloy
version: 0.10.1
Expand Down
33 changes: 23 additions & 10 deletions charts/k8s-monitoring/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ CHART_TEMPLATE_FILES = $(shell find templates -name "*.tpl")
CHART_YAML_FILES = $(shell find templates -name "*.yaml")
UPDATECLI_FILES := $(shell yq -e '.dependencies[] | select(.repository == "http*") | ".updatecli-" + .name + ".yaml"' Chart.yaml 2>/dev/null | sort | uniq)

FEATURE_CHARTS = $(shell ls charts | grep feature-)

SCHEMA_MODS_JSON_FILES = $(shell find schema-mods -name "*.json")
SCHEMA_MODS_JQ_FILES = $(shell find schema-mods -name "*.jq")

Expand Down Expand Up @@ -91,12 +93,6 @@ alloy_configs = $(shell \
DIR="$(shell dirname $(1))/" yq e 'with_entries(select(.key == "alloy-*")) | select(.[].enabled == true) | to_entries | env(DIR) + .[].key + ".alloy"' $(1) \
)

# TODO: Ideally, this shouldn't result in "modified" files if the subchart content is the same.
# The issue is that tar and gz include things like timestamps in their headers, which will
# result in different hashes for the same content. Not great for Makefiles or modified file checks.
Chart.lock: Chart.yaml
helm dependency update .

%/output.yaml: %/values.yaml Chart.yaml Chart.lock values.yaml values.schema.json templates/destinations/_destination_types.tpl $(DESTINATION_VALUES_FILES) $(CHART_TEMPLATE_FILES) $(CHART_YAML_FILES) alloyModules/LICENSE $(ALLOY_MODULE_FILES)
helm template $(EXAMPLE_RELEASE_NAME) . -f $< > $@

Expand Down Expand Up @@ -157,14 +153,31 @@ platform-test-checks: $(PLATFORM_TEST_OUTPUT_FILES)
clean:
rm -f README.md values.schema.json $(UPDATECLI_FILES) templates/destinations/_destination_types.tpl schema-mods/destination-list.json $(DESTINATION_SCHEMA_FILES) $(DESTINATION_DOCS_FILES)
rm -f $(EXAMPLE_OUTPUT_FILES) $(EXAMPLE_ALLOY_FILES) $(EXAMPLE_README_FILES) $(INTEGRATION_TEST_OUTPUT_FILES) $(PLATFORM_TEST_OUTPUT_FILES)
set -e && \
for chart in $(FEATURE_CHARTS); do \
make -C charts/$$chart clean; \
done

build-features:
set -e && \
for chart in $(FEATURE_CHARTS); do \
make -C charts/$$chart build; \
done

# Build targets
.PHONY: build
build: README.md alloyModules/LICENSE values.schema.json templates/destinations/_destination_types.tpl $(DESTINATION_DOCS_FILES) $(UPDATECLI_FILES) examples integration-test-checks platform-test-checks
build: build-features README.md alloyModules/LICENSE values.schema.json templates/destinations/_destination_types.tpl $(DESTINATION_DOCS_FILES) $(UPDATECLI_FILES) examples integration-test-checks platform-test-checks

# Test targets
.PHONY: test unittest lint-helm lint-configs
test: unittest lint-helm lint-configs example-checks
test: unittest lint-helm lint-configs example-checks test-features

test-features:
set -e && \
for chart in $(FEATURE_CHARTS); do \
make -C charts/$$chart test; \
done

lint-configs: $(EXAMPLE_ALLOY_FILES)
../../scripts/lint-alloy.sh $(EXAMPLE_ALLOY_FILES)
rm -rf data-alloy # Clean up the data-alloy directory, which is created by lint-alloy.sh when it runs Alloy.
Expand All @@ -176,7 +189,7 @@ lint-helm: build

unittest: values.schema.json templates/destinations/_destination_types.tpl
ifdef HAS_HELM_UNITTEST
helm unittest .
helm unittest --failfast --with-subchart=false .
else
docker run --rm --volume $(shell pwd):/apps helmunittest/helm-unittest .
docker run --rm --volume $(shell pwd):/apps helmunittest/helm-unittest --failfast --with-subchart=false .
endif
Loading

0 comments on commit c22f4cc

Please sign in to comment.