Skip to content

Missing parameters in the commands to test the custom changes via a Docker image #167

@apoorvajagtap

Description

@apoorvajagtap

build-chart script fails with undeclared main:

While building a docker image using the script per steps in Creating a Docker image based off of your changes
, the script fails with undeclared main function:

$ ./scripts/build-chart && GOOS=linux CGO_ENABLED=0 go build -ldflags "-extldflags -static -s" -o build/bin/prometheus-federator && REPO=${REPO} TAG=v3-resync make package
Fetching version 0.3.4 of rancher-project-monitoring
Completed rancher-project-monitoring (ver: 0.0.0-dev.1-3688d2b) chart build process.
# github.com/rancher/prometheus-federator
runtime.main_main·f: function main is undeclared in the main package

Reason:

  • Given the code structure, the prometheus-federator's main.go resides in cmd/prometheus-federator/main.go, so this should be specified in the command.

Not specifying clusterID while deploying prometheus-federator chart leads to Prometheus-federator pod failing to interact with the webhook.

time="2025-02-12T07:28:26Z" level=error msg="error syncing 'p-bm6rw': failed to create cattle-project-p-bm6rw /v1, Kind=Namespace for project-registration-namespace-applier: Internal error occurred: failed calling webhook \"rancher.cattle.io.namespaces.create-non-kubesystem\": failed to call webhook: an error on the server 
...
has prevented the request from succeeding, requeuing"

Reason:

  • Using the specified command just sets the custom image values, but doesn't help setting the clusterId. For a beginner, it might be helpful to have clusterId set through the same command.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions