Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

K8s client app develop #5889

Open
wants to merge 49 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
d89b2d2
k8s client app first commit
kripanshdevtron Jan 22, 2023
56db1aa
cluster repo file based commit
kripanshdevtron Jan 23, 2023
e2a0061
user and userAuth Service
kripanshdevtron Jan 23, 2023
cf7c2a6
mux handler passed
kripanshdevtron Jan 23, 2023
c0e0912
cluster data fixes
kripanshdevtron Jan 23, 2023
0b4ce2e
code refactoring
kripanshdevtron Jan 23, 2023
2b368ff
cluster terminal in k8s client + refactoring
kripanshdevtron Jan 23, 2023
3598778
kubeconfig file syncer + open port server handling
kripanshdevtron Jan 24, 2023
ab26bd3
logging file based and rotatory
kripanshdevtron Jan 24, 2023
624ee97
k8s client install script and port save handling
kripanshdevtron Jan 24, 2023
8b3a09a
install script updated
kripanshdevtron Jan 25, 2023
340c82e
Merge branch 'main' into k8s-client-app
kripanshdevtron Jan 27, 2023
a27e8d1
telemetry event handling
kripanshdevtron Jan 31, 2023
9dbc1fb
Merge branch 'main' into k8s-client-app
kripanshdevtron Feb 2, 2023
5ef3ad9
default templates coding refactoring
kripanshdevtron Feb 5, 2023
3973b24
fatal error on folder create
kripanshdevtron Feb 5, 2023
cc04c27
contexts incorporation
kripanshdevtron Feb 5, 2023
7720c51
Merge branch 'main' into k8s-client-app
kripanshdevtron Feb 9, 2023
86dc88f
wire gen
kripanshdevtron Feb 9, 2023
3438313
url updated for security
kripanshdevtron Feb 9, 2023
af2db21
removed code smells
kripanshdevtron Feb 9, 2023
3520589
default templates path fix
kripanshdevtron Feb 9, 2023
5b31036
app upgrade handling
kripanshdevtron Feb 12, 2023
a78dc06
Merge branch 'main' into k8s-client-app
kripanshdevtron Feb 12, 2023
a692795
readme init commit
kripanshdevtron Feb 13, 2023
21ef853
terminal access templates fix
kripanshdevtron Feb 14, 2023
b917365
Merge branch 'main' into k8s-client-app
kripanshdevtron Mar 21, 2023
d1f4ecd
Merge branch 'main' into k8s-client-app-revised
kripanshdevtron Sep 10, 2024
35e0c7d
noop user service fix
kripanshdevtron Sep 10, 2024
78f26f5
fixes done
kripanshdevtron Sep 13, 2024
74d03d0
file based generic note history service
kripanshdevtron Sep 13, 2024
2014a14
final commit
kripanshdevtron Sep 16, 2024
dd1396a
db migrator and sqlite connection handling added
kripanshdevtron Sep 18, 2024
b948f26
noop transaction wrapper
kripanshdevtron Sep 18, 2024
7b1615a
enforcer fix
kripanshdevtron Sep 18, 2024
61d6834
ephemeral container fixes
kripanshdevtron Sep 18, 2024
4f0658a
cluster metadata fix
kripanshdevtron Sep 20, 2024
c619e93
refactoring done
kripanshdevtron Sep 23, 2024
474d2fb
Merge branch 'main' into k8s-client-app-revised
kripanshdevtron Sep 23, 2024
d376b5b
main merge fixes
kripanshdevtron Sep 23, 2024
ee79a1b
Merge branch 'develop' into k8s-client-app-develop
kripanshdevtron Sep 23, 2024
9b30cd4
generated proto files
Ash-exp Sep 23, 2024
0b750da
fixes
kripanshdevtron Sep 23, 2024
8e047c4
Merge branch 'develop' into k8s-client-app-develop
kripanshdevtron Sep 23, 2024
0ead4bc
model removed
kripanshdevtron Sep 24, 2024
08d8e82
Merge branch 'develop' into k8s-client-app-develop
kripanshdevtron Sep 24, 2024
b3c9ded
insecure flag fix
kripanshdevtron Sep 24, 2024
6547580
node debug handling added
kripanshdevtron Sep 27, 2024
7dc1ddf
empty list handling
kripanshdevtron Sep 27, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@
.env
/cmd/external-app/devtron-ea
devtron
/cmd/k8s-client-app/ui/
/cmd/k8s-client-app/devtron-k8s-client-*
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ docker-build-push: docker-build-image

#############################################################################

build-all: build
make --directory ./cmd/external-app build
build-all: build build-ea
make --directory ./cmd/k8s-client-app build

build-ea:
make --directory ./cmd/external-app build
Expand Down
8 changes: 8 additions & 0 deletions api/argoApplication/wire_argoApplication.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,11 @@ var ArgoApplicationWireSet = wire.NewSet(
NewArgoApplicationRouterImpl,
wire.Bind(new(ArgoApplicationRouter), new(*ArgoApplicationRouterImpl)),
)

var ArgoApplicationWireSetForK8sApp = wire.NewSet(
read.NewNoopImpl,
wire.Bind(new(read.ArgoApplicationReadService), new(*read.ArgoApplicationReadServiceImpl)),

argoApplication.NewNoopImpl,
wire.Bind(new(argoApplication.ArgoApplicationService), new(*argoApplication.ArgoApplicationServiceImpl)),
)
3 changes: 3 additions & 0 deletions api/cluster/ClusterRestHandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,9 @@ func (impl ClusterRestHandlerImpl) FindAll(w http.ResponseWriter, r *http.Reques
}
}
//RBAC enforcer Ends
if len(result) == 0 {
result = make([]*cluster.ClusterBean, 0)
}

common.WriteJsonResp(w, err, result, http.StatusOK)
}
Expand Down
32 changes: 32 additions & 0 deletions api/cluster/wire_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,3 +99,35 @@ var ClusterWireSetEa = wire.NewSet(
NewEnvironmentRouterImpl,
wire.Bind(new(EnvironmentRouter), new(*EnvironmentRouterImpl)),
)

var ClusterWireSetK8sClient = wire.NewSet(
cluster.NewNoopServiceImpl,
wire.Bind(new(cluster.EnvironmentService), new(*cluster.EnvironmentServiceImpl)),
repository.NewClusterRepositoryFileBased,
wire.Bind(new(repository.ClusterRepository), new(*repository.ClusterFileBasedRepository)),
cluster.NewClusterRbacNoopServiceImpl,
wire.Bind(new(cluster.ClusterRbacService), new(*cluster.ClusterRbacNoopServiceImpl)),
repository.NewClusterDescriptionFileBasedRepository,
wire.Bind(new(repository.ClusterDescriptionRepository), new(*repository.ClusterDescriptionFileBasedRepositoryImpl)),
cluster.NewClusterDescriptionServiceImpl,
wire.Bind(new(cluster.ClusterDescriptionService), new(*cluster.ClusterDescriptionServiceImpl)),

repository2.NewGenericNoteHistoryFileBasedRepositoryImpl,
wire.Bind(new(repository2.GenericNoteHistoryRepository), new(*repository2.GenericNoteHistoryFileBasedRepositoryImpl)),
repository2.NewGenericNoteFileBasedRepository,
wire.Bind(new(repository2.GenericNoteRepository), new(*repository2.GenericNoteFileBasedRepositoryImpl)),
genericNotes.NewGenericNoteHistoryServiceImpl,
wire.Bind(new(genericNotes.GenericNoteHistoryService), new(*genericNotes.GenericNoteHistoryServiceImpl)),
genericNotes.NewGenericNoteServiceImpl,
wire.Bind(new(genericNotes.GenericNoteService), new(*genericNotes.GenericNoteServiceImpl)),


cluster.NewClusterServiceImpl,
wire.Bind(new(cluster.ClusterService), new(*cluster.ClusterServiceImpl)),
NewClusterRestHandlerImpl,
wire.Bind(new(ClusterRestHandler), new(*ClusterRestHandlerImpl)),
NewClusterRouterImpl,
wire.Bind(new(ClusterRouter), new(*ClusterRouterImpl)),
cluster.NewKubeConfigFileSyncerImpl,
wire.Bind(new(cluster.KubeConfigFileSyncer), new(*cluster.KubeConfigFileSyncerImpl)),
)
5 changes: 5 additions & 0 deletions api/fluxApplication/wire_fluxApplication.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,8 @@ var FluxApplicationWireSet = wire.NewSet(
NewFluxApplicationRouterImpl,
wire.Bind(new(FluxApplicationRouter), new(*FluxApplicationRouterImpl)),
)

var FluxApplicationWireSetForK8sApp = wire.NewSet(
fluxApplication.NewNoopImpl,
wire.Bind(new(fluxApplication.FluxApplicationService), new(*fluxApplication.FluxApplicationServiceImpl)),
)
4 changes: 4 additions & 0 deletions api/helm-app/service/HelmAppService.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,10 @@ type HelmAppServiceImpl struct {
helmReleaseConfig *HelmReleaseConfig
}

func NewNoopServiceImpl() *HelmAppServiceImpl {
return nil
}

func NewHelmAppServiceImpl(Logger *zap.SugaredLogger, clusterService cluster.ClusterService,
helmAppClient gRPC.HelmAppClient, pump connector.Pump, enforcerUtil rbac.EnforcerUtilHelm,
serverDataStore *serverDataStore.ServerDataStore, serverEnvConfig *serverEnvConfig.ServerEnvConfig,
Expand Down
2 changes: 1 addition & 1 deletion api/k8s/application/k8sApplicationRestHandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -973,7 +973,7 @@ func (handler *K8sApplicationRestHandlerImpl) getRbacCallbackForResource(token s
}

func (handler *K8sApplicationRestHandlerImpl) verifyRbacForResource(token string, clusterName string, resourceIdentifier util3.ResourceIdentifier, casbinAction string) bool {
resourceName, objectName := handler.enforcerUtil.GetRBACNameForClusterEntity(clusterName, resourceIdentifier)
resourceName, objectName := rbac.GetRBACNameForClusterEntity(clusterName, resourceIdentifier)
return handler.enforcer.Enforce(token, strings.ToLower(resourceName), casbinAction, objectName)
}

Expand Down
5 changes: 4 additions & 1 deletion api/k8s/capacity/k8sCapacityRestHandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ func (handler *K8sCapacityRestHandlerImpl) GetClusterListWithDetail(w http.Respo
authenticatedClusters = append(authenticatedClusters, cluster)
}
}
if len(authenticatedClusters) == 0 {
if len(authenticatedClusters) == 0 && len(clusters) != 0 {
common.WriteJsonResp(w, errors.New("unauthorized"), nil, http.StatusForbidden)
return
}
Expand All @@ -150,6 +150,9 @@ func (handler *K8sCapacityRestHandlerImpl) GetClusterListWithDetail(w http.Respo
common.WriteJsonResp(w, err, nil, http.StatusInternalServerError)
return
}
if len(clusterDetailList) == 0 {
clusterDetailList = make([]*bean.ClusterCapacityDetail, 0)
}
common.WriteJsonResp(w, nil, clusterDetailList, http.StatusOK)
}

Expand Down
26 changes: 26 additions & 0 deletions api/k8s/wire_k8sApp.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,29 @@ var K8sApplicationWireSet = wire.NewSet(
informer.NewK8sInformerFactoryImpl,
wire.Bind(new(informer.K8sInformerFactory), new(*informer.K8sInformerFactoryImpl)),
)

var K8sApplicationWireSetForK8sApp = wire.NewSet(
application2.NewK8sApplicationServiceImpl,
wire.Bind(new(application2.K8sApplicationService), new(*application2.K8sApplicationServiceImpl)),
k8s.NewK8sCommonServiceImpl,
wire.Bind(new(k8s.K8sCommonService), new(*k8s.K8sCommonServiceImpl)),
application.NewK8sApplicationRouterImpl,
wire.Bind(new(application.K8sApplicationRouter), new(*application.K8sApplicationRouterImpl)),
application.NewK8sApplicationRestHandlerImpl,
wire.Bind(new(application.K8sApplicationRestHandler), new(*application.K8sApplicationRestHandlerImpl)),
clusterRepository.NewEphemeralContainerFileBasedRepository,
wire.Bind(new(clusterRepository.EphemeralContainersRepository), new(*clusterRepository.EphemeralContainerFileBasedRepositoryImpl)),
cluster.NewEphemeralContainerServiceImpl,
wire.Bind(new(cluster.EphemeralContainerService), new(*cluster.EphemeralContainerServiceImpl)),
terminal.NewTerminalSessionHandlerImpl,
wire.Bind(new(terminal.TerminalSessionHandler), new(*terminal.TerminalSessionHandlerImpl)),
capacity.NewK8sCapacityRouterImpl,
wire.Bind(new(capacity.K8sCapacityRouter), new(*capacity.K8sCapacityRouterImpl)),
capacity.NewK8sCapacityRestHandlerImpl,
wire.Bind(new(capacity.K8sCapacityRestHandler), new(*capacity.K8sCapacityRestHandlerImpl)),
capacity2.NewK8sCapacityServiceImpl,
wire.Bind(new(capacity2.K8sCapacityService), new(*capacity2.K8sCapacityServiceImpl)),
informer.NewGlobalMapClusterNamespace,
informer.NewK8sInformerFactoryImpl,
wire.Bind(new(informer.K8sInformerFactory), new(*informer.K8sInformerFactoryImpl)),
)
18 changes: 14 additions & 4 deletions api/terminal/wire_terminal.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,29 @@
package terminal

import (
"github.com/devtron-labs/devtron/internal/sql/repository"
"github.com/devtron-labs/devtron/internal/sql/repository/terminal"
"github.com/devtron-labs/devtron/pkg/clusterTerminalAccess"
"github.com/google/wire"
)

var TerminalWireSet = wire.NewSet(
var terminalWireBaseSet = wire.NewSet(
NewUserTerminalAccessRouterImpl,
wire.Bind(new(UserTerminalAccessRouter), new(*UserTerminalAccessRouterImpl)),
NewUserTerminalAccessRestHandlerImpl,
wire.Bind(new(UserTerminalAccessRestHandler), new(*UserTerminalAccessRestHandlerImpl)),
clusterTerminalAccess.GetTerminalAccessConfig,
clusterTerminalAccess.NewUserTerminalAccessServiceImpl,
wire.Bind(new(clusterTerminalAccess.UserTerminalAccessService), new(*clusterTerminalAccess.UserTerminalAccessServiceImpl)),
repository.NewTerminalAccessRepositoryImpl,
wire.Bind(new(repository.TerminalAccessRepository), new(*repository.TerminalAccessRepositoryImpl)),
)

var TerminalWireSet = wire.NewSet(
terminalWireBaseSet,
terminal.NewTerminalAccessRepositoryImpl,
wire.Bind(new(terminal.TerminalAccessRepository), new(*terminal.TerminalAccessRepositoryImpl)),
)

var TerminalWireSetK8sClient = wire.NewSet(
terminalWireBaseSet,
terminal.NewTerminalAccessFileBasedRepository,
wire.Bind(new(terminal.TerminalAccessRepository), new(*terminal.TerminalAccessFileBasedRepository)),
)
Loading