-
Notifications
You must be signed in to change notification settings - Fork 104
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add integration tests for the instance admission controller #1442
Conversation
Signed-off-by: Aleksey Dukhovniy <alex.dukhovniy@googlemail.com>
The `should clear scheduled plan when it is completed` test is failing: this is a bug in the IAC that needs to be fixed. Signed-off-by: Aleksey Dukhovniy <alex.dukhovniy@googlemail.com>
Signed-off-by: Aleksey Dukhovniy <alex.dukhovniy@googlemail.com>
introduced new `PlanExecution.Status` field which is written by IC and read by IAC signalling that a plan is terminal. Signed-off-by: Aleksey Dukhovniy <alex.dukhovniy@googlemail.com>
Signed-off-by: Aleksey Dukhovniy <alex.dukhovniy@googlemail.com>
Signed-off-by: Aleksey Dukhovniy <alex.dukhovniy@googlemail.com>
Signed-off-by: Aleksey Dukhovniy <alex.dukhovniy@googlemail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would appreciate discussing the logger... others looks good
@@ -9,6 +9,8 @@ require ( | |||
github.com/gosuri/uitable v0.0.4 | |||
github.com/kudobuilder/kuttl v0.1.0 | |||
github.com/manifoldco/promptui v0.6.0 | |||
github.com/onsi/ginkgo v1.11.0 | |||
github.com/onsi/gomega v1.8.1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought we previously had these as dependencies and they were removed... now they are back?
I'm not against... but now find myself curious if there are competing mental models
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unit tests do not need it and neither does kuttl. However, instance_admission_integration_test
is complex enough that ginkgo becomes necessary. Gomega is not strictly necessary and we could use an existing matcher lib but both seem to be used together everwhere else so I didn't want to break that pattern 🤷♂
@@ -183,7 +184,7 @@ func admitUpdate(old, new *kudov1beta1.Instance, ov *kudov1beta1.OperatorVersion | |||
isPlanRetriggered := hadPlan && newPlan == oldPlan && newUID != oldUID | |||
isPlanCancellation := hadPlan && newPlan == "" | |||
isDeleting := new.IsDeleting() // a non-empty meta.deletionTimestamp is a signal to switch to the uninstalling life-cycle phase | |||
isPlanTerminal := isTerminal(new, newPlan, new.Spec.PlanExecution.UID) | |||
isPlanTerminal := new.Spec.PlanExecution.Status.IsTerminal() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👏
Signed-off-by: Aleksey Dukhovniy <alex.dukhovniy@googlemail.com>
Signed-off-by: Aleksey Dukhovniy <alex.dukhovniy@googlemail.com>
Summary: #1442 introduced new `Instance.Spec.PlanExecution.Status` field which duplicates part of the `Instance.Spec.PlanStatus` information . With that, plan execution status is now saved three times: in `planExecution`, `aggregatedStatus` and the corresponding `planStatus` fields e.g.: ```yaml apiVersion: kudo.dev/v1beta1 kind: Instance spec: planExecution: planName: deploy status: IN_PROGRESS status: aggregatedStatus: activePlanName: deploy status: IN_PROGRESS planStatus: deploy: name: deploy phases: - name: deploy status: IN_PROGRESS steps: - name: app status: IN_PROGRESS status: IN_PROGRESS ``` `aggregatedStatus` is completely duplicating `planExecution` while `planStatus` provides extended information on individual phases and steps. This PR removes `aggregatedStatus` field in favour of `planExecution`. The only caveat is that we previously kept `aggregatedStatus.status` value even **after** the plan was finished to signal how _last_ plan execution ended. However, `kudo plan status` already calculates and displays this information from the corresponding `planStatus`. Additionally, having `aggregatedStatus.activePlanName` populated when no plan is active is somewhat broken to begin with. Signed-off-by: Aleksey Dukhovniy <alex.dukhovniy@googlemail.com>
Summary: #1442 introduced new `Instance.Spec.PlanExecution.Status` field which duplicates part of the `Instance.Spec.PlanStatus` information . With that, plan execution status is now saved three times: in `planExecution`, `aggregatedStatus` and the corresponding `planStatus` fields e.g.: ```yaml apiVersion: kudo.dev/v1beta1 kind: Instance spec: planExecution: planName: deploy status: IN_PROGRESS status: aggregatedStatus: activePlanName: deploy status: IN_PROGRESS planStatus: deploy: name: deploy phases: - name: deploy status: IN_PROGRESS steps: - name: app status: IN_PROGRESS status: IN_PROGRESS ``` `aggregatedStatus` is completely duplicating `planExecution` while `planStatus` provides extended information on individual phases and steps. This PR removes `aggregatedStatus` field in favour of `planExecution`. The only caveat is that we previously kept `aggregatedStatus.status` value even **after** the plan was finished to signal how _last_ plan execution ended. However, `kudo plan status` already calculates and displays this information from the corresponding `planStatus`. Additionally, having `aggregatedStatus.activePlanName` populated when no plan is active is somewhat broken to begin with. Signed-off-by: Aleksey Dukhovniy <alex.dukhovniy@googlemail.com>
Summary: #1442 introduced new `Instance.Spec.PlanExecution.Status` field which duplicates part of the `Instance.Spec.PlanStatus` information . With that, plan execution status is now saved three times: in `planExecution`, `aggregatedStatus` and the corresponding `planStatus` fields e.g.: ```yaml apiVersion: kudo.dev/v1beta1 kind: Instance spec: planExecution: planName: deploy status: IN_PROGRESS status: aggregatedStatus: activePlanName: deploy status: IN_PROGRESS planStatus: deploy: name: deploy phases: - name: deploy status: IN_PROGRESS steps: - name: app status: IN_PROGRESS status: IN_PROGRESS ``` `aggregatedStatus` is completely duplicating `planExecution` while `planStatus` provides extended information on individual phases and steps. This PR removes `aggregatedStatus` field in favor of `planExecution`. The only caveat is that we previously kept `aggregatedStatus.status` value even **after** the plan was finished to signal how _last_ plan execution ended. However, `kudo plan status` already calculates and displays this information from the corresponding `planStatus`. Additionally, having `aggregatedStatus.activePlanName` populated when no plan is active is somewhat broken, to begin with. Signed-off-by: Aleksey Dukhovniy <alex.dukhovniy@googlemail.com>
Summary:
the tests discovered a bug in the instance admission controller (IAC) where IAC was trying to reset
PlanExecution.PlanName
when a plan becomes terminal. However, it wasn't doing this because:Instance.Status
was being updated (Status is a sub-resource) andInstance
resource can not be changed uponStatus
subresource updates (any resource is only allowed to modify itself from the webhook)To fix this problem we would either need to merge
Status
back into theInstance
resource or duplicate part of theStatus
information in theInstance.Spec
. After long discussions, we decided to introduce a newPlanExecution.Status
field which is populated by the instance controller and duplicates the correspondingStatus.PlanStatus
field.