Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proof of concept for macro-benchmarking automation #1012

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions .github/scripts/deploy_parca.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/bin/bash
# Copyright 2024 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.


# Create GKE cluster
gcloud beta container --project "lees-gmp" clusters create "parca-cluster" --zone "us-central1-c" --no-enable-basic-auth --cluster-version "1.28.9-gke.1000000" --release-channel "regular" --machine-type "e2-medium" --image-type "COS_CONTAINERD" --disk-type "pd-balanced" --disk-size "100" --metadata disable-legacy-endpoints=true --scopes "https://www.googleapis.com/auth/devstorage.read_only","https://www.googleapis.com/auth/logging.write","https://www.googleapis.com/auth/monitoring","https://www.googleapis.com/auth/servicecontrol","https://www.googleapis.com/auth/service.management.readonly","https://www.googleapis.com/auth/trace.append" --num-nodes "3" --logging=SYSTEM,WORKLOAD --monitoring=SYSTEM --enable-ip-alias --network "projects/lees-gmp/global/networks/lees-network" --subnetwork "projects/lees-gmp/regions/us-central1/subnetworks/lees-network" --no-enable-intra-node-visibility --default-max-pods-per-node "110" --security-posture=standard --workload-vulnerability-scanning=disabled --no-enable-master-authorized-networks --addons HorizontalPodAutoscaling,HttpLoadBalancing,GcePersistentDiskCsiDriver --enable-autoupgrade --enable-autorepair --max-surge-upgrade 1 --max-unavailable-upgrade 0 --binauthz-evaluation-mode=DISABLED --no-enable-managed-prometheus --enable-shielded-nodes --node-locations "us-central1-c"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't believe GH has access to our gcloud projects. @maxamins do you recall what we did for prombench to get around this?

kubectl config set-cluster parca-cluster

# Deploy Parca and Prometheus resources
kubectl create namespace parca
kubectl apply -f ../manifests/parca-server.yaml
kubectl apply -f https://raw.githubusercontent.com/GoogleCloudPlatform/prometheus-engine/v0.10.0/manifests/setup.yaml
kubectl apply -f $1

kubectl wait --for=condition=Ready deployment/gmp-operator -n gmp-system

kubectl apply -f https://raw.githubusercontent.com/GoogleCloudPlatform/prometheus-engine/v0.10.0/examples/instrumentation/go-synthetic/go-synthetic.yaml

# Port-forward Parca service to see visualization system
kubectl -n parca port-forward service/parca 7070 &

sleep 1800

# Cleanup
kill %1 # Terminate the background port-forward process
kubectl delete all --all --all-namespaces
13 changes: 13 additions & 0 deletions .github/workflows/presubmit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,3 +96,16 @@ jobs:
- uses: actions/checkout@v4
- name: Run e2e
run: TEST_RUN=${{matrix.testrun}} make e2e
parca-profile:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }} # Fetch the PR's code
- name: Profile the latest stabe version of GMP collector
run: |
./.github/scripts/deploy_parca.sh https://raw.githubusercontent.com/GoogleCloudPlatform/prometheus-engine/v0.10.0/manifests/operator.yaml
- name: Profile the incoming change of GMP collector
run: |
./.github/scripts/deploy_parca.sh ../../manifests/operator.yaml

5 changes: 5 additions & 0 deletions examples/instrumentation/go-synthetic/go-synthetic.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ spec:
- "--listen-address=:8080"
- "--cpu-burn-ops=75"
- "--memory-ballast-mbs=1024"
- "--histogram-count=2"
- "--native-histogram-count=1"
- "--gauge-count=2"
- "--counter-count=2"
- "--summary-count=2"
env:
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these changes exist because we want the prometheus instance to scrape metrics from go-synthetic

# Needed when using --tls-create-self-signed
- name: POD_IP
Expand Down
195 changes: 195 additions & 0 deletions manifests/parca-server.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,195 @@
# Copyright 2024 Google LLC
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: I would move these files out of manifests/.

manifests/ is a directory we reserve for users manually installing managed collection on K8s, which shouldn't include Parca right now :)

Maybe put it in hack/ or examples/ for now.

#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

---
apiVersion: v1
data:
parca.yaml: |-
"object_storage":
"bucket":
"config":
"directory": "/var/lib/parca"
"type": "FILESYSTEM"
scrape_configs:
- job_name: 'kubernetes-pods'
kubernetes_sd_configs:
- role: pod
relabel_configs:
- action: labelmap
regex: __meta_kubernetes_pod_label_app_kubernetes_io_(.+)
replacement: "app_kubernetes_io_$1"
- source_labels: [__meta_kubernetes_namespace]
action: replace
target_label: namespace
- source_labels: [__meta_kubernetes_pod_name]
action: replace
target_label: pod
- source_labels: [__meta_kubernetes_pod_container_name]
action: replace
target_label: container
kind: ConfigMap
metadata:
labels:
app.kubernetes.io/component: observability
app.kubernetes.io/instance: parca
app.kubernetes.io/name: parca
app.kubernetes.io/version: v0.21.0
name: parca
namespace: parca
---
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app.kubernetes.io/component: observability
app.kubernetes.io/instance: parca
app.kubernetes.io/name: parca
app.kubernetes.io/version: v0.21.0
name: parca
namespace: parca
spec:
replicas: 1
selector:
matchLabels:
app.kubernetes.io/component: observability
app.kubernetes.io/instance: parca
app.kubernetes.io/name: parca
template:
metadata:
labels:
app.kubernetes.io/component: observability
app.kubernetes.io/instance: parca
app.kubernetes.io/name: parca
app.kubernetes.io/version: v0.21.0
spec:
containers:
- args:
- /parca
- --http-address=:7070
- --config-path=/etc/parca/parca.yaml
- --log-level=info
- --cors-allowed-origins=*
- --debuginfod-upstream-servers=debuginfod.systemtap.org
- --debuginfod-http-request-timeout=5m
image: ghcr.io/parca-dev/parca:v0.21.0
livenessProbe:
exec:
command:
- /grpc_health_probe
- -v
- -addr=:7070
initialDelaySeconds: 5
name: parca
ports:
- containerPort: 7070
name: http
readinessProbe:
exec:
command:
- /grpc_health_probe
- -v
- -addr=:7070
initialDelaySeconds: 10
resources: {}
securityContext:
allowPrivilegeEscalation: false
capabilities:
drop:
- ALL
terminationMessagePolicy: FallbackToLogsOnError
volumeMounts:
- mountPath: /etc/parca
name: config
- mountPath: /var/lib/parca
name: data
nodeSelector:
kubernetes.io/os: linux
securityContext:
fsGroup: 65534
runAsNonRoot: true
runAsUser: 65534
seccompProfile:
type: RuntimeDefault
supplementalGroups:
- 65534
serviceAccountName: parca
terminationGracePeriodSeconds: 120
volumes:
- configMap:
name: parca
name: config
- emptyDir: {}
name: data
---
apiVersion: v1
kind: Namespace
metadata:
labels:
pod-security.kubernetes.io/audit: privileged
pod-security.kubernetes.io/enforce: privileged
pod-security.kubernetes.io/warn: privileged
name: parca
---
apiVersion: v1
kind: Service
metadata:
labels:
app.kubernetes.io/component: observability
app.kubernetes.io/instance: parca
app.kubernetes.io/name: parca
app.kubernetes.io/version: v0.21.0
name: parca
namespace: parca
spec:
ports:
- name: http
port: 7070
targetPort: 7070
selector:
app.kubernetes.io/component: observability
app.kubernetes.io/instance: parca
app.kubernetes.io/name: parca
---
apiVersion: v1
kind: ServiceAccount
metadata:
labels:
app.kubernetes.io/component: observability
app.kubernetes.io/instance: parca
app.kubernetes.io/name: parca
app.kubernetes.io/version: v0.21.0
name: parca
namespace: parca
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: parca-viewer
rules:
- apiGroups: [""]
resources: ["pods"]
verbs: ["get", "list", "watch"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: parca-viewer-binding
subjects:
- kind: ServiceAccount
name: parca
namespace: parca # Replace with your Parca namespace
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: parca-viewer
Loading