cli: annotate CoreDNS resources for Helm (#3236)

This commit is contained in:
Markus Rudy 2024-07-03 19:37:51 +02:00
parent b872fbdfe8
commit 4fa9d85ea6
8 changed files with 81 additions and 0 deletions

View file

@ -422,6 +422,9 @@ func (a *applyCmd) apply(
// Apply Helm Charts
if !a.flags.skipPhases.contains(skipHelmPhase) {
if err := a.applier.AnnotateCoreDNSResources(cmd.Context()); err != nil {
return fmt.Errorf("annotating CoreDNS: %w", err)
}
if err := a.runHelmApply(cmd, conf, stateFile, upgradeDir); err != nil {
return err
}
@ -843,6 +846,7 @@ type applier interface {
// methods required to install/upgrade Helm charts
AnnotateCoreDNSResources(context.Context) error
PrepareHelmCharts(
flags helm.Options, state *state.State, serviceAccURI string, masterSecret uri.MasterSecret,
) (helm.Applier, bool, error)

View file

@ -553,6 +553,7 @@ func (s *stubConstellApplier) Init(context.Context, atls.Validator, *state.State
}
type helmApplier interface {
AnnotateCoreDNSResources(context.Context) error
PrepareHelmCharts(
flags helm.Options, stateFile *state.State, serviceAccURI string, masterSecret uri.MasterSecret,
) (

View file

@ -278,6 +278,10 @@ type stubHelmApplier struct {
err error
}
func (s stubHelmApplier) AnnotateCoreDNSResources(_ context.Context) error {
return nil
}
func (s stubHelmApplier) PrepareHelmCharts(
_ helm.Options, _ *state.State, _ string, _ uri.MasterSecret,
) (helm.Applier, bool, error) {

View file

@ -375,6 +375,10 @@ type mockApplier struct {
mock.Mock
}
func (m *mockApplier) AnnotateCoreDNSResources(_ context.Context) error {
return nil
}
func (m *mockApplier) PrepareHelmCharts(
helmOpts helm.Options, stateFile *state.State, str string, masterSecret uri.MasterSecret,
) (helm.Applier, bool, error) {