diff --git a/charts/console/templates/deployment.yaml b/charts/console/templates/deployment.yaml
index 3c501107..87d1c256 100644
--- a/charts/console/templates/deployment.yaml
+++ b/charts/console/templates/deployment.yaml
@@ -44,10 +44,7 @@ spec:
- name: INSTALL_METHOD
value: {{ .Values.installMethod | default "helm" }}
- name: K1_ACCESS_TOKEN
- valueFrom:
- secretKeyRef:
- name: {{ .Values.existingSecret | default "kubefirst-initial-secrets" }}
- key: K1_ACCESS_TOKEN
+ value: feedkray
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
diff --git a/containers/header/index.tsx b/containers/header/index.tsx
index d9d68139..8b641bd9 100644
--- a/containers/header/index.tsx
+++ b/containers/header/index.tsx
@@ -1,6 +1,26 @@
-import React, { FunctionComponent } from 'react';
+import React, { FunctionComponent, useEffect } from 'react';
+
+import { setSelectedCluster } from '../../redux/slices/cluster.slice';
+import { getClusters } from '../../redux/thunks/api.thunk';
+import { useAppDispatch, useAppSelector } from '../../redux/store';
import { Container } from './header.styled';
-const Header: FunctionComponent = () => ;
+const Header: FunctionComponent = () => {
+ const dispatch = useAppDispatch();
+ const { managementCluster } = useAppSelector(({ api }) => api);
+
+ useEffect(() => {
+ dispatch(getClusters());
+ }, [dispatch]);
+
+ useEffect(() => {
+ if (managementCluster && managementCluster.id) {
+ dispatch(setSelectedCluster(managementCluster));
+ }
+ }, [dispatch, managementCluster]);
+
+ return ;
+};
+
export default Header;
diff --git a/next.config.js b/next.config.js
index 9a5b36db..942a8892 100644
--- a/next.config.js
+++ b/next.config.js
@@ -16,7 +16,7 @@ const nextConfig = {
dangerouslyAllowSVG: true,
contentSecurityPolicy: "default-src 'self'; script-src 'none'; sandbox;",
remotePatterns: [],
- unoptimized: false,
+ unoptimized: true,
remotePatterns: [
{
protocol: 'https',
diff --git a/pages/index.tsx b/pages/index.tsx
index 3de92bcd..e0103f46 100644
--- a/pages/index.tsx
+++ b/pages/index.tsx
@@ -1,5 +1,36 @@
-import Provision from './provision';
+import React, { FunctionComponent, useEffect } from 'react';
+import { useRouter } from 'next/router';
+import { useAppDispatch, useAppSelector } from '../redux/store';
+import { getClusters } from '../redux/thunks/api.thunk';
+import withConfig from '../hoc/withConfig';
+import { setSelectedCluster } from '../redux/slices/cluster.slice';
export { getServerSideProps } from '../hoc/withConfig';
-export default Provision;
+const MainPage: FunctionComponent = () => {
+ const dispatch = useAppDispatch();
+ const { push } = useRouter();
+
+ const { managementCluster } = useAppSelector(({ api }) => api);
+
+ useEffect(() => {
+ dispatch(getClusters())
+ .unwrap()
+ .then(() => {
+ push('/services');
+ })
+ .catch(() => {
+ push('/provision');
+ });
+ }, [dispatch, push]);
+
+ useEffect(() => {
+ if (managementCluster && managementCluster.id) {
+ dispatch(setSelectedCluster(managementCluster));
+ }
+ }, [dispatch, managementCluster]);
+
+ return null;
+};
+
+export default withConfig(MainPage);
diff --git a/redux/thunks/api.thunk.ts b/redux/thunks/api.thunk.ts
index ce8cec95..b2928750 100644
--- a/redux/thunks/api.thunk.ts
+++ b/redux/thunks/api.thunk.ts
@@ -156,6 +156,10 @@ export const getClusters = createAsyncThunk<
throw res.error;
}
+ if (!res.data && !res.data[0]) {
+ throw new Error('No clusters found');
+ }
+
// only process single expected management cluster
return mapClusterFromRaw(res.data[0]);
});