Skip to content

Commit

Permalink
feat: sealosDomain->ingressDomain
Browse files Browse the repository at this point in the history
  • Loading branch information
mlhiter committed Oct 21, 2024
1 parent 3c5e3a5 commit 84b8a75
Show file tree
Hide file tree
Showing 9 changed files with 29 additions and 14 deletions.
2 changes: 2 additions & 0 deletions frontend/providers/devbox/.vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@
"runtimes",
"sailos",
"sealos",
"sealosbja",
"sealosusw",
"SSHDOMAIN",
"statefulset",
"svgr",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@ import { MySelect, MySlider, Tabs, useMessage } from '@sealos/ui'

import {
INSTALL_ACCOUNT,
SEALOS_DOMAIN,
frameworkTypeList,
frameworkVersionMap,
languageTypeList,
languageVersionMap,
osTypeList,
osVersionMap,
getRuntimeVersionList
getRuntimeVersionList,
INGRESS_DOMAIN
} from '@/stores/static'
import { useRouter } from '@/i18n'
import MyIcon from '@/components/Icon'
Expand Down Expand Up @@ -767,7 +767,7 @@ const Form = ({
<Box flex={1} userSelect={'all'} className="textEllipsis">
{network.customDomain
? network.customDomain
: `${network.publicDomain}.${SEALOS_DOMAIN}`}
: `${network.publicDomain}.${INGRESS_DOMAIN}`}
</Box>
<Box
fontSize={'11px'}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { DevboxVersionListItemType } from '@/types/devbox'
import ReleaseModal from '@/components/modals/releaseModal'
import { delDevboxVersionByName, getSSHRuntimeInfo } from '@/api/devbox'
import EditVersionDesModal from '@/components/modals/EditVersionDesModal'
import { NAMESPACE, REGISTRY_ADDR, SEALOS_DOMAIN } from '@/stores/static'
import { NAMESPACE, REGISTRY_ADDR, INGRESS_DOMAIN } from '@/stores/static'
import { DevboxReleaseStatusEnum } from '@/constants/devbox'
import { useConfirm } from '@/hooks/useConfirm'

Expand Down Expand Up @@ -53,7 +53,7 @@ const Version = () => {
port: network.port,
protocol: network.protocol,
openPublicDomain: network.openPublicDomain,
domain: SEALOS_DOMAIN
domain: INGRESS_DOMAIN
}
})

Expand All @@ -70,7 +70,7 @@ const Version = () => {
port: 80,
protocol: 'http',
openPublicDomain: false,
domain: SEALOS_DOMAIN
domain: INGRESS_DOMAIN
}
],
runCMD: releaseCommand,
Expand Down
4 changes: 2 additions & 2 deletions frontend/providers/devbox/app/api/createDevbox/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ export async function POST(req: NextRequest) {
kubeconfig: await authSession(headerList)
})

const { SEALOS_DOMAIN, INGRESS_SECRET, DEVBOX_AFFINITY_ENABLE, SQUASH_ENABLE } = process.env
const { INGRESS_DOMAIN, INGRESS_SECRET, DEVBOX_AFFINITY_ENABLE, SQUASH_ENABLE } = process.env
const devbox = json2Devbox(
devboxForm,
runtimeNamespaceMap,
DEVBOX_AFFINITY_ENABLE,
SQUASH_ENABLE
)
const service = json2Service(devboxForm)
const ingress = json2Ingress(devboxForm, SEALOS_DOMAIN as string, INGRESS_SECRET as string)
const ingress = json2Ingress(devboxForm, INGRESS_DOMAIN as string, INGRESS_SECRET as string)

await applyYamlList([devbox, service, ingress], 'create')

Expand Down
2 changes: 2 additions & 0 deletions frontend/providers/devbox/app/api/getEnv/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export type SystemEnvResponse = {
registryAddr: string
devboxAffinityEnable: string
squashEnable: string
ingressDomain: string
}

export const dynamic = 'force-dynamic'
Expand All @@ -15,6 +16,7 @@ export async function GET() {
data: {
domain: process.env.SEALOS_DOMAIN || 'dev.sealos.plus',
ingressSecret: process.env.INGRESS_SECRET || 'wildcard-cert',
ingressDomain: process.env.INGRESS_DOMAIN || 'sealosusw.site',
registryAddr: process.env.REGISTRY_ADDR || 'hub.dev.sealos.plus',
devboxAffinityEnable: process.env.DEVBOX_AFFINITY_ENABLE || 'true',
squashEnable: process.env.SQUASH_ENABLE || 'true'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { InfoOutlineIcon } from '@chakra-ui/icons'

import { postAuthCname } from '@/api/platform'
import { useRequest } from '@/hooks/useRequest'
import { SEALOS_DOMAIN } from '@/stores/static'
import { INGRESS_DOMAIN } from '@/stores/static'

export type CustomAccessModalParams = {
publicDomain: string
Expand All @@ -42,7 +42,7 @@ const CustomAccessModal = ({
mb: 2
}

const completePublicDomain = useMemo(() => `${publicDomain}.${SEALOS_DOMAIN}`, [publicDomain])
const completePublicDomain = useMemo(() => `${publicDomain}.${INGRESS_DOMAIN}`, [publicDomain])

const { mutate: authCNAME, isLoading } = useRequest({
mutationFn: async () => {
Expand Down
2 changes: 2 additions & 0 deletions frontend/providers/devbox/deploy/manifests/deploy.yaml.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ spec:
value: http://launchpad-monitor.sealos.svc.cluster.local:8428
- name: SQUASH_ENABLE
value: 'true'
- name: INGRESS_DOMAIN
value: sealosusw.site
securityContext:
runAsNonRoot: true
runAsUser: 1001
Expand Down
11 changes: 10 additions & 1 deletion frontend/providers/devbox/stores/static.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export let INGRESS_SECRET = 'wildcard-cert'
export let REGISTRY_ADDR = 'hub.dev.sealos.plus'
export let DEVBOX_AFFINITY_ENABLE = 'true'
export let SQUASH_ENABLE = 'false'
export let INGRESS_DOMAIN = 'sealosusw.site'

export const runtimeNamespace = 'devbox-system'

Expand Down Expand Up @@ -145,12 +146,20 @@ export const getRuntime = async () => {
export const getEnv = async () => {
try {
const res = await getAppEnv()
const { domain, ingressSecret, registryAddr, devboxAffinityEnable, squashEnable } = res
const {
domain,
ingressSecret,
registryAddr,
devboxAffinityEnable,
squashEnable,
ingressDomain
} = res
SEALOS_DOMAIN = domain
INGRESS_SECRET = ingressSecret
REGISTRY_ADDR = registryAddr
DEVBOX_AFFINITY_ENABLE = devboxAffinityEnable
SQUASH_ENABLE = squashEnable
INGRESS_DOMAIN = ingressDomain
} catch (err) {
retryGetEnv--
if (retryGetEnv >= 0) {
Expand Down
6 changes: 3 additions & 3 deletions frontend/providers/devbox/utils/json2Yaml.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import yaml from 'js-yaml'

import {
INGRESS_SECRET,
SEALOS_DOMAIN,
INGRESS_DOMAIN,
runtimeNamespaceMap as defaultRuntimeNamespaceMap
} from '@/stores/static'
import { str2Num } from './tools'
Expand Down Expand Up @@ -125,7 +125,7 @@ export const json2DevboxRelease = (data: {

export const json2Ingress = (
data: DevboxEditType,
sealosDomain: string = SEALOS_DOMAIN,
ingressDomain: string = INGRESS_DOMAIN,
ingressSecret: string = INGRESS_SECRET
) => {
// different protocol annotations
Expand Down Expand Up @@ -156,7 +156,7 @@ export const json2Ingress = (
.map((network, i) => {
const host = network.customDomain
? network.customDomain
: `${network.publicDomain}.${sealosDomain}`
: `${network.publicDomain}.${ingressDomain}`

const secretName = network.customDomain ? network.networkName : ingressSecret

Expand Down

0 comments on commit 84b8a75

Please sign in to comment.