feat: add volcengine alb deployer

This commit is contained in:
Fu Diwei
2025-03-23 21:29:03 +08:00
parent 12102ef641
commit 74b431481d
16 changed files with 681 additions and 6 deletions

View File

@@ -10,7 +10,6 @@ type DeployNodeConfigFormVolcEngineCLBConfigFieldValues = Nullish<{
region: string;
loadbalancerId?: string;
listenerId?: string;
domain?: string;
}>;
export type DeployNodeConfigFormVolcEngineCLBConfigProps = {
@@ -21,6 +20,7 @@ export type DeployNodeConfigFormVolcEngineCLBConfigProps = {
onValuesChange?: (values: DeployNodeConfigFormVolcEngineCLBConfigFieldValues) => void;
};
const RESOURCE_TYPE_LOADBALANCER = "loadbalancer" as const;
const RESOURCE_TYPE_LISTENER = "listener" as const;
const initFormModel = (): DeployNodeConfigFormVolcEngineCLBConfigFieldValues => {
@@ -39,11 +39,22 @@ const DeployNodeConfigFormVolcEngineCLBConfig = ({
const { t } = useTranslation();
const formSchema = z.object({
resourceType: z.literal(RESOURCE_TYPE_LISTENER, { message: t("workflow_node.deploy.form.volcengine_clb_resource_type.placeholder") }),
resourceType: z.union([z.literal(RESOURCE_TYPE_LOADBALANCER), z.literal(RESOURCE_TYPE_LISTENER)], {
message: t("workflow_node.deploy.form.volcengine_clb_resource_type.placeholder"),
}),
region: z
.string({ message: t("workflow_node.deploy.form.volcengine_clb_region.placeholder") })
.nonempty(t("workflow_node.deploy.form.volcengine_clb_region.placeholder"))
.trim(),
loadbalancerId: z
.string()
.max(64, t("common.errmsg.string_max", { max: 64 }))
.trim()
.nullish()
.refine(
(v) => ![RESOURCE_TYPE_LOADBALANCER].includes(fieldResourceType) || !!v?.trim(),
t("workflow_node.deploy.form.volcengine_clb_loadbalancer_id.placeholder")
),
listenerId: z
.string()
.max(64, t("common.errmsg.string_max", { max: 64 }))
@@ -73,6 +84,9 @@ const DeployNodeConfigFormVolcEngineCLBConfig = ({
>
<Form.Item name="resourceType" label={t("workflow_node.deploy.form.volcengine_clb_resource_type.label")} rules={[formRule]}>
<Select placeholder={t("workflow_node.deploy.form.volcengine_clb_resource_type.placeholder")}>
<Select.Option key={RESOURCE_TYPE_LOADBALANCER} value={RESOURCE_TYPE_LOADBALANCER}>
{t("workflow_node.deploy.form.volcengine_clb_resource_type.option.loadbalancer.label")}
</Select.Option>
<Select.Option key={RESOURCE_TYPE_LISTENER} value={RESOURCE_TYPE_LISTENER}>
{t("workflow_node.deploy.form.volcengine_clb_resource_type.option.listener.label")}
</Select.Option>
@@ -88,6 +102,17 @@ const DeployNodeConfigFormVolcEngineCLBConfig = ({
<Input placeholder={t("workflow_node.deploy.form.volcengine_clb_region.placeholder")} />
</Form.Item>
<Show when={fieldResourceType === RESOURCE_TYPE_LOADBALANCER}>
<Form.Item
name="listenerId"
label={t("workflow_node.deploy.form.volcengine_clb_loadbalancer_id.label")}
rules={[formRule]}
tooltip={<span dangerouslySetInnerHTML={{ __html: t("workflow_node.deploy.form.volcengine_clb_loadbalancer_id.tooltip") }}></span>}
>
<Input placeholder={t("workflow_node.deploy.form.volcengine_clb_loadbalancer_id.placeholder")} />
</Form.Item>
</Show>
<Show when={fieldResourceType === RESOURCE_TYPE_LISTENER}>
<Form.Item
name="listenerId"