Skip to content

Commit

Permalink
Merge pull request #23 from Kuadrant/release-0.2.0
Browse files Browse the repository at this point in the history
Move examples into config dir for easier release process
  • Loading branch information
Ygnas authored Sep 8, 2023
2 parents 433aaa7 + 54a53ad commit a893a3f
Show file tree
Hide file tree
Showing 27 changed files with 41 additions and 29 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ To use the CustomResourceState, see the [configuration information](https://gith
configure an existing or separate kube-state-metrics instance with a custom
resource configuration.

The CustomResourceState is available at [./custom-resource-state.yaml](./custom-resource-state.yaml)
The CustomResourceState is available at [./config/default/custom-resource-state.yaml](./config/default/custom-resource-state.yaml)

For easier consumption via kustomize, a [./kustomization.yaml](./kustomization.yaml)
is available that generates a ConfigMap named `custom-resource-state` with the
CustomResourceState data in a key called `custom-resource-state.yaml`.

## Kube Prometheus Example

An example of how to use this with kube-promethues in shown in [./examples/kube-prometheus](./examples/kube-prometheus)
An example of how to use this with kube-promethues in shown in [./config/examples/kube-prometheus](./config/examples/kube-prometheus)
The kustomization config does the following:

- mounts the ConfigMap as a volume in the kube-state-metrics Deployment
Expand All @@ -28,7 +28,7 @@ and the various Gateway API resources in the `gateway.networking.k8s.io` apiGrou

## Dashboards

A set of Grafana dashboards are available in [./examples/dashboards](./examples/dashboards)
A set of Grafana dashboards are available in [./config/examples/dashboards](./config/examples/dashboards)
and on [grafana.com](https://grafana.com/grafana/dashboards/?search=Gateway+API+State)
You can import them directly into Grafana and modify as needed.
The dashboards are divided by resources (GatewayClasses, Gateways and HTTPRoutes),
Expand All @@ -46,7 +46,7 @@ https://grafana.com/grafana/dashboards/19434

## Alerts

A set of example Alerts are available in [./examples/rules](./examples/rules).
A set of example Alerts are available in [./config/examples/rules](./config/examples/rules).
You can create the PrometheusRule resource directly or modify it as needed.

## Metrics
Expand Down
11 changes: 4 additions & 7 deletions RELEASE.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
# Releasing

- Checkout `main`
- Update the ref in examples/kube-prometheus/kustomization.yaml to the new release number.
- e.g. `github.com/kuadrant/gateway-api-state-metrics?ref=0.1.0` for release `0.1.0`
- Add and commit the change
- Tag the commit with the release number e.g. `git tag 0.1.0`
- Push the commit and tag with `git push origin main && git push origin 0.1.0`
- Create a release in Github at https://github.com/Kuadrant/gateway-api-state-metrics/releases/new, using the tag
- Checkout a new branch from `main`, e.g. `release-0.2.0`
- Update the bundle yaml files as per instructions in [./config/examples/kube-prometheus/bundle-README.md](./config/examples/kube-prometheus/bundle-README.md)
- Create a new PR with the change
- After merging, create a release in Github at https://github.com/Kuadrant/gateway-api-state-metrics/releases/new from `main`, specifying a release tag e.g. `0.2.0`
- Title can be the release nubmer. Description can include any important changes
File renamed without changes.
11 changes: 11 additions & 0 deletions config/default/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,11 @@ There are 3 Gateways with various services attached.

```bash
kind create cluster
kubectl create -f ../../config/gateway-api/crd/standard/
kubectl create -f ../../gateway-api/crd/standard/
kubectl create -f ./all.yaml
kubectl replace --subresource=status -f ./all.yaml
kubectl apply --server-side -f ../kube-prometheus/bundle_crd.yaml
kubectl apply -f ../kube-prometheus/bundle.yaml

kubectl -n monitoring wait --timeout=5m deployment/grafana --for=condition=Available
kubectl -n monitoring port-forward service/grafana 3000:3000 > /dev/null &
kubectl -n monitoring rollout status --watch --timeout=5m statefulset/prometheus-k8s
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -1106,6 +1106,14 @@ data:
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"
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@ kind: Kustomization

resources:
- github.com/prometheus-operator/kube-prometheus?ref=release-0.11
- github.com/kuadrant/gateway-api-state-metrics?ref=0.1.0
# Use the github url instead of the relative path if using this outside the repo
# - github.com/kuadrant/gateway-api-state-metrics?ref=<release>
- ../../default
# Include the example dashboars and rules if you want
- ../dashboards
- ../rules

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
10 changes: 2 additions & 8 deletions kustomization.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

generatorOptions:
disableNameSuffixHash: true

configMapGenerator:
- name: custom-resource-state
namespace: monitoring
files:
- custom-resource-state.yaml
resources:
- ./config/default
14 changes: 7 additions & 7 deletions tests/e2e.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ function finish() {
echo "calling cleanup function"
# kill kubectl proxy in background
kill %1 || true
kubectl delete -f examples/kube-state-metrics/ || true
kubectl delete -f config/examples/kube-state-metrics/ || true
kubectl delete -f tests/manifests/ || true
}

Expand Down Expand Up @@ -132,17 +132,17 @@ trap finish EXIT
kubectl create -f ./config/gateway-api/crd/standard/

# create gateway-api customresourcestatemetrics configmap
kubectl create configmap custom-resource-state --from-file=./custom-resource-state.yaml --dry-run=client -o yaml | kubectl -n kube-system apply -f -
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 -

# set up kube-state-metrics manifests
kubectl create -f ./examples/kube-state-metrics/service-account.yaml
kubectl create -f ./config/examples/kube-state-metrics/service-account.yaml

kubectl create -f ./examples/kube-state-metrics/cluster-role.yaml
kubectl create -f ./examples/kube-state-metrics/cluster-role-binding.yaml
kubectl create -f ./config/examples/kube-state-metrics/cluster-role.yaml
kubectl create -f ./config/examples/kube-state-metrics/cluster-role-binding.yaml

kubectl create -f ./examples/kube-state-metrics/deployment.yaml
kubectl create -f ./config/examples/kube-state-metrics/deployment.yaml

kubectl create -f ./examples/kube-state-metrics/service.yaml
kubectl create -f ./config/examples/kube-state-metrics/service.yaml

# Create test Gateway API resources
kubectl create -f ./tests/manifests/
Expand Down

0 comments on commit a893a3f

Please sign in to comment.