-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Restart the frontend deployment to update site-config #60776
base: main
Are you sure you want to change the base?
Conversation
aeb87de to
1e3ff6d
Compare
| return nil, err | ||
| } | ||
| ns := endpoint.Namespace(r.logger) | ||
| data := fmt.Sprintf(`{"spec": {"template": {"metadata": {"annotations": {"kubectl.kubernetes.io/restartedAt": "%s"}}}}}`, time.Now().Format("20060102150405")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will this cause drift with the deployment manifests? e.g., kustomize, helm.
I would like to see an E2E test against a locally deployed (with kind) sourcegraph k8s deployment.
you can build images from this branch with:
sg ci build docker-images-candidates-notestThen in your helm overrides:
storageClass:
create: false
name: standard
sourcegraph:
localDevMode: true
image:
# you can find the tag from buildkite logs
defaultTag: docker-images-candidates-notest-<replace_md>
useGlobalTagAsDefault: trueThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will this cause drift with the deployment manifests? e.g., kustomize, helm.
I would like to see an E2E test against a locally deployed (with
kind) sourcegraph k8s deployment.you can build images from this branch with:
sg ci build docker-images-candidates-notestThen in your helm overrides:
storageClass: create: false name: standard sourcegraph: localDevMode: true image: # you can find the tag from buildkite logs defaultTag: docker-images-candidates-notest-<replace_md> useGlobalTagAsDefault: true
@michaellzc I do not expect any drift, b/c I just did kubectl rollout restart deployment sourcegraph-frontend and it resulted in these annotations being added to deployment:
template:
metadata:
annotations:
checksum/auth: 5dda2c15191bf709225a311e8b732e6253d7b1c9afcf89e6ec994511cbbd2cf4
checksum/redis: 63b58e05a2640417d599c4aee6d866cb9063e3a9aa452dc08dbfff836b7781b7
kubectl.kubernetes.io/default-container: frontend
kubectl.kubernetes.io/restartedAt: "2024-02-29T00:51:29+01:00" <-- new one just added by kubectlso this action is same as normal operation done by our self-service
but +1 for test results.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
got it, didn't know that's how rollout restart work underneath.
on that notes, a few suggestions:
- replace the annotation namespace from
kubectl.kubernetes.io/restartedAtto something likesourcegraph.com/restartedAt. just makes it clear we're not trying to impersonate askubectl, and leave a proper fingerprint. - add some basic sanity checks to prevent mis-used, e.g., check if all pods are healthy, check if there's restart in progress, etc.
- record this action in audit logs
- add a flag (e.g.,
SRC_ENABLE_FRONTEND_SITE_RELOAD) so it's possible to disable this feature if we want, especially frontend availability affects Cloud uptime SLA.
0377f37 to
efecd89
Compare
| if err := auth.CheckCurrentUserIsSiteAdmin(ctx, r.db); err != nil { | ||
| return nil, err | ||
| } | ||
| if cloud.SiteConfig().SourcegraphOperatorAuthProviderEnabled() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cloud only - nice 👍
@dandiem requested this to reduce CE workload
Test plan
We can do this, we should do this
Will test images