Skip to content

Commit

Permalink
fix: add root CA bundle to docker image (grafana#591)
Browse files Browse the repository at this point in the history
Signed-off-by: dan-j <5727701+dan-j@users.noreply.github.com>
  • Loading branch information
dan-j committed Nov 9, 2021
1 parent a0fc281 commit 7089df7
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 5 deletions.
6 changes: 6 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,13 @@ COPY version/ version/
# Build
RUN CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -a -o manager main.go

FROM --platform=${TARGETPLATFORM} registry.access.redhat.com/ubi8/ubi-minimal:8.4 as ubi-minimal

FROM --platform=${TARGETPLATFORM} registry.access.redhat.com/ubi8/ubi-micro:8.4

# copy Root CA bundle from ubi-minimal
COPY --from=ubi-minimal /etc/pki/tls/certs/ca-bundle.crt /etc/pki/tls/certs/ca-bundle.crt

WORKDIR /
COPY --from=builder /workspace/manager .

Expand Down
5 changes: 3 additions & 2 deletions deploy/examples/dashboards/DashboardFromGrafana.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@ metadata:
app: grafana
spec:
grafanaCom:
id: 10441
revision: 1
id: 1860
revision: 23
json: ""
1 change: 1 addition & 0 deletions hack/clean_e2e.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ DEBUG_FILE="/tmp/grafana_e2e_debug.txt"
kubectl delete -f deploy/examples/Grafana.yaml -n $NAMESPACE

kubectl delete -f deploy/examples/dashboards/SimpleDashboard.yaml -n $NAMESPACE
kubectl delete -f deploy/examples/dashboards/DashboardFromGrafana.yaml -n $NAMESPACE
kubectl delete -f deploy/examples/datasources/Prometheus.yaml -n $NAMESPACE

sleep 2
Expand Down
21 changes: 18 additions & 3 deletions hack/e2e.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ PASSWORD=$(kubectl -n $NAMESPACE get secrets grafana-admin-credentials --templat

# Create some base dashboard & datasource
kubectl apply -f deploy/examples/dashboards/SimpleDashboard.yaml -n $NAMESPACE
kubectl apply -f deploy/examples/dashboards/DashboardFromGrafana.yaml -n $NAMESPACE
kubectl apply -f deploy/examples/datasources/Prometheus.yaml -n $NAMESPACE

# Verify that the grafana dashboard exist
Expand All @@ -84,11 +85,25 @@ FPID=$!
sleep 5
curl localhost:3000/api/health
sleep 5
DASHBOARDOUTPUT=$(curl $HEADER "http://admin:$PASSWORD@localhost:3000/api/search?folderIds=0&query=&starred=false")

# get top-level folders
DASHBOARDOUTPUT=$(curl $HEADER "http://admin:$PASSWORD@localhost:3000/api/search?folderIds=0")
sleep 1
GRAFANAUID=$(echo $DASHBOARDOUTPUT |jq -r '.[0].uid')
echo "DASHBOARDOUTPUT: $(echo ${DASHBOARDOUTPUT} | jq)"

# get folder ID
GRAFANA_TOP_FOLDER_ID=$(echo $DASHBOARDOUTPUT |jq -r '.[0].id')
sleep 1
GRAFANA_DASHBOARD=$(curl $HEADER "http://admin:$PASSWORD@localhost:3000/api/dashboards/uid/$GRAFANAUID")

GRAFANA_DASHBOARDS=$(curl $HEADER "http://admin:$PASSWORD@localhost:3000/api/search?folderIds=$GRAFANA_TOP_FOLDER_ID")
NUM_DASHBOARDS=$(echo $GRAFANA_DASHBOARDS | jq -r length)
if [[ $NUM_DASHBOARDS != 2 ]]; then
echo "NUM_DASHBOARDS: want 2, got $NUM_DASHBOARDS"
echo "Available dashboards: ${GRAFANA_DASHBOARDS}" >> $DEBUG_FILE
exit 1
fi

GRAFANA_DASHBOARDS=$(curl $HEADER "http://admin:$PASSWORD@localhost:3000/api/dashboards/uid/$GRAFANA_TOP_FOLDER_ID")
sleep 1
FOLDER_ID=$(echo $GRAFANA_DASHBOARD |jq -r .meta.folderId)
if [[ $FOLDER_ID != 0 ]]; then
Expand Down

0 comments on commit 7089df7

Please sign in to comment.