Skip to content

Commit

Permalink
refactor: use traefik object to install traefik (#2208)
Browse files Browse the repository at this point in the history
  • Loading branch information
cwyl02 authored May 10, 2024
1 parent 89c263b commit 1243de3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 33 deletions.
18 changes: 0 additions & 18 deletions apptests/appscenarios/karma.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,21 +70,3 @@ func (k karma) install(ctx context.Context, env *environment.Env, appPath string

return err
}

func (k karma) ApplyTraefikOverrideCM(ctx context.Context, env *environment.Env, cmName string) error {
testDataPath, err := getTestDataDir()
if err != nil {
return err
}
cmPath := filepath.Join(testDataPath, "traefik", "override-cm.yaml")
err = env.ApplyYAML(ctx, cmPath, map[string]string{
"name": cmName,
"namespace": kommanderNamespace,
})
if err != nil {
return err
}

return nil

}
18 changes: 3 additions & 15 deletions apptests/appscenarios/karma_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -382,10 +382,8 @@ func installKarmaDependencies(k *karma) {
Expect(err).To(BeNil())

By("should install traefik")
// TODO: use traefik object to install
err = k.ApplyTraefikOverrideCM(ctx, env, traefikOverrideCMName)
Expect(err).To(BeNil())
err = k.InstallDependency(ctx, env, constants.Traefik)
tfk := NewTraefik()
err = tfk.Install(ctx, env)
Expect(err).To(BeNil())

hr = &fluxhelmv2beta2.HelmRelease{
Expand All @@ -394,21 +392,11 @@ func installKarmaDependencies(k *karma) {
APIVersion: fluxhelmv2beta2.GroupVersion.Version,
},
ObjectMeta: metav1.ObjectMeta{
Name: constants.Traefik,
Name: tfk.Name(),
Namespace: kommanderNamespace,
},
}

// override traefik values.yaml
err = k8sClient.Get(ctx, ctrlClient.ObjectKeyFromObject(hr), hr)
Expect(err).To(BeNil())
hr.Spec.ValuesFrom = append(hr.Spec.ValuesFrom, fluxhelmv2beta2.ValuesReference{
Kind: "ConfigMap",
Name: traefikOverrideCMName,
})
err = k8sClient.Update(ctx, hr)
Expect(err).To(BeNil())

Eventually(func() error {
err = k8sClient.Get(ctx, ctrlClient.ObjectKeyFromObject(hr), hr)
if err != nil {
Expand Down

0 comments on commit 1243de3

Please sign in to comment.