Skip to content

Commit

Permalink
feat(plugins) Add helm diff to status (#858)
Browse files Browse the repository at this point in the history
  • Loading branch information
gciezkowski-acc committed Feb 7, 2025
1 parent a261b17 commit 5335562
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 0 deletions.
4 changes: 4 additions & 0 deletions charts/manager/crds/greenhouse.sap_plugins.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,10 @@ spec:
HelmReleaseStatus reflects the status of the latest HelmChart release.
This is only configured if the pluginDefinition is backed by HelmChart.
properties:
diff:
description: Diff contains the difference between the deployed
helm chart and the helm chart in the last reconciliation
type: string
firstDeployed:
description: FirstDeployed is the timestamp of the first deployment
of the release.
Expand Down
8 changes: 8 additions & 0 deletions e2e/plugin/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,14 @@ var _ = Describe("Plugin E2E", Ordered, func() {
g.Expect(err).NotTo(HaveOccurred())
}).Should(Succeed())

By("Check the diff status")
Eventually(func(g Gomega) {
err = adminClient.Get(ctx, client.ObjectKey{Name: testPlugin.Name, Namespace: env.TestNamespace}, testPlugin)
g.Expect(err).NotTo(HaveOccurred())
g.Expect(testPlugin.Status.HelmReleaseStatus).ToNot(BeNil())
g.Expect(len(testPlugin.Status.HelmReleaseStatus.Diff) > 0).To(BeTrue())
}).Should(Succeed())

By("Check replicas in deployment list")
Eventually(func(g Gomega) {
err = remoteClient.List(ctx, deploymentList, client.InNamespace(env.TestNamespace))
Expand Down
2 changes: 2 additions & 0 deletions pkg/apis/greenhouse/v1alpha1/plugin_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,8 @@ type HelmReleaseStatus struct {
LastDeployed metav1.Time `json:"lastDeployed,omitempty"`
// PluginOptionChecksum is the checksum of plugin option values.
PluginOptionChecksum string `json:"pluginOptionChecksum,omitempty"`
// Diff contains the difference between the deployed helm chart and the helm chart in the last reconciliation
Diff string `json:"diff,omitempty"`
}

//+kubebuilder:object:root=true
Expand Down
1 change: 1 addition & 0 deletions pkg/controllers/plugin/plugin_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,7 @@ func (r *PluginReconciler) reconcileStatus(ctx context.Context,
Status: "unknown",
FirstDeployed: metav1.Time{},
LastDeployed: metav1.Time{},
Diff: pluginStatus.HelmReleaseStatus.Diff,
}
)

Expand Down

0 comments on commit 5335562

Please sign in to comment.