Skip to content

Commit 3b061cf

Browse files
committed
chore: Replace gojsontoyaml with gojq
1 parent 0b01e3a commit 3b061cf

22 files changed

+643
-642
lines changed

Makefile

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ MARKDOWNLINT_CLI2_VERSION = 0.17.2
2424
DOCKER_CLI ?= docker
2525
PROMTOOL_CLI ?= promtool
2626
GOMPLATE_CLI ?= go tool github.com/hairyhenderson/gomplate/v4/cmd/gomplate
27-
GOJSONTOYAML_CLI ?= go tool github.com/brancz/gojsontoyaml
27+
GOJQ_CLI ?= go tool github.com/itchyny/gojq/cmd/gojq
2828
EMBEDMD_CLI ?= go tool github.com/campoy/embedmd
2929
JSONNET_CLI ?= go tool github.com/google/go-jsonnet/cmd/jsonnet
3030
JB_CLI ?= go tool github.com/jsonnet-bundler/jsonnet-bundler/cmd/jb
@@ -152,23 +152,23 @@ mixin: examples/prometheus-alerting-rules/alerts.yaml
152152

153153
examples/prometheus-alerting-rules/alerts.yaml: jsonnet $(shell find jsonnet | grep ".libsonnet") scripts/mixin.jsonnet scripts/vendor
154154
mkdir -p examples/prometheus-alerting-rules
155-
${JSONNET_CLI} -J scripts/vendor scripts/mixin.jsonnet | ${GOJSONTOYAML_CLI} > examples/prometheus-alerting-rules/alerts.yaml
155+
${JSONNET_CLI} -J scripts/vendor scripts/mixin.jsonnet | ${GOJQ_CLI} --yaml-output > examples/prometheus-alerting-rules/alerts.yaml
156156

157157
examples: examples/standard examples/autosharding examples/daemonsetsharding mixin
158158

159159
examples/standard: jsonnet $(shell find jsonnet | grep ".libsonnet") scripts/standard.jsonnet scripts/vendor
160160
mkdir -p examples/standard
161-
${JSONNET_CLI}} -J scripts/vendor -m examples/standard --ext-str version="$(VERSION)" scripts/standard.jsonnet | xargs -I{} sh -c 'cat {} | ${GOJSONTOYAML_CLI} > `echo {} | sed "s/\(.\)\([A-Z]\)/\1-\2/g" | tr "[:upper:]" "[:lower:]"`.yaml' -- {}
161+
${JSONNET_CLI} -J scripts/vendor -m examples/standard --ext-str version="$(VERSION)" scripts/standard.jsonnet | xargs -I{} sh -c 'cat {} | ${GOJQ_CLI} --yaml-output > `echo {} | sed "s/\(.\)\([A-Z]\)/\1-\2/g" | tr "[:upper:]" "[:lower:]"`.yaml' -- {}
162162
find examples -type f ! -name '*.yaml' -delete
163163

164164
examples/autosharding: jsonnet $(shell find jsonnet | grep ".libsonnet") scripts/autosharding.jsonnet scripts/vendor
165165
mkdir -p examples/autosharding
166-
${JSONNET_CLI} -J scripts/vendor -m examples/autosharding --ext-str version="$(VERSION)" scripts/autosharding.jsonnet | xargs -I{} sh -c 'cat {} | ${GOJSONTOYAML_CLI} > `echo {} | sed "s/\(.\)\([A-Z]\)/\1-\2/g" | tr "[:upper:]" "[:lower:]"`.yaml' -- {}
166+
${JSONNET_CLI} -J scripts/vendor -m examples/autosharding --ext-str version="$(VERSION)" scripts/autosharding.jsonnet | xargs -I{} sh -c 'cat {} | ${GOJQ_CLI} --yaml-output > `echo {} | sed "s/\(.\)\([A-Z]\)/\1-\2/g" | tr "[:upper:]" "[:lower:]"`.yaml' -- {}
167167
find examples -type f ! -name '*.yaml' -delete
168168

169169
examples/daemonsetsharding: jsonnet $(shell find jsonnet | grep ".libsonnet") scripts/daemonsetsharding.jsonnet scripts/vendor
170170
mkdir -p examples/daemonsetsharding
171-
${JSONETT_CLI} -J scripts/vendor -m examples/daemonsetsharding --ext-str version="$(VERSION)" scripts/daemonsetsharding.jsonnet | xargs -I{} sh -c 'cat {} | ${GOJSONTOYAML_CLI} > `echo {} | sed "s/\(.\)\([A-Z]\)/\1-\2/g" | tr "[:upper:]" "[:lower:]"`.yaml' -- {}
171+
${JSONNET_CLI} -J scripts/vendor -m examples/daemonsetsharding --ext-str version="$(VERSION)" scripts/daemonsetsharding.jsonnet | xargs -I{} sh -c 'cat {} | ${GOJQ_CLI} --yaml-output > `echo {} | sed "s/\(.\)\([A-Z]\)/\1-\2/g" | tr "[:upper:]" "[:lower:]"`.yaml' -- {}
172172
find examples -type f ! -name '*.yaml' -delete
173173

174174
scripts/vendor: scripts/jsonnetfile.json scripts/jsonnetfile.lock.json

examples/autosharding/cluster-role-binding.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@ roleRef:
1111
kind: ClusterRole
1212
name: kube-state-metrics
1313
subjects:
14-
- kind: ServiceAccount
15-
name: kube-state-metrics
16-
namespace: kube-system
14+
- kind: ServiceAccount
15+
name: kube-state-metrics
16+
namespace: kube-system

examples/autosharding/cluster-role.yaml

Lines changed: 119 additions & 119 deletions
Original file line numberDiff line numberDiff line change
@@ -7,122 +7,122 @@ metadata:
77
app.kubernetes.io/version: 2.15.0
88
name: kube-state-metrics
99
rules:
10-
- apiGroups:
11-
- ""
12-
resources:
13-
- configmaps
14-
- secrets
15-
- nodes
16-
- pods
17-
- services
18-
- serviceaccounts
19-
- resourcequotas
20-
- replicationcontrollers
21-
- limitranges
22-
- persistentvolumeclaims
23-
- persistentvolumes
24-
- namespaces
25-
- endpoints
26-
verbs:
27-
- list
28-
- watch
29-
- apiGroups:
30-
- apps
31-
resources:
32-
- statefulsets
33-
- daemonsets
34-
- deployments
35-
- replicasets
36-
verbs:
37-
- list
38-
- watch
39-
- apiGroups:
40-
- batch
41-
resources:
42-
- cronjobs
43-
- jobs
44-
verbs:
45-
- list
46-
- watch
47-
- apiGroups:
48-
- autoscaling
49-
resources:
50-
- horizontalpodautoscalers
51-
verbs:
52-
- list
53-
- watch
54-
- apiGroups:
55-
- authentication.k8s.io
56-
resources:
57-
- tokenreviews
58-
verbs:
59-
- create
60-
- apiGroups:
61-
- authorization.k8s.io
62-
resources:
63-
- subjectaccessreviews
64-
verbs:
65-
- create
66-
- apiGroups:
67-
- policy
68-
resources:
69-
- poddisruptionbudgets
70-
verbs:
71-
- list
72-
- watch
73-
- apiGroups:
74-
- certificates.k8s.io
75-
resources:
76-
- certificatesigningrequests
77-
verbs:
78-
- list
79-
- watch
80-
- apiGroups:
81-
- discovery.k8s.io
82-
resources:
83-
- endpointslices
84-
verbs:
85-
- list
86-
- watch
87-
- apiGroups:
88-
- storage.k8s.io
89-
resources:
90-
- storageclasses
91-
- volumeattachments
92-
verbs:
93-
- list
94-
- watch
95-
- apiGroups:
96-
- admissionregistration.k8s.io
97-
resources:
98-
- mutatingwebhookconfigurations
99-
- validatingwebhookconfigurations
100-
verbs:
101-
- list
102-
- watch
103-
- apiGroups:
104-
- networking.k8s.io
105-
resources:
106-
- networkpolicies
107-
- ingressclasses
108-
- ingresses
109-
verbs:
110-
- list
111-
- watch
112-
- apiGroups:
113-
- coordination.k8s.io
114-
resources:
115-
- leases
116-
verbs:
117-
- list
118-
- watch
119-
- apiGroups:
120-
- rbac.authorization.k8s.io
121-
resources:
122-
- clusterrolebindings
123-
- clusterroles
124-
- rolebindings
125-
- roles
126-
verbs:
127-
- list
128-
- watch
10+
- apiGroups:
11+
- ""
12+
resources:
13+
- configmaps
14+
- secrets
15+
- nodes
16+
- pods
17+
- services
18+
- serviceaccounts
19+
- resourcequotas
20+
- replicationcontrollers
21+
- limitranges
22+
- persistentvolumeclaims
23+
- persistentvolumes
24+
- namespaces
25+
- endpoints
26+
verbs:
27+
- list
28+
- watch
29+
- apiGroups:
30+
- apps
31+
resources:
32+
- statefulsets
33+
- daemonsets
34+
- deployments
35+
- replicasets
36+
verbs:
37+
- list
38+
- watch
39+
- apiGroups:
40+
- batch
41+
resources:
42+
- cronjobs
43+
- jobs
44+
verbs:
45+
- list
46+
- watch
47+
- apiGroups:
48+
- autoscaling
49+
resources:
50+
- horizontalpodautoscalers
51+
verbs:
52+
- list
53+
- watch
54+
- apiGroups:
55+
- authentication.k8s.io
56+
resources:
57+
- tokenreviews
58+
verbs:
59+
- create
60+
- apiGroups:
61+
- authorization.k8s.io
62+
resources:
63+
- subjectaccessreviews
64+
verbs:
65+
- create
66+
- apiGroups:
67+
- policy
68+
resources:
69+
- poddisruptionbudgets
70+
verbs:
71+
- list
72+
- watch
73+
- apiGroups:
74+
- certificates.k8s.io
75+
resources:
76+
- certificatesigningrequests
77+
verbs:
78+
- list
79+
- watch
80+
- apiGroups:
81+
- discovery.k8s.io
82+
resources:
83+
- endpointslices
84+
verbs:
85+
- list
86+
- watch
87+
- apiGroups:
88+
- storage.k8s.io
89+
resources:
90+
- storageclasses
91+
- volumeattachments
92+
verbs:
93+
- list
94+
- watch
95+
- apiGroups:
96+
- admissionregistration.k8s.io
97+
resources:
98+
- mutatingwebhookconfigurations
99+
- validatingwebhookconfigurations
100+
verbs:
101+
- list
102+
- watch
103+
- apiGroups:
104+
- networking.k8s.io
105+
resources:
106+
- networkpolicies
107+
- ingressclasses
108+
- ingresses
109+
verbs:
110+
- list
111+
- watch
112+
- apiGroups:
113+
- coordination.k8s.io
114+
resources:
115+
- leases
116+
verbs:
117+
- list
118+
- watch
119+
- apiGroups:
120+
- rbac.authorization.k8s.io
121+
resources:
122+
- clusterrolebindings
123+
- clusterroles
124+
- rolebindings
125+
- roles
126+
verbs:
127+
- list
128+
- watch

examples/autosharding/role-binding.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@ roleRef:
1212
kind: Role
1313
name: kube-state-metrics
1414
subjects:
15-
- kind: ServiceAccount
16-
name: kube-state-metrics
15+
- kind: ServiceAccount
16+
name: kube-state-metrics

examples/autosharding/role.yaml

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,17 @@ metadata:
88
name: kube-state-metrics
99
namespace: kube-system
1010
rules:
11-
- apiGroups:
12-
- ""
13-
resources:
14-
- pods
15-
verbs:
16-
- get
17-
- apiGroups:
18-
- apps
19-
resourceNames:
20-
- kube-state-metrics
21-
resources:
22-
- statefulsets
23-
verbs:
24-
- get
11+
- apiGroups:
12+
- ""
13+
resources:
14+
- pods
15+
verbs:
16+
- get
17+
- apiGroups:
18+
- apps
19+
resourceNames:
20+
- kube-state-metrics
21+
resources:
22+
- statefulsets
23+
verbs:
24+
- get

examples/autosharding/service.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ metadata:
1010
spec:
1111
clusterIP: None
1212
ports:
13-
- name: http-metrics
14-
port: 8080
15-
targetPort: http-metrics
16-
- name: telemetry
17-
port: 8081
18-
targetPort: telemetry
13+
- name: http-metrics
14+
port: 8080
15+
targetPort: http-metrics
16+
- name: telemetry
17+
port: 8081
18+
targetPort: telemetry
1919
selector:
2020
app.kubernetes.io/name: kube-state-metrics

0 commit comments

Comments
 (0)