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(k8sclusterreceiver): 🔥 remove deprecated kubernetes API resources #26516

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
c74fc14
feat(k8sclusterreceiver): ✨ introduce ignore_deprecated_resource config
prashant-shahi Sep 6, 2023
0f7bd1f
docs(k8scluster): 📝 update README and example config
prashant-shahi Sep 7, 2023
6c2e5cb
Merge branch 'main' into chore/flag-autoscaling-v2beta2
prashant-shahi Sep 7, 2023
1389666
chore: 🚚 rename ignore_deprecated_resource to ignore_deprecated_resou…
prashant-shahi Sep 8, 2023
e1d1ae6
docs(k8scluster): 📝 update changelog
prashant-shahi Sep 8, 2023
1528480
Merge branch 'main' into chore/flag-autoscaling-v2beta2
prashant-shahi Sep 8, 2023
c1e5f70
Merge branch 'main' into chore/flag-autoscaling-v2beta2
prashant-shahi Sep 8, 2023
d421469
refactor(k8sclusterreceiver): :recycle: remove deprecated APIs and re…
prashant-shahi Sep 9, 2023
00ebf82
Merge branch 'main' into chore/flag-autoscaling-v2beta2
prashant-shahi Sep 9, 2023
97e1d40
docs(k8sclusterreceiver): 📝 update readme docs
prashant-shahi Sep 9, 2023
a6622b2
docs(k8scluster): 📝 update changelog
prashant-shahi Sep 9, 2023
3eca59a
Merge branch 'main' into chore/flag-autoscaling-v2beta2
prashant-shahi Sep 11, 2023
ee9e5d7
docs(k8scluster): 📝 update changelog generator config instead
prashant-shahi Sep 11, 2023
7a9bea3
docs(k8scluster): 📝 update changelog
prashant-shahi Sep 11, 2023
fb9a091
chore: update .chloggen/k8sclusterreceiver-remove-deprecated-resource…
prashant-shahi Sep 11, 2023
b8e0fbb
chore: update .chloggen/k8sclusterreceiver-remove-deprecated-resource…
prashant-shahi Sep 11, 2023
8ace748
Merge branch 'main' into chore/flag-autoscaling-v2beta2
prashant-shahi Sep 11, 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
Next Next commit
feat(k8sclusterreceiver): ✨ introduce ignore_deprecated_resource config
Signed-off-by: Prashant Shahi <me@prashantshahi.dev>
  • Loading branch information
prashant-shahi committed Sep 6, 2023
commit c74fc1407ce6b859f35bcb489c7899f1d053bad6
3 changes: 3 additions & 0 deletions receiver/k8sclusterreceiver/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ type Config struct {

// MetricsBuilderConfig allows customizing scraped metrics/attributes representation.
metadata.MetricsBuilderConfig `mapstructure:",squash"`

// Whether to ignore deprecated resources or not.
IgnoreDeprecatedResource bool `mapstructure:"ignore_deprecated_resource"`
}

func (cfg *Config) Validate() error {
Expand Down
2 changes: 2 additions & 0 deletions receiver/k8sclusterreceiver/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ const (
defaultCollectionInterval = 10 * time.Second
defaultDistribution = distributionKubernetes
defaultMetadataCollectionInterval = 5 * time.Minute
defaultIgnoreDeprecatedResource = false
)

var defaultNodeConditionsToReport = []string{"Ready"}
Expand All @@ -37,6 +38,7 @@ func createDefaultConfig() component.Config {
},
MetadataCollectionInterval: defaultMetadataCollectionInterval,
MetricsBuilderConfig: metadata.DefaultMetricsBuilderConfig(),
IgnoreDeprecatedResource: defaultIgnoreDeprecatedResource,
}
}

Expand Down
32 changes: 19 additions & 13 deletions receiver/k8sclusterreceiver/watcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,19 +127,25 @@ func (rw *resourceWatcher) prepareSharedInformerFactory() error {
// informer for that kind won't be set and a warning message is thrown.
// This map should be kept in sync with what can be provided by the supported k8s server versions.
supportedKinds := map[string][]schema.GroupVersionKind{
"Pod": {gvk.Pod},
"Node": {gvk.Node},
"Namespace": {gvk.Namespace},
"ReplicationController": {gvk.ReplicationController},
"ResourceQuota": {gvk.ResourceQuota},
"Service": {gvk.Service},
"DaemonSet": {gvk.DaemonSet},
"Deployment": {gvk.Deployment},
"ReplicaSet": {gvk.ReplicaSet},
"StatefulSet": {gvk.StatefulSet},
"Job": {gvk.Job},
"CronJob": {gvk.CronJob, gvk.CronJobBeta},
"HorizontalPodAutoscaler": {gvk.HorizontalPodAutoscaler, gvk.HorizontalPodAutoscalerBeta},
"Pod": {gvk.Pod},
"Node": {gvk.Node},
"Namespace": {gvk.Namespace},
"ReplicationController": {gvk.ReplicationController},
"ResourceQuota": {gvk.ResourceQuota},
"Service": {gvk.Service},
"DaemonSet": {gvk.DaemonSet},
"Deployment": {gvk.Deployment},
"ReplicaSet": {gvk.ReplicaSet},
"StatefulSet": {gvk.StatefulSet},
"Job": {gvk.Job},
}

if !rw.config.IgnoreDeprecatedResource {
supportedKinds["CronJob"] = []schema.GroupVersionKind{gvk.CronJob, gvk.CronJobBeta}
supportedKinds["HorizontalPodAutoscaler"] = []schema.GroupVersionKind{gvk.HorizontalPodAutoscaler, gvk.HorizontalPodAutoscalerBeta}
} else {
supportedKinds["CronJob"] = []schema.GroupVersionKind{gvk.CronJob}
supportedKinds["HorizontalPodAutoscaler"] = []schema.GroupVersionKind{gvk.HorizontalPodAutoscaler}
}

for kind, gvks := range supportedKinds {
Expand Down