@@ -10,7 +10,8 @@ import (
10
10
)
11
11
12
12
type AnalysisScheduler interface {
13
- AnalyzeOnClusterStateChange (clusterStateChannel <- chan types.ClusterState , resultsChannel chan <- types.AnalysisResult )
13
+ AnalyzeOnClusterStateChange (clusterStateChannel <- chan types.ClusterState ,
14
+ resultsChannel chan <- types.AnalysisResult )
14
15
}
15
16
16
17
type analysisSchedulerImpl struct {
@@ -39,20 +40,45 @@ func (analysisScheduler analysisSchedulerImpl) AnalyzeOnClusterStateChange(
39
40
40
41
func (analysisScheduler analysisSchedulerImpl ) analyze (clusterState types.ClusterState ) types.AnalysisResult {
41
42
start := time .Now ()
42
- pods := analysisScheduler .podAnalyzer .Analyze (clusterState .Pods )
43
- podIsolations , allowedRoutes := analysisScheduler .trafficAnalyzer .Analyze (clusterState .Pods ,
44
- clusterState .Namespaces , clusterState .NetworkPolicies )
45
- services , replicaSets , deployments := analysisScheduler .workloadAnalyzer .Analyze (clusterState .Pods ,
46
- clusterState .Services , clusterState .ReplicaSets , clusterState .Deployments )
43
+ podsResult := analysisScheduler .podAnalyzer .Analyze (pod.ClusterState {
44
+ Pods : clusterState .Pods ,
45
+ })
46
+ trafficResult := analysisScheduler .trafficAnalyzer .Analyze (traffic.ClusterState {
47
+ Pods : clusterState .Pods ,
48
+ Namespaces : clusterState .Namespaces ,
49
+ NetworkPolicies : clusterState .NetworkPolicies ,
50
+ })
51
+ workloadResult := analysisScheduler .workloadAnalyzer .Analyze (workload.ClusterState {
52
+ Pods : clusterState .Pods ,
53
+ Services : clusterState .Services ,
54
+ Ingresses : clusterState .Ingresses ,
55
+ ReplicaSets : clusterState .ReplicaSets ,
56
+ StatefulSets : clusterState .StatefulSets ,
57
+ DaemonSets : clusterState .DaemonSets ,
58
+ Deployments : clusterState .Deployments ,
59
+ })
60
+ pods := podsResult .Pods
61
+ podIsolations := trafficResult .Pods
62
+ allowedRoutes := trafficResult .AllowedRoutes
63
+ services := workloadResult .Services
64
+ ingresses := workloadResult .Ingresses
65
+ replicaSets := workloadResult .ReplicaSets
66
+ statefulSets := workloadResult .StatefulSets
67
+ daemonSets := workloadResult .DaemonSets
68
+ deployments := workloadResult .Deployments
47
69
elapsed := time .Since (start )
48
- log .Printf ("Finished analysis in %s, found: %d pods, %d allowed routes, %d services, %d replicaSets and " +
49
- "%d deployments\n " , elapsed , len (pods ), len (allowedRoutes ), len (services ), len (replicaSets ), len (deployments ))
70
+ log .Printf ("Finished analysis in %s, found: %d pods, %d allowed routes, %d services, %d ingresses, " +
71
+ "%d replicaSets, %d statefulSets, %d daemonSets and %d deployments\n " , elapsed , len (pods ), len (allowedRoutes ),
72
+ len (services ), len (ingresses ), len (replicaSets ), len (statefulSets ), len (daemonSets ), len (deployments ))
50
73
return types.AnalysisResult {
51
74
Pods : pods ,
52
75
PodIsolations : podIsolations ,
53
76
AllowedRoutes : allowedRoutes ,
54
77
Services : services ,
78
+ Ingresses : ingresses ,
55
79
ReplicaSets : replicaSets ,
80
+ StatefulSets : statefulSets ,
81
+ DaemonSets : daemonSets ,
56
82
Deployments : deployments ,
57
83
}
58
84
}
0 commit comments