Skip to content
This repository was archived by the owner on Jul 19, 2023. It is now read-only.

Commit 88a081a

Browse files
authored
Merge pull request #415 from grafana/fix-local-kubernetes1
Fixes local kubernetes cluster test
2 parents f90864f + d4f93d6 commit 88a081a

File tree

4 files changed

+53
-12
lines changed

4 files changed

+53
-12
lines changed

Makefile

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ COPYRIGHT_YEARS := 2021-2022
1111
LICENSE_IGNORE := -e /testdata/
1212
GO_TEST_FLAGS ?= -v -race -cover
1313

14+
GOOS ?= $(shell go env GOOS)
15+
GOARCH ?= $(shell go env GOARCH)
1416
IMAGE_PLATFORM = linux/amd64
1517
BUILDX_ARGS =
1618
GOPRIVATE=github.com/grafana/frostdb
@@ -88,8 +90,8 @@ go/deps:
8890

8991
.PHONY: go/bin
9092
go/bin:
91-
CGO_ENABLED=0 $(GO) build $(GO_FLAGS) ./cmd/phlare
92-
CGO_ENABLED=0 $(GO) build $(GO_FLAGS) ./cmd/profilecli
93+
GOOS=$(GOOS) GOARCH=$(GOARCH) CGO_ENABLED=0 $(GO) build $(GO_FLAGS) ./cmd/phlare
94+
GOOS=$(GOOS) GOARCH=$(GOARCH) CGO_ENABLED=0 $(GO) build $(GO_FLAGS) ./cmd/profilecli
9395

9496
.PHONY: go/lint
9597
go/lint: $(BIN)/golangci-lint
@@ -152,10 +154,12 @@ define deploy
152154
$(BIN)/kind load docker-image --name $(KIND_CLUSTER) $(IMAGE_PREFIX)phlare:$(IMAGE_TAG)
153155
kubectl get pods
154156
$(BIN)/helm upgrade --install $(1) ./operations/phlare/helm/phlare $(2) \
155-
--set phlare.image.tag=$(IMAGE_TAG) --set phlare.image.repository=$(IMAGE_PREFIX)phlare --set phlare.service.port_name=http-metrics
157+
--set phlare.image.tag=$(IMAGE_TAG) --set phlare.image.repository=$(IMAGE_PREFIX)phlare --set phlare.service.port_name=http-metrics \
158+
--set phlare.components.querier.resources=null --set phlare.components.distributor.resources=null --set phlare.components.ingester.resources=null
156159
endef
157160

158161
.PHONY: docker-image/phlare/build
162+
docker-image/phlare/build: GOOS=linux GOARCH=amd64
159163
docker-image/phlare/build: go/bin
160164
$(call docker_buildx,--load)
161165

@@ -338,6 +342,12 @@ tools/monitoring/environments/default/spec.json: $(BIN)/tk $(BIN)/kind
338342
echo "import 'monitoring.libsonnet'" > tools/monitoring/environments/default/main.jsonnet
339343
$(BIN)/tk env set tools/monitoring/environments/default --server=$(shell $(BIN)/kind get kubeconfig --name phlare-dev | grep server: | sed 's/server://g' | xargs) --namespace=monitoring
340344

345+
.PHONY: deploy-demo
346+
deploy-demo: $(BIN)/kind
347+
docker build -t cp-java-simple:0.1.0 ./tools/docker-compose/java/simple
348+
$(BIN)/kind load docker-image --name $(KIND_CLUSTER) cp-java-simple:0.1.0
349+
kubectl --context="kind-$(KIND_CLUSTER)" apply -f ./tools/kubernetes/java-simple-deployment.yaml
350+
341351
.PHONY: docs/%
342352
docs/%:
343353
$(MAKE) -C docs $*
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: java-simple-deployment
5+
labels:
6+
app: java-simple
7+
spec:
8+
replicas: 3
9+
selector:
10+
matchLabels:
11+
app: java-simple
12+
template:
13+
metadata:
14+
labels:
15+
app: java-simple
16+
spec:
17+
containers:
18+
- name: java-simple
19+
imagePullPolicy: Never
20+
securityContext:
21+
capabilities:
22+
add:
23+
- CAP_PERFMON
24+
image: cp-java-simple:0.1.0
25+
ports:
26+
- containerPort: 8080

tools/monitoring/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@ By default it install:
1313
- Grafana with plugin, datasources and dashboards.
1414
- An nginx proxy to access all applications.
1515

16-
To access the proxy you just need to port forward using `kubeclt port-forward deployments.apps/nginx -n monitoring 3100:80`.
16+
To access the proxy you just need to port forward using `kubectl port-forward deployments.apps/nginx -n monitoring 3100:80`.
1717

1818
> You can replace 3100 with the local port of your choice

tools/monitoring/environments/default/monitoring.libsonnet

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
local phlare = import './../../../../deploy/jsonnet/phlare-mixin/mixin.libsonnet';
1+
local phlare = import './../../../../operations/phlare/jsonnet/phlare-mixin/phlare-mixin/mixin.libsonnet';
22
local grafana = import 'grafana/grafana.libsonnet';
33
local k = import 'ksonnet-util/kausal.libsonnet';
44
local prom_k_grafana = import 'prometheus-ksonnet/grafana/grafana.libsonnet';
@@ -10,9 +10,16 @@ prometheus {
1010
_config+:: {
1111
cluster_name: cluster_name,
1212
namespace: 'monitoring',
13+
grafana_ini+: {
14+
sections+: {
15+
feature_toggles+: {
16+
enable: 'flameGraph',
17+
},
18+
},
19+
},
1320
},
1421
_images+:: {
15-
grafana: 'ctovena/grafana:hackathon-1',
22+
grafana: 'grafana/grafana:main',
1623
},
1724
prometheus+::
1825
prometheus.withMixinsConfigmaps($.mixins) + {
@@ -33,20 +40,18 @@ prometheus {
3340
},
3441
},
3542
mixins+:: {
36-
phlare: phlare {
37-
grafanaPlugins: ['pyroscope-datasource', 'pyroscope-panel'],
38-
},
43+
phlare: phlare {},
3944
},
4045
grafana_datasource_config_map+: k.core.v1.configMap.withDataMixin({
4146
'phlare-datasource.yml': k.util.manifestYaml({
4247
apiVersion: 1,
4348
datasources: [
4449
prom_k_grafana.grafana_datasource(
4550
'phlare',
46-
'http://phlare-micro-services-querier.default.svc.cluster.local.:4100/pyroscope/',
47-
type='pyroscope-datasource'
51+
'http://phlare-micro-services-querier.default.svc.cluster.local.:4100',
52+
type='phlare'
4853
) + grafana.datasource.withJsonData({
49-
path: 'http://phlare-micro-services-querier.default.svc.cluster.local.:4100/pyroscope/',
54+
path: 'http://phlare-micro-services-querier.default.svc.cluster.local.:4100/',
5055
},),
5156
],
5257
}),

0 commit comments

Comments
 (0)