turbot/kubernetes_insights

Query: statefulsets_for_service

Usage

powerpipe query kubernetes_insights.query.statefulsets_for_service

SQL

select
st.uid as uid
from
kubernetes_stateful_set as st,
kubernetes_service as s
where
st.service_name = s.name
and s.context_name = st.context_name
and s.uid = $1
union
select
distinct st.uid as uid
from
kubernetes_stateful_set as st,
kubernetes_pod as pod,
jsonb_array_elements(pod.owner_references) as pod_owner,
kubernetes_service as s
where
s.uid = $1
and s.context_name = st.context_name
and pod_owner ->> 'uid' = st.uid
and pod.selector_search = s.selector_query;