Skip to content

Commit

Permalink
fix operator binary metadata path (#1367)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
laverya authored Oct 23, 2024
1 parent 34a3b29 commit adc8a2c
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 2 deletions.
5 changes: 5 additions & 0 deletions operator/deploy/melange.tmpl.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ pipeline:
- runs: |
set -exuo pipefail
# remove a 'v' prefix from the version if it exists
if [[ ${VERSION:0:1} == "v" ]]; then
export VERSION=${VERSION:1}
fi
make -C operator build
cp operator/bin/manager "${{targets.contextdir}}/manager"
- uses: strip
4 changes: 4 additions & 0 deletions operator/pkg/charts/charts.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (
"github.com/replicatedhq/embedded-cluster/pkg/defaults"
"github.com/replicatedhq/embedded-cluster/pkg/metrics"
"github.com/replicatedhq/embedded-cluster/pkg/release"
"github.com/replicatedhq/embedded-cluster/pkg/versions"
kotsv1beta1 "github.com/replicatedhq/kotskinds/apis/kots/v1beta1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
Expand Down Expand Up @@ -96,8 +97,11 @@ func generateHelmConfigs(ctx context.Context, in *clusterv1beta1.Installation, c
if err != nil {
return nil, fmt.Errorf("unable to get operator images: %w", err)
}
// 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
// those values depend on the sha256 of the compiled binary itself
embeddedclusteroperator.Metadata.Images = oi
embeddedclusteroperator.Metadata.Location = operatorLocation
embeddedclusteroperator.Metadata.Version = versions.Version
embeddedclusteroperator.Render()

migrationStatus := k8sutil.CheckConditionStatus(in.Status, registry.RegistryMigrationStatusConditionType)
Expand Down
2 changes: 1 addition & 1 deletion operator/pkg/charts/charts_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,7 @@ func test_replaceAddonMeta() {
embeddedclusteroperator.Metadata = release.AddonMetadata{
Location: "oci://proxy.replicated.com/anonymous/registry.replicated.com/library/embedded-cluster-operator",
}
versions.Version = "1.2.3-operator" // This is not great, the operator addon uses this to determine what version to deploy
versions.Version = "1.2.3-operator" // This is not great, we use this to override the version of the operator chart
// we can't use the version from the metadata because it won't be set in the operator binary
// TODO fix this

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ func Render() {
helmValues["kotsVersion"] = adminconsole.Metadata.Version
helmValues["embeddedClusterVersion"] = versions.Version
helmValues["embeddedClusterK0sVersion"] = versions.K0sVersion
Metadata.Version = versions.Version
}

// EmbeddedClusterOperator manages the installation of the embedded cluster operator
Expand Down

0 comments on commit adc8a2c

Please sign in to comment.