Skip to content

Make sure dashboard is deployed after server and public api server #18995

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

Merged
merged 11 commits into from
Nov 6, 2023

Conversation

mustard-mh
Copy link
Contributor

@mustard-mh mustard-mh commented Nov 1, 2023

Description

To make sure dashboard is deployed after server and public api server

  • 👎 Every time server or public-api-server deployed a new version, dashboard will restart. But it's not harmful for dashboard.
  • 👎 We can not manually change server or public-api-server 's image anymore. Everything that deployed should be built from installer
Summary generated by Copilot ### 🤖 Generated by Copilot at d93f3fa

This pull request adds a new service-waiter package and command that waits for the server and public-api-server components to be ready before starting the dashboard component. It also adds a new service account and role for the dashboard component, and updates the constants and deployments of the dashboard and public-api-server components accordingly.

Related Issue(s)

Fixes EXP-822

How to test

  • Open PR with Gitpod
  • Check logs of dashboard pod container server-waiter and public-api-server-waiter, they should be succeed and dashboard should be accessable
  • --image of dashboard initContainer should be the same with server and public-api-server 's image.
  • Change deployment/server's image i.e. eu.gcr.io/gitpod-core-dev/build/server:main-gha.19119, restart dashboard, it should failed. (remember to undo server changes)
# change server
export KUBE_EDITOR='code --wait'
kubectl edit deployment/server

# restart dashboard
kubectl rollout restart deploy/dashboard

# check logs of service waiter if you want
kubectl logs -f pod/<dashboard_tab_tab_tab> -c server-waiter

# undo server
kubectl rollout undo deploy/server

Test result share

Waiter started and works Incorrect server image dashboard will not restart with health status Undo server changes dashboard will ready
image image image

Documentation

Preview status

Gitpod was successfully deployed to your preview environment.

Build Options

Build
  • /werft with-werft
    Run the build with werft instead of GHA
  • leeway-no-cache
  • /werft no-test
    Run Leeway with --dont-test
Publish
  • /werft publish-to-npm
  • /werft publish-to-jb-marketplace
Installer
  • analytics=segment
  • with-dedicated-emulation
  • workspace-feature-flags
    Add desired feature flags to the end of the line above, space separated
Preview Environment / Integration Tests
  • /werft with-local-preview
    If enabled this will build install/preview
  • /werft with-preview
  • /werft with-large-vm
  • /werft with-gce-vm
    If enabled this will create the environment on GCE infra
  • with-integration-tests=all
    Valid options are all, workspace, webapp, ide, jetbrains, vscode, ssh. If enabled, with-preview and with-large-vm will be enabled.
  • with-monitoring

/hold

@mustard-mh mustard-mh changed the title [WIP] Make sure dashboard is deployed after server and public api server Make sure dashboard is deployed after server and public api server Nov 2, 2023
@mustard-mh mustard-mh marked this pull request as ready for review November 2, 2023 09:06
@mustard-mh mustard-mh requested a review from a team as a code owner November 2, 2023 09:06
@akosyakov akosyakov requested a review from geropl November 2, 2023 15:13
// We need a new service account because
// - Update old one will make preview env / dedicated deploy failed with err
// The RoleBinding "dashboard" is invalid: roleRef: Invalid value: rbac.RoleRef{APIGroup:"rbac.authorization.k8s.io", Kind:"Role", Name:"dashboard"}: cannot change roleRef
// - Add new one will not work for dedicated since it will not clean old resources
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure I understand this line: AFAIK with this approach, yes, we will leak resources (which is a more general problem), but the rollout should work, no? 🤔

Copy link
Contributor Author

@mustard-mh mustard-mh Nov 3, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@geropl We just need a new name, we use Component as it's name before with xxx-restricted-root-user as its role (which its actual role was deleted in previous PR but not delete this role bind)

  • Change RoleRef is not allowed for k8s
  • When we use APIs, it will check the bind roles, then find that xxx-restricted-root-user not exists, so we need to delete old one

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • we will leak resources : no
  • rollout should work: yes

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool!

@akosyakov
Copy link
Member

/gh run recreate-vm=true

@mustard-mh
Copy link
Contributor Author

Remove --image flag
SCR-20231103-rdcu

Dashboard started
SCR-20231103-rdma

@mustard-mh
Copy link
Contributor Author

Let's hold until Monday

Copy link
Member

@akosyakov akosyakov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I only looked at the code and did not try.

@roboquat roboquat merged commit 1ec7186 into main Nov 6, 2023
@roboquat roboquat deleted the hw/service-waiter branch November 6, 2023 08:12
mustard-mh added a commit that referenced this pull request Nov 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants