Skip to content

Commit 1bf4f90

Browse files
[Dashboard] Do not show role column in the user table for basic auth on ingress case (#7811)
do not show role column for basic auth on ingress case
1 parent 997a9c3 commit 1bf4f90

File tree

5 files changed

+25
-2
lines changed

5 files changed

+25
-2
lines changed

charts/skypilot/templates/api-deployment.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,10 @@ spec:
7979
- name: ENABLE_SERVICE_ACCOUNTS
8080
value: "true"
8181
{{- end }}
82+
{{- if include "skypilot.ingressBasicAuthEnabled" . | trim | eq "true" }}
83+
- name: SKYPILOT_INGRESS_BASIC_AUTH_ENABLED
84+
value: "true"
85+
{{- end }}
8286
{{- if .Values.gcpCredentials.enabled }}
8387
- name: GOOGLE_APPLICATION_CREDENTIALS
8488
value: /root/gcp-cred.json

sky/dashboard/src/components/users.jsx

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,8 @@ export function Users() {
257257
const [basicAuthEnabled, setBasicAuthEnabled] = useState(undefined);
258258
const [serviceAccountTokenEnabled, setServiceAccountTokenEnabled] =
259259
useState(undefined);
260+
const [ingressBasicAuthEnabled, setIngressBasicAuthEnabled] =
261+
useState(undefined);
260262
const [healthCheckLoading, setHealthCheckLoading] = useState(true);
261263
const [activeMainTab, setActiveMainTab] = useState('users');
262264
const [showCreateDialog, setShowCreateDialog] = useState(false);
@@ -373,13 +375,16 @@ export function Users() {
373375
const data = await resp.json();
374376
setBasicAuthEnabled(!!data.basic_auth_enabled);
375377
setServiceAccountTokenEnabled(!!data.service_account_token_enabled);
378+
setIngressBasicAuthEnabled(!!data.ingress_basic_auth_enabled);
376379
} else {
377380
setBasicAuthEnabled(false);
378381
setServiceAccountTokenEnabled(false);
382+
setIngressBasicAuthEnabled(false);
379383
}
380384
} catch {
381385
setBasicAuthEnabled(false);
382386
setServiceAccountTokenEnabled(false);
387+
setIngressBasicAuthEnabled(false);
383388
} finally {
384389
setHealthCheckLoading(false);
385390
}
@@ -866,6 +871,7 @@ export function Users() {
866871
onResetPassword={handleResetPasswordClick}
867872
onDeleteUser={handleDeleteUserClick}
868873
basicAuthEnabled={basicAuthEnabled}
874+
ingressBasicAuthEnabled={ingressBasicAuthEnabled}
869875
currentUserRole={userRoleCache?.role}
870876
currentUserId={userRoleCache?.id}
871877
filters={filters}
@@ -1289,6 +1295,7 @@ function UsersTable({
12891295
onResetPassword,
12901296
onDeleteUser,
12911297
basicAuthEnabled,
1298+
ingressBasicAuthEnabled,
12921299
currentUserRole,
12931300
currentUserId,
12941301
filters,
@@ -2027,7 +2034,7 @@ function UsersTable({
20272034
User ID{getSortDirection('fullEmailID')}
20282035
</TableHead>
20292036
)}
2030-
{!deduplicateUsers && (
2037+
{!deduplicateUsers && !ingressBasicAuthEnabled && (
20312038
<TableHead
20322039
onClick={() => requestSort('role')}
20332040
className="sortable whitespace-nowrap cursor-pointer hover:bg-gray-50 w-1/6"
@@ -2079,7 +2086,7 @@ function UsersTable({
20792086
{user.fullEmailID}
20802087
</TableCell>
20812088
)}
2082-
{!deduplicateUsers && (
2089+
{!deduplicateUsers && !ingressBasicAuthEnabled && (
20832090
<TableCell className="truncate" title={user.role}>
20842091
<div className="flex items-center gap-2">
20852092
{editingUserId === user.userId ? (
@@ -2266,6 +2273,7 @@ UsersTable.propTypes = {
22662273
onResetPassword: PropTypes.func.isRequired,
22672274
onDeleteUser: PropTypes.func.isRequired,
22682275
basicAuthEnabled: PropTypes.bool,
2276+
ingressBasicAuthEnabled: PropTypes.bool,
22692277
currentUserRole: PropTypes.string,
22702278
currentUserId: PropTypes.string,
22712279
};

sky/schemas/api/responses.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,13 @@ class APIHealthResponse(ResponseBaseModel):
7777
version: str = ''
7878
version_on_disk: str = ''
7979
commit: str = ''
80+
# Whether basic auth on api server is enabled
8081
basic_auth_enabled: bool = False
8182
user: Optional[models.User] = None
83+
# Whether service account token is enabled
8284
service_account_token_enabled: bool = False
85+
# Whether basic auth on ingress is enabled
86+
ingress_basic_auth_enabled: bool = False
8387

8488

8589
class StatusResponse(ResponseBaseModel):

sky/server/server.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1805,12 +1805,18 @@ async def health(request: fastapi.Request) -> responses.APIHealthResponse:
18051805
version=sky.__version__,
18061806
version_on_disk=common.get_skypilot_version_on_disk(),
18071807
commit=sky.__commit__,
1808+
# Whether basic auth on api server is enabled
18081809
basic_auth_enabled=os.environ.get(constants.ENV_VAR_ENABLE_BASIC_AUTH,
18091810
'false').lower() == 'true',
18101811
user=user if user is not None else None,
1812+
# Whether service account token is enabled
18111813
service_account_token_enabled=(os.environ.get(
18121814
constants.ENV_VAR_ENABLE_SERVICE_ACCOUNTS,
18131815
'false').lower() == 'true'),
1816+
# Whether basic auth on ingress is enabled
1817+
ingress_basic_auth_enabled=os.environ.get(
1818+
constants.SKYPILOT_INGRESS_BASIC_AUTH_ENABLED,
1819+
'false').lower() == 'true',
18141820
)
18151821

18161822

sky/skylet/constants.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -474,6 +474,7 @@
474474
# authentication is enabled in the API server.
475475
ENV_VAR_ENABLE_BASIC_AUTH = 'ENABLE_BASIC_AUTH'
476476
SKYPILOT_INITIAL_BASIC_AUTH = 'SKYPILOT_INITIAL_BASIC_AUTH'
477+
SKYPILOT_INGRESS_BASIC_AUTH_ENABLED = 'SKYPILOT_INGRESS_BASIC_AUTH_ENABLED'
477478
ENV_VAR_ENABLE_SERVICE_ACCOUNTS = 'ENABLE_SERVICE_ACCOUNTS'
478479

479480
# Enable debug logging for requests.

0 commit comments

Comments
 (0)