Note: if you are running CloudGraph locally you can view the interactive, automatically generated documentation in either GraphQL Playground or Altair by clicking the docs button on the right-hand side of the screen. After reading the below information we highly suggest you use one of these tools to test your queries as they will autocomplete fields for you and let you know if your queries are valid before you even submit them.
You can currently query the following attributes and connections on a k8s Ingress:
type k8sIngress {
id: String!
context: String!
apiVersion: String
kind: String
metadata: {
id: String
annotations: {
id: String!
key: String
value: String
}
clusterName: String
creationTimestamp: String
deletionGracePeriodSeconds: Int
deletionTimestamp: String
finalizers: [String]
generateName: String
generation: Int
labels: {
id: String!
key: String
value: String
}
ownerReferences: {
id: String!
apiVersion: String
blockOwnerDeletion: Boolean
controller: Boolean
kind: String
name: String
}
name: String
namespace: String
resourceVersion: String
selfLink: String
}
spec {
defaultBackend {
resource {
apiGroup: String
kind: String
name: String
}
service {
name: String
port {
name: String
number: Int
}
}
}
ingressClassName: String
rules {
id: String
host: String
http {
paths {
id: String
path: String
pathType: String
backend {
resource {
apiGroup: String
kind: String
name: String
}
service {
name: String
port {
name: String
number: Int
}
}
}
}
}
tls {
id: String
hosts: [String]
secretName: String
}
}
status: {
loadBalancer {
ingress {
id: String
hostname: String
ip: String
ports {
id: String
error: String
port: Int
protocol: String
}
}
}
}
namespace {
id
}
}
Get data for a single ingress that you know the id for:
query {
getk8sIngress(id: "12345") {
id
}
}
Get data for all of the ingresses in a certain k8s Context:
query {
queryk8sIngress(filter: { context: { eq: "my-context-name" } }) {
id
}
}
Get data for all of the ingresses NOT in a certain k8s Context:
query {
queryk8sIngress(filter: { not: { context: { eq: "my-context-name" } } }) {
id
}
}
Get data for all of the ingresses that have a namespace:
query {
queryk8sIngress(filter: { has: namespace }) {
id
}
}
Use multiple filter selectors, (i.e. has, and, not, or) to get data for all of the ingresses that have a namespace AND status OR that do not have a spec. Note that you can use has, and, not, or completely independently of each other:
query {
queryk8sIngress(
filter: {
has: namespace
and: { has: status }
or: { not: { has: spec } }
}
) {
id
}
}
You may also filter using a regex when filtering on a string field like, context if you want to look for a value that matches say, some-value (case insensitive):
query {
queryk8sIngress(
filter: { context: { regexp: "/.*some-value*./i" } }
) {
id
}
}
You can order the results you get back either asc or desc depending on your preference:
query {
queryk8sIngress(order: { desc: context }) {
context
}
}
Only select and return the first two ingresses that are found:
query {
queryk8sIngress(first: 2, order: { desc: apiVersion }) {
apiVersion
}
}
Only select and return the first two ingresses that are found, but offset by one so ingresses two & three are returned:
query {
queryk8sIngress(first: 2, order: { desc: context }, offset: 1) {
id
context
}
}
Count the number of ingresses across all scanned K8s contexts:
query {
aggregatek8sIngress {
count
}
}
Count the number of ingresses in a single context. Note that you can apply all of the same filters that are listed above to aggregate queries:
query {
aggregatek8sIngress(filter: { context: { eq: "my-context-name" } }) {
count
}
}
Putting it all together; get all data for all ingresses across all k8s contexts in a single query. For the purposes of this example we will only get direct children of the ingress but if you want to it's easy to go from say, ingress -> namespace -> job ...etc:
query {
queryk8sIngress {
id
context
apiVersion
kind
metadata {
id
annotations {
id
key
value
}
clusterName
creationTimestamp
deletionGracePeriodSeconds
deletionTimestamp
finalizers
generateName
generation
labels {
id
key
value
}
ownerReferences {
id
apiVersion
blockOwnerDeletion
controller
kind
name
}
name
namespace
resourceVersion
selfLink
}
spec {
defaultBackend {
resource {
apiGroup
kind
name
}
service {
name
port {
name
number
}
}
}
ingressClassName
rules {
id
host
http {
paths {
id
path
pathType
backend {
resource {
apiGroup
kind
name
}
service {
name
port {
name
number
}
}
}
}
}
tls {
id
hosts
secretName
}
}
status {
loadBalancer {
ingress {
id
hostname
ip
ports {
id
error
port
protocol
}
}
}
}
namespace {
id
context
apiVersion
kind
metadata {
id
annotations {
id
key
value
}
clusterName
creationTimestamp
deletionGracePeriodSeconds
deletionTimestamp
finalizers
generateName
generation
labels {
id
key
value
}
ownerReferences {
id
apiVersion
blockOwnerDeletion
controller
kind
name
}
name
namespace
resourceVersion
selfLink
}
spec {
finalizers
}
status {
phase
conditions {
id
lastHeartbeatTime
lastTransitionTime
message
reason
status
type
}
}
networkPolicies {
id
}
nodes {
id
}
pods {
id
}
deployments {
id
}
ingresses {
id
}
secrets {
id
}
services {
id
}
serviceAccounts {
id
}
storageClasses {
id
}
persistentVolumes {
id
}
persistentVolumeClaims {
id
}
roles {
id
}
jobs {
id
}
cronJobs {
id
}
}
}
}