From 77250c7e14500e63b8729d80b5165b2438842db2 Mon Sep 17 00:00:00 2001 From: vsoch Date: Tue, 27 Feb 2024 16:13:30 -0700 Subject: [PATCH] bug: disable view should not update path Problem: the disable view currently is adding the view bin to the path, and controller-gen had a release (today, 2/26/2024) where the go.mod is invalid for go 1.20 (minor version string not supported) and the input -i is removed. To fix this, we pin the commit from 2 days ago, and for the view, we ensure we do not change the path if it is being disabled Signed-off-by: vsoch --- Makefile | 2 +- go.mod | 2 +- pkg/flux/templates/components.sh | 9 +++++---- pkg/flux/templates/wait.sh | 5 ++++- 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index 437eac1a..0ed86b78 100644 --- a/Makefile +++ b/Makefile @@ -347,7 +347,7 @@ $(CONTROLLER_GEN): $(LOCALBIN) .PHONY: openapi-gen openapi-gen: $(OPENAPI_GEN) ## Download controller-gen locally if necessary. $(OPENAPI_GEN): $(LOCALBIN) - which ${OPENAPI_GEN} > /dev/null || (git clone --depth 1 https://github.com/kubernetes/kube-openapi /tmp/kube-openapi && cd /tmp/kube-openapi && go build -o ${OPENAPI_GEN} ./cmd/openapi-gen) + which ${OPENAPI_GEN} > /dev/null || (git clone https://github.com/kubernetes/kube-openapi /tmp/kube-openapi && cd /tmp/kube-openapi && git checkout 582cce78233bcb0195bc9a84f80662b9502325ee && go build -o ${OPENAPI_GEN} ./cmd/openapi-gen) .PHONY: swagger-jar swagger-jar: $(SWAGGER_JAR) ## Download controller-gen locally if necessary. diff --git a/go.mod b/go.mod index ca3a3283..505fc32e 100644 --- a/go.mod +++ b/go.mod @@ -82,4 +82,4 @@ require ( sigs.k8s.io/json v0.0.0-20220713155537-f223a00ba0e2 // indirect sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect sigs.k8s.io/yaml v1.3.0 // indirect -) +) \ No newline at end of file diff --git a/pkg/flux/templates/components.sh b/pkg/flux/templates/components.sh index 017601a4..d5c66b78 100644 --- a/pkg/flux/templates/components.sh +++ b/pkg/flux/templates/components.sh @@ -30,15 +30,16 @@ software="${viewbase}/software" viewbin="${viewroot}/bin" fluxpath=${viewbin}/flux -# Set the flux root -{{ if not .Spec.Logging.Quiet }} +# Set the flux root, don't show the viewer if view is disabled (can be confusing) +# The view is used to have configs and that is it +{{ if not .Spec.Logging.Quiet }}{{ if not .Spec.Flux.Container.Disable }} echo echo "Flux install root: ${viewroot}" echo -{{ end }} +{{ end }}{{ end }} # Important to add AFTER in case software in container duplicated -export PATH=$PATH:${viewbin} +{{ if not .Spec.Flux.Container.Disable }}export PATH=$PATH:${viewbin}{{ end }} # Wait for marker (from spack.go) to indicate copy is done goshare-wait-fs -p ${viewbase}/flux-operator-done.txt {{ if .Spec.Logging.Quiet }}> /dev/null 2>&1{{ end }} diff --git a/pkg/flux/templates/wait.sh b/pkg/flux/templates/wait.sh index c61c6aad..8523d36f 100644 --- a/pkg/flux/templates/wait.sh +++ b/pkg/flux/templates/wait.sh @@ -10,6 +10,7 @@ {{ .Container.Commands.Init}} {{ if .Spec.Logging.Quiet }}> /dev/null{{ end }} # Shared logic to wait for view +# We include the view even for disabling flux because it generates needed config files {{template "wait-view" .}} {{ if not .Spec.Flux.Container.Disable }}{{template "paths" .}}{{ end }} @@ -52,11 +53,13 @@ chown -R ${fluxuid} ${curvepath} # If we have disabled the view, we need to use the flux here to generate resources {{ if .Spec.Flux.Container.Disable }} hosts=$(cat ${viewroot}/etc/flux/system/hostlist) +{{ if not .Spec.Logging.Quiet }} echo echo "📦 Resources" echo "flux R encode --hosts=${hosts} --local" +{{ end }} flux R encode --hosts=${hosts} --local > ${viewroot}/etc/flux/system/R -cat ${viewroot}/etc/flux/system/R +{{ if not .Spec.Logging.Quiet }}cat ${viewroot}/etc/flux/system/R{{ end }} {{ end }} # Put the state directory in /var/lib on shared view