Skip to content

Commit

Permalink
Update docs and also create rendered output for the integration tests…
Browse files Browse the repository at this point in the history
…, so it ensures that things are still valid there

Signed-off-by: Pete Wall <[email protected]>
  • Loading branch information
petewall committed Nov 26, 2024
1 parent c0208a9 commit 4980be1
Show file tree
Hide file tree
Showing 86 changed files with 15,790 additions and 2,180 deletions.
2 changes: 1 addition & 1 deletion charts/k8s-monitoring/Chart.lock
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,4 @@ dependencies:
repository: https://grafana.github.io/helm-charts
version: 0.10.0
digest: sha256:5805f8a2eb47cc7ed65d2f8b94d07a3bf474143d179bf781be69c5f7ce1a4d00
generated: "2024-11-26T10:43:19.397726-06:00"
generated: "2024-11-26T14:43:42.607469-06:00"
18 changes: 14 additions & 4 deletions charts/k8s-monitoring/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,15 @@ else
endif

# Example targets
EXAMPLE_RELEASE_NAME=ko
EXAMPLE_RELEASE_NAME=k8smon
EXAMPLE_VALUES_FILES = $(shell find docs/examples -name values.yaml)
EXAMPLE_OUTPUT_FILES = $(EXAMPLE_VALUES_FILES:values.yaml=output.yaml)
EXAMPLE_ALLOY_FILES = $(foreach file,$(EXAMPLE_VALUES_FILES),$(call alloy_configs, $(file)))
EXAMPLE_README_FILES = $(EXAMPLE_VALUES_FILES:values.yaml=README.md)

INTEGRATION_TEST_VALUES_FILES = $(shell find tests/integration -name values.yaml)
INTEGRATION_TEST_OUTPUT_FILES = $(INTEGRATION_TEST_VALUES_FILES:values.yaml=.rendered/output.yaml)

alloy_configs = $(shell \
DIR="$(shell dirname $(1))/" yq e 'with_entries(select(.key == "alloy-*")) | select(.[].enabled == true) | to_entries | env(DIR) + .[].key + ".alloy"' $(1) \
)
Expand All @@ -94,6 +97,10 @@ Chart.lock: Chart.yaml
%/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 $< > $@

%/.rendered/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)
mkdir -p $(dir $@)
helm template $(EXAMPLE_RELEASE_NAME) . -f $< > $@

%/alloy-logs.alloy: %/output.yaml
yq 'select(.kind=="ConfigMap" and .metadata.name=="$(EXAMPLE_RELEASE_NAME)-alloy-logs") | .data["config.alloy"]' $< > $@

Expand Down Expand Up @@ -138,18 +145,21 @@ else
docker run --platform linux/amd64 --rm --volume $(shell pwd):/src shellspec/shellspec -c /src/tests/example-checks -s /bin/sh
endif

.PHONY: integration-test-checks
integration-test-checks: $(INTEGRATION_TEST_OUTPUT_FILES)

.PHONY: clean
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)
rm -f $(EXAMPLE_OUTPUT_FILES) $(EXAMPLE_ALLOY_FILES) $(EXAMPLE_README_FILES) $(INTEGRATION_TEST_OUTPUT_FILES)

# Build targets
.PHONY: build
build: README.md alloyModules/LICENSE values.schema.json templates/destinations/_destination_types.tpl $(DESTINATION_DOCS_FILES) $(UPDATECLI_FILES) examples
build: README.md alloyModules/LICENSE values.schema.json templates/destinations/_destination_types.tpl $(DESTINATION_DOCS_FILES) $(UPDATECLI_FILES) examples integration-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 integration-test-checks example-checks
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 Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 4980be1

Please sign in to comment.