Skip to content

Commit

Permalink
renames persist-shoot to dump-shoot-spec
Browse files Browse the repository at this point in the history
  • Loading branch information
Disper authored and m00g3n committed Jul 26, 2024
1 parent cf2df9f commit bbef43a
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 13 deletions.
7 changes: 3 additions & 4 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ func main() {
var expirationTime time.Duration
var gardenerRequestTimeout time.Duration
var enableRuntimeReconciler bool
var persistShoot bool
var converterConfigFilepath string
var shootSpecDumpEnabled bool

flag.StringVar(&metricsAddr, "metrics-bind-address", ":8080", "The address the metric endpoint binds to.")
flag.StringVar(&probeAddr, "health-probe-bind-address", ":8081", "The address the probe endpoint binds to.")
Expand All @@ -86,8 +86,8 @@ func main() {
flag.DurationVar(&expirationTime, "kubeconfig-expiration-time", defaultExpirationTime, "Dynamic kubeconfig expiration time")
flag.DurationVar(&gardenerRequestTimeout, "gardener-request-timeout", defaultGardenerRequestTimeout, "Timeout duration for requests to Gardener")
flag.BoolVar(&enableRuntimeReconciler, "runtime-reconciler-enabled", defaultRuntimeReconcilerEnabled, "Feature flag for all runtime reconciler functionalities")
flag.BoolVar(&persistShoot, "persist-shoot", false, "Feature flag to allow persisting created shoots")
flag.StringVar(&converterConfigFilepath, "converter-config-filepath", "hack/converter_config.json", "A file path to the gardener shoot converter configuration.")
flag.BoolVar(&shootSpecDumpEnabled, "shoot-spec-dump-enabled", false, "Feature flag to allow persisting specs of created shoots")

opts := zap.Options{
Development: true,
Expand Down Expand Up @@ -174,8 +174,7 @@ func main() {
ShootNamesapace: gardenerNamespace,
ConverterConfig: converterConfig,
}

if persistShoot {
if shootSpecDumpEnabled {
cfg.PVCPath = "/testdata/kim"
}

Expand Down
1 change: 1 addition & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ You can configure the Infrastructure Manager deployment with the following argum
4. `kubeconfig-expiration-time` - maximum time after which kubeconfig is rotated. The rotation happens between (`minimal-rotation-time` * `kubeconfig-expiration-time`) and `kubeconfig-expiration-time`.
4. `gardener-request-timeout` - specifies the timeout for requests to Gardener. Default value is `60s`.
5. `runtime-reconciler-enabled` - feature flag responsible for enabling the runtime reconciler. Default value is `false`.
6. `shoot-spec-dump-enabled` - feature flag responsible for enabling the shoot spec dump. Default value is `false`.


See [manager_gardener_secret_patch.yaml](../config/default/manager_gardener_secret_patch.yaml) for default values.
Expand Down
6 changes: 3 additions & 3 deletions internal/controller/runtime/fsm/runtime_fsm_create_shoot.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ func sFnCreateShoot(ctx context.Context, m *fsm, s *systemState) (stateFn, *ctrl
)

// it will be executed only once because created shoot is executed only once
shouldPersistShoot := m.PVCPath != ""
if shouldPersistShoot {
shouldDumpShootSpec := m.PVCPath != ""
if shouldDumpShootSpec {
s.shoot = newShoot.DeepCopy()
return switchState(sFnPersistShoot)
return switchState(sFnDumpShootSpec)
}

return updateStatusAndRequeueAfter(gardenerRequeueDuration)
Expand Down
6 changes: 3 additions & 3 deletions internal/controller/runtime/fsm/runtime_fsm_patch_shoot.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ func sFnPatchExistingShoot(ctx context.Context, m *fsm, s *systemState) (stateFn
"Shoot is pending",
)

shouldPersistShoot := m.PVCPath != ""
if shouldPersistShoot {
return switchState(sFnPersistShoot)
shouldDumpShootSpec := m.PVCPath != ""
if shouldDumpShootSpec {
return switchState(sFnDumpShootSpec)
}

return updateStatusAndRequeueAfter(gardenerRequeueDuration)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func persist(path string, s *gardener.Shoot, saveFunc writerGetter) error {
return nil
}

func sFnPersistShoot(_ context.Context, m *fsm, s *systemState) (stateFn, *ctrl.Result, error) {
func sFnDumpShootSpec(_ context.Context, m *fsm, s *systemState) (stateFn, *ctrl.Result, error) {
path := fmt.Sprintf("%s/%s-%s.yaml", m.PVCPath, s.shoot.Namespace, s.shoot.Name)
if err := persist(path, s.shoot, m.writerProvider); err != nil {
return updateStatusAndStopWithError(err)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ var _ = Describe("KIM sFnPersist", func() {
expectedData, err := yaml.Marshal(&testing.ShootNoDNS)
Expect(err).ShouldNot(HaveOccurred())

It("shoutld persist shoot data", func() {
next, _, err := sFnPersistShoot(testCtx, must(newFakeFSM, withStorageWriter(testWriterGetter)), &systemState{shoot: &testing.ShootNoDNS})
It("should persist shoot data", func() {
next, _, err := sFnDumpShootSpec(testCtx, must(newFakeFSM, withStorageWriter(testWriterGetter)), &systemState{shoot: &testing.ShootNoDNS})
Expect(err).To(BeNil())
Expect(next).To(haveName("sFnUpdateStatus"))
Expect(expectedData).To(Equal(b.Bytes()))
Expand Down

0 comments on commit bbef43a

Please sign in to comment.