Skip to content
This repository has been archived by the owner on Jul 1, 2022. It is now read-only.

Commit

Permalink
Merge pull request #43 from fluxcd/jp-cleanup
Browse files Browse the repository at this point in the history
Remove workloads, reorganize hooks, fix missing namespace bug, add initial UI tests
  • Loading branch information
jpellizzari committed May 19, 2021
2 parents 3f4b35f + 8f2010c commit 0ce609e
Show file tree
Hide file tree
Showing 43 changed files with 13,108 additions and 6,690 deletions.
1 change: 1 addition & 0 deletions .github/workflows/main.yaml
Expand Up @@ -47,6 +47,7 @@ jobs:
- run: npm ci
- run: npm run build
- run: npm run lint
- run: npm test
- run: go mod download
- run: make test
env:
Expand Down
Empty file removed .uptodate
Empty file.
16,594 changes: 11,552 additions & 5,042 deletions package-lock.json

Large diffs are not rendered by default.

35 changes: 27 additions & 8 deletions package.json
Expand Up @@ -9,25 +9,44 @@
"build": "parcel build --no-source-maps ui/index.html",
"start": "nodemon dev-server.js --watch dev-server.js",
"lint": "eslint ui",
"test": "jest"
"test": "jest",
"watch": "jest --runInBand --watch"
},
"jest": {
"preset": "ts-jest"
},
"dependencies": {
"@material-ui/core": "^4.11.2",
"@babel/preset-env": "^7.13.8",
"@babel/preset-react": "^7.13.13",
"@babel/preset-typescript": "^7.13.0",
"@material-ui/core": "^4.11.4",
"@material-ui/icons": "^4.11.2",
"@material-ui/lab": "^4.0.0-alpha.58",
"@testing-library/jest-dom": "^5.12.0",
"@testing-library/react": "^11.2.7",
"@testing-library/react-hooks": "^6.0.0",
"@types/jest": "^26.0.23",
"@types/lodash": "^4.14.165",
"@types/react": "^17.0.6",
"@types/react-dom": "^17.0.5",
"@types/react-router": "^5.1.8",
"@types/react-router-dom": "^5.1.6",
"@types/styled-components": "^5.1.4",
"babel-jest": "^26.6.3",
"d3": "^6.6.0",
"dagre": "^0.8.5",
"dagre-d3": "^0.6.4",
"lodash": "^4.17.20",
"jest": "^26.6.3",
"jest-styled-components": "^7.0.4",
"lodash": "^4.17.21",
"query-string": "^6.13.7",
"react": "^17.0.1",
"react-dom": "^17.0.1",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-router-dom": "^5.2.0",
"react-test-renderer": "^17.0.2",
"react-toastify": "^7.0.3",
"styled-components": "^5.2.1"
"styled-components": "^5.2.1",
"ts-jest": "^26.5.6"
},
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^4.16.1",
Expand All @@ -38,8 +57,8 @@
"http-proxy": "^1.18.1",
"morgan": "^1.10.0",
"nodemon": "^2.0.6",
"parcel": "^1.12.4",
"parcel-bundler": "^1.12.4",
"parcel": "1.12.3",
"parcel-bundler": "1.12.3",
"prettier": "^2.2.1",
"typescript": "^4.1.2"
}
Expand Down
44 changes: 0 additions & 44 deletions pkg/clustersserver/clustersserver.go
Expand Up @@ -14,7 +14,6 @@ import (
sourcev1 "github.com/fluxcd/source-controller/api/v1beta1"
pb "github.com/fluxcd/webui/pkg/rpc/clusters"
"github.com/fluxcd/webui/pkg/util"
appsv1 "k8s.io/api/apps/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/types"
Expand Down Expand Up @@ -537,49 +536,6 @@ func (s *Server) SyncHelmRelease(ctx context.Context, msg *pb.SyncHelmReleaseReq
const KustomizationNameLabelKey string = "kustomize.toolkit.fluxcd.io/name"
const KustomizationNamespaceLabelKey string = "kustomize.toolkit.fluxcd.io/namespace"

func (s *Server) ListWorkloads(ctx context.Context, msg *pb.ListWorkloadsReq) (*pb.ListWorkloadsRes, error) {
c, err := s.getClient(msg.ContextName)

if err != nil {
return nil, fmt.Errorf("could not create client: %w", err)
}

deployments := appsv1.DeploymentList{}

if err := c.List(ctx, &deployments, namespaceOpts(msg.Namespace)); err != nil {
return nil, fmt.Errorf("could not get kustomization: %w", err)
}

workloads := []*pb.Workload{}

for _, dep := range deployments.Items {
kustomizationRefName := dep.Labels[KustomizationNameLabelKey]
kustomizationRefNamespace := dep.Labels[KustomizationNamespaceLabelKey]

wl := pb.Workload{
Name: dep.Name,
Namespace: dep.Namespace,
KustomizationRefName: kustomizationRefName,
KustomizationRefNamespace: kustomizationRefNamespace,
PodTemplate: &pb.PodTemplate{
Containers: []*pb.Container{},
},
}

for _, c := range dep.Spec.Template.Spec.Containers {
wl.PodTemplate.Containers = append(wl.PodTemplate.Containers, &pb.Container{
Name: c.Name,
Image: c.Image,
})
}

workloads = append(workloads, &wl)
}

return &pb.ListWorkloadsRes{Workloads: workloads}, nil

}

func (s *Server) ListEvents(ctx context.Context, msg *pb.ListEventsReq) (*pb.ListEventsRes, error) {
c, err := s.getClient(msg.ContextName)

Expand Down
64 changes: 29 additions & 35 deletions pkg/rpc/clusters/clusters.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion pkg/rpc/clusters/clusters.proto
Expand Up @@ -10,7 +10,6 @@ service Clusters {
rpc ListSources (ListSourcesReq) returns (ListSourcesRes);
rpc SyncKustomization (SyncKustomizationReq) returns (SyncKustomizationRes);
rpc ListHelmReleases (ListHelmReleasesReq) returns (ListHelmReleasesRes);
rpc ListWorkloads (ListWorkloadsReq) returns (ListWorkloadsRes);
rpc ListEvents (ListEventsReq) returns (ListEventsRes);
rpc SyncSource (SyncSourceReq) returns (SyncSourceRes);
rpc SyncHelmRelease (SyncHelmReleaseReq) returns (SyncHelmReleaseRes);
Expand Down

0 comments on commit 0ce609e

Please sign in to comment.