From c881cf8121e0106cf261d64fb6b7bec4f7850f3a Mon Sep 17 00:00:00 2001 From: David Martin Date: Tue, 17 Sep 2024 10:52:08 +0100 Subject: [PATCH] Move kuadrant resources to separate kustomization file Signed-off-by: David Martin --- .github/workflows/ci.yaml | 21 +- .gitignore | 3 +- config/default/custom-resource-state.yaml | 251 ------ .../kube-prometheus/kustomization.yaml | 2 +- .../custom-resource-state-kuadrant.yaml | 251 ++++++ config/kuadrant/custom-resource-state.yaml | 717 ++++++++++++++++++ config/kuadrant/kustomization.yaml | 11 + hack/gen_kuadrant_custom_resource_state.sh | 14 + tests/e2e.sh | 4 +- 9 files changed, 1017 insertions(+), 257 deletions(-) create mode 100644 config/kuadrant/custom-resource-state-kuadrant.yaml create mode 100644 config/kuadrant/custom-resource-state.yaml create mode 100644 config/kuadrant/kustomization.yaml create mode 100755 hack/gen_kuadrant_custom_resource_state.sh diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 23333bd..13f7973 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -45,7 +45,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout Code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Download Kustomize run: | curl -s "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh" | bash @@ -55,4 +55,21 @@ jobs: if ! make compare-bundles; then echo "::error:: Bundles comparison failed. Please run 'make generate-bundles' and check in changes." exit 1 - fi \ No newline at end of file + fi + + check-kuadrant-custom-resource-state: + runs-on: ubuntu-latest + steps: + - name: Checkout Code + uses: actions/checkout@v4 + + - name: Execute generation script + run: ./hack/gen_kuadrant_custom_resource_state.sh + + - name: Check for changes in generated file + run: | + if ! git diff --exit-code ./config/kuadrant/custom-resource-state.yaml; then + echo "The generated file ./config/kuadrant/custom-resource-state.yaml has changes." + echo "Please run './hack/gen_kuadrant_custom_resource_state.sh' locally and check in the changes." + exit 1 + fi diff --git a/.gitignore b/.gitignore index 5f059fc..5ef11c2 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,5 @@ bin/* log/ -/vendor/ \ No newline at end of file +/vendor/ +.vscode/ \ No newline at end of file diff --git a/config/default/custom-resource-state.yaml b/config/default/custom-resource-state.yaml index 0d51ddd..a228b9d 100644 --- a/config/default/custom-resource-state.yaml +++ b/config/default/custom-resource-state.yaml @@ -459,204 +459,6 @@ spec: parent_namespace: ["parentRef", "namespace"] parent_section_name: ["parentRef", "sectionName"] parent_port: ["parentRef", "port"] - - groupVersionKind: - group: kuadrant.io - kind: "TLSPolicy" - version: "v1alpha1" - metricNamePrefix: gatewayapi_tlspolicy - labelsFromPath: - name: - - metadata - - name - namespace: - - metadata - - namespace - metrics: - - name: "labels" - help: "Kubernetes labels converted to Prometheus labels." - each: - type: Info - info: - path: [metadata] - labelsFromPath: - "*": [labels] - - name: "created" - help: "created timestamp" - each: - type: Gauge - gauge: - path: [metadata, creationTimestamp] - - name: "deleted" - help: "deletion timestamp" - each: - type: Gauge - gauge: - path: [metadata, deletionTimestamp] - - name: "target_info" - help: "Target references that the tlspolicy wants to be attached to" - each: - type: Info - info: - path: [spec, targetRef] - labelsFromPath: - target_group: ["group"] - target_kind: ["kind"] - target_name: ["name"] - target_namespace: ["namespace"] - - name: "status" - help: "status condition" - each: - type: Gauge - gauge: - path: [status, conditions] - labelsFromPath: - type: ["type"] - valueFrom: ["status"] - - groupVersionKind: - group: kuadrant.io - kind: "DNSRecord" - version: "v1alpha1" - metricNamePrefix: kuadrant_dnsrecord - labelsFromPath: - name: - - metadata - - name - namespace: - - metadata - - namespace - rootDomain: - - spec - - rootHost - metrics: - - name: "created" - help: "created timestamp" - each: - type: Gauge - gauge: - path: [metadata, creationTimestamp] - - name: "status_root_domain_owners" - help: "root domain owners (the ids of controllers managing this root domain)" - each: - type: Info - info: - path: [status, domainOwners] - labelsFromPath: - owner: [] - - name: "status" - help: "status condition" - each: - type: Gauge - gauge: - path: [status, conditions] - labelsFromPath: - type: ["type"] - valueFrom: ["status"] - - groupVersionKind: - group: kuadrant.io - kind: "DNSPolicy" - version: "v1alpha1" - metricNamePrefix: gatewayapi_dnspolicy - labelsFromPath: - name: - - metadata - - name - namespace: - - metadata - - namespace - metrics: - - name: "labels" - help: "Kubernetes labels converted to Prometheus labels." - each: - type: Info - info: - path: [metadata] - labelsFromPath: - "*": [labels] - - name: "created" - help: "created timestamp" - each: - type: Gauge - gauge: - path: [metadata, creationTimestamp] - - name: "deleted" - help: "deletion timestamp" - each: - type: Gauge - gauge: - path: [metadata, deletionTimestamp] - - name: "target_info" - help: "Target references that the dnspolicy wants to be attached to" - each: - type: Info - info: - path: [spec, targetRef] - labelsFromPath: - target_group: ["group"] - target_kind: ["kind"] - target_name: ["name"] - target_namespace: ["namespace"] - - name: "status" - help: "status condition" - each: - type: Gauge - gauge: - path: [status, conditions] - labelsFromPath: - type: ["type"] - valueFrom: ["status"] - - groupVersionKind: - group: kuadrant.io - kind: "RateLimitPolicy" - version: "v1beta2" - metricNamePrefix: gatewayapi_ratelimitpolicy - labelsFromPath: - name: - - metadata - - name - namespace: - - metadata - - namespace - metrics: - - name: "labels" - help: "Kubernetes labels converted to Prometheus labels." - each: - type: Info - info: - path: [metadata] - labelsFromPath: - "*": [labels] - - name: "created" - help: "created timestamp" - each: - type: Gauge - gauge: - path: [metadata, creationTimestamp] - - name: "deleted" - help: "deletion timestamp" - each: - type: Gauge - gauge: - path: [metadata, deletionTimestamp] - - name: "target_info" - help: "Target references that the tlspolicy wants to be attached to" - each: - type: Info - info: - path: [spec, targetRef] - labelsFromPath: - target_group: ["group"] - target_kind: ["kind"] - target_name: ["name"] - target_namespace: ["namespace"] - - name: "status" - help: "status condition" - each: - type: Gauge - gauge: - path: [status, conditions] - labelsFromPath: - type: ["type"] - valueFrom: ["status"] - groupVersionKind: group: gateway.networking.k8s.io kind: "BackendTLSPolicy" @@ -701,56 +503,3 @@ spec: target_kind: ["kind"] target_name: ["name"] target_namespace: ["namespace"] - - groupVersionKind: - group: kuadrant.io - kind: "AuthPolicy" - version: "v1beta2" - metricNamePrefix: gatewayapi_authpolicy - labelsFromPath: - name: - - metadata - - name - namespace: - - metadata - - namespace - metrics: - - name: "labels" - help: "Kubernetes labels converted to Prometheus labels." - each: - type: Info - info: - path: [metadata] - labelsFromPath: - "*": [labels] - - name: "created" - help: "created timestamp" - each: - type: Gauge - gauge: - path: [metadata, creationTimestamp] - - name: "deleted" - help: "deletion timestamp" - each: - type: Gauge - gauge: - path: [metadata, deletionTimestamp] - - name: "target_info" - help: "Target references that the authpolicy wants to be attached to" - each: - type: Info - info: - path: [spec, targetRef] - labelsFromPath: - target_group: ["group"] - target_kind: ["kind"] - target_name: ["name"] - target_namespace: ["namespace"] - - name: "status" - help: "status condition" - each: - type: Gauge - gauge: - path: [status, conditions] - labelsFromPath: - type: ["type"] - valueFrom: ["status"] \ No newline at end of file diff --git a/config/examples/kube-prometheus/kustomization.yaml b/config/examples/kube-prometheus/kustomization.yaml index 64eeb13..58fec18 100644 --- a/config/examples/kube-prometheus/kustomization.yaml +++ b/config/examples/kube-prometheus/kustomization.yaml @@ -5,7 +5,7 @@ resources: - github.com/prometheus-operator/kube-prometheus?ref=release-0.11 # Use the github url instead of the relative path if using this outside the repo # - github.com/kuadrant/gateway-api-state-metrics?ref= - - ../../default + - ../../kuadrant # Include the example dashboars and rules if you want - ../dashboards - ../rules diff --git a/config/kuadrant/custom-resource-state-kuadrant.yaml b/config/kuadrant/custom-resource-state-kuadrant.yaml new file mode 100644 index 0000000..618f495 --- /dev/null +++ b/config/kuadrant/custom-resource-state-kuadrant.yaml @@ -0,0 +1,251 @@ + - groupVersionKind: + group: kuadrant.io + kind: "TLSPolicy" + version: "v1alpha1" + metricNamePrefix: gatewayapi_tlspolicy + labelsFromPath: + name: + - metadata + - name + namespace: + - metadata + - namespace + metrics: + - name: "labels" + help: "Kubernetes labels converted to Prometheus labels." + each: + type: Info + info: + path: [metadata] + labelsFromPath: + "*": [labels] + - name: "created" + help: "created timestamp" + each: + type: Gauge + gauge: + path: [metadata, creationTimestamp] + - name: "deleted" + help: "deletion timestamp" + each: + type: Gauge + gauge: + path: [metadata, deletionTimestamp] + - name: "target_info" + help: "Target references that the tlspolicy wants to be attached to" + each: + type: Info + info: + path: [spec, targetRef] + labelsFromPath: + target_group: ["group"] + target_kind: ["kind"] + target_name: ["name"] + target_namespace: ["namespace"] + - name: "status" + help: "status condition" + each: + type: Gauge + gauge: + path: [status, conditions] + labelsFromPath: + type: ["type"] + valueFrom: ["status"] + - groupVersionKind: + group: kuadrant.io + kind: "DNSPolicy" + version: "v1alpha1" + metricNamePrefix: gatewayapi_dnspolicy + labelsFromPath: + name: + - metadata + - name + namespace: + - metadata + - namespace + metrics: + - name: "labels" + help: "Kubernetes labels converted to Prometheus labels." + each: + type: Info + info: + path: [metadata] + labelsFromPath: + "*": [labels] + - name: "created" + help: "created timestamp" + each: + type: Gauge + gauge: + path: [metadata, creationTimestamp] + - name: "deleted" + help: "deletion timestamp" + each: + type: Gauge + gauge: + path: [metadata, deletionTimestamp] + - name: "target_info" + help: "Target references that the dnspolicy wants to be attached to" + each: + type: Info + info: + path: [spec, targetRef] + labelsFromPath: + target_group: ["group"] + target_kind: ["kind"] + target_name: ["name"] + target_namespace: ["namespace"] + - name: "status" + help: "status condition" + each: + type: Gauge + gauge: + path: [status, conditions] + labelsFromPath: + type: ["type"] + valueFrom: ["status"] + - groupVersionKind: + group: kuadrant.io + kind: "RateLimitPolicy" + version: "v1beta2" + metricNamePrefix: gatewayapi_ratelimitpolicy + labelsFromPath: + name: + - metadata + - name + namespace: + - metadata + - namespace + metrics: + - name: "labels" + help: "Kubernetes labels converted to Prometheus labels." + each: + type: Info + info: + path: [metadata] + labelsFromPath: + "*": [labels] + - name: "created" + help: "created timestamp" + each: + type: Gauge + gauge: + path: [metadata, creationTimestamp] + - name: "deleted" + help: "deletion timestamp" + each: + type: Gauge + gauge: + path: [metadata, deletionTimestamp] + - name: "target_info" + help: "Target references that the tlspolicy wants to be attached to" + each: + type: Info + info: + path: [spec, targetRef] + labelsFromPath: + target_group: ["group"] + target_kind: ["kind"] + target_name: ["name"] + target_namespace: ["namespace"] + - name: "status" + help: "status condition" + each: + type: Gauge + gauge: + path: [status, conditions] + labelsFromPath: + type: ["type"] + valueFrom: ["status"] + - groupVersionKind: + group: kuadrant.io + kind: "AuthPolicy" + version: "v1beta2" + metricNamePrefix: gatewayapi_authpolicy + labelsFromPath: + name: + - metadata + - name + namespace: + - metadata + - namespace + metrics: + - name: "labels" + help: "Kubernetes labels converted to Prometheus labels." + each: + type: Info + info: + path: [metadata] + labelsFromPath: + "*": [labels] + - name: "created" + help: "created timestamp" + each: + type: Gauge + gauge: + path: [metadata, creationTimestamp] + - name: "deleted" + help: "deletion timestamp" + each: + type: Gauge + gauge: + path: [metadata, deletionTimestamp] + - name: "target_info" + help: "Target references that the authpolicy wants to be attached to" + each: + type: Info + info: + path: [spec, targetRef] + labelsFromPath: + target_group: ["group"] + target_kind: ["kind"] + target_name: ["name"] + target_namespace: ["namespace"] + - name: "status" + help: "status condition" + each: + type: Gauge + gauge: + path: [status, conditions] + labelsFromPath: + type: ["type"] + valueFrom: ["status"] + - groupVersionKind: + group: kuadrant.io + kind: "DNSRecord" + version: "v1alpha1" + metricNamePrefix: kuadrant_dnsrecord + labelsFromPath: + name: + - metadata + - name + namespace: + - metadata + - namespace + rootDomain: + - spec + - rootHost + metrics: + - name: "created" + help: "created timestamp" + each: + type: Gauge + gauge: + path: [metadata, creationTimestamp] + - name: "status_root_domain_owners" + help: "root domain owners (the ids of controllers managing this root domain)" + each: + type: Info + info: + path: [status, domainOwners] + labelsFromPath: + owner: [] + - name: "status" + help: "status condition" + each: + type: Gauge + gauge: + path: [status, conditions] + labelsFromPath: + type: ["type"] + valueFrom: ["status"] diff --git a/config/kuadrant/custom-resource-state.yaml b/config/kuadrant/custom-resource-state.yaml new file mode 100644 index 0000000..b678ed8 --- /dev/null +++ b/config/kuadrant/custom-resource-state.yaml @@ -0,0 +1,717 @@ +kind: CustomResourceStateMetrics +spec: + resources: + - groupVersionKind: + group: gateway.networking.k8s.io + kind: "Gateway" + version: "v1beta1" + metricNamePrefix: gatewayapi_gateway + labelsFromPath: + name: + - metadata + - name + namespace: + - metadata + - namespace + metrics: + - name: "info" + help: "Gateway information" + each: + type: Info + info: + labelsFromPath: + gatewayclass_name: [spec, gatewayClassName] + - name: "labels" + help: "Kubernetes labels converted to Prometheus labels." + each: + type: Info + info: + path: [metadata] + labelsFromPath: + "*": [labels] + - name: "created" + help: "created timestamp" + each: + type: Gauge + gauge: + path: [metadata, creationTimestamp] + - name: "deleted" + help: "deletion timestamp" + each: + type: Gauge + gauge: + path: [metadata, deletionTimestamp] + - name: "listener_info" + help: "Gateway listener information" + each: + type: Info + info: + path: [spec, listeners] + labelsFromPath: + listener_name: ["name"] + port: ["port"] + protocol: ["protocol"] + hostname: ["hostname"] + tls_mode: ["tls","mode"] + allowed_routes_namespaces_from: ["allowedRoutes", "namespaces", "from"] + - name: "status" + help: "status condition" + each: + type: Gauge + gauge: + path: [status, conditions] + labelsFromPath: + type: ["type"] + valueFrom: ["status"] + - name: "status_listener_attached_routes" + help: "Number of attached routes for a listener" + each: + type: Gauge + gauge: + path: [status, listeners] + labelsFromPath: + listener_name: ["name"] + valueFrom: ["attachedRoutes"] + - name: "status_address_info" + help: "Gateway address types and values" + each: + type: Info + info: + path: [status, addresses] + labelsFromPath: + type: ["type"] + value: ["value"] + - groupVersionKind: + group: gateway.networking.k8s.io + kind: "GatewayClass" + version: "v1beta1" + metricNamePrefix: gatewayapi_gatewayclass + labelsFromPath: + name: + - metadata + - name + metrics: + - name: "info" + help: "GatewayClass information" + each: + type: Info + info: + labelsFromPath: + controller_name: [spec, controllerName] + - name: "labels" + help: "Kubernetes labels converted to Prometheus labels." + each: + type: Info + info: + path: [metadata] + labelsFromPath: + "*": [labels] + - name: "created" + help: "created timestamp" + each: + type: Gauge + gauge: + path: [metadata, creationTimestamp] + - name: "deleted" + help: "deletion timestamp" + each: + type: Gauge + gauge: + path: [metadata, deletionTimestamp] + - name: "status" + help: "status condition" + each: + type: Gauge + gauge: + path: [status, conditions] + labelsFromPath: + type: ["type"] + valueFrom: ["status"] + - name: "status_supported_features" + help: "List of supported features for the GatewayClass" + each: + type: Info + info: + path: [status, supportedFeatures] + labelsFromPath: + features: [] + - groupVersionKind: + group: gateway.networking.k8s.io + kind: "HTTPRoute" + version: "v1beta1" + metricNamePrefix: gatewayapi_httproute + labelsFromPath: + name: + - metadata + - name + namespace: + - metadata + - namespace + metrics: + - name: "labels" + help: "Kubernetes labels converted to Prometheus labels." + each: + type: Info + info: + path: [metadata] + labelsFromPath: + "*": [labels] + - name: "created" + help: "created timestamp" + each: + type: Gauge + gauge: + path: [metadata, creationTimestamp] + - name: "deleted" + help: "deletion timestamp" + each: + type: Gauge + gauge: + path: [metadata, deletionTimestamp] + - name: "hostname_info" + help: "Hostname information" + each: + type: Info + info: + path: [spec, hostnames] + labelsFromPath: + hostname: [] + - name: "parent_info" + help: "Parent references that the httproute wants to be attached to" + each: + type: Info + info: + path: [spec, parentRefs] + labelsFromPath: + parent_group: ["group"] + parent_kind: ["kind"] + parent_name: ["name"] + parent_namespace: ["namespace"] + parent_section_name: ["sectionName"] + parent_port: ["port"] + - name: "status_parent_info" + help: "Parent references that the httproute is attached to" + each: + type: Info + info: + path: [status, parents] + labelsFromPath: + controller_name: ["controllerName"] + parent_group: ["parentRef", "group"] + parent_kind: ["parentRef", "kind"] + parent_name: ["parentRef", "name"] + parent_namespace: ["parentRef", "namespace"] + parent_section_name: ["parentRef", "sectionName"] + parent_port: ["parentRef", "port"] + - groupVersionKind: + group: gateway.networking.k8s.io + kind: "GRPCRoute" + version: "v1alpha2" + metricNamePrefix: gatewayapi_grpcroute + labelsFromPath: + name: + - metadata + - name + namespace: + - metadata + - namespace + metrics: + - name: "labels" + help: "Kubernetes labels converted to Prometheus labels." + each: + type: Info + info: + path: [metadata] + labelsFromPath: + "*": [labels] + - name: "created" + help: "created timestamp" + each: + type: Gauge + gauge: + path: [metadata, creationTimestamp] + - name: "deleted" + help: "deletion timestamp" + each: + type: Gauge + gauge: + path: [metadata, deletionTimestamp] + - name: "hostname_info" + help: "Hostname information" + each: + type: Info + info: + path: [spec, hostnames] + labelsFromPath: + hostname: [] + - name: "parent_info" + help: "Parent references that the grpcroute wants to be attached to" + each: + type: Info + info: + path: [spec, parentRefs] + labelsFromPath: + parent_group: ["group"] + parent_kind: ["kind"] + parent_name: ["name"] + parent_namespace: ["namespace"] + parent_section_name: ["sectionName"] + parent_port: ["port"] + - name: "status_parent_info" + help: "Parent references that the grpcroute is attached to" + each: + type: Info + info: + path: [status, parents] + labelsFromPath: + controller_name: ["controllerName"] + parent_group: ["parentRef", "group"] + parent_kind: ["parentRef", "kind"] + parent_name: ["parentRef", "name"] + parent_namespace: ["parentRef", "namespace"] + parent_section_name: ["parentRef", "sectionName"] + parent_port: ["parentRef", "port"] + - groupVersionKind: + group: gateway.networking.k8s.io + kind: "TCPRoute" + version: "v1alpha2" + metricNamePrefix: gatewayapi_tcproute + labelsFromPath: + name: + - metadata + - name + namespace: + - metadata + - namespace + metrics: + - name: "labels" + help: "Kubernetes labels converted to Prometheus labels." + each: + type: Info + info: + path: [metadata] + labelsFromPath: + "*": [labels] + - name: "created" + help: "created timestamp" + each: + type: Gauge + gauge: + path: [metadata, creationTimestamp] + - name: "deleted" + help: "deletion timestamp" + each: + type: Gauge + gauge: + path: [metadata, deletionTimestamp] + - name: "parent_info" + help: "Parent references that the tcproute wants to be attached to" + each: + type: Info + info: + path: [spec, parentRefs] + labelsFromPath: + parent_group: ["group"] + parent_kind: ["kind"] + parent_name: ["name"] + parent_namespace: ["namespace"] + parent_section_name: ["sectionName"] + parent_port: ["port"] + - name: "status_parent_info" + help: "Parent references that the tcproute is attached to" + each: + type: Info + info: + path: [status, parents] + labelsFromPath: + controller_name: ["controllerName"] + parent_group: ["parentRef", "group"] + parent_kind: ["parentRef", "kind"] + parent_name: ["parentRef", "name"] + parent_namespace: ["parentRef", "namespace"] + parent_section_name: ["parentRef", "sectionName"] + parent_port: ["parentRef", "port"] + - groupVersionKind: + group: gateway.networking.k8s.io + kind: "TLSRoute" + version: "v1alpha2" + metricNamePrefix: gatewayapi_tlsroute + labelsFromPath: + name: + - metadata + - name + namespace: + - metadata + - namespace + metrics: + - name: "labels" + help: "Kubernetes labels converted to Prometheus labels." + each: + type: Info + info: + path: [metadata] + labelsFromPath: + "*": [labels] + - name: "created" + help: "created timestamp" + each: + type: Gauge + gauge: + path: [metadata, creationTimestamp] + - name: "deleted" + help: "deletion timestamp" + each: + type: Gauge + gauge: + path: [metadata, deletionTimestamp] + - name: "hostname_info" + help: "Hostname information" + each: + type: Info + info: + path: [spec, hostnames] + labelsFromPath: + hostname: [] + - name: "parent_info" + help: "Parent references that the tlsroute wants to be attached to" + each: + type: Info + info: + path: [spec, parentRefs] + labelsFromPath: + parent_group: ["group"] + parent_kind: ["kind"] + parent_name: ["name"] + parent_namespace: ["namespace"] + parent_section_name: ["sectionName"] + parent_port: ["port"] + - name: "status_parent_info" + help: "Parent references that the tlsroute is attached to" + each: + type: Info + info: + path: [status, parents] + labelsFromPath: + controller_name: ["controllerName"] + parent_group: ["parentRef", "group"] + parent_kind: ["parentRef", "kind"] + parent_name: ["parentRef", "name"] + parent_namespace: ["parentRef", "namespace"] + parent_section_name: ["parentRef", "sectionName"] + parent_port: ["parentRef", "port"] + - groupVersionKind: + group: gateway.networking.k8s.io + kind: "UDPRoute" + version: "v1alpha2" + metricNamePrefix: gatewayapi_udproute + labelsFromPath: + name: + - metadata + - name + namespace: + - metadata + - namespace + metrics: + - name: "labels" + help: "Kubernetes labels converted to Prometheus labels." + each: + type: Info + info: + path: [metadata] + labelsFromPath: + "*": [labels] + - name: "created" + help: "created timestamp" + each: + type: Gauge + gauge: + path: [metadata, creationTimestamp] + - name: "deleted" + help: "deletion timestamp" + each: + type: Gauge + gauge: + path: [metadata, deletionTimestamp] + - name: "parent_info" + help: "Parent references that the udproute wants to be attached to" + each: + type: Info + info: + path: [spec, parentRefs] + labelsFromPath: + parent_group: ["group"] + parent_kind: ["kind"] + parent_name: ["name"] + parent_namespace: ["namespace"] + parent_section_name: ["sectionName"] + parent_port: ["port"] + - name: "status_parent_info" + help: "Parent references that the udproute is attached to" + each: + type: Info + info: + path: [status, parents] + labelsFromPath: + controller_name: ["controllerName"] + parent_group: ["parentRef", "group"] + parent_kind: ["parentRef", "kind"] + parent_name: ["parentRef", "name"] + parent_namespace: ["parentRef", "namespace"] + parent_section_name: ["parentRef", "sectionName"] + parent_port: ["parentRef", "port"] + - groupVersionKind: + group: gateway.networking.k8s.io + kind: "BackendTLSPolicy" + version: "v1alpha2" + metricNamePrefix: gatewayapi_backendtlspolicy + labelsFromPath: + name: + - metadata + - name + namespace: + - metadata + - namespace + metrics: + - name: "labels" + help: "Kubernetes labels converted to Prometheus labels." + each: + type: Info + info: + path: [metadata] + labelsFromPath: + "*": [labels] + - name: "created" + help: "created timestamp" + each: + type: Gauge + gauge: + path: [metadata, creationTimestamp] + - name: "deleted" + help: "deletion timestamp" + each: + type: Gauge + gauge: + path: [metadata, deletionTimestamp] + - name: "target_info" + help: "Target references that the backendtlspolicy wants to be attached to" + each: + type: Info + info: + path: [spec, targetRef] + labelsFromPath: + target_group: ["group"] + target_kind: ["kind"] + target_name: ["name"] + target_namespace: ["namespace"] + - groupVersionKind: + group: kuadrant.io + kind: "TLSPolicy" + version: "v1alpha1" + metricNamePrefix: gatewayapi_tlspolicy + labelsFromPath: + name: + - metadata + - name + namespace: + - metadata + - namespace + metrics: + - name: "labels" + help: "Kubernetes labels converted to Prometheus labels." + each: + type: Info + info: + path: [metadata] + labelsFromPath: + "*": [labels] + - name: "created" + help: "created timestamp" + each: + type: Gauge + gauge: + path: [metadata, creationTimestamp] + - name: "deleted" + help: "deletion timestamp" + each: + type: Gauge + gauge: + path: [metadata, deletionTimestamp] + - name: "target_info" + help: "Target references that the tlspolicy wants to be attached to" + each: + type: Info + info: + path: [spec, targetRef] + labelsFromPath: + target_group: ["group"] + target_kind: ["kind"] + target_name: ["name"] + target_namespace: ["namespace"] + - name: "status" + help: "status condition" + each: + type: Gauge + gauge: + path: [status, conditions] + labelsFromPath: + type: ["type"] + valueFrom: ["status"] + - groupVersionKind: + group: kuadrant.io + kind: "DNSPolicy" + version: "v1alpha1" + metricNamePrefix: gatewayapi_dnspolicy + labelsFromPath: + name: + - metadata + - name + namespace: + - metadata + - namespace + metrics: + - name: "labels" + help: "Kubernetes labels converted to Prometheus labels." + each: + type: Info + info: + path: [metadata] + labelsFromPath: + "*": [labels] + - name: "created" + help: "created timestamp" + each: + type: Gauge + gauge: + path: [metadata, creationTimestamp] + - name: "deleted" + help: "deletion timestamp" + each: + type: Gauge + gauge: + path: [metadata, deletionTimestamp] + - name: "target_info" + help: "Target references that the dnspolicy wants to be attached to" + each: + type: Info + info: + path: [spec, targetRef] + labelsFromPath: + target_group: ["group"] + target_kind: ["kind"] + target_name: ["name"] + target_namespace: ["namespace"] + - name: "status" + help: "status condition" + each: + type: Gauge + gauge: + path: [status, conditions] + labelsFromPath: + type: ["type"] + valueFrom: ["status"] + - groupVersionKind: + group: kuadrant.io + kind: "RateLimitPolicy" + version: "v1beta2" + metricNamePrefix: gatewayapi_ratelimitpolicy + labelsFromPath: + name: + - metadata + - name + namespace: + - metadata + - namespace + metrics: + - name: "labels" + help: "Kubernetes labels converted to Prometheus labels." + each: + type: Info + info: + path: [metadata] + labelsFromPath: + "*": [labels] + - name: "created" + help: "created timestamp" + each: + type: Gauge + gauge: + path: [metadata, creationTimestamp] + - name: "deleted" + help: "deletion timestamp" + each: + type: Gauge + gauge: + path: [metadata, deletionTimestamp] + - name: "target_info" + help: "Target references that the tlspolicy wants to be attached to" + each: + type: Info + info: + path: [spec, targetRef] + labelsFromPath: + target_group: ["group"] + target_kind: ["kind"] + target_name: ["name"] + target_namespace: ["namespace"] + - name: "status" + help: "status condition" + each: + type: Gauge + gauge: + path: [status, conditions] + labelsFromPath: + type: ["type"] + valueFrom: ["status"] + - groupVersionKind: + group: kuadrant.io + kind: "AuthPolicy" + version: "v1beta2" + metricNamePrefix: gatewayapi_authpolicy + labelsFromPath: + name: + - metadata + - name + namespace: + - metadata + - namespace + metrics: + - name: "labels" + help: "Kubernetes labels converted to Prometheus labels." + each: + type: Info + info: + path: [metadata] + labelsFromPath: + "*": [labels] + - name: "created" + help: "created timestamp" + each: + type: Gauge + gauge: + path: [metadata, creationTimestamp] + - name: "deleted" + help: "deletion timestamp" + each: + type: Gauge + gauge: + path: [metadata, deletionTimestamp] + - name: "target_info" + help: "Target references that the authpolicy wants to be attached to" + each: + type: Info + info: + path: [spec, targetRef] + labelsFromPath: + target_group: ["group"] + target_kind: ["kind"] + target_name: ["name"] + target_namespace: ["namespace"] + - name: "status" + help: "status condition" + each: + type: Gauge + gauge: + path: [status, conditions] + labelsFromPath: + type: ["type"] + valueFrom: ["status"] diff --git a/config/kuadrant/kustomization.yaml b/config/kuadrant/kustomization.yaml new file mode 100644 index 0000000..41f17b2 --- /dev/null +++ b/config/kuadrant/kustomization.yaml @@ -0,0 +1,11 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization + +generatorOptions: + disableNameSuffixHash: true + +configMapGenerator: +- name: custom-resource-state + namespace: monitoring + files: + - custom-resource-state.yaml diff --git a/hack/gen_kuadrant_custom_resource_state.sh b/hack/gen_kuadrant_custom_resource_state.sh new file mode 100755 index 0000000..f94f6de --- /dev/null +++ b/hack/gen_kuadrant_custom_resource_state.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +# Paths to the input files and the output file +file1="./config/default/custom-resource-state.yaml" +file2="./config/kuadrant/custom-resource-state-kuadrant.yaml" +output_file="./config/kuadrant/custom-resource-state.yaml" + +# Ensure the directory for the output file exists +mkdir -p "$(dirname "$output_file")" + +# Append the contents of file1 and file2, and write to output_file +cat "$file1" "$file2" > "$output_file" + +echo "Contents of $file1 and $file2 have been combined into $output_file" diff --git a/tests/e2e.sh b/tests/e2e.sh index 6139049..e2c7b1e 100755 --- a/tests/e2e.sh +++ b/tests/e2e.sh @@ -133,7 +133,7 @@ kubectl create -f ./config/gateway-api/crd/standard/ kubectl create -f ./config/kuadrant/crd/ # create gateway-api customresourcestatemetrics configmap -kubectl create configmap custom-resource-state --from-file=./config/default/custom-resource-state.yaml --dry-run=client -o yaml | kubectl -n kube-system apply -f - +kubectl create configmap custom-resource-state --from-file=./config/kuadrant/custom-resource-state.yaml --dry-run=client -o yaml | kubectl -n kube-system apply -f - # set up kube-state-metrics manifests kubectl create -f ./config/examples/kube-state-metrics/service-account.yaml @@ -165,7 +165,7 @@ echo "kube-state-metrics is up and running" echo "start e2e test for kube-state-metrics" KSM_HTTP_METRICS_URL='http://localhost:8001/api/v1/namespaces/kube-system/services/kube-state-metrics:http-metrics/proxy' KSM_TELEMETRY_URL='http://localhost:8001/api/v1/namespaces/kube-system/services/kube-state-metrics:telemetry/proxy' -go test -v ./tests/e2e/main_test.go --ksm-http-metrics-url=${KSM_HTTP_METRICS_URL} --ksm-telemetry-url=${KSM_TELEMETRY_URL} +go test -mod=readonly -v ./tests/e2e/main_test.go --ksm-http-metrics-url=${KSM_HTTP_METRICS_URL} --ksm-telemetry-url=${KSM_TELEMETRY_URL} # TODO: re-implement the following test cases in Go with the goal of removing this file. echo "access kube-state-metrics metrics endpoint"