mirror of
https://github.com/kubernetes-sigs/prometheus-adapter.git
synced 2026-04-06 17:57:51 +00:00
test
This commit is contained in:
parent
c9e69613d3
commit
d2deecefbc
6 changed files with 83 additions and 1 deletions
16
deploy/Makefile
Normal file
16
deploy/Makefile
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
# Run in custom metrics namespace
|
||||
deploy-adapter-local:
|
||||
kubectl apply -f manifests/
|
||||
|
||||
# Run in custom metrics namespace
|
||||
delete-adapter-local:
|
||||
kubectl delete -f manifests/
|
||||
|
||||
namespace:
|
||||
kubectl create -f addepar/custom-metrics-namespace.json
|
||||
|
||||
raw:
|
||||
kubectl get --raw /apis/custom.metrics.k8s.io/v1beta1
|
||||
|
||||
shell:
|
||||
kubectl run -it --rm --restart=Never alpine --image=alpine sh --limits="cpu=500m,memory=512Mi"
|
||||
16
deploy/addepar/certs/Makefile
Normal file
16
deploy/addepar/certs/Makefile
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
.PHONY: build clean deploy
|
||||
|
||||
all: clean build deploy
|
||||
|
||||
build:
|
||||
$(shell cd test && ../gencerts.sh)
|
||||
|
||||
clean:
|
||||
rm -rf test
|
||||
mkdir test
|
||||
|
||||
deploy:
|
||||
kubectl -n custom-metrics create -f test/cm-adapter-serving-certs.yaml
|
||||
|
||||
delete:
|
||||
kubectl -n custom-metrics delete -f test/cm-adapter-serving-certs.yaml
|
||||
37
deploy/addepar/certs/gencerts.sh
Executable file
37
deploy/addepar/certs/gencerts.sh
Executable file
|
|
@ -0,0 +1,37 @@
|
|||
#!/usr/bin/env bash
|
||||
# exit immediately when a command fails
|
||||
set -e
|
||||
# only exit with zero if all commands of the pipeline exit successfully
|
||||
set -o pipefail
|
||||
# error on unset variables
|
||||
set -u
|
||||
|
||||
# Detect if we are on mac or should use GNU base64 options
|
||||
case $(uname) in
|
||||
Darwin)
|
||||
b64_opts='-b=0'
|
||||
;;
|
||||
*)
|
||||
b64_opts='--wrap=0'
|
||||
esac
|
||||
|
||||
#go get -v -u github.com/cloudflare/cfssl/cmd/...
|
||||
|
||||
export PURPOSE=metrics
|
||||
openssl req -x509 -sha256 -new -nodes -days 365 -newkey rsa:2048 -keyout ${PURPOSE}-ca.key -out ${PURPOSE}-ca.crt -subj "/CN=ca"
|
||||
echo '{"signing":{"default":{"expiry":"43800h","usages":["signing","key encipherment","'${PURPOSE}'"]}}}' > "${PURPOSE}-ca-config.json"
|
||||
|
||||
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
|
||||
|
||||
cat <<-EOF > cm-adapter-serving-certs.yaml
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: cm-adapter-serving-certs
|
||||
data:
|
||||
serving.crt: $(base64 ${b64_opts} < apiserver.pem)
|
||||
serving.key: $(base64 ${b64_opts} < apiserver-key.pem)
|
||||
EOF
|
||||
10
deploy/addepar/custom-metrics-namespace.json
Normal file
10
deploy/addepar/custom-metrics-namespace.json
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"apiVersion": "v1",
|
||||
"kind": "Namespace",
|
||||
"metadata": {
|
||||
"name": "custom-metrics",
|
||||
"labels": {
|
||||
"name": "custom-metrics"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -19,7 +19,8 @@ spec:
|
|||
serviceAccountName: custom-metrics-apiserver
|
||||
containers:
|
||||
- name: custom-metrics-apiserver
|
||||
image: gcr.io/k8s-staging-prometheus-adapter-amd64
|
||||
image: gcr.io/k8s-staging-prometheus-adapter/prometheus-adapter-amd64
|
||||
imagePullPolicy: Never
|
||||
args:
|
||||
- --secure-port=6443
|
||||
- --tls-cert-file=/var/run/serving-cert/serving.crt
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue