Add time_zone column to kubernetes_cronjob#365
Conversation
Signed-off-by: Mikkel Oscar Lyderik Larsen <mikkel.larsen@zalando.de>
There was a problem hiding this comment.
Pull request overview
Extends the kubernetes_cronjob Steampipe table schema to expose Kubernetes CronJob spec.timeZone so users can query CronJobs by their schedule time zone.
Changes:
- Added a
time_zonecolumn to thekubernetes_cronjobtable (mapped fromSpec.TimeZone). - Updated the CronJob k8s-test manifest to set
spec.timeZone. - Updated the CronJob table docs examples to include
time_zone.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| kubernetes/table_kubernetes_cronjob.go | Adds the time_zone column sourced from Spec.TimeZone. |
| k8s-test/tests/kubernetes_cronjob/cronjob.yaml | Sets spec.timeZone in the CronJob fixture manifest. |
| docs/tables/kubernetes_cronjob.md | Includes time_zone in example queries. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| name: hello | ||
| spec: | ||
| schedule: "* * * * *" | ||
| timeZone: "Europe/Berlin" |
There was a problem hiding this comment.
cronjob.yaml now uses spec.timeZone, which is only supported by Kubernetes >= v1.27. Since this test fixture is applied via kubectl apply (with validation enabled by default), running the k8s-test suite against older clusters will fail. Consider either ensuring the test environment is pinned to >=1.27, adding --validate=false for this apply step, or making the manifest conditional so the suite stays compatible with older versions.
Also, the existing cronjob table tests don't assert the new time_zone column; updating the SQL/expected JSON to include it would ensure this change is actually exercised.
| timeZone: "Europe/Berlin" |
This extends the
kubernetes_cronjobschema to include atime_zonecolumn representing thespec.timeZonefield of CronJobs, stable since Kubernetes v1.27: https://kubernetes.io/docs/concepts/workloads/controllers/cron-jobs/#time-zonesThis allows to query based on
time_zonewhen relevant.