Skip to content

Commit d24e8fe

Browse files
Craig FurmanjdpleinessChickensoupwithriceDaedalusGnelsonjr
authored
feat(appliance): backport all recent appliance changes (sourcegraph#64182)
Draft in case plan in https://linear.app/sourcegraph/issue/REL-309/release-process-for-appliance not agreed. Please see that first. Generated by: ``` git log --format=%H d47b4cc..origin/main -- cmd/appliance internal/appliance docker-images/appliance-frontend | tac | xargs git cherry-pick ``` d47b4cc being the commit we branched off main from to create the 5.5.x branch (https://buildkite.com/sourcegraph/sourcegraph/builds/281882). Commits (generated by `git log --format='- https://github.com/sourcegraph/sourcegraph/commit/%H' d47b4cc..origin/main -- cmd/appliance internal/appliance docker-images/appliance-frontend | tac`): - https://github.com/sourcegraph/sourcegraph/commit/a20b0650b453d11d7dc428b9f919b79465db088c - https://github.com/sourcegraph/sourcegraph/commit/b71c986c77829cfe3bdc6f2d31e8590fdb969b17 - https://github.com/sourcegraph/sourcegraph/commit/91864283bc0811928188f415e6cda7d3fe940e34 - https://github.com/sourcegraph/sourcegraph/commit/c88b57020fa49fe996e37ca9409a541d48d7a63e - https://github.com/sourcegraph/sourcegraph/commit/0491839942c3087687d0f48ade1c544f1fbcb881 - https://github.com/sourcegraph/sourcegraph/commit/619fc5707415bd50631153bcb1b01c670d44fd82 - https://github.com/sourcegraph/sourcegraph/commit/e81c39a834810a60c8827456963511213eb5f602 - https://github.com/sourcegraph/sourcegraph/commit/a61f353e0e93f848fa476ffda6d46f71060d465d - https://github.com/sourcegraph/sourcegraph/commit/0abef7b43d5dadac92a3ff318f3caf6d7b572f6a - https://github.com/sourcegraph/sourcegraph/commit/0e391a964ae8d21904bd875862759db521feb5ba - https://github.com/sourcegraph/sourcegraph/commit/daae9adfb642f2c73e7b4b2dcb7acca618ae86d3 - https://github.com/sourcegraph/sourcegraph/commit/6e31f0f4cc89ad7d3892e67bad55ab9a0b9658a7 - https://github.com/sourcegraph/sourcegraph/commit/49a600220d5eb2875ab54c87329d0a90f15c38d6 - https://github.com/sourcegraph/sourcegraph/commit/37cf4a7b7e9dfb4f09635d2e04ce30daf5d8b7a0 - https://github.com/sourcegraph/sourcegraph/commit/29fc613c376fe38055fa907c5bbd293ea6e4408f - https://github.com/sourcegraph/sourcegraph/commit/255e6387cc7854c8aed6dfa1445fcade380ec690 - https://github.com/sourcegraph/sourcegraph/commit/49b32fcf3a1ec8362e3be286de182aba76f93917 - https://github.com/sourcegraph/sourcegraph/commit/9f4c160f91838ed3167a38ba62b7ca90ad90a771 - https://github.com/sourcegraph/sourcegraph/commit/3814fd7390455354be1129cdb1b240c201ef5964 - https://github.com/sourcegraph/sourcegraph/commit/c68e92bc28b3ce0878aebe8e10471cca89010b77 - https://github.com/sourcegraph/sourcegraph/commit/7e82c27ab5de1c76f1e877ec9dee665800807cbb - https://github.com/sourcegraph/sourcegraph/commit/98c6b9703f889bb8b706855204276d3528b03356 - https://github.com/sourcegraph/sourcegraph/commit/a01ebad8417d4c14b969f61a3a6ad8e836728047 - https://github.com/sourcegraph/sourcegraph/commit/8c2d8da234cc46b529b8df92a38cdf7f7d83a7a7 - https://github.com/sourcegraph/sourcegraph/commit/ebec72d7ed7046406d22d2bf8276612945db358d - https://github.com/sourcegraph/sourcegraph/commit/d945f192852a7dc3cd2482602fe37f614f82f8a1 - https://github.com/sourcegraph/sourcegraph/commit/84e28998e9d3976b79d858439953d101ca44ab7e ## Test plan Tests pass. ## Changelog - Backport all recent appliance changes. The appliance is still pre-release. --------- Co-authored-by: Jacob Pleiness <[email protected]> Co-authored-by: Anish Lakhwara <[email protected]> Co-authored-by: Warren Gifford <[email protected]> Co-authored-by: Nelson Araujo <[email protected]>
1 parent 162d383 commit d24e8fe

File tree

234 files changed

+8985
-1844
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

234 files changed

+8985
-1844
lines changed

client/web/dev/utils/create-js-context.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ export const createJsContext = ({ sourcegraphBaseUrl }: { sourcegraphBaseUrl: st
3535
accessTokensExpirationDaysOptions: [7, 14, 30, 60, 90],
3636
allowSignup: true,
3737
batchChangesEnabled: true,
38+
applianceManaged: false,
3839
batchChangesDisableWebhooksWarning: false,
3940
batchChangesWebhookLogsEnabled: true,
4041
executorsEnabled: false,

client/web/src/enterprise/site-admin/SiteAdminSidebar.story.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ export const AdminSidebarItems: StoryFn = () => (
3838
batchChangesExecutionEnabled={true}
3939
batchChangesWebhookLogsEnabled={true}
4040
codeInsightsEnabled={true}
41+
applianceManaged={false}
4142
endUserOnboardingEnabled={false}
4243
/>
4344
<SiteAdminSidebar
@@ -48,6 +49,7 @@ export const AdminSidebarItems: StoryFn = () => (
4849
batchChangesExecutionEnabled={true}
4950
batchChangesWebhookLogsEnabled={true}
5051
codeInsightsEnabled={true}
52+
applianceManaged={false}
5153
endUserOnboardingEnabled={false}
5254
/>
5355
<SiteAdminSidebar
@@ -58,6 +60,7 @@ export const AdminSidebarItems: StoryFn = () => (
5860
batchChangesExecutionEnabled={false}
5961
batchChangesWebhookLogsEnabled={false}
6062
codeInsightsEnabled={true}
63+
applianceManaged={false}
6164
endUserOnboardingEnabled={false}
6265
/>
6366
<SiteAdminSidebar
@@ -68,6 +71,7 @@ export const AdminSidebarItems: StoryFn = () => (
6871
batchChangesExecutionEnabled={true}
6972
batchChangesWebhookLogsEnabled={true}
7073
codeInsightsEnabled={false}
74+
applianceManaged={false}
7175
endUserOnboardingEnabled={false}
7276
/>
7377
</Grid>

client/web/src/integration/jscontext.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ export const createJsContext = ({ sourcegraphBaseUrl }: { sourcegraphBaseUrl: st
2727
accessTokensExpirationDaysOptions: [7, 30, 60, 90],
2828
allowSignup: false,
2929
batchChangesEnabled: true,
30+
applianceManaged: false,
3031
batchChangesDisableWebhooksWarning: false,
3132
batchChangesWebhookLogsEnabled: true,
3233
codeInsightsEnabled: true,

client/web/src/jscontext.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,11 @@ export interface SourcegraphContext extends Pick<Required<SiteConfiguration>, 'e
196196

197197
batchChangesWebhookLogsEnabled: boolean
198198

199+
/**
200+
* Whether this sourcegraph instance is managed by Appliance
201+
*/
202+
applianceManaged: boolean
203+
199204
/**
200205
* Whether Cody is enabled on this instance. Check
201206
* {@link SourcegraphContext.codyEnabledForCurrentUser} to see whether Cody is enabled for the

client/web/src/routes.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,7 @@ export const routes: RouteObject[] = [
268268
sideBarGroups={props.siteAdminSideBarGroups}
269269
overviewComponents={props.siteAdminOverviewComponents}
270270
codeInsightsEnabled={window.context.codeInsightsEnabled}
271+
applianceManaged={window.context.applianceManaged}
271272
telemetryRecorder={props.platformContext.telemetryRecorder}
272273
/>
273274
)}

client/web/src/site-admin/SiteAdminArea.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ export interface SiteAdminAreaRouteContext
5959
overviewComponents: readonly React.ComponentType<React.PropsWithChildren<{}>>[]
6060

6161
codeInsightsEnabled: boolean
62+
applianceManaged: boolean
6263

6364
endUserOnboardingEnabled: boolean
6465
}
@@ -77,6 +78,7 @@ interface SiteAdminAreaProps
7778
authenticatedUser: AuthenticatedUser
7879
isSourcegraphDotCom: boolean
7980
codeInsightsEnabled: boolean
81+
applianceManaged: boolean
8082
}
8183

8284
const sourcegraphOperatorSiteAdminMaintenanceBlockItems = new Set([
@@ -142,6 +144,7 @@ const AuthenticatedSiteAdminArea: React.FunctionComponent<React.PropsWithChildre
142144
telemetryService: props.telemetryService,
143145
telemetryRecorder: props.telemetryRecorder,
144146
codeInsightsEnabled: props.codeInsightsEnabled,
147+
applianceManaged: props.applianceManaged,
145148
endUserOnboardingEnabled,
146149
}
147150

@@ -161,6 +164,7 @@ const AuthenticatedSiteAdminArea: React.FunctionComponent<React.PropsWithChildre
161164
batchChangesExecutionEnabled={props.batchChangesExecutionEnabled}
162165
batchChangesWebhookLogsEnabled={props.batchChangesWebhookLogsEnabled}
163166
codeInsightsEnabled={props.codeInsightsEnabled}
167+
applianceManaged={props.applianceManaged}
164168
endUserOnboardingEnabled={endUserOnboardingEnabled}
165169
/>
166170
<div className="flex-bounded">

client/web/src/site-admin/SiteAdminSidebar.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ export interface SiteAdminSideBarGroupContext extends BatchChangesProps {
1515
isSourcegraphDotCom: boolean
1616
codeInsightsEnabled: boolean
1717
endUserOnboardingEnabled: boolean
18+
applianceManaged: boolean
1819
}
1920

2021
export interface SiteAdminSideBarGroup extends NavGroupDescriptor<SiteAdminSideBarGroupContext> {}

client/web/src/site-admin/sidebaritems.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,12 @@ const maintenanceGroup: SiteAdminSideBarGroup = {
135135
{
136136
label: maintenanceGroupUpdatesItemLabel,
137137
to: '/site-admin/updates',
138+
condition: ({ applianceManaged }) => !applianceManaged,
139+
},
140+
{
141+
label: maintenanceGroupUpdatesItemLabel,
142+
to: '/appliance/updates',
143+
condition: ({ applianceManaged }) => applianceManaged,
138144
},
139145
{
140146
label: 'Documentation',

cmd/appliance/shared/BUILD.bazel

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@ go_library(
1111
visibility = ["//visibility:public"],
1212
deps = [
1313
"//internal/appliance",
14+
"//internal/appliance/healthchecker",
1415
"//internal/appliance/reconciler",
16+
"//internal/appliance/selfupdate",
1517
"//internal/appliance/v1:appliance",
1618
"//internal/debugserver",
1719
"//internal/env",
@@ -23,6 +25,7 @@ go_library(
2325
"//lib/errors",
2426
"@com_github_sourcegraph_log//:log",
2527
"@com_github_sourcegraph_log_logr//:logr",
28+
"@io_k8s_apimachinery//pkg/types",
2629
"@io_k8s_client_go//rest",
2730
"@io_k8s_client_go//tools/clientcmd",
2831
"@io_k8s_client_go//util/homedir",

cmd/appliance/shared/config.go

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,15 @@ import (
1616
type Config struct {
1717
env.BaseConfig
1818

19-
k8sConfig *rest.Config
20-
metrics metricsConfig
21-
grpc grpcConfig
22-
http httpConfig
23-
namespace string
24-
relregEndpoint string
25-
applianceVersion string
19+
k8sConfig *rest.Config
20+
metrics metricsConfig
21+
grpc grpcConfig
22+
http httpConfig
23+
namespace string
24+
relregEndpoint string
25+
applianceVersion string
26+
selfDeploymentName string
27+
noResourceRestrictions string
2628
}
2729

2830
func (c *Config) Load() {
@@ -43,10 +45,12 @@ func (c *Config) Load() {
4345
c.metrics.addr = c.Get("APPLIANCE_METRICS_ADDR", ":8734", "Appliance metrics server address.")
4446
c.metrics.secure = c.GetBool("APPLIANCE_METRICS_SECURE", "false", "Appliance metrics server uses https.")
4547
c.grpc.addr = c.Get("APPLIANCE_GRPC_ADDR", ":9000", "Appliance gRPC address.")
46-
c.http.addr = c.Get("APPLIANCE_HTTP_ADDR", ":8080", "Appliance http address.")
48+
c.http.addr = c.Get("APPLIANCE_HTTP_ADDR", ":8888", "Appliance http address.")
4749
c.namespace = c.Get("APPLIANCE_NAMESPACE", "default", "Namespace to monitor.")
4850
c.applianceVersion = c.Get("APPLIANCE_VERSION", version.Version(), "Version tag for the running appliance.")
51+
c.selfDeploymentName = c.Get("APPLIANCE_DEPLOYMENT_NAME", "", "Own deployment name for self-update. Default is to disable self-update.")
4952
c.relregEndpoint = c.Get("RELEASE_REGISTRY_ENDPOINT", releaseregistry.Endpoint, "Release registry endpoint.")
53+
c.noResourceRestrictions = c.Get("APPLIANCE_NO_RESOURCE_RESTRICTIONS", "false", "Remove all resource requests and limits from deployed resources. Only recommended for local development.")
5054
}
5155

5256
func (c *Config) Validate() error {

0 commit comments

Comments
 (0)