Skip to content

Commit adc8a2c

Browse files
authored
fix operator binary metadata path (#1367)
* move operator version override into operator charts code * attempt to remove extra v prefix from embedded-cluster metadata * trim * remove any 'v' prefix from the version as part of melange
1 parent 34a3b29 commit adc8a2c

File tree

4 files changed

+10
-2
lines changed

4 files changed

+10
-2
lines changed

operator/deploy/melange.tmpl.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@ pipeline:
2424
- runs: |
2525
set -exuo pipefail
2626
27+
# remove a 'v' prefix from the version if it exists
28+
if [[ ${VERSION:0:1} == "v" ]]; then
29+
export VERSION=${VERSION:1}
30+
fi
31+
2732
make -C operator build
2833
cp operator/bin/manager "${{targets.contextdir}}/manager"
2934
- uses: strip

operator/pkg/charts/charts.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import (
1818
"github.com/replicatedhq/embedded-cluster/pkg/defaults"
1919
"github.com/replicatedhq/embedded-cluster/pkg/metrics"
2020
"github.com/replicatedhq/embedded-cluster/pkg/release"
21+
"github.com/replicatedhq/embedded-cluster/pkg/versions"
2122
kotsv1beta1 "github.com/replicatedhq/kotskinds/apis/kots/v1beta1"
2223
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2324
)
@@ -96,8 +97,11 @@ func generateHelmConfigs(ctx context.Context, in *clusterv1beta1.Installation, c
9697
if err != nil {
9798
return nil, fmt.Errorf("unable to get operator images: %w", err)
9899
}
100+
// set the images, location, and version of the operator chart because the files compiled into the embedded-cluster-operator do not include the correct values
101+
// those values depend on the sha256 of the compiled binary itself
99102
embeddedclusteroperator.Metadata.Images = oi
100103
embeddedclusteroperator.Metadata.Location = operatorLocation
104+
embeddedclusteroperator.Metadata.Version = versions.Version
101105
embeddedclusteroperator.Render()
102106

103107
migrationStatus := k8sutil.CheckConditionStatus(in.Status, registry.RegistryMigrationStatusConditionType)

operator/pkg/charts/charts_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,7 @@ func test_replaceAddonMeta() {
457457
embeddedclusteroperator.Metadata = release.AddonMetadata{
458458
Location: "oci://proxy.replicated.com/anonymous/registry.replicated.com/library/embedded-cluster-operator",
459459
}
460-
versions.Version = "1.2.3-operator" // This is not great, the operator addon uses this to determine what version to deploy
460+
versions.Version = "1.2.3-operator" // This is not great, we use this to override the version of the operator chart
461461
// we can't use the version from the metadata because it won't be set in the operator binary
462462
// TODO fix this
463463

pkg/addons/embeddedclusteroperator/embeddedclusteroperator.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ func Render() {
6161
helmValues["kotsVersion"] = adminconsole.Metadata.Version
6262
helmValues["embeddedClusterVersion"] = versions.Version
6363
helmValues["embeddedClusterK0sVersion"] = versions.K0sVersion
64-
Metadata.Version = versions.Version
6564
}
6665

6766
// EmbeddedClusterOperator manages the installation of the embedded cluster operator

0 commit comments

Comments
 (0)