Skip to content

Commit

Permalink
Add telemetry configs for updating (#19)
Browse files Browse the repository at this point in the history
Signed-off-by: Kim Tsao <ktsao@redhat.com>
  • Loading branch information
kim-tsao committed Mar 9, 2022
1 parent 4edcaee commit 30870a5
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions controllers/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,23 @@ func (r *DevfileRegistryReconciler) updateDeployment(ctx context.Context, cr *re
needsUpdating := false

indexImage := registry.GetDevfileIndexImage(cr)
if dep.Spec.Template.Spec.Containers[0].Image != indexImage {
dep.Spec.Template.Spec.Containers[0].Image = indexImage
indexImageContainer := dep.Spec.Template.Spec.Containers[0]
if indexImageContainer.Image != indexImage {
indexImageContainer.Image = indexImage
needsUpdating = true
} else {
//check Telemetry config to see updates are needed
registryName := cr.Spec.Telemetry.RegistryName
registryKey := cr.Spec.Telemetry.Key
if indexImageContainer.Env[1].Value != registryName {
indexImageContainer.Env[1].Value = registryName
needsUpdating = true
}

if indexImageContainer.Env[2].Value != registryKey {
indexImageContainer.Env[2].Value = registryKey
needsUpdating = true
}
}
ociImage := registry.GetOCIRegistryImage(cr)
if dep.Spec.Template.Spec.Containers[1].Image != ociImage {
Expand Down

0 comments on commit 30870a5

Please sign in to comment.