Skip to content

Commit

Permalink
Migration to new runtimedetails approach (#2082)
Browse files Browse the repository at this point in the history
  • Loading branch information
tamirdavid1 authored Dec 30, 2024
1 parent 401fa50 commit 6c6bcc3
Show file tree
Hide file tree
Showing 8 changed files with 428 additions and 9 deletions.
6 changes: 3 additions & 3 deletions api/odigos/v1alpha1/instrumentedapplication_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ type InstrumentationLibraryOptions struct {
type ProcessingState string

const (
ProcessingStateFailed ProcessingState = "Failed"
ProcessingStateSucceeded ProcessingState = "Succeeded"
ProcessingStateSkipped ProcessingState = "Skipped"
ProcessingStateFailed ProcessingState = "Failed" // Used when CRI fails to detect the runtime envs
ProcessingStateSucceeded ProcessingState = "Succeeded" // Indicates that CRI successfully processed the runtime environments, even if no environments were detected.
ProcessingStateSkipped ProcessingState = "Skipped" // Used when env originally come from manifest
)

// +kubebuilder:object:generate=true
Expand Down
5 changes: 5 additions & 0 deletions cli/cmd/resources/instrumentor.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,11 @@ func NewInstrumentorClusterRole() *rbacv1.ClusterRole {
Resources: []string{"instrumentationconfigs"},
Verbs: []string{"create", "delete", "get", "list", "patch", "update", "watch"},
},
{
APIGroups: []string{"odigos.io"},
Resources: []string{"instrumentationconfigs/status"},
Verbs: []string{"update"},
},
},
}
}
Expand Down
4 changes: 4 additions & 0 deletions common/envOverwrite/overwriter.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,3 +181,7 @@ func ValToAppend(envName string, sdk common.OtelSdk) (string, bool) {

return valToAppend, true
}

func GetPossibleValuesPerEnv(env string) map[common.OtelSdk]string {
return EnvValuesMap[env].values
}
6 changes: 6 additions & 0 deletions helm/odigos/templates/instrumentor/clusterrole.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -78,3 +78,9 @@ rules:
- patch
- update
- watch
- apiGroups:
- odigos.io
resources:
- instrumentationconfigs/status
verbs:
- update
5 changes: 5 additions & 0 deletions instrumentor/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import (

corev1 "k8s.io/api/core/v1"

runtimemigration "github.com/odigos-io/odigos/instrumentor/runtimemigration"
"sigs.k8s.io/controller-runtime/pkg/cache"
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/manager/signals"
Expand Down Expand Up @@ -152,6 +153,10 @@ func main() {

ctx := signals.SetupSignalHandler()

// This temporary migration step ensures the runtimeDetails migration in the instrumentationConfig is performed.
// This code can be removed once the migration is confirmed to be successful.
mgr.Add(&runtimemigration.MigrationRunnable{KubeClient: mgr.GetClient(), Logger: setupLog})

err = sdks.SetDefaultSDKs(ctx)

if err != nil {
Expand Down
Loading

0 comments on commit 6c6bcc3

Please sign in to comment.