You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
kubectl-datadog: redistribute autoscaling cluster packages by concern (#3012)
* kubectl-datadog: extract EKS helpers to common/eks/
Continue the redistribution of `guess/` started by PRs #2980 and #3000:
move every helper that operates on an EKS cluster object or the EKS API
into a dedicated `common/eks/` package. After this commit, `common/eks/`
contains:
- authmode.go (was guess/clusterauthmode.go)
- podidentityagent.go (was guess/ekspodidentityagent.go)
- oidcprovider.go (was guess/oidcprovider.go)
- privatesubnets.go (was guess/privatesubnets.go)
Import alias `commoneks` is used to avoid colliding with the existing
`github.com/aws/aws-sdk-go-v2/service/eks` (aliased `eks`).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* kubectl-datadog: consolidate aws-auth into common/awsauth/
`common/aws/aws-auth.go` was misnamed: it manipulates a Kubernetes
ConfigMap (`kube-system/aws-auth`), not an AWS-SDK resource. Together
with `guess/aws-auth.go` (read-only presence check), it belongs in a
dedicated `common/awsauth/` package: both files operate on the same
ConfigMap.
Function names lose the now-redundant `AwsAuth` prefix:
- `IsAwsAuthConfigMapPresent` -> `IsConfigMapPresent`
- `EnsureAwsAuthRole` -> `EnsureRole`
- `RemoveAwsAuthRole` -> `RemoveRole`
`common/aws/` now contains only cloudformation.go (pure AWS-SDK).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* kubectl-datadog: fold clustername into common/clients/
The only caller of `guess.GetClusterNameFromKubeconfig` is the wrapper
`clients.GetClusterNameFromKubeconfig` in `common/clients/clients.go`.
Move the helper next to its caller as an unexported function
`clusterNameFromKubeconfig`. The public API of `common/clients/` is
unchanged.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* kubectl-datadog: carve out karpenter package
Consolidate everything Karpenter-shaped into `common/karpenter/`,
alongside the existing detection helper:
- Intermediate model: NodePoolsSet, EC2NodeClass, NodePool,
MetadataOptions, BlockDeviceMapping (from guess/nodepoolsset.go)
- Producers from EKS node groups: GetNodeGroupsProperties (from
guess/nodegroupproperties.go -> fromnodegroups.go)
- Producers from running k8s Nodes: GetNodesProperties (from
guess/nodesproperties.go -> fromnodes.go)
- CR builders: CreateOrUpdateEC2NodeClass, CreateOrUpdateNodePool
(from cluster/k8s/{ec2nodeclass,nodepool}.go)
`cluster/k8s/` is gone (it was misnamed: those files build Karpenter
CRDs, they aren't generic k8s primitives). `common/k8s/` keeps its
narrow scope: generic object CRUD + deployment-finder.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* kubectl-datadog: awsauth: extract ConfigMap name/namespace constants
`kube-system` and `aws-auth` each appeared 5 times across the three
functions. Promote them to package-level constants so the package's
single-ConfigMap scope is explicit at a glance.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
0 commit comments