Skip to content

Commit

Permalink
fix: syntax errors in kube-state-metrics.libsonnet
Browse files Browse the repository at this point in the history
Previously customizing kube-prometheus [1] failed with the following
error.

    ❯ ./build.sh example.jsonnet
    + set -o pipefail
    + rm -rf manifests
    + mkdir -p manifests/setup
    + jsonnet -J vendor -m manifests example.jsonnet
    + xargs '-I{}' sh -c 'cat {} | gojsontoyaml > {}.yaml' -- '{}'
    RUNTIME ERROR: vendor/github.com/kubernetes/kube-state-metrics/jsonnet/kube-state-metrics/kube-state-metrics.libsonnet:392:21-22 Expected token OPERATOR but got "{"
            vendor/kube-prometheus/components/kube-state-metrics.libsonnet:51:19-124        function <anonymous>
            vendor/kube-prometheus/main.libsonnet:136:21-64 object <anonymous>
            vendor/kube-prometheus/platforms/platforms.libsonnet:37:22-40   +:
            example.jsonnet:33:90-109       thunk from <$>
            <std>:1539:24-25        thunk from <function <anonymous>>
            <std>:1539:5-33 function <anonymous>
            example.jsonnet:33:73-110       $
            example.jsonnet:33:1-112
            example.jsonnet:33:1-112
            During evaluation

With this patch, the build succeeds:

    ❯ bash build.sh example.jsonnet ; echo $?
    + set -o pipefail
    + rm -rf manifests
    + mkdir -p manifests/setup
    + jsonnet -J vendor -m manifests example.jsonnet
    + xargs '-I{}' sh -c 'cat {} | gojsontoyaml > {}.yaml' -- '{}'
    + find manifests -type f '!' -name '*.yaml' -delete
    + rm -f kustomization
    0

[1]: https://github.com/prometheus-operator/kube-prometheus/blob/main/docs/customizing.md
  • Loading branch information
jeffmccune committed Jul 24, 2024
1 parent e96dfc0 commit 0ebaeb8
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions jsonnet/kube-state-metrics/kube-state-metrics.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -389,15 +389,15 @@
labels: {'app.kubernetes.io/name': shardksmname}
},
spec: {
selector{
matchLabels: {app.kubernetes.io/name': shardksmname}
}
selector: {
matchLabels: {'app.kubernetes.io/name': shardksmname}
},
template: {
metadata: {
labels: {
app.kubernetes.io/name': shardksmname
'app.kubernetes.io/name': shardksmname
}
}
},
spec: {
containers: [c],
},
Expand Down Expand Up @@ -475,5 +475,3 @@
clusterRoleBinding: ksm.clusterRoleBinding,
},
}


0 comments on commit 0ebaeb8

Please sign in to comment.