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

✨ add labels and annotations to k8s namespace #1395

Merged
merged 1 commit into from
Jul 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion resources/packs/k8s/info/k8s.lr.json

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions resources/packs/k8s/k8s.lr
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,10 @@ private k8s.namespace @defaults("name created") {
uid string
// Kubernetes Object Name
name string
// Kubernetes Labels
labels() map[string]string
// Kubernetes Annotations
annotations() map[string]string
// Kubernetes Object Creation Timestamp
created time
// Full resource manifest
Expand Down
96 changes: 96 additions & 0 deletions resources/packs/k8s/k8s.lr.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions resources/packs/k8s/namespace.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,22 @@ func (k *mqlK8s) GetNamespaces() ([]interface{}, error) {
"id", objIdFromK8sObj(obj, objT),
"uid", string(obj.GetUID()),
"name", obj.GetName(),
"labels", core.StrMapToInterface(obj.GetLabels()),
"annotations", core.StrMapToInterface(obj.GetAnnotations()),
"created", &ts.Time,
"manifest", manifest,
)
})
}

func (k *mqlK8sNamespace) GetAnnotations() (interface{}, error) {
return k8sAnnotations(k.MqlResource())
}

func (k *mqlK8sNamespace) GetLabels() (interface{}, error) {
return k8sLabels(k.MqlResource())
}

func (k *mqlK8sNamespace) id() (string, error) {
return k.Id()
}