Skip to content
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

[DO NOT MERGE] Generate go structs from helm chart values #897

Closed
wants to merge 1 commit into from
Closed
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
59 changes: 59 additions & 0 deletions k8s/manifests/charts/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
default: help

COREDNS_FILE_NAME := coredns-1.36.0
CK_LOADBALANCER_FILE_NAME = ck-loadbalancer
CILIUM_FILE_NAME := cilium-1.16.3
METALLB_FILE_NAME := metallb-0.14.8
RAWFILE_CSI_FILE_NAME := rawfile-csi-0.9.0
METRICS_SERVER_FILE_NAME := metrics-server-3.12.2
TARGET_DIR := ../../../src/k8s/pkg/k8sd/features/values

.PHONY: help
help:
@echo "Available targets:"
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf " %-15s %s\n", $$1, $$2}'

.PHONY: extract-values
extract-values: ## Extract values.yaml files from Helm charts.
@echo "Extracting CoreDNS values..."
@tar --transform='s|coredns/values.yaml|${COREDNS_FILE_NAME}_values.yaml|' -zxf ${COREDNS_FILE_NAME}.tgz coredns/values.yaml

@echo "Extracting Cilium values..."
@tar --transform='s|cilium/values.yaml|${CILIUM_FILE_NAME}_values.yaml|' -zxf ${CILIUM_FILE_NAME}.tgz cilium/values.yaml

@echo "Copying CK Loadbalancer values..."
@cp ck-loadbalancer/values.yaml ${CK_LOADBALANCER_FILE_NAME}_values.yaml

@echo "Extracting MetalLB values..."
@tar --transform='s|metallb/values.yaml|${METALLB_FILE_NAME}_values.yaml|' -zxf ${METALLB_FILE_NAME}.tgz metallb/values.yaml

@echo "Extracting Rawfile CSI values..."
@tar --transform='s|rawfile-csi/values.yaml|${RAWFILE_CSI_FILE_NAME}_values.yaml|' -zxf ${RAWFILE_CSI_FILE_NAME}.tgz rawfile-csi/values.yaml

@echo "Extracting Metrics Server values..."
@tar --transform='s|metrics-server/values.yaml|${METRICS_SERVER_FILE_NAME}_values.yaml|' -zxf ${METRICS_SERVER_FILE_NAME}.tgz metrics-server/values.yaml

.PHONY: gen
gen: extract-values ## Generate Go code from values.yaml files.
@go run generator.go -files=${COREDNS_FILE_NAME}_values.yaml,${CILIUM_FILE_NAME}_values.yaml,${CK_LOADBALANCER_FILE_NAME}_values.yaml,${METALLB_FILE_NAME}_values.yaml,${RAWFILE_CSI_FILE_NAME}_values.yaml,${METRICS_SERVER_FILE_NAME}_values.yaml -pkg=values -out-dir=${TARGET_DIR} -advanced-types=true -unsafe-field=true

.PHONY: clean
clean: clean-yaml-values clean-gen-values ## Clean up.

.PHONY: clean-yaml-values
clean-yaml-values: ## Clean up extracted values.yaml files.
rm -f ${COREDNS_FILE_NAME}_values.yaml
rm -f ${CILIUM_FILE_NAME}_values.yaml
rm -f ${CK_LOADBALANCER_FILE_NAME}_values.yaml
rm -f ${METALLB_FILE_NAME}_values.yaml
rm -f ${RAWFILE_CSI_FILE_NAME}_values.yaml
rm -f ${METRICS_SERVER_FILE_NAME}_values.yaml

.PHONY: clean-gen-values
clean-gen-values: ## Clean up generated Go code.
rm -f ${TARGET_DIR}/${COREDNS_FILE_NAME}_values.go
rm -f ${TARGET_DIR}/${CILIUM_FILE_NAME}_values.go
rm -f ${TARGET_DIR}/${CK_LOADBALANCER_FILE_NAME}_values.go
rm -f ${TARGET_DIR}/${METALLB_FILE_NAME}_values.go
rm -f ${TARGET_DIR}/${RAWFILE_CSI_FILE_NAME}_values.go
rm -f ${TARGET_DIR}/${METRICS_SERVER_FILE_NAME}_values.go
Loading
Loading