Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix a bug with registry push/pull on detected but invalid clusters #1930

Merged
merged 6 commits into from
Aug 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions src/cmd/tools/crane.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ func init() {
if platform != "all" {
v1Platform, err = v1.ParsePlatform(platform)
if err != nil {
message.Fatalf(err, lang.CmdToolsRegistryInvalidPlatformErr, err.Error())
message.Fatalf(err, lang.CmdToolsRegistryInvalidPlatformErr, platform, err.Error())
}
}

Expand Down Expand Up @@ -137,7 +137,7 @@ func zarfCraneInternalWrapper(commandToWrap func(*[]crane.Option) *cobra.Command

wrappedCommand.RunE = func(cmd *cobra.Command, args []string) error {
if len(args) < imageNameArgumentIndex+1 {
message.Fatal(nil, lang.CmdToolsCraneNotEnoughArgumentsSpecified)
message.Fatal(nil, lang.CmdToolsCraneNotEnoughArgumentsErr)
}

// Try to connect to a Zarf initialized cluster otherwise then pass it down to crane.
Expand All @@ -146,10 +146,11 @@ func zarfCraneInternalWrapper(commandToWrap func(*[]crane.Option) *cobra.Command
return originalListFn(cmd, args)
}

// Load the state
// Load the state (if able)
zarfState, err := zarfCluster.LoadZarfState()
if err != nil {
return err
message.Warnf(lang.CmdToolsCraneConnectedButBadStateErr, err.Error())
return originalListFn(cmd, args)
}

// Check to see if it matches the existing internal address.
Expand Down
7 changes: 4 additions & 3 deletions src/config/lang/english.go
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,8 @@ const (
CmdToolsClearCacheSuccess = "Successfully cleared the cache from %s"
CmdToolsClearCacheFlagCachePath = "Specify the location of the Zarf artifact cache (images and git repositories)"

CmdToolsCraneNotEnoughArgumentsSpecified = "You do not have enough arguments specified."
CmdToolsCraneNotEnoughArgumentsErr = "You do not have enough arguments specified for this command"
CmdToolsCraneConnectedButBadStateErr = "Detected a K8s cluster but was unable to get Zarf state - continuing without state information: %s"

CmdToolsDownloadInitShort = "Downloads the init package for the current Zarf version into the specified directory"
CmdToolsDownloadInitFlagOutputDirectory = "Specify a directory to place the init package in."
Expand Down Expand Up @@ -421,7 +422,7 @@ const (
zarf tools wait-for http google.com success # wait for any 2xx response from http://google.com
`
CmdToolsWaitForFlagTimeout = "Specify the timeout duration for the wait command."
CmdToolsWaitForErrTimeoutString = "Invalid timeout duration. Please use a valid duration string (e.g. 1s, 2m, 3h)."
CmdToolsWaitForErrTimeoutString = "Invalid timeout duration '%s'. Please use a valid duration string (e.g. 1s, 2m, 3h)."
CmdToolsWaitForErrTimeout = "Wait timed out."
CmdToolsWaitForErrConditionString = "Invalid HTTP status code. Please use a valid HTTP status code (e.g. 200, 404, 500)."
CmdToolsWaitForErrZarfPath = "Could not locate the current Zarf binary path."
Expand Down Expand Up @@ -513,7 +514,7 @@ const (
var (
ErrInitNotFound = errors.New("this command requires a zarf-init package, but one was not found on the local system. Re-run the last command again without '--confirm' to download the package")
ErrUnableToCheckArch = errors.New("unable to get the configured cluster's architecture")
ErrInterrupt = errors.New("Failed due to interrupt")
ErrInterrupt = errors.New("execution cancelled due to an interrupt")
)

// Collection of reusable warn messages.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ spec:
- name: manager
resources:
limits:
cpu: 500m
memory: 1Gi
cpu: 200m
memory: 256Mi
requests:
cpu: 500m
memory: 1Gi
cpu: 100m
memory: 64Mi
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: kustomize-controller
namespace: flux-system
spec:
template:
spec:
containers:
- name: manager
resources:
limits:
cpu: 200m
memory: 256Mi
requests:
cpu: 100m
memory: 64Mi
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: notification-controller
namespace: flux-system
spec:
template:
spec:
containers:
- name: manager
resources:
limits:
cpu: 200m
memory: 256Mi
requests:
cpu: 100m
memory: 64Mi
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ spec:
resources:
limits:
cpu: 100m
memory: 384Mi
memory: 256Mi
requests:
cpu: 100m
memory: 384Mi
cpu: 50m
memory: 64Mi
2 changes: 2 additions & 0 deletions src/extensions/bigbang/test/package/zarf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ components:
fluxPatchFiles:
- flux-overrides-helm-controller.yaml
- flux-overrides-source-controller.yaml
- flux-overrides-kustomize-controller.yaml
- flux-overrides-notification-controller.yaml
valuesFiles:
- disable-all-bb###ZARF_PKG_TMPL_BB_MAJOR###.yaml
- enable-twistlock.yaml
Expand Down