Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
kube-prometheus
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
GitHub Mirror
prometheus-operator
kube-prometheus
Commits
cd709826
Commit
cd709826
authored
Jun 18, 2018
by
Max Leonard Inden
Browse files
Options
Downloads
Patches
Plain Diff
format: Introduce shellcheck [1] for shell script analysis
[1]
https://github.com/koalaman/shellcheck
parent
17477a11
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
Makefile
+1
-4
1 addition, 4 deletions
Makefile
README.md
+1
-1
1 addition, 1 deletion
README.md
build.sh
+1
-1
1 addition, 1 deletion
build.sh
experimental/custom-metrics-api/gencerts.sh
+5
-4
5 additions, 4 deletions
experimental/custom-metrics-api/gencerts.sh
test.sh
+4
-3
4 additions, 3 deletions
test.sh
with
12 additions
and
13 deletions
Makefile
+
1
−
4
View file @
cd709826
...
...
@@ -3,8 +3,6 @@ JSONNET_FMT := jsonnet fmt -n 2 --max-blank-lines 2 --string-style s --comment-s
JB_BINARY
:=
$(
GOPATH
)
/bin/jb
EMBEDMD_BINARY
:=
$(
GOPATH
)
/bin/embedmd
# edit 1
all
:
generate fmt test
../../hack/jsonnet-docker-image
:
../../scripts/jsonnet/Dockerfile
...
...
@@ -26,10 +24,9 @@ generate-in-docker: ../../hack/jsonnet-docker-image
generate
:
manifests **.md
**.md
:
$(EMBEDMD_BINARY) $(shell find examples) build.sh example.jsonnet
echo
'>>> inside **.md'
$(
EMBEDMD_BINARY
)
-w
`
find
.
-name
"*.md"
|
grep
-v
vendor
`
manifests
:
vendor example.jsonnet
manifests
:
vendor example.jsonnet
build.sh
rm
-rf
manifests
./build.sh
...
...
This diff is collapsed.
Click to expand it.
README.md
+
1
−
1
View file @
cd709826
...
...
@@ -112,7 +112,7 @@ rm -rf manifests
mkdir
manifests
# optional, but we would like to generate yaml, not json
jsonnet
-J
vendor
-m
manifests
${
1
-example.jsonnet
}
| xargs
-I
{}
sh
-c
'cat
$1
| gojsontoyaml >
$1
.yaml; rm -f
$1
'
--
{}
jsonnet
-J
vendor
-m
manifests
"
${
1
-example.jsonnet
}
"
| xargs
-I
{}
sh
-c
'cat
{}
| gojsontoyaml >
{}
.yaml; rm -f
{}
'
--
{}
```
...
...
This diff is collapsed.
Click to expand it.
build.sh
+
1
−
1
View file @
cd709826
...
...
@@ -9,5 +9,5 @@ rm -rf manifests
mkdir
manifests
# optional, but we would like to generate yaml, not json
jsonnet
-J
vendor
-m
manifests
${
1
-example.jsonnet
}
| xargs
-I
{}
sh
-c
'cat
$1
| gojsontoyaml >
$1
.yaml; rm -f
$1
'
--
{}
jsonnet
-J
vendor
-m
manifests
"
${
1
-example.jsonnet
}
"
| xargs
-I
{}
sh
-c
'cat
{}
| gojsontoyaml >
{}
.yaml; rm -f
{}
'
--
{}
This diff is collapsed.
Click to expand it.
experimental/custom-metrics-api/gencerts.sh
+
5
−
4
View file @
cd709826
#!/usr/bin/env bash
# Detect if we are on mac or should use GNU base64 options
case
`
uname
`
in
case
$(
uname
)
in
Darwin
)
b64_opts
=
'-b=0'
;;
...
...
@@ -17,7 +17,8 @@ echo '{"signing":{"default":{"expiry":"43800h","usages":["signing","key encipher
export
SERVICE_NAME
=
custom-metrics-apiserver
export
ALT_NAMES
=
'"custom-metrics-apiserver.monitoring","custom-metrics-apiserver.monitoring.svc"'
echo
'{"CN":"'
${
SERVICE_NAME
}
'","hosts":['
${
ALT_NAMES
}
'],"key":{"algo":"rsa","size":2048}}'
| cfssl gencert
-ca
=
metrics-ca.crt
-ca-key
=
metrics-ca.key
-config
=
metrics-ca-config.json - | cfssljson
-bare
apiserver
echo
"{
\"
CN
\"
:
\"
${
SERVICE_NAME
}
\"
,
\"
hosts
\"
: [
${
ALT_NAMES
}
],
\"
key
\"
: {
\"
algo
\"
:
\"
rsa
\"
,
\"
size
\"
: 2048}}"
|
\
cfssl gencert
-ca
=
metrics-ca.crt
-ca-key
=
metrics-ca.key
-config
=
metrics-ca-config.json - | cfssljson
-bare
apiserver
cat
<<-
EOF
> cm-adapter-serving-certs.yaml
apiVersion: v1
...
...
@@ -25,6 +26,6 @@ kind: Secret
metadata:
name: cm-adapter-serving-certs
data:
serving.crt:
$(
cat
apiserver.pem |
base64
${
b64_opts
}
)
serving.key:
$(
cat
apiserver-key.pem |
base64
${
b64_opts
}
)
serving.crt:
$(
base64
${
b64_opts
}
< apiserver.pem
)
serving.key:
$(
base64
${
b64_opts
}
< apiserver-key.pem
)
EOF
This diff is collapsed.
Click to expand it.
test.sh
+
4
−
3
View file @
cd709826
...
...
@@ -8,7 +8,8 @@ for i in examples/jsonnet-snippets/*.jsonnet; do
[
-f
"
$i
"
]
||
break
echo
"Testing:
${
i
}
"
echo
""
snippet
=
"local kp =
$(
<
${
i
}
)
;
fileContent
=
$(
<
"
$i
"
)
snippet
=
"local kp =
$fileContent
;
$(
<examples/jsonnet-build-snippet/build-snippet.jsonnet
)
"
echo
"
${
snippet
}
"
>
"test.jsonnet"
...
...
@@ -25,8 +26,8 @@ for i in examples/*.jsonnet; do
echo
"Testing:
${
i
}
"
echo
""
echo
"
\`\`\`
"
echo
"
$(
<
${
i
}
)
"
cat
"
${
i
}
"
echo
"
\`\`\`
"
echo
""
jsonnet
-J
vendor
${
i
}
>
/dev/null
jsonnet
-J
vendor
"
${
i
}
"
>
/dev/null
done
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
sign in
to comment