Skip to content

Commit

Permalink
Changed flagname to secretref
Browse files Browse the repository at this point in the history
also added a shorthand  for secretref flag

Signed-off-by: Devanshu <[email protected]>
  • Loading branch information
devanshuVmware committed Aug 28, 2024
1 parent c291116 commit e60acf8
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions cli/pkg/kctrl/cmd/package/repository/add_or_update.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ type AddOrUpdateOptions struct {
URL string
SemverTagConstraints string
CreateNamespace bool
Secret string
SecretRef string

DryRun bool

Expand Down Expand Up @@ -79,7 +79,7 @@ func NewAddCmd(o *AddOrUpdateOptions, flagsFactory cmdcore.FlagsFactory) *cobra.
// TODO consider how to support other repository types
cmd.Flags().StringVar(&o.URL, "url", "", "OCI registry url for package repository bundle (required)")
cmd.Flags().StringVar(&o.SemverTagConstraints, "semver-tag-constraints", "", "tag/semver constraint when tag is not present in URL (If both tags and semver are present, then tag gets precedence)")
cmd.Flags().StringVar(&o.Secret, "secret", "", "SecretRef name for imgpkgbundle, optional")
cmd.Flags().StringVarP(&o.SecretRef, "secretref", "s", "", "SecretRef name for imgpkgbundle, optional")
cmd.Flags().BoolVar(&o.DryRun, "dry-run", false, "Print YAML for resources being applied to the cluster without applying them, optional")

cmd.Flags().BoolVar(&o.CreateNamespace, "create-namespace", false, "Create the package repository namespace if not present (default false)")
Expand Down Expand Up @@ -121,7 +121,7 @@ func NewUpdateCmd(o *AddOrUpdateOptions, flagsFactory cmdcore.FlagsFactory) *cob

cmd.Flags().StringVarP(&o.URL, "url", "", "", "OCI registry url for package repository bundle (required)")
cmd.Flags().StringVarP(&o.SemverTagConstraints, "semver-tag-constraints", "", "", "tag/semver constraint when tag is not present in URL (If both tags and semver are present, then tag gets precedence)")
cmd.Flags().StringVarP(&o.Secret, "secret", "", "", "SecretRef name for imgpkgbundle, optional")
cmd.Flags().StringVarP(&o.SecretRef, "secretref", "s", "", "SecretRef name for imgpkgbundle, optional")

o.WaitFlags.Set(cmd, flagsFactory, &cmdcore.WaitFlagsOpts{
AllowDisableWait: true,
Expand Down Expand Up @@ -260,8 +260,8 @@ func (o *AddOrUpdateOptions) updateExistingPackageRepository(pkgr *kcpkg.Package
ImgpkgBundle: &kappctrl.AppFetchImgpkgBundle{Image: o.URL},
}

if o.Secret != "" {
pkgr.Spec.Fetch.ImgpkgBundle.SecretRef = &kappctrl.AppFetchLocalRef{Name: o.Secret}
if o.SecretRef != "" {
pkgr.Spec.Fetch.ImgpkgBundle.SecretRef = &kappctrl.AppFetchLocalRef{Name: o.SecretRef}
}

ref, err := name.ParseReference(o.URL, name.WeakValidation)
Expand Down Expand Up @@ -323,8 +323,8 @@ func (o AddOrUpdateOptions) dryRun() error {
},
}

if o.Secret != "" {
packageRepo.Spec.Fetch.ImgpkgBundle.SecretRef = &kappctrl.AppFetchLocalRef{Name: o.Secret}
if o.SecretRef != "" {
packageRepo.Spec.Fetch.ImgpkgBundle.SecretRef = &kappctrl.AppFetchLocalRef{Name: o.SecretRef}
}

ref, err := name.ParseReference(o.URL, name.WeakValidation)
Expand Down

0 comments on commit e60acf8

Please sign in to comment.