-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
install operator with no custom values in install2 (#1756)
* install operator with no custom values in install2 * check installation state is installed in install2 tests * use CRD based installation type * use correct CRD kind, apply multiple CRDs, wait for right condition * recreate crd object for second loop * add loading spinner, decrease wait times, remove debug logs * allow crd to be taken over by helm * remove prefix from installation name * formatting * set installation status after upgrade * Revert "set installation status after upgrade" This reverts commit 1b6cd62. * Revert "remove prefix from installation name" This reverts commit 226950b.
- Loading branch information
Showing
12 changed files
with
217 additions
and
95 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package charts | ||
|
||
// this package is used to embed the installation CRD file into the binary | ||
|
||
import _ "embed" | ||
|
||
//go:embed embedded-cluster-operator/charts/crds/templates/resources.yaml | ||
var InstallationCRDFile string |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
pkg/addons2/embeddedclusteroperator/embeddedclusteroperator.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package embeddedclusteroperator | ||
|
||
import ( | ||
_ "embed" | ||
|
||
"github.com/pkg/errors" | ||
"github.com/replicatedhq/embedded-cluster/pkg/release" | ||
"gopkg.in/yaml.v2" | ||
) | ||
|
||
type EmbeddedClusterOperator struct{} | ||
|
||
const ( | ||
releaseName = "embedded-cluster-operator" | ||
namespace = "embedded-cluster" | ||
) | ||
|
||
var ( | ||
//go:embed static/values.tpl.yaml | ||
rawvalues []byte | ||
// helmValues is the unmarshal version of rawvalues. | ||
helmValues map[string]interface{} | ||
//go:embed static/metadata.yaml | ||
rawmetadata []byte | ||
// Metadata is the unmarshal version of rawmetadata. | ||
Metadata release.AddonMetadata | ||
) | ||
|
||
func init() { | ||
if err := yaml.Unmarshal(rawmetadata, &Metadata); err != nil { | ||
panic(errors.Wrap(err, "unable to unmarshal metadata")) | ||
} | ||
hv, err := release.RenderHelmValues(rawvalues, Metadata) | ||
if err != nil { | ||
panic(errors.Wrap(err, "unable to unmarshal values")) | ||
} | ||
helmValues = hv | ||
} | ||
|
||
func (a *EmbeddedClusterOperator) Name() string { | ||
return "Embedded Cluster Operator" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package embeddedclusteroperator | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/pkg/errors" | ||
"github.com/replicatedhq/embedded-cluster/pkg/helm" | ||
"github.com/replicatedhq/embedded-cluster/pkg/spinner" | ||
"sigs.k8s.io/controller-runtime/pkg/client" | ||
) | ||
|
||
func (o *EmbeddedClusterOperator) Install(ctx context.Context, kcli client.Client, hcli *helm.Helm, writer *spinner.MessageWriter) error { | ||
if err := o.prepare(); err != nil { | ||
return errors.Wrap(err, "prepare metrics operator") | ||
} | ||
|
||
_, err := hcli.Install(ctx, helm.InstallOptions{ | ||
ReleaseName: releaseName, | ||
ChartPath: Metadata.Location, | ||
ChartVersion: Metadata.Version, | ||
Values: helmValues, | ||
Namespace: namespace, | ||
}) | ||
if err != nil { | ||
return errors.Wrap(err, "install metrics operator") | ||
} | ||
|
||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package embeddedclusteroperator | ||
|
||
import ( | ||
"github.com/pkg/errors" | ||
) | ||
|
||
func (a *EmbeddedClusterOperator) prepare() error { | ||
if err := a.generateHelmValues(); err != nil { | ||
return errors.Wrap(err, "generate helm values") | ||
} | ||
|
||
return nil | ||
} | ||
|
||
func (a *EmbeddedClusterOperator) generateHelmValues() error { | ||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# | ||
# this file is automatically generated by buildtools. manual edits are not recommended. | ||
# to regenerate this file, run the following commands: | ||
# | ||
# $ make buildtools | ||
# $ output/bin/buildtools update addon <addon name> | ||
# | ||
version: 1.19.0+k8s-1.30 | ||
location: oci://proxy.replicated.com/anonymous/registry.replicated.com/library/embedded-cluster-operator | ||
images: | ||
embedded-cluster-operator: | ||
repo: proxy.replicated.com/anonymous/replicated/embedded-cluster-operator-image | ||
tag: | ||
amd64: v1.19.0-k8s-1.30 | ||
arm64: v1.19.0-k8s-1.30 | ||
utils: | ||
repo: proxy.replicated.com/anonymous/replicated/ec-utils | ||
tag: | ||
amd64: latest | ||
arm64: latest |
10 changes: 10 additions & 0 deletions
10
pkg/addons2/embeddedclusteroperator/static/values.tpl.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
global: | ||
labels: | ||
replicated.com/disaster-recovery: infra | ||
replicated.com/disaster-recovery-chart: embedded-cluster-operator | ||
{{- if .ReplaceImages }} | ||
image: | ||
repository: '{{ (index .Images "embedded-cluster-operator").Repo }}' | ||
tag: '{{ index (index .Images "embedded-cluster-operator").Tag .GOARCH }}' | ||
utilsImage: '{{ ImageString (index .Images "utils") }}' | ||
{{- end }} |
Oops, something went wrong.