Skip to content

Commit

Permalink
Update for config-sync sidecar
Browse files Browse the repository at this point in the history
  • Loading branch information
grs committed Mar 9, 2022
1 parent 941026c commit 16dbbd1
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions client/router_update.go
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,15 @@ func (cli *VanClient) RouterUpdateVersionInNamespace(ctx context.Context, hup bo
router.Spec.Template.Spec.Containers[0].Image = desiredRouterImage
updateRouter = true
}
configSync := ConfigSyncContainer()
if !hasContainer(configSync.Name, router.Spec.Template.Spec.Containers) {
err = kube.UpdateRole(namespace, types.TransportRoleName, types.TransportPolicyRule, cli.KubeClient)
if err != nil {
return false, err
}
router.Spec.Template.Spec.Containers = append(router.Spec.Template.Spec.Containers, *configSync)
updateRouter = true
}
if updateRouter || updateSite || hup {
if !updateRouter {
// need to trigger a router redployment to pick up the revised metadata field
Expand Down Expand Up @@ -1043,3 +1052,12 @@ func (cli *VanClient) GetSiteMetadata() (*qdr.SiteMetadata, error) {
metadata := config.GetSiteMetadata()
return &metadata, nil
}

func hasContainer(name string, containers []corev1.Container) bool {
for _, c := range containers {
if c.Name == name {
return true
}
}
return false
}

0 comments on commit 16dbbd1

Please sign in to comment.