Skip to content

Commit

Permalink
feat: bump traefik image (#2745)
Browse files Browse the repository at this point in the history
* feat: bump traefik image

* build: Updated licenses.d2iq.yaml

* fix: update errors in upgrade test

* fix: retry on conflict

* fix: wait for upgrade to complete

---------

Co-authored-by: d2iq-mergebot <ci-mergebot@d2iq.com>
  • Loading branch information
mhrabovcin and d2iq-mergebot authored Oct 17, 2024
1 parent 9c4eb34 commit 3c1e918
Show file tree
Hide file tree
Showing 10 changed files with 21 additions and 14 deletions.
19 changes: 11 additions & 8 deletions apptests/appscenarios/traefik.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import (
"path/filepath"

metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/util/retry"
controllerruntime "sigs.k8s.io/controller-runtime"
ctrlClient "sigs.k8s.io/controller-runtime/pkg/client"

fluxhelmv2beta2 "github.com/fluxcd/helm-controller/api/v2beta2"
Expand Down Expand Up @@ -88,16 +90,17 @@ func (t traefik) install(ctx context.Context, env *environment.Env, appPath stri
if err != nil {
return fmt.Errorf("could not create the generic client: %w", err)
}
err = genericClient.Get(ctx, ctrlClient.ObjectKeyFromObject(hr), hr)
if err != nil {
return fmt.Errorf("could not get the HelmRelease: %w", err)
}

hr.Spec.ValuesFrom = append(hr.Spec.ValuesFrom, fluxhelmv2beta2.ValuesReference{
Kind: "ConfigMap",
Name: traefikCMName,
err = retry.RetryOnConflict(retry.DefaultRetry, func() error {
_, err = controllerruntime.CreateOrUpdate(ctx, genericClient, hr, func() error {
hr.Spec.ValuesFrom = append(hr.Spec.ValuesFrom, fluxhelmv2beta2.ValuesReference{
Kind: "ConfigMap",
Name: traefikCMName,
})
return nil
})
return err
})
err = genericClient.Update(ctx, hr)

return err
}
Expand Down
8 changes: 5 additions & 3 deletions apptests/appscenarios/traefik_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -225,9 +225,11 @@ func assertTraefikEndpoints(t *traefik, podList *corev1.PodList) {
listOptions := &ctrlClient.ListOptions{
LabelSelector: selector,
}
err = k8sClient.List(ctx, podList, listOptions)
Expect(err).To(BeNil())
Expect(podList.Items).To(HaveLen(1))

Eventually(func() ([]corev1.Pod, error) {
err := k8sClient.List(ctx, podList, listOptions)
return podList.Items, err
}).WithPolling(5 * time.Second).WithTimeout(time.Minute).Should(HaveLen(1))

By("checking traefik prometheus metrics endpoint")
res := restClientV1Pods.Get().Resource("pods").Namespace(podList.Items[0].Namespace).Name(podList.Items[0].Name + ":9100").SubResource("proxy").Suffix("/metrics").Do(ctx)
Expand Down
2 changes: 1 addition & 1 deletion licenses.d2iq.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ resources:
- license_path: LICENSE
ref: 3.6.0
url: https://github.com/Kong/kong
- container_image: docker.io/library/traefik:v2.11.2
- container_image: docker.io/library/traefik:v2.11.9
sources:
- license_path: LICENSE.md
ref: ${image_tag}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: traefik-27.0.2-d2iq-defaults
name: traefik-27.0.3-d2iq-defaults
namespace: ${releaseNamespace}
data:
values.yaml: |
---
image:
tag: v2.11.9
priorityClassName: "dkp-critical-priority"
podDisruptionBudget:
minAvailable: 1
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ spec:
releaseName: kommander-traefik
valuesFrom:
- kind: ConfigMap
name: traefik-27.0.2-d2iq-defaults
name: traefik-27.0.3-d2iq-defaults
- kind: ConfigMap
name: traefik-overrides
optional: true
Expand Down

0 comments on commit 3c1e918

Please sign in to comment.