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

Non-existing config file not causing execution failure (or even a warning), but a run with defaults #269

Closed
frittentheke opened this issue Aug 26, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@frittentheke
Copy link

frittentheke commented Aug 26, 2024

What happened:
When running with a --config parameter pointing to a non-existing file ...
./anchore-k8s-inventory --config idontevenexist.yaml

k8-inventory is not failing or issuing at least a warning.
This causes a run with all default settings, so potentially very far from the intended settings.

What you expected to happen:
The command to just fail, as I wanted to explicitly run a certain config and fail otherwise.

How to reproduce it (as minimally and precisely as possible):
./anchore-k8s-inventory --verbose --verbose --verbose-inventory-reports --config idontevenexist.yaml

[2024-08-26 10:44:42] DEBUG Application config:
configpath: k8s-inventory/idontexist.yaml
quiet: false
log:
  structured: false
  levelopt: debug
  level: ""
  file: ""
clioptions:
  configpath: k8s-inventory/idontexist.yaml
  verbosity: 2
dev:
  profile-cpu: false
kubeconfig:
  path: ""
  cluster: ""
  cluster-cert: ""
  server: ""
  user:
    userconftype: 0
    type: ""
    client-cert: ""
    private-key: ""
    token: ""
kubernetes:
  request-timeout-seconds: 60
  request-batch-size: 100
  worker-pool-size: 100
namespaces: []
kubernetes-request-timeout-seconds: -1
namespace-selectors:
  include: []
  exclude: []
  ignore-empty: false
account-routes: {}
account-route-by-namespace-label:
  key: ""
  default-account: ""
  ignore-missing-label: false
missing-registry-override: ""
missing-tag-policy:
  policy: digest
  tag: UNKNOWN
runmode: 0
mode: adhoc
ignore-not-running: true
polling-interval-seconds: 300
inventory-report-limits:
  namespaces: 0
metadata-collection:
  nodes:
    include-annotations: []
    include-labels: []
    disable: false
  namespaces:
    include-annotations: []
    include-labels: []
    disable: false
  pods:
    include-annotations: []
    include-labels: []
    disable: false
anchore:
  url: ""
  user: ""
  password: ""
  account: admin
  http:
    insecure: false
    timeout-seconds: 10
verbose-inventory-reports: true

[2024-08-26 10:44:42]  INFO anchore-k8s-inventory is starting up...
[2024-08-26 10:44:42]  INFO Starting image inventory collection
[2024-08-26 10:44:42] DEBUG using kube config from ~/.kube/config
[2024-08-26 10:44:42] DEBUG Fetching namespaces took 243.545319ms


[...]

Giving it a config file that actually exists
./anchore-k8s-inventory --verbose-inventory-reports --config config.yaml

that config is used

[2024-08-26 10:47:34] DEBUG Application config:
configpath: config.yaml

[...]
namespace-selectors:
  include: []
  exclude:
  - thisconfigfilewasparsed
  ignore-empty: false

[...]

Anything else we need to know?:

Environment:

  • kai version (use kai version):
  • OS (e.g: cat /etc/os-release or similar):
@frittentheke frittentheke added the bug Something isn't working label Aug 26, 2024
@bradleyjones
Copy link
Member

@frittentheke thanks for the bug report, I have confirmed the issue we'll get this addressed for the next release

bradleyjones added a commit that referenced this issue Sep 12, 2024
bradleyjones added a commit that referenced this issue Sep 12, 2024
@bradleyjones
Copy link
Member

fixed in v1.6.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants