-
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.
feat: pull add on images through replicated proxy
replace add on image references in order to pull images using replicated proxy for oci artifacts.
- Loading branch information
1 parent
b6f2e17
commit c835732
Showing
20 changed files
with
1,006 additions
and
191 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
"strings" | ||
|
||
"github.com/sirupsen/logrus" | ||
"github.com/urfave/cli/v2" | ||
) | ||
|
||
var updateAdminConsoleAddonCommand = &cli.Command{ | ||
Name: "admin-console", | ||
Usage: "Updates the Admin Console addon", | ||
UsageText: environmentUsageText, | ||
Action: func(c *cli.Context) error { | ||
logrus.Infof("updating admin console addon") | ||
|
||
logrus.Infof("getting admin console latest tag") | ||
latest, err := GetLatestGitHubTag(c.Context, "replicatedhq", "kots-helm") | ||
if err != nil { | ||
return fmt.Errorf("failed to get admin console latest tag: %w", err) | ||
} | ||
logrus.Infof("latest tag found: %s", latest) | ||
|
||
latest = strings.TrimPrefix(latest, "v") | ||
original, err := GetMakefileVariable("ADMIN_CONSOLE_CHART_VERSION") | ||
if err != nil { | ||
return fmt.Errorf("unable to get value: %w", err) | ||
} else if latest == original && !c.Bool("force") { | ||
logrus.Infof("admin console chart version is already up-to-date: %s", original) | ||
return nil | ||
} | ||
|
||
logrus.Infof("updating makefile with admin console version") | ||
if err := SetMakefileVariable("ADMIN_CONSOLE_CHART_VERSION", latest); err != nil { | ||
return fmt.Errorf("failed to set admin console chart version: %w", err) | ||
} | ||
|
||
images := map[string]string{ | ||
"ADMIN_CONSOLE_IMAGE_TAG": "kotsadm/kotsadm", | ||
"ADMIN_CONSOLE_MIGRATIONS_IMAGE_TAG": "kotsadm/kotsadm-migrations", | ||
"ADMIN_CONSOLE_RQLITE_IMAGE_TAG": "kotsadm/rqlite", | ||
"ADMIN_CONSOLE_KURL_PROXY_IMAGE_TAG": "kotsadm/kurl-proxy", | ||
} | ||
|
||
for key, image := range images { | ||
tag, err := RenderOCIChartAndFindImageDigest( | ||
c.Context, | ||
"oci://registry.replicated.com/library/admin-console", | ||
"admin-console", | ||
latest, | ||
map[string]interface{}{ | ||
"kurlProxy": map[string]interface{}{ | ||
"enabled": true, | ||
}, | ||
}, | ||
image, | ||
) | ||
if err != nil { | ||
return fmt.Errorf("failed to find digest for image %s: %w", image, err) | ||
} | ||
|
||
logrus.Infof("updating makefile tag for image %s", image) | ||
if err := SetMakefileVariable(key, tag); err != nil { | ||
return fmt.Errorf("unable to update value: %w", err) | ||
} | ||
} | ||
|
||
logrus.Infof("admin console operator addon updated") | ||
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
Oops, something went wrong.