Skip to content

Commit

Permalink
Use the newly extracted GetCiliumVersion method
Browse files Browse the repository at this point in the history
Signed-off-by: Thomas Balthazar <thomas@balthazar.info>
  • Loading branch information
tbalthazar authored and tklauser committed Dec 14, 2022
1 parent 8e51358 commit 646869c
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions connectivity/check/context.go
Expand Up @@ -509,18 +509,12 @@ func (ct *ConnectivityTest) initCiliumPods(ctx context.Context) error {
func (ct *ConnectivityTest) DetectMinimumCiliumVersion(ctx context.Context) (*semver.Version, error) {
var minVersion *semver.Version
for name, ciliumPod := range ct.ciliumPods {
stdout, err := ciliumPod.K8sClient.ExecInPod(ctx, ciliumPod.Pod.Namespace, ciliumPod.Pod.Name,
defaults.AgentContainerName, []string{"cilium", "version", "-o", "jsonpath={$.Daemon.Version}"})
if err != nil {
return nil, fmt.Errorf("unable to fetch cilium version on pod %q: %w", name, err)
}
v, _, _ := strings.Cut(strings.TrimSpace(stdout.String()), "-") // strips proprietary -releaseX suffix
podVersion, err := semver.Parse(v)
podVersion, err := ciliumPod.K8sClient.GetCiliumVersion(ctx, ciliumPod.Pod)
if err != nil {
return nil, fmt.Errorf("unable to parse cilium version on pod %q: %w", name, err)
}
if minVersion == nil || podVersion.LT(*minVersion) {
minVersion = &podVersion
minVersion = podVersion
}
}

Expand Down

0 comments on commit 646869c

Please sign in to comment.