Skip to content

Write deployment context in init container #2871

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

Merged
merged 11 commits into from
Dec 11, 2024
Merged
Changes from 1 commit
Commits
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
Prev Previous commit
Next Next commit
Unexport telemetry methods
  • Loading branch information
Kate Osborn committed Dec 11, 2024
commit 7dda8cf3d8aa988585c8634ebf5e760b190db44c
12 changes: 6 additions & 6 deletions internal/mode/static/telemetry/collector.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ func (c DataCollectorImpl) Collect(ctx context.Context) (Data, error) {
return Data{}, fmt.Errorf("failed to collect NGF resource counts: %w", err)
}

replicaSet, err := GetPodReplicaSet(ctx, c.cfg.K8sClientReader, c.cfg.PodNSName)
replicaSet, err := getPodReplicaSet(ctx, c.cfg.K8sClientReader, c.cfg.PodNSName)
if err != nil {
return Data{}, fmt.Errorf("failed to get replica set for pod %v: %w", c.cfg.PodNSName, err)
}
Expand All @@ -158,7 +158,7 @@ func (c DataCollectorImpl) Collect(ctx context.Context) (Data, error) {
return Data{}, fmt.Errorf("failed to collect NGF replica count: %w", err)
}

deploymentID, err := GetDeploymentID(replicaSet)
deploymentID, err := getDeploymentID(replicaSet)
if err != nil {
return Data{}, fmt.Errorf("failed to get NGF deploymentID: %w", err)
}
Expand Down Expand Up @@ -280,8 +280,8 @@ func computeRouteCount(
}
}

// GetPodReplicaSet returns the replicaset for the provided Pod.
func GetPodReplicaSet(
// getPodReplicaSet returns the replicaset for the provided Pod.
func getPodReplicaSet(
ctx context.Context,
k8sClient client.Reader,
podNSName types.NamespacedName,
Expand Down Expand Up @@ -324,8 +324,8 @@ func getReplicas(replicaSet *appsv1.ReplicaSet) (int, error) {
return int(*replicaSet.Spec.Replicas), nil
}

// GetDeploymentID gets the deployment ID of the provided ReplicaSet.
func GetDeploymentID(replicaSet *appsv1.ReplicaSet) (string, error) {
// getDeploymentID gets the deployment ID of the provided ReplicaSet.
func getDeploymentID(replicaSet *appsv1.ReplicaSet) (string, error) {
replicaOwnerRefs := replicaSet.GetOwnerReferences()
if len(replicaOwnerRefs) != 1 {
return "", fmt.Errorf("expected one owner reference of the NGF ReplicaSet, got %d", len(replicaOwnerRefs))
Expand Down