cloudquery / cq-provider-k8s

CloudQuery Provider for Kubernetes
https://cloudquery.io
Mozilla Public License 2.0
9 stars 7 forks source link

Panic when trying to fetch from a specifc context #71

Closed shimonp21 closed 2 years ago

shimonp21 commented 2 years ago

Describe the Bug

Setting contexts parameter in config.hcl causees panic.

Expected Behavior

cloudquery should fetch from this context.

CloudQuery Version

Version: 0.22.7 Commit: fb5a1447e0851d96af0fb7d522585bf78566ff3f Date: 2022-04-19T08:55:30Z

cq-provider-k8s version: v0.4.2

Debug Output

See attached file. log.txt

Steps to Reproduce

config.hcl file:

// Configuration AutoGenerated by CloudQuery CLI
cloudquery {
  plugin_directory = "./cq/providers"
  policy_directory = "./cq/policies"

  provider "k8s" {
    version = "latest"
  }

  connection {
    dsn = "postgres://postgres:pass@localhost:5432/postgres?sslmode=disable"
  }
}

// All Provider Configurations

provider "k8s" {
  configuration {
    // Optional. Set contexts that you want to fetch. If it is not given then all contexts from config are iterated over.
    contexts = ["one"]
  }
  // list of resources to fetch
  resources = [
    "apps.daemon_sets",
    "apps.deployments",
    "apps.replica_sets",
    "apps.stateful_sets",
    "batch.cron_jobs",
    "batch.jobs",
    "core.endpoints",
    "core.limit_ranges",
    "core.namespaces",
    "core.nodes",
    "core.pods",
    "core.resource_quotas",
    "core.service_accounts",
    "core.services",
    "networking.network_policies",
    "rbac.role_bindings",
    "rbac.roles"
  ]
  // enables partial fetching, allowing for any failures to not stop full resource pull
  enable_partial_fetch = true
}
cloudquery fetch

Additional Context

References

See also #70

shimonp21 commented 2 years ago

TODO: also fix documentation to say that cloudquery doesn't iterate over all contexts, but only current context.

shimonp21 commented 2 years ago

TODO: also fix documentation on hub to include the "contexts" field.