Skip to content

Commit

Permalink
feat:template deploy add template-static (#4457)
Browse files Browse the repository at this point in the history
Signed-off-by: jingyang <[email protected]>
  • Loading branch information
zjy365 authored Jan 3, 2024
1 parent 3c3563b commit 16b92b8
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 17 deletions.
51 changes: 50 additions & 1 deletion frontend/providers/template/deploy/manifests/deploy.yaml.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -83,4 +83,53 @@ spec:
protocol: TCP
targetPort: 3000
selector:
app: template-frontend
app: template-frontend
---
apiVersion: batch/v1
kind: CronJob
metadata:
namespace: template-frontend
name: template-static
spec:
schedule: "0 0 * * *"
jobTemplate:
spec:
template:
spec:
serviceAccountName: default
containers:
- name: template-static
image: bitnami/kubectl:latest
command:
- /bin/sh
- -c
- >
echo "$(kubectl get instances -A -o=jsonpath='{range .items[*]}{.spec.title}{"\n"}{end}' | tr a-z A-Z | sort | uniq -c | sort -nr | sed 's/ *//g')" > /tmp/install-count &&
kubectl create configmap -n template-frontend template-static --from-file=/tmp/install-count -o yaml --dry-run=client | kubectl apply -f -
imagePullPolicy: IfNotPresent
restartPolicy: OnFailure
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: template-frontend-static-role
rules:
- apiGroups: [""]
resources: ["configmaps"]
verbs: ["create", "get", "list", "watch", "update", "delete","patch"]
- apiGroups: ["app.sealos.io"]
resources: ["instances"]
verbs: ["get", "list", "watch"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: template-frontend-static-role-binding
subjects:
- kind: ServiceAccount
name: default
namespace: template-frontend
roleRef:
kind: ClusterRole
name: template-frontend-static-role
apiGroup: rbac.authorization.k8s.io
6 changes: 3 additions & 3 deletions frontend/providers/template/src/pages/app/components/list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,10 @@ export default function InstanceList() {
<Image src={item?.icon} alt="" width={'36px'} height={'36px'} />
</Box>
<Box ml="16px">
<Text fontSize="24px" fontWeight={600} color="#24282C">
<Text fontSize="16px" fontWeight={500} color="#000000">
{item?.displayName ? item.displayName : item?.id}
</Text>
<Text fontSize={'16px'} color={'#111824'} fontWeight={400}>
<Text fontSize={'12px'} color={'#485264'} fontWeight={500}>
{item?.id}
</Text>
</Box>
Expand All @@ -110,7 +110,7 @@ export default function InstanceList() {
fill="#485264"
/>
</Icon>
<Text fontSize={'12px'} color={'#5A646E'} fontWeight={400}>
<Text fontSize={'12px'} color={'#485264'} fontWeight={400}>
{t('Installation Time')}: {item?.createTime}
</Text>
</Flex>
Expand Down
15 changes: 2 additions & 13 deletions frontend/providers/template/src/pages/app/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,28 +21,17 @@ export default function MyApp() {
borderRadius={'12px'}
background={'linear-gradient(180deg, #FFF 0%, rgba(255, 255, 255, 0.70) 100%)'}
pt={'36px'}
pl="42px"
>
pl="42px">
<Tabs
fontWeight={500}
position="relative"
variant="unstyled"
index={tabIndex}
onChange={handleTabsChange}
>
onChange={handleTabsChange}>
<TabList>
<Tab p="0" mb="6px" color={tabIndex === 0 ? '#24282C' : '#7B838B'}>
{t('Installed')}
</Tab>
{/* <Tab
isDisabled
p="0"
mb="6px"
pb="10px"
ml="26px"
color={tabIndex === 0 ? '#7B838B' : '#24282C'}>
我收藏的
</Tab> */}
</TabList>
<TabIndicator mt="-1.5px" height="2px" bg="#24282C" borderRadius="1px" />
</Tabs>
Expand Down

0 comments on commit 16b92b8

Please sign in to comment.