Skip to content

Commit

Permalink
feat: use odiglet enterprise image for odigos cloud installations (#806)
Browse files Browse the repository at this point in the history
  • Loading branch information
blumamir authored Dec 3, 2023
1 parent a8810cf commit 14b7bf7
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 12 deletions.
2 changes: 1 addition & 1 deletion cli/cmd/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ func init() {
installCmd.Flags().StringVarP(&odigosCloudApiKeyFlag, "api-key", "k", "", "api key for odigos cloud")
installCmd.Flags().BoolVar(&skipWait, "nowait", false, "skip waiting for odigos pods to be ready")
installCmd.Flags().BoolVar(&telemetryEnabled, "telemetry", true, "send general telemetry regarding Odigos usage")
installCmd.Flags().StringVar(&odigletImage, "odiglet-image", "keyval/odigos-odiglet", "odiglet container image name")
installCmd.Flags().StringVar(&odigletImage, "odiglet-image", "", "odiglet container image name")
installCmd.Flags().StringVar(&instrumentorImage, "instrumentor-image", "keyval/odigos-instrumentor", "instrumentor container image name")
installCmd.Flags().StringVar(&autoScalerImage, "autoscaler-image", "keyval/odigos-autoscaler", "autoscaler container image name")
installCmd.Flags().StringVar(&imagePrefix, "image-prefix", "", "prefix for all container images. used when your cluster doesn't have access to docker hub")
Expand Down
2 changes: 1 addition & 1 deletion cli/cmd/resources/managers.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ func CreateResourceManagers(client *kube.Client, odigosNs string, isOdigosCloud
NewDataCollectionResourceManager(client, odigosNs, config),
NewInstrumentorResourceManager(client, odigosNs, config),
NewSchedulerResourceManager(client, odigosNs, config),
NewOdigletResourceManager(client, odigosNs, config),
NewOdigletResourceManager(client, odigosNs, config, isOdigosCloud),
NewAutoScalerResourceManager(client, odigosNs, config),
}...)

Expand Down
36 changes: 26 additions & 10 deletions cli/cmd/resources/odiglet.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,12 @@ import (
)

const (
OdigletServiceName = "odiglet"
OdigletDaemonSetName = "odiglet"
OdigletAppLabelValue = "odiglet"
OdigletContainerName = "odiglet"
OdigletServiceName = "odiglet"
OdigletDaemonSetName = "odiglet"
OdigletAppLabelValue = "odiglet"
OdigletContainerName = "odiglet"
OdigletImageName = "keyval/odigos-odiglet"
OdigletEnterpriseImageName = "keyval/odigos-enterprise-odiglet"
)

func NewOdigletServiceAccount(ns string) *corev1.ServiceAccount {
Expand Down Expand Up @@ -373,23 +375,37 @@ func ptrMountPropagationMode(p corev1.MountPropagationMode) *corev1.MountPropaga
}

type odigletResourceManager struct {
client *kube.Client
ns string
config *odigosv1.OdigosConfigurationSpec
client *kube.Client
ns string
config *odigosv1.OdigosConfigurationSpec
isOdigosCloud bool
}

func NewOdigletResourceManager(client *kube.Client, ns string, config *odigosv1.OdigosConfigurationSpec) ResourceManager {
return &odigletResourceManager{client: client, ns: ns, config: config}
func NewOdigletResourceManager(client *kube.Client, ns string, config *odigosv1.OdigosConfigurationSpec, isOdigosCloud bool) ResourceManager {
return &odigletResourceManager{client: client, ns: ns, config: config, isOdigosCloud: isOdigosCloud}
}

func (a *odigletResourceManager) Name() string { return "Odiglet" }

func (a *odigletResourceManager) InstallFromScratch(ctx context.Context) error {

odigletImage := a.config.OdigletImage
// if the user specified an image, use it. otherwise, use the default image.
// prev v1.0.4 - the cli would automatically store "keyval/odigos-odiglet" instead of empty value,
// thus we need to treat the default image name as empty value.
if odigletImage == "" || odigletImage == OdigletImageName {
if a.isOdigosCloud {
odigletImage = OdigletEnterpriseImageName
} else {
odigletImage = OdigletImageName
}
}

resources := []client.Object{
NewOdigletServiceAccount(a.ns),
NewOdigletClusterRole(a.config.Psp),
NewOdigletClusterRoleBinding(a.ns),
NewOdigletDaemonSet(a.ns, a.config.OdigosVersion, a.config.ImagePrefix, a.config.OdigletImage),
NewOdigletDaemonSet(a.ns, a.config.OdigosVersion, a.config.ImagePrefix, odigletImage),
}
return a.client.ApplyResources(ctx, a.config.ConfigVersion, resources)
}

0 comments on commit 14b7bf7

Please sign in to comment.