Skip to content

Commit

Permalink
Merge branch 'main' into source-details-docs
Browse files Browse the repository at this point in the history
  • Loading branch information
damemi authored Feb 11, 2025
2 parents 9dfdb94 + de33e57 commit d972fa7
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
1 change: 1 addition & 0 deletions .github/workflows/publish-modules-artifactregistry.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ jobs:
name: Authenticate with Google Cloud
uses: google-github-actions/auth@v2
with:
token_format: 'access_token'
workload_identity_provider: ${{ secrets.GCP_WORKLOAD_IDENTITY_PROVIDER }}
service_account: ${{ secrets.GCP_SERVICE_ACCOUNT }}
access_token_lifetime: 1200s
Expand Down
18 changes: 18 additions & 0 deletions instrumentor/controllers/agentenabled/podswebhook/mount.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,15 @@ func MountDirectory(containerSpec *corev1.Container, dir string) {
// TODO: assuming the directory always starts with {{ODIGOS_AGENTS_DIR}}. This should be validated.
// Should we return errors here to validate static values?
relativePath := strings.TrimPrefix(dir, distro.AgentPlaceholderDirectory+"/")

// make sure we are idempotent, not adding ourselves multiple times
for _, volumeMount := range containerSpec.VolumeMounts {
if volumeMount.SubPath == dir {
// the volume is already mounted, do not add it again
return
}
}

absolutePath := strings.ReplaceAll(dir, distro.AgentPlaceholderDirectory, k8sconsts.OdigosAgentsDirectory)
containerSpec.VolumeMounts = append(containerSpec.VolumeMounts, corev1.VolumeMount{
Name: k8sconsts.OdigosAgentMountVolumeName,
Expand All @@ -22,6 +31,15 @@ func MountDirectory(containerSpec *corev1.Container, dir string) {
}

func MountPodVolume(pod *corev1.Pod) {

// make sure we are idempotent, not adding ourselves multiple times
for _, volume := range pod.Spec.Volumes {
if volume.Name == k8sconsts.OdigosAgentMountVolumeName {
// the volume is already mounted, do not add it again
return
}
}

pod.Spec.Volumes = append(pod.Spec.Volumes, corev1.Volume{
Name: k8sconsts.OdigosAgentMountVolumeName,
VolumeSource: corev1.VolumeSource{
Expand Down

0 comments on commit d972fa7

Please sign in to comment.