diff --git a/cli/cmd/install.go b/cli/cmd/install.go index d553d5e36..3de34a831 100644 --- a/cli/cmd/install.go +++ b/cli/cmd/install.go @@ -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") diff --git a/cli/cmd/resources/managers.go b/cli/cmd/resources/managers.go index 80f85dbc0..3643834bd 100644 --- a/cli/cmd/resources/managers.go +++ b/cli/cmd/resources/managers.go @@ -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), }...) diff --git a/cli/cmd/resources/odiglet.go b/cli/cmd/resources/odiglet.go index ae88a7f6d..323a749c9 100644 --- a/cli/cmd/resources/odiglet.go +++ b/cli/cmd/resources/odiglet.go @@ -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 { @@ -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) }