PageSourceSearch

https://flanksource.com/assets/js/01340f77.4fbb560a.js

js flanksource.com collected 2026-09-25 15:26:23 UTC 5,986 bytes, 1 lines download raw bytes

1"use strict";(globalThis.webpackChunkmission_control=globalThis.webpackChunkmission_control||[]).push([[3363],{22325(e,n,t){t.r(n),t.d(n,{assets:()=>c,contentTitle:()=>i,default:()=>p,frontMatter:()=>l,metadata:()=>s,toc:()=>r});const s=JSON.parse('{"id":"guide/views/table/columns/labels","title":"Labels","description":"The labels column type renders key/value labels and supports include/exclude filtering by tag. Values must be a JSON object (e.g., {team \\"prod\\"}).","source":"@site/docs/guide/views/table/columns/labels.md","sourceDirName":"guide/views/table/columns","slug":"/guide/views/table/columns/labels","permalink":"/docs/guide/views/table/columns/labels","draft":false,"unlisted":false,"editUrl":"https://github.com/flanksource/docs/tree/main/docs/guide/views/table/columns/labels.md","tags":[],"version":"current","frontMatter":{"title":"Labels","sidebar_custom_props":{"icon":"mdi:label"}},"sidebar":"guide","previous":{"title":"Health","permalink":"/docs/guide/views/table/columns/health"},"next":{"title":"Millicore","permalink":"/docs/guide/views/table/columns/millicore"}}');var a=t(74848),o=t(28453);const l={title:"Labels",sidebar_custom_props:{icon:"mdi:label"}},i=void 0,c={},r=[{value:"Behavior",id:"behavior",level:2},{value:"Example",id:"example",level:2}];function m(e){const n={code:"code",h2:"h2",li:"li",p:"p",pre:"pre",ul:"ul",...(0,o.R)(),...e.components},{ColumnDef:t}=n;return t||function(e,n){throw new Error("Expected "+(n?"component":"object")+" `"+e+"` to be defined: you likely forgot to import, pass, or provide it.")}("ColumnDef",!0),(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(n.p,{children:["The ",(0,a.jsx)(n.code,{children:"labels"})," column type renders key/value labels and supports include/exclude filtering by tag. Values must be a JSON object (e.g., ",(0,a.jsx)(n.code,{children:'{team: "platform", env: "prod"}'}),")."]}),"\n",(0,a.jsx)(t,{}),"\n",(0,a.jsx)(n.h2,{id:"behavior",children:"Behavior"}),"\n",(0,a.jsxs)(n.ul,{children:["\n",(0,a.jsxs)(n.li,{children:["Enable ",(0,a.jsx)(n.code,{children:"filter.type: multiselect"})," to allow users to include or exclude specific label values."]}),"\n",(0,a.jsx)(n.li,{children:"UI filters encode selections per label key, so users can combine multiple label filters without losing context."}),"\n"]}),"\n",(0,a.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-yaml",metastring:'title="pods.yaml" file=<rootDir>/modules/mission-control/fixtures/views/pods.yaml {49-50}',children:"apiVersion: mission-control.flanksource.com/v1\nkind: View\nmetadata:\n  name: pods\n  namespace: mc\nspec:\n  templating:\n    - key: cluster\n      label: Cluster\n      valueFrom:\n        config:\n          types:\n            - Kubernetes::Cluster\n    - key: namespace\n      label: Namespace\n      dependsOn:\n        - cluster\n      valueFrom:\n        config:\n          tagSelector: \"cluster=$(.var.cluster)\"\n          types:\n            - Kubernetes::Namespace\n  cache:\n    maxAge: 1m\n    minAge: 5s\n  display:\n    title: Pods\n    icon: pod\n    sidebar: true\n  columns:\n    - name: name\n      type: string\n      primaryKey: true\n    - name: namespace\n      type: string\n      primaryKey: true\n    - name: status\n      type: status\n    - name: health\n      type: health\n    - name: memory\n      type: bytes\n    - name: memory_limit\n      type: bytes\n    - name: cpu\n      type: millicore\n    - name: cpu_limit\n      type: millicore\n    - name: tags\n      type: labels\n    - name: created\n      type: datetime\n  merge: |\n    SELECT \n      pod.name,\n      json_extract(pod.tags, '$.namespace') AS namespace,\n      pod.status,\n      pod.health,\n      pod.tags,\n      pod.created_at,\n      CAST(memory.value AS TEXT) as memory,\n      COALESCE(\n        json_extract(pod.config, '$.spec.containers[0].resources.limits.memory'), \n        ''\n      ) AS memory_limit,\n      COALESCE(CAST(cpu.value AS TEXT), '0') as cpu,\n      COALESCE(\n        json_extract(pod.config, '$.spec.containers[0].resources.limits.cpu'), \n        ''\n      ) AS cpu_limit\n    FROM pod\n    LEFT JOIN memory\n      ON pod.name = memory.pod \n      AND json_extract(pod.tags, '$.namespace') = memory.namespace\n    LEFT JOIN cpu\n      ON pod.name = cpu.pod \n      AND json_extract(pod.tags, '$.namespace') = cpu.namespace\n  queries:\n    memory:\n      columns:\n        namespace: string\n        pod: string\n        value: decimal\n      prometheus:\n        connection: connection://mc/prometheus\n        query: |\n          sum by (namespace, pod) (\n            container_memory_working_set_bytes{\n              container!=\"POD\", # Skip The pause/infra container\n              image!=\"\" # Skip dead containers\n            }\n          )\n    cpu:\n      columns:\n        namespace: string\n        pod: string\n        value: decimal\n      prometheus:\n        connection: connection://mc/prometheus\n        query: |\n          sum by (namespace, pod) (\n            irate(container_
1cpu_usage_seconds_total{\n              container!=\"POD\", # Skip The pause/infra container\n              image!=\"\" # Skip dead containers\n            }[30s])\n          ) * 1000\n    pod:\n      configs:\n        search: \"@order=name\"\n        tagSelector: namespace in (default)\n        types:\n          - Kubernetes::Pod\n  mapping:\n    created: row.created_at\n"})})]})}function p(e={}){const{wrapper:n}={...(0,o.R)(),...e.components};return n?(0,a.jsx)(n,{...e,children:(0,a.jsx)(m,{...e})}):m(e)}},28453(e,n,t){t.d(n,{R:()=>l,x:()=>i});var s=t(96540);const a={},o=s.createContext(a);function l(e){const n=s.useContext(o);return s.useMemo(function(){return"function"==typeof e?e(n):{...n,...e}},[n,e])}function i(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(a):e.components||a:l(e.components),s.createElement(o.Provider,{value:n},e.children)}}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.