cloudfoundry-community / splunk-firehose-nozzle

Send CF component metrics, CF app logs, and CF app metrics to Splunk
Apache License 2.0
29 stars 29 forks source link

Splunk nozzle "deploy-all" errand should not use a specific stack! #362

Closed schindlersebastian closed 5 months ago

schindlersebastian commented 6 months ago

What happened The errand "deploy-all" fails with missing binary-buildpack for the stack cflinuxfs3 if run in a cflinuxfs4-only environment.

What you expected to happen: The errand should run without errors on any stack.

How to reproduce it (as minimally and precisely as possible): Disable the binary-buildpack for the cflinuxfs3 stack and run the errand "deploy-all"

Anything else we need to know?: The errand's cf push is invoked with -s cflinuxfs3 which is a bug in our opinion.
It should not require a specific stack.

Environment:

Invoked command

  cf push splunk-firehose-nozzle-1.3.0 -n splunk-firehose-nozzle -d apps.some.domain -f /var/vcap/packages/splunk_firehose_nozzle/manifest.yml -s cflinuxfs3 --no-start  
...        
Exit code 1
Stderr     Using cflinuxfs3 stack  
           Buildpack is invalid: Requested buildpack(s) 'binary_buildpack' are disabled and cannot be used for staging  
sbylica-splunk commented 6 months ago

Hi @schindlersebastian, what is the exact command you are using to run this?

schindlersebastian commented 6 months ago

We are using the .pivotal Tile and one part of the installation / upgrade procedure is the errand deploy-all that installs the app.
So in fact only the bosh run-errand command is executed and the errand itself invokes the cf push.

schindlersebastian commented 6 months ago

Hi @sbylica-splunk,

it seems to be my bad...

I think you do not set a specific stack in your code (at least I found nothing so far). But the stack of the currently deployed app (which is cflinuxfs3 in our case) is used if we cf push the app again without explictly adding -s cflinuxfs4 - even when the default stack is set to cflinuxfs4 in cloud foundry.
This produces the misleading output:

cf push splunk-firehose-nozzle-1.3.0 -n splunk-firehose-nozzle -d apps.some.domain -f /var/vcap/packages/splunk_firehose_nozzle/manifest.yml -s cflinuxfs3 --no-start

Sorry for the confusion, we have to fix this at our side... You can close the issue, if you want.
Thank you!

schindlersebastian commented 6 months ago

I have to revert my last comment, the error is located in the pivotal tile
-> releases -> splunk-nozzle-1.3.0.tgz -> jobs -> deploy-all.tgz -> templates-> deploy-all.sh.erb It's in line 247 - 254

The stack is in fact hardcoded in this file as long as it is available!

schindlersebastian commented 6 months ago

I wonder what this function is intended for? IMHO it is senseless in any case...

deploy-all.sh.erb:

function get_stack() {
    if $CF stacks 2>&1 | grep "cflinuxfs3" > /dev/null; then
        echo >&2 "Using cflinuxfs3 stack"
        echo "-s cflinuxfs3"
    else
        echo >&2 "Using default stack"
    fi
}
sbylica-splunk commented 6 months ago

Hey @schindlersebastian, sorry for the late reply I was working on some other issues. Where did you get this script from? I'm not seeing it in our repo, is it something created by pivotal?

Regards, Szymon

schindlersebastian commented 6 months ago

Hi @sbylica-splunk, yes I know, I also didn't find it in the repo, only in the pivotal asset that can be downloaded here...

I don't know where it actually comes from / who is responsible in the end, the script is included in the .pivotal tile we download from here:

I already filed an Issue at Tanzu support but they felt not responsible for the tile and pointed me to this github project...
If you are sure that they are in fact responsible for the script template I will return to Tanzu support and try to get a fix there.

Regards, Sebastian

sbylica-splunk commented 6 months ago

Hi @schindlersebastian this .pivotal file is created using the tile generator found here (https://docs.vmware.com/en/Tile-Developer-Guide/3.0/tile-dev-guide/tile-generator.html).

I checked out this documentation and it doesn't look like our codebase affects anything in this script, I also tried re-building it on a couple of different machines and it looks the same.

Also it looks like the cflinuxfs3 stack is no longer supported, which my be the cause of this issue: https://docs.cloudfoundry.org/buildpacks/stack-association.html

vchrisb commented 6 months ago

The tile generator release 15.0.2 added support for cflinuxfs4. The tile-builder.sh script used to build the splunk tile is using an older version v13.0.2. The file probably needs to be updated to use at least v15.0.2. The bosh cli should also be updated.

sbylica-splunk commented 5 months ago

Hey, thanks for the info @vchrisb, I checked it out and it seems to be working.

We've included this fix in our script, it will be released with 1.3.2 but there is no release date for now. Until then it has to be changed manually @schindlersebastian.