Skip to content

Commit cc8560a

Browse files
fix: default cluster tier settings & default team networkPolicy egress setting (#678)
Co-authored-by: svcAPLBot <[email protected]>
1 parent 980c5dc commit cc8560a

File tree

4 files changed

+25
-4
lines changed

4 files changed

+25
-4
lines changed

src/components/Setting.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ export const getSettingUiSchema = (settings: GetSettingsInfoApiResponse, setting
6161
cluster: {
6262
k8sContext: { 'ui:widget': 'hidden' },
6363
defaultStorageClass: { 'ui:widget': 'hidden' },
64+
linode: { 'ui:widget': 'hidden' },
6465
},
6566
otomi: {
6667
isMultitenant: { 'ui:widget': 'hidden' },

src/pages/teams/create-edit/TeamsCreateEditPage.tsx

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export default function TeamsCreateEditPage({
4141
},
4242
}: RouteComponentProps<Params>) {
4343
const { classes } = useStyles()
44-
const { appsEnabled, user } = useSession()
44+
const { appsEnabled, user, settings } = useSession()
4545
const { themeView } = useSettings()
4646
const { isPlatformAdmin } = user
4747
const [create, { isLoading: isLoadingCreate, isSuccess: isSuccessCreate }] = useCreateTeamMutation()
@@ -66,8 +66,18 @@ export default function TeamsCreateEditPage({
6666
// imgSrc: '/logos/email_logo.svg',
6767
// },
6868
]
69+
const tier = settings?.cluster?.linode?.tier || 'standard'
6970

70-
const mergedDefaultValues = createTeamApiResponseSchema.cast(data)
71+
const mergedDefaultValues = createTeamApiResponseSchema.cast({
72+
...data,
73+
...(!teamId && {
74+
networkPolicy: {
75+
...data?.networkPolicy,
76+
ingressPrivate: true,
77+
egressPublic: tier !== 'enterprise',
78+
},
79+
}),
80+
})
7181

7282
const methods = useForm<CreateTeamApiResponse>({
7383
disabled: !isPlatformAdmin,
@@ -133,6 +143,7 @@ export default function TeamsCreateEditPage({
133143
const rawReceivers = submitData.alerts?.receivers ?? []
134144
let receivers = rawReceivers.filter((r) => r !== 'none')
135145

146+
// @ts-ignore: no receivers requires 'none' string
136147
if (submitData.managedMonitoring?.alertmanager && receivers.length === 0) receivers = ['none']
137148

138149
// 3) Combine edge cases with submittedData for final payload

src/pages/teams/create-edit/create-edit-teams.validator.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,8 @@ export const createTeamApiResponseSchema = yup.object({
8383
]),
8484
networkPolicy: yup
8585
.object({
86-
ingressPrivate: yup.boolean().optional().default(true),
87-
egressPublic: yup.boolean().optional().default(true),
86+
ingressPrivate: yup.boolean().optional(),
87+
egressPublic: yup.boolean().optional(),
8888
})
8989
.optional(),
9090
selfService: selfServiceSchema.optional(),

src/redux/otomiApi.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5658,6 +5658,9 @@ export type GetSettingsInfoApiResponse = /** status 200 The request is successfu
56585658
domainSuffix?: string
56595659
apiServer?: string
56605660
provider?: 'linode' | 'custom'
5661+
linode?: {
5662+
tier?: 'standard' | 'enterprise'
5663+
}
56615664
}
56625665
dns?: {
56635666
zones?: string[]
@@ -5732,6 +5735,9 @@ export type GetSettingsApiResponse = /** status 200 The request is successful. *
57325735
k8sContext?: string
57335736
owner?: string
57345737
provider: 'linode' | 'custom'
5738+
linode?: {
5739+
tier?: 'standard' | 'enterprise'
5740+
}
57355741
defaultStorageClass?: string
57365742
}
57375743
platformBackups?: {
@@ -5998,6 +6004,9 @@ export type EditSettingsApiArg = {
59986004
k8sContext?: string
59996005
owner?: string
60006006
provider: 'linode' | 'custom'
6007+
linode?: {
6008+
tier?: 'standard' | 'enterprise'
6009+
}
60016010
defaultStorageClass?: string
60026011
}
60036012
platformBackups?: {

0 commit comments

Comments
 (0)