Skip to content

Commit

Permalink
Merge pull request #413 from parca-dev/dev_updates
Browse files Browse the repository at this point in the history
deploy: Update dev environment
  • Loading branch information
metalmatze authored Nov 4, 2021
2 parents efa9c7d + 4bf47e3 commit d7d98b0
Show file tree
Hide file tree
Showing 14 changed files with 138 additions and 17 deletions.
2 changes: 1 addition & 1 deletion Dockerfile.dev
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ FROM golang:1.17.2-alpine AS builder

WORKDIR /app

RUN go install github.com/go-delve/delve/cmd/dlv@v1.6.0
RUN go install github.com/go-delve/delve/cmd/dlv@v1.7.2
RUN go install github.com/grpc-ecosystem/grpc-health-probe@latest

COPY go.mod go.sum /app/
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.go.dev
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ FROM golang:1.17.2-alpine AS builder

WORKDIR /app

RUN go install github.com/go-delve/delve/cmd/dlv@v1.6.0
RUN go install github.com/go-delve/delve/cmd/dlv@v1.7.2
RUN go install github.com/grpc-ecosystem/grpc-health-probe@latest

COPY go.mod go.sum /app/
Expand Down
9 changes: 6 additions & 3 deletions Tiltfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ docker_prune_settings(num_builds=5)
# Parca

## API Only
docker_build('parca.io/parca/parca:dev', '.',
docker_build(
'parca.io/parca/parca:dev', '.',
dockerfile='Dockerfile.go.dev',
only=['./cmd', './pkg', './proto', './gen', './go.mod', './go.sum', 'parca.yaml'],
)
Expand All @@ -18,7 +19,8 @@ k8s_yaml('deploy/tilt/parca-server-deployment.yaml')
k8s_resource('parca', port_forwards=[7070, 40000])

## UI
docker_build('parca.io/parca-dev/parca-ui:dev', './ui',
docker_build(
'parca.io/parca/parca-ui:dev', './ui',
entrypoint='yarn workspace @parca/web dev',
dockerfile='./ui/Dockerfile.dev',
live_update=[
Expand All @@ -31,7 +33,8 @@ k8s_resource('parca-ui', port_forwards=3000)

## Parca Agent

docker_build('parca.io/parca/parca-agent:dev', './tmp/parca-agent',
docker_build(
'parca.io/parca/parca-agent:dev', './tmp/parca-agent',
dockerfile='./tmp/parca-agent/Dockerfile.dev',
)
k8s_yaml('deploy/tilt/parca-agent-daemonSet.yaml')
Expand Down
2 changes: 1 addition & 1 deletion deploy/dev.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ local parcaAgent = (import 'parca-agent/parca-agent.libsonnet')({
local parcaUI = (import 'parca/parca-ui.libsonnet')({
name: 'parca-ui',
namespace: ns.metadata.name,
image: 'parca.io/parca-dev/parca-ui:dev',
image: 'parca.io/parca/parca-ui:dev',
version: 'dev',
replicas: 1,
apiEndpoint: 'http://localhost:7070',
Expand Down
4 changes: 2 additions & 2 deletions deploy/jsonnetfile.lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
"subdir": "deploy/lib/parca-agent"
}
},
"version": "c7b1f38480ad626c8b8c90a169b4e28e6e87d0a1",
"sum": "vPh6MZwSJoHPgemsv4u4t4ZV0X/gAptpyMX1funjJFs="
"version": "451109e5d50fc7d9e342fd2f7ad7565cdb7db8c2",
"sum": "GZnEZ+TFSgygtCumTXEKUk5WoKfujjOG0L71jzfjawk="
},
{
"source": {
Expand Down
2 changes: 1 addition & 1 deletion deploy/lib/parca/parca.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ function(params) {
'--log-level=' + prc.config.logLevel,
] +
(if prc.config.corsAllowedOrigins == '' then []
else ['--cors-allowed-origins=' + prc.config.corsAllowedOrigins]) +
else ['--cors-allowed-origins=' + prc.config.corsAllowedOrigins]) +
(if prc.config.storageRetentionTime == '' then []
else ['--storage-tsdb-retention-time=' + prc.config.storageRetentionTime]),
ports: [
Expand Down
24 changes: 24 additions & 0 deletions deploy/tilt/parca-agent-clusterRole.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
labels:
app.kubernetes.io/component: observability
app.kubernetes.io/instance: parca-agent
app.kubernetes.io/name: parca-agent
app.kubernetes.io/version: dev
name: parca-agent
namespace: parca
rules:
- apiGroups:
- ""
resources:
- pods
verbs:
- list
- watch
- apiGroups:
- ""
resources:
- nodes
verbs:
- get
8 changes: 7 additions & 1 deletion deploy/tilt/parca-agent-clusterRoleBinding.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
labels:
app.kubernetes.io/component: observability
app.kubernetes.io/instance: parca-agent
app.kubernetes.io/name: parca-agent
app.kubernetes.io/version: dev
name: parca-agent
namespace: parca
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: cluster-admin
name: parca-agent
subjects:
- kind: ServiceAccount
name: parca-agent
Expand Down
17 changes: 12 additions & 5 deletions deploy/tilt/parca-agent-daemonSet.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,16 @@ spec:
fieldPath: spec.nodeName
image: parca.io/parca/parca-agent:dev
name: parca-agent
ports:
- containerPort: 7071
hostPort: 7071
name: http
resources: {}
securityContext:
privileged: true
volumeMounts:
- mountPath: /tmp
name: tmp
- mountPath: /host/root
name: root
readOnly: true
Expand All @@ -58,16 +65,19 @@ spec:
name: cgroup
- mountPath: /sys/fs/bpf
name: bpffs
- mountPath: /etc/localtime
name: localtime
hostPID: true
nodeSelector:
kubernetes.io/arch: amd64
kubernetes.io/os: linux
serviceAccountName: parca-agent
tolerations:
- effect: NoSchedule
operator: Exists
- effect: NoExecute
operator: Exists
volumes:
- emptyDir: {}
name: tmp
- hostPath:
path: /
name: root
Expand All @@ -89,6 +99,3 @@ spec:
- hostPath:
path: /sys/kernel/debug
name: debugfs
- hostPath:
path: /etc/localtime
name: localtime
44 changes: 44 additions & 0 deletions deploy/tilt/parca-agent-podSecurityPolicy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
apiVersion: policy/v1beta1
kind: PodSecurityPolicy
metadata:
labels:
app.kubernetes.io/component: observability
app.kubernetes.io/instance: parca-agent
app.kubernetes.io/name: parca-agent
app.kubernetes.io/version: dev
name: parca-agent
namespace: parca
spec:
allowPrivilegeEscalation: true
allowedCapabilities:
- '*'
allowedHostPaths:
- pathPrefix: /proc
- pathPrefix: /sys
- pathPrefix: /
- pathPrefix: /lib
- pathPrefix: /etc
fsGroup:
rule: RunAsAny
hostIPC: true
hostNetwork: true
hostPID: true
hostPorts:
- max: 7071
min: 7071
privileged: true
readOnlyRootFilesystem: true
runAsUser:
rule: RunAsAny
seLinux:
rule: RunAsAny
supplementalGroups:
rule: RunAsAny
volumes:
- configMap
- emptyDir
- projected
- secret
- downwardAPI
- persistentVolumeClaim
- hostPath
19 changes: 19 additions & 0 deletions deploy/tilt/parca-agent-role.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
labels:
app.kubernetes.io/component: observability
app.kubernetes.io/instance: parca-agent
app.kubernetes.io/name: parca-agent
app.kubernetes.io/version: dev
name: parca-agent
namespace: parca
rules:
- apiGroups:
- policy
resourceNames:
- parca-agent
resources:
- podsecuritypolicies
verbs:
- use
17 changes: 17 additions & 0 deletions deploy/tilt/parca-agent-roleBinding.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
labels:
app.kubernetes.io/component: observability
app.kubernetes.io/instance: parca-agent
app.kubernetes.io/name: parca-agent
app.kubernetes.io/version: dev
name: parca-agent
namespace: parca
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: parca-agent
subjects:
- kind: ServiceAccount
name: parca-agent
2 changes: 1 addition & 1 deletion deploy/tilt/parca-ui-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ spec:
- env:
- name: NEXT_PUBLIC_API_ENDPOINT
value: http://localhost:7070
image: parca.io/parca-dev/parca-ui:dev
image: parca.io/parca/parca-ui:dev
name: parca-ui
ports:
- containerPort: 3000
Expand Down
3 changes: 2 additions & 1 deletion scripts/local-dev.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ function up() {
echo "----------------------------------------------------------"
else
ctlptl create registry ctlptl-registry || echo 'Registry already exists'
minikube start -p parca --driver=virtualbox --kubernetes-version=v1.22.0 --cpus=4 --disk-size=80000mb --docker-opt dns=8.8.8.8
minikube start -p parca --driver=virtualbox --kubernetes-version=v1.22.3 --cpus=4 --disk-size=80000mb --docker-opt dns=8.8.8.8
# minikube start -p parca --driver=kvm2 --kubernetes-version=v1.22.3 --cpus=12 --memory=40gb --disk-size=120gb --docker-opt dns=8.8.8.8
fi

# Pull parca-agent repo to build live image
Expand Down

0 comments on commit d7d98b0

Please sign in to comment.