Skip to content

Commit

Permalink
Michael's feedback #2
Browse files Browse the repository at this point in the history
  • Loading branch information
gfichtenholt committed Sep 13, 2021
1 parent 4dfc48a commit 8291486
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
12 changes: 10 additions & 2 deletions cmd/kubeapps-apis/plugins/fluxv2/packages/v1alpha1/release.go
Original file line number Diff line number Diff line change
Expand Up @@ -375,11 +375,19 @@ func (s *Server) newRelease(ctx context.Context, packageRef *corev1.AvailablePac

// returns 3 things:
// - ready: whether the HelmRelease object is in a ready state
// - reason: one of SUCCESS/FAILURE/PENDING/UNKNOWN, if present
// - reason: one of SUCCESS/FAILURE/PENDING/UNSPECIFIED,
// - userReason: textual description of why the object is in current state, if present
// docs:
// 1. https://fluxcd.io/docs/components/helm/helmreleases/#examples
// 2. discussion on https://vmware.slack.com/archives/C4HEXCX3N/p1630907107078800.
// 2. discussion on private slack channel. Summary:
// - "ready" field: - it's not indicating that the resource has completed (i.e. whether the task
// completed with install or failure), but rather just whether the resource is ready or not.
// So it can be false because of either a final state (failure) or a pending state
// (reconciliation in progress or whatever). That means the ready flag will only be set to true
// when install completes with success
// - "reason" field: failure only when flux returns "InstallFailed" reason
// otherwise pending or unspecified when there are no status conditions to go by
//
func isHelmReleaseReady(unstructuredObj map[string]interface{}) (ready bool, status corev1.InstalledPackageStatus_StatusReason, userReason string) {
if !checkGeneration(unstructuredObj) {
return false, corev1.InstalledPackageStatus_STATUS_REASON_UNSPECIFIED, ""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ func TestKindClusterCreateInstalledPackage(t *testing.T) {
expectedDetail: expected_detail_with_values,
expectedPodPrefix: "@TARGET_NS@-my-podinfo-4-",
},
// TODO: (gfichtenholt) negative case
}

rand.Seed(time.Now().UnixNano())
Expand Down Expand Up @@ -130,7 +131,7 @@ func TestKindClusterCreateInstalledPackage(t *testing.T) {
} else if i == maxWait {
t.Fatalf("Timed out waiting for available package [%s], last error: [%v]", availablePackageRef, err)
} else {
t.Logf("waiting 1s for repository [%s] to be indexed, attempt [%d/%d]...", idParts[0], i+1, maxWait)
t.Logf("Waiting 1s for repository [%s] to be indexed, attempt [%d/%d]...", idParts[0], i+1, maxWait)
time.Sleep(1 * time.Second)
}
}
Expand Down

0 comments on commit 8291486

Please sign in to comment.