Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: use odiglet enterprise image for odigos cloud installations #806

Merged
merged 2 commits into from
Dec 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)
}
Loading