Skip to content

Commit

Permalink
feat: Nginx UI condition (#1475)
Browse files Browse the repository at this point in the history
  • Loading branch information
yodigos authored Sep 1, 2024
1 parent e12b670 commit 2c186b2
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions instrumentor/controllers/instrumentationdevice/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package instrumentationdevice
import (
"context"
"errors"
"github.com/odigos-io/odigos/common"

odigosv1 "github.com/odigos-io/odigos/api/odigos/v1alpha1"
"github.com/odigos-io/odigos/common/consts"
Expand All @@ -26,6 +27,7 @@ const (
ApplyInstrumentationDeviceReasonNoRuntimeDetails ApplyInstrumentationDeviceReason = "NoRuntimeDetails"
ApplyInstrumentationDeviceReasonErrApplying ApplyInstrumentationDeviceReason = "ErrApplyingInstrumentationDevice"
ApplyInstrumentationDeviceReasonErrRemoving ApplyInstrumentationDeviceReason = "ErrRemovingInstrumentationDevice"
ApplyInstrumentationDeviceReasonNotSupported ApplyInstrumentationDeviceReason = "ErrVersionNotSupported"
)

const (
Expand Down Expand Up @@ -210,6 +212,14 @@ func reconcileSingleWorkload(ctx context.Context, kubeClient client.Client, runt
return err
}

for _, runtimeDetail := range runtimeDetails.Spec.RuntimeDetails {
if runtimeDetail.Language == common.NginxProgrammingLanguage {
err := removeInstrumentationDeviceFromWorkload(ctx, kubeClient, runtimeDetails.Namespace, workloadKind, workloadName, ApplyInstrumentationDeviceReasonNotSupported)
conditions.UpdateStatusConditions(ctx, kubeClient, runtimeDetails, &runtimeDetails.Status.Conditions, metav1.ConditionFalse, appliedInstrumentationDeviceType, string(ApplyInstrumentationDeviceReasonNotSupported), "Nginx Instrumentation is Coming Soon!")
return err
}
}

err = addInstrumentationDeviceToWorkload(ctx, kubeClient, runtimeDetails)
if err == nil {
conditions.UpdateStatusConditions(ctx, kubeClient, runtimeDetails, &runtimeDetails.Status.Conditions, metav1.ConditionTrue, appliedInstrumentationDeviceType, "InstrumentationDeviceApplied", "Instrumentation device applied successfully")
Expand Down

0 comments on commit 2c186b2

Please sign in to comment.