-
Notifications
You must be signed in to change notification settings - Fork 103
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into docs/azure-push
- Loading branch information
Showing
24 changed files
with
195 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
package framework | ||
|
||
import ( | ||
"fmt" | ||
"runtime/debug" | ||
|
||
core "k8s.io/api/core/v1" | ||
"sigs.k8s.io/controller-runtime/pkg/client" | ||
) | ||
|
||
// GetLogs returns the logs for all containers in all pods for a release. | ||
func GetLogs(rm ResourceManager, namespace string, releaseName string) string { | ||
var returnLogs string | ||
pods, err := rm.GetPods(namespace, client.MatchingLabels{ | ||
"app.kubernetes.io/instance": releaseName, | ||
}) | ||
if err != nil { | ||
return fmt.Sprintf("failed to get pods: %v", err) | ||
} | ||
|
||
for _, pod := range pods { | ||
for _, container := range pod.Spec.Containers { | ||
returnLogs += fmt.Sprintf("Logs for container %s:\n", container.Name) | ||
logs, err := rm.GetPodLogs(pod.Namespace, pod.Name, &core.PodLogOptions{ | ||
Container: container.Name, | ||
}) | ||
if err != nil { | ||
returnLogs += fmt.Sprintf(" failed to get logs: %v\n", err) | ||
continue | ||
} | ||
returnLogs += fmt.Sprintf(" %s\n", logs) | ||
} | ||
} | ||
return returnLogs | ||
} | ||
|
||
// GetEvents returns the events for a namespace. | ||
func GetEvents(rm ResourceManager, namespace string) string { | ||
var returnEvents string | ||
events, err := rm.GetEvents(namespace) | ||
if err != nil { | ||
return fmt.Sprintf("failed to get events: %v", err) | ||
} | ||
|
||
eventGroups := make(map[string][]core.Event) | ||
for _, event := range events.Items { | ||
eventGroups[event.InvolvedObject.Name] = append(eventGroups[event.InvolvedObject.Name], event) | ||
} | ||
|
||
for name, events := range eventGroups { | ||
returnEvents += fmt.Sprintf("Events for %s:\n", name) | ||
for _, event := range events { | ||
returnEvents += fmt.Sprintf(" %s\n", event.Message) | ||
} | ||
returnEvents += "\n" | ||
} | ||
return returnEvents | ||
} | ||
|
||
// GetBuildInfo returns the build information. | ||
func GetBuildInfo() (commitHash string, commitTime string, dirtyBuild string) { | ||
commitHash = "unknown" | ||
commitTime = "unknown" | ||
dirtyBuild = "unknown" | ||
|
||
info, ok := debug.ReadBuildInfo() | ||
if !ok { | ||
return | ||
} | ||
|
||
for _, kv := range info.Settings { | ||
switch kv.Key { | ||
case "vcs.revision": | ||
commitHash = kv.Value | ||
case "vcs.time": | ||
commitTime = kv.Value | ||
case "vcs.modified": | ||
dirtyBuild = kv.Value | ||
} | ||
} | ||
|
||
return | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -eo pipefail | ||
set -o pipefail | ||
|
||
source scripts/vars.env | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -eo pipefail | ||
set -o pipefail | ||
|
||
source scripts/vars.env | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package suite | ||
package main | ||
|
||
import ( | ||
"bytes" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package suite | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package suite | ||
package main | ||
|
||
import ( | ||
"context" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package suite | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package suite | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
|
Oops, something went wrong.