-
Notifications
You must be signed in to change notification settings - Fork 208
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: delete instrumentation instance if exit with healthy state (#2209)
- Loading branch information
1 parent
920ada0
commit d208952
Showing
3 changed files
with
33 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package instrumentation_instance | ||
|
||
import ( | ||
"context" | ||
|
||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
"sigs.k8s.io/controller-runtime/pkg/client" | ||
|
||
"github.com/odigos-io/odigos/api/odigos/v1alpha1" | ||
) | ||
|
||
func DeleteInstrumentationInstance(ctx context.Context, owner client.Object, containerName string, kubeClient client.Client, pid int) error { | ||
instrumentationInstanceName := InstrumentationInstanceName(owner.GetName(), pid) | ||
err := kubeClient.Delete(ctx, &v1alpha1.InstrumentationInstance{ | ||
ObjectMeta: v1.ObjectMeta{ | ||
Name: instrumentationInstanceName, | ||
Namespace: owner.GetNamespace(), | ||
}, | ||
}) | ||
if err != nil { | ||
return client.IgnoreNotFound(err) | ||
} | ||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters