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

chore: renaming gather files #768

Merged
merged 50 commits into from
Jun 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
edc0591
chore(clusterconfig): rename authentications to gather_authentication
Apr 17, 2023
63fdced
chore(clusterconfig): rename ceph_cluster to gather_cepth_cluster
Apr 17, 2023
3710e8e
chore(clusterconfig): rename certificate_signing_requests to gather_c…
Apr 17, 2023
da0b56e
chore(clusterconfig): rename config_maps to gather_config_maps
Apr 17, 2023
6ef92a5
chore(clusterconfig): rename container_images to gather_container_images
Apr 17, 2023
81e6af8
chore(clusterconfig): rename container_runtime_configs to gather_cont…
Apr 17, 2023
8260cd8
chore(clusterconfig): rename cost_management_metrics_configs to gathe…
Apr 17, 2023
e9c8235
chore(clusterconfig): rename custom_resource_definitions to gather_cu…
Apr 17, 2023
d6a0c18
chore(clusterconfig): rename dvo_metrics to gather_dvo_metrics
Apr 17, 2023
27b7916
chore(clusterconfig): rename feature_gates to gather_feature_gates
Apr 17, 2023
ed530f3
chore(clusterconfig): rename host_subnets to gather_host_subnets
Apr 17, 2023
7355ced
chore(clusterconfig): rename image to gather_cluster_image
Apr 17, 2023
82eab0e
chore(clusterconfig): rename image_pruners to gather_image_pruners
Apr 17, 2023
5f4badc
chore(clusterconfig): rename image_registries to gather_cluster_image…
Apr 17, 2023
63d949b
chore(clusterconfig): rename install_plans to gather_install_plans
Apr 17, 2023
afbbe8c
chore(clusterconfig): rename jaeger_cr to gather_jaeger_cr
Apr 17, 2023
7aadecb
chore(clusterconfig): rename machine_autoscalers to gather_machine_au…
Apr 17, 2023
87f5319
chore(clusterconfig): rename machine_config_pools to gather_machine_c…
Apr 17, 2023
35f440c
chore(clusterconfig): rename machine_configs to gather_machine_configs
Apr 17, 2023
6502f28
chore(clusterconfig): rename machine_healthchecks to gather_machine_h…
Apr 17, 2023
1e743f4
chore(clusterconfig): rename machine_sets to gather_machine_sets
Apr 17, 2023
ff384d3
chore(clusterconfig): rename machines to gather_machines
Apr 17, 2023
f282491
chore(clusterconfig): rename mutatingwebhookconfigurations to gather_…
Apr 17, 2023
b71e5b0
chore(clusterconfig): rename namespaces_with_overlapping_uids to gath…
Apr 17, 2023
dd0dcdc
chore(clusterconfig): rename netnamespace to gather_net_namespace
Apr 17, 2023
a7f8493
chore(clusterconfig): rename node_logs to gather_node_logs
Apr 17, 2023
e6477d3
chore(clusterconfig): rename olm_operators to gather_olm_operators
Apr 17, 2023
793a339
chore(clusterconfig): rename openshift_logging to gather_openshift_lo…
Apr 17, 2023
6316cfb
chore(clusterconfig): rename openshift_machine_api_events to gather_o…
Apr 17, 2023
f049b91
chore(clusterconfig): rename operators to gather_cluster_operators
Apr 17, 2023
67485fe
chore(clusterconfig): rename operators_pods_and_events to gather_clus…
Apr 17, 2023
933d2f7
chore(clusterconfig): rename pod_disruption_budgets to gather_pod_dis…
Apr 17, 2023
db27aaf
chore(clusterconfig): rename pod_network_connectivity_checks to gathe…
Apr 17, 2023
5ce319b
chore(clusterconfig): rename sap_config to gather_sap_config
Apr 17, 2023
61737ee
chore(clusterconfig): rename sap_datahubs to gather_sap_datahubs
Apr 17, 2023
fb8e6a6
chore(clusterconfig): rename sap_pods to gather_sap_pods
Apr 17, 2023
2f4ec00
chore(clusterconfig): rename scheduler to gather_schedulers
Apr 17, 2023
240f461
chore(clusterconfig): rename service_accounts to gather_service_accounts
Apr 17, 2023
1d52a7c
chore(clusterconfig): rename storage_cluster to gather_storage_cluster
Apr 17, 2023
720899d
chore(clusterconfig): rename support_secret to gather_support_secret
Apr 17, 2023
33f24a8
chore(clusterconfig): rename tsdb_status to gather_prometheus_tsdb_st…
Apr 17, 2023
7a3871e
chore(clusterconfig): rename validatingwebhookconfigurations to gathe…
Apr 17, 2023
d47e572
test(clusterconfig): adjusting method names
Apr 17, 2023
285f91c
chore(workloads): rename workload_info to gather_workload_info
Apr 17, 2023
fc75d52
docs(gathered-data): update gathered-data docs
Apr 17, 2023
c54d8e4
refactor: sort the gatherers for configcluster
May 15, 2023
4174040
test(clusterconfig): add tests for gather_cluster_feature_gates
Jun 16, 2023
dd76bbd
test(clusterconfig): add tests for gather_cluster_authentication
Jun 16, 2023
220b377
test(clusterconfig): adds unit test for gather_prometheus_tsdb_status
Jun 20, 2023
fd44e09
fix: adding lost gatherers on merge
Jun 27, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
110 changes: 55 additions & 55 deletions docs/gathered-data.md
Original file line number Diff line number Diff line change
Expand Up @@ -1501,35 +1501,6 @@ Collects logs from pods in `openshift-sdn` namespace with following substrings:
None


## PNCC

Collects a summary of failed `PodNetworkConnectivityChecks` from last 24 hours.

Time of the most recently failed check with each reason and message is recorded.

### API Reference
- podnetworkconnectivitychecks.controlplane.operator.openshift.io/v1alpha1
- https://pkg.go.dev/github.com/openshift/api/operatorcontrolplane/v1alpha1

### Sample data
- [docs/insights-archive-sample/config/podnetworkconnectivitychecks.json](./insights-archive-sample/config/podnetworkconnectivitychecks.json)

### Location in archive
- `config/podnetworkconnectivitychecks.json`

### Config ID
`clusterconfig/pod_network_connectivity_checks`

### Released version
- 4.8.2

### Backported versions
None

### Changes
None


## PodDefinition

Collects pod definition from pods that are
Expand Down Expand Up @@ -1586,6 +1557,61 @@ Collects the cluster's `PodDisruptionBudgets`.
and the limit of gathered records to 100 since 4.14.


## PodNetworkConnectivityChecks

Collects a summary of failed `PodNetworkConnectivityChecks` from last 24 hours.

Time of the most recently failed check with each reason and message is recorded.

### API Reference
- podnetworkconnectivitychecks.controlplane.operator.openshift.io/v1alpha1
- https://pkg.go.dev/github.com/openshift/api/operatorcontrolplane/v1alpha1

### Sample data
- [docs/insights-archive-sample/config/podnetworkconnectivitychecks.json](./insights-archive-sample/config/podnetworkconnectivitychecks.json)

### Location in archive
- `config/podnetworkconnectivitychecks.json`

### Config ID
`clusterconfig/pod_network_connectivity_checks`

### Released version
- 4.8.2

### Backported versions
None

### Changes
None


## PrometheusTSDBStatus

Collects Prometheus TSDB status.

### API Reference
None

### Sample data
- [docs/insights-archive-sample/config/tsdb.json](./insights-archive-sample/config/tsdb.json)

### Location in archive
- `config/tsdb.json`

### Config ID
`clusterconfig/tsdb_status`

### Released version
- 4.10.0

### Backported versions
None

### Changes
None


## SAPConfig

Collects selected security context constraints
Expand Down Expand Up @@ -1879,32 +1905,6 @@ None
None


## TSDBStatus

Collects Prometheus TSDB status.

### API Reference
None

### Sample data
- [docs/insights-archive-sample/config/tsdb.json](./insights-archive-sample/config/tsdb.json)

### Location in archive
- `config/tsdb.json`

### Config ID
`clusterconfig/tsdb_status`

### Released version
- 4.10.0

### Backported versions
None

### Changes
None


## ValidatingWebhookConfigurations

Collects `ValidatingWebhookConfiguration` resources
Expand Down
86 changes: 43 additions & 43 deletions pkg/gatherers/clusterconfig/clusterconfig_gatherer.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,66 +27,66 @@ type Gatherer struct {
type gathererFuncPtr = func(*Gatherer, context.Context) ([]record.Record, []error)

var gatheringFunctions = map[string]gathererFuncPtr{
"pdbs": (*Gatherer).GatherPodDisruptionBudgets,
"metrics": (*Gatherer).GatherMostRecentMetrics,
"dvo_metrics": (*Gatherer).GatherDVOMetrics,
"operators": (*Gatherer).GatherClusterOperators,
"operators_pods_and_events": (*Gatherer).GatherClusterOperatorPodsAndEvents,
"container_images": (*Gatherer).GatherContainerImages,
"nodes": (*Gatherer).GatherNodes,
"config_maps": (*Gatherer).GatherConfigMaps,
"version": (*Gatherer).GatherClusterVersion,
"infrastructures": (*Gatherer).GatherClusterInfrastructure,
"networks": (*Gatherer).GatherClusterNetwork,
"active_alerts": (*Gatherer).GatherActiveAlerts,
"authentication": (*Gatherer).GatherClusterAuthentication,
"image_registries": (*Gatherer).GatherClusterImageRegistry,
"image_pruners": (*Gatherer).GatherClusterImagePruner,
"feature_gates": (*Gatherer).GatherClusterFeatureGates,
"oauths": (*Gatherer).GatherClusterOAuth,
"ingress": (*Gatherer).GatherClusterIngress,
"proxies": (*Gatherer).GatherClusterProxy,
"certificate_signing_requests": (*Gatherer).GatherCertificateSigningRequests,
"ceph_cluster": (*Gatherer).GatherCephCluster,
"config_maps": (*Gatherer).GatherConfigMaps,
"container_images": (*Gatherer).GatherContainerImages,
"container_runtime_configs": (*Gatherer).GatherContainerRuntimeConfig,
"cost_management_metrics_configs": (*Gatherer).GatherCostManagementMetricsConfigs,
"crds": (*Gatherer).GatherCRD,
"dvo_metrics": (*Gatherer).GatherDVOMetrics,
"feature_gates": (*Gatherer).GatherClusterFeatureGates,
"host_subnets": (*Gatherer).GatherHostSubnet,
"machines": (*Gatherer).GatherMachine,
"machine_sets": (*Gatherer).GatherMachineSet,
"image": (*Gatherer).GatherClusterImage,
"image_pruners": (*Gatherer).GatherClusterImagePruner,
"image_registries": (*Gatherer).GatherClusterImageRegistry,
"infrastructures": (*Gatherer).GatherClusterInfrastructure,
"ingress": (*Gatherer).GatherClusterIngress,
"install_plans": (*Gatherer).GatherInstallPlans,
"jaegers": (*Gatherer).GatherJaegerCR,
"kube_controller_manager_logs": (*Gatherer).GatherKubeControllerManagerLogs,
"machine_autoscalers": (*Gatherer).GatherMachineAutoscalers,
"machine_config_pools": (*Gatherer).GatherMachineConfigPool,
"machine_configs": (*Gatherer).GatherMachineConfigs,
"machine_healthchecks": (*Gatherer).GatherMachineHealthCheck,
"machine_sets": (*Gatherer).GatherMachineSet,
"machines": (*Gatherer).GatherMachine,
"metrics": (*Gatherer).GatherMostRecentMetrics,
"monitoring_persistent_volumes": (*Gatherer).GatherMonitoringPVs,
"install_plans": (*Gatherer).GatherInstallPlans,
rluders marked this conversation as resolved.
Show resolved Hide resolved
"service_accounts": (*Gatherer).GatherServiceAccounts,
"machine_config_pools": (*Gatherer).GatherMachineConfigPool,
rluders marked this conversation as resolved.
Show resolved Hide resolved
"container_runtime_configs": (*Gatherer).GatherContainerRuntimeConfig,
"mutating_webhook_configurations": (*Gatherer).GatherMutatingWebhookConfigurations,
"netnamespaces": (*Gatherer).GatherNetNamespace,
"networks": (*Gatherer).GatherClusterNetwork,
"node_logs": (*Gatherer).GatherNodeLogs,
"nodes": (*Gatherer).GatherNodes,
"oauths": (*Gatherer).GatherClusterOAuth,
"olm_operators": (*Gatherer).GatherOLMOperators,
"openshift_apiserver_operator_logs": (*Gatherer).GatherOpenShiftAPIServerOperatorLogs,
"openshift_sdn_logs": (*Gatherer).GatherOpenshiftSDNLogs,
"openshift_sdn_controller_logs": (*Gatherer).GatherOpenshiftSDNControllerLogs,
"openshift_authentication_logs": (*Gatherer).GatherOpenshiftAuthenticationLogs,
"openshift_logging": (*Gatherer).GatherOpenshiftLogging,
"openshift_machine_api_events": (*Gatherer).GatherOpenshiftMachineAPIEvents,
"openshift_sdn_controller_logs": (*Gatherer).GatherOpenshiftSDNControllerLogs,
"openshift_sdn_logs": (*Gatherer).GatherOpenshiftSDNLogs,
"operators": (*Gatherer).GatherClusterOperators,
"operators_pods_and_events": (*Gatherer).GatherClusterOperatorPodsAndEvents,
"overlapping_namespace_uids": (*Gatherer).GatherNamespacesWithOverlappingUIDs,
"pdbs": (*Gatherer).GatherPodDisruptionBudgets,
"pod_network_connectivity_checks": (*Gatherer).GatherPodNetworkConnectivityChecks,
"proxies": (*Gatherer).GatherClusterProxy,
"sap_config": (*Gatherer).GatherSAPConfig,
"sap_datahubs": (*Gatherer).GatherSAPDatahubs,
"sap_license_management_logs": (*Gatherer).GatherSAPVsystemIptablesLogs,
"sap_pods": (*Gatherer).GatherSAPPods,
"sap_datahubs": (*Gatherer).GatherSAPDatahubs,
"olm_operators": (*Gatherer).GatherOLMOperators,
"pod_network_connectivity_checks": (*Gatherer).GatherPNCC,
"machine_autoscalers": (*Gatherer).GatherMachineAutoscalers,
"openshift_logging": (*Gatherer).GatherOpenshiftLogging,
"storage_cluster": (*Gatherer).GatherStorageCluster,
"jaegers": (*Gatherer).GatherJaegerCR,
"validating_webhook_configurations": (*Gatherer).GatherValidatingWebhookConfigurations,
"mutating_webhook_configurations": (*Gatherer).GatherMutatingWebhookConfigurations,
"cost_management_metrics_configs": (*Gatherer).GatherCostManagementMetricsConfigs,
"node_logs": (*Gatherer).GatherNodeLogs,
"tsdb_status": (*Gatherer).GatherTSDBStatus,
"schedulers": (*Gatherer).GatherSchedulers,
"scheduler_logs": (*Gatherer).GatherSchedulerLogs,
"service_accounts": (*Gatherer).GatherServiceAccounts,
"silenced_alerts": (*Gatherer).GatherSilencedAlerts,
"image": (*Gatherer).GatherClusterImage,
"kube_controller_manager_logs": (*Gatherer).GatherKubeControllerManagerLogs,
"overlapping_namespace_uids": (*Gatherer).GatherNamespacesWithOverlappingUIDs,
"storage_cluster": (*Gatherer).GatherStorageCluster,
"support_secret": (*Gatherer).GatherSupportSecret,
"active_alerts": (*Gatherer).GatherActiveAlerts,
"ceph_cluster": (*Gatherer).GatherCephCluster,
"openshift_machine_api_events": (*Gatherer).GatherOpenshiftMachineAPIEvents,
"tsdb_status": (*Gatherer).GatherPrometheusTSDBStatus,
"validating_webhook_configurations": (*Gatherer).GatherValidatingWebhookConfigurations,
"version": (*Gatherer).GatherClusterVersion,
}

func New(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
certificatesv1api "k8s.io/api/certificates/v1"
)

func Test_CSR(t *testing.T) {
func Test_gatherCertificateSigningRequests(t *testing.T) {
var files = []struct {
dataFile string
expFile string
Expand Down Expand Up @@ -66,7 +66,7 @@ func Test_CSR(t *testing.T) {
}

// Verifies if CSR features will be ignored in package
func Test_CSR_Filters(t *testing.T) {
func Test_gatherCertificateSigningRequestsFilters(t *testing.T) {
var files = []struct {
name string
csr *CSRAnonymizedFeatures
Expand Down
63 changes: 63 additions & 0 deletions pkg/gatherers/clusterconfig/gather_cluster_authentication_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
package clusterconfig

import (
"context"
"testing"

metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

configfake "github.com/openshift/client-go/config/clientset/versioned/fake"

v1 "github.com/openshift/api/config/v1"
"github.com/openshift/insights-operator/pkg/record"
"github.com/stretchr/testify/assert"
)

func Test_gatherClusterAuthentication(t *testing.T) {
tests := []struct {
name string
authentication *v1.Authentication
result []record.Record
errCount int
}{
{
name: "Retrieving authentication returns record of that authentication and no errors",
authentication: &v1.Authentication{
ObjectMeta: metav1.ObjectMeta{
Name: "cluster",
},
},
result: []record.Record{
{
Name: "config/authentication",
Item: record.ResourceMarshaller{
Resource: &v1.Authentication{
ObjectMeta: metav1.ObjectMeta{Name: "cluster"},
},
},
},
},
errCount: 0,
},
{
name: "Retrieving no authentication returns no error/no records",
authentication: &v1.Authentication{},
result: nil,
},
}
for _, testCase := range tests {
tc := testCase
t.Run(tc.name, func(t *testing.T) {
t.Parallel()
// Given
configClient := configfake.NewSimpleClientset(tc.authentication)

// When
got, gotErrs := gatherClusterAuthentication(context.Background(), configClient.ConfigV1())

// Assert
assert.Equal(t, tc.result, got)
assert.Len(t, gotErrs, tc.errCount)
})
}
}
63 changes: 63 additions & 0 deletions pkg/gatherers/clusterconfig/gather_cluster_feature_gates_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
package clusterconfig

import (
"context"
"testing"

metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

v1 "github.com/openshift/api/config/v1"

configfake "github.com/openshift/client-go/config/clientset/versioned/fake"
"github.com/openshift/insights-operator/pkg/record"
"github.com/stretchr/testify/assert"
)

func Test_gatherClusterFeatureGates(t *testing.T) {
tests := []struct {
name string
feature *v1.FeatureGate
result []record.Record
errCount int
}{
{
name: "Retrieving featuregate returns record of that featuregate and no errors",
feature: &v1.FeatureGate{
ObjectMeta: metav1.ObjectMeta{
Name: "cluster",
},
},
result: []record.Record{
{
Name: "config/featuregate",
Item: record.ResourceMarshaller{
Resource: &v1.FeatureGate{
ObjectMeta: metav1.ObjectMeta{Name: "cluster"},
},
},
},
},
errCount: 0,
},
{
name: "Retrieving no featuregate returns no error/no record",
feature: &v1.FeatureGate{},
result: nil,
},
}
for _, testCase := range tests {
tc := testCase
t.Run(tc.name, func(t *testing.T) {
t.Parallel()
// Given
configClient := configfake.NewSimpleClientset(tc.feature)

// When
got, gotErrs := gatherClusterFeatureGates(context.Background(), configClient.ConfigV1())

// Assert
assert.Equal(t, tc.result, got)
assert.Len(t, gotErrs, tc.errCount)
})
}
}
Loading