Skip to content
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
2 changes: 1 addition & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
# Hash of Go module dependencies.
# Update this after changing go.mod/go.sum:
# task nix-update-hash
vendorHash = "sha256-+VvpuUSdZqqfz6CzCjrgDxN8QTYaFO8fp9GiASiaY8k=";
vendorHash = "sha256-BV3Wapjf3VY1JI8nUXSbd71zROuDfIPimlig8h/reLk=";

env.CGO_ENABLED = 0;

Expand Down
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ require (
github.com/zalando/go-keyring v0.2.8
go.miloapis.com/activity v0.7.1
go.miloapis.com/milo v0.29.3
go.miloapis.com/service-catalog v0.3.2-0.20260714000123-a002414738b7
golang.org/x/mod v0.37.0
golang.org/x/oauth2 v0.36.0
golang.org/x/term v0.44.0
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,8 @@ go.miloapis.com/activity v0.7.1 h1:e2c4xVISMA10QQJwPv8pT8U1T1xS3eTGhy8FJHXOKvY=
go.miloapis.com/activity v0.7.1/go.mod h1:Sh2Irbq6siJcfq17nLjHvm4JHN/2Csc5YCHB+ycz20c=
go.miloapis.com/milo v0.29.3 h1:x9dK3gKNtY8VERK2b0DkYpjekiOh3U42kvT5FiYtrXM=
go.miloapis.com/milo v0.29.3/go.mod h1:p9O2kk194mvoL8rhqjwb+LWB+GIyY4vQqiTowwibVWo=
go.miloapis.com/service-catalog v0.3.2-0.20260714000123-a002414738b7 h1:KFVt4meD7dMhi0KSTyFq1BeFZ8/AS/mJ+ymLsxZA7Wo=
go.miloapis.com/service-catalog v0.3.2-0.20260714000123-a002414738b7/go.mod h1:chpaRFLTMODPZBEc7gOx3/e58loYBPSKHCojdKompXA=
go.opentelemetry.io/otel v1.41.0 h1:YlEwVsGAlCvczDILpUXpIpPSL/VPugt7zHThEMLce1c=
go.opentelemetry.io/otel v1.41.0/go.mod h1:Yt4UwgEKeT05QbLwbyHXEwhnjxNO6D8L5PQP51/46dE=
go.opentelemetry.io/otel/trace v1.41.0 h1:Vbk2co6bhj8L59ZJ6/xFTskY+tGAbOnCtQGVVa9TIN0=
Expand Down
34 changes: 34 additions & 0 deletions internal/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ import (

"github.com/spf13/cobra"
activity "go.miloapis.com/activity/pkg/cmd"
servicescmd "go.miloapis.com/service-catalog/pkg/cmd"
"k8s.io/cli-runtime/pkg/genericclioptions"
"k8s.io/client-go/rest"
"k8s.io/client-go/transport"
componentversion "k8s.io/component-base/version"
"k8s.io/kubectl/pkg/cmd/apiresources"
Expand Down Expand Up @@ -708,6 +710,19 @@ Specify the resource type and name to view its history.`
}
rootCmd.AddCommand(activityCmd)

servicesCatalogCfg, servicesProjectCfg := servicesRESTConfigs(factory)
servicesCmd := servicescmd.NewServicesCommand(servicescmd.ServicesCommandOptions{
IOStreams: ioStreams,
CatalogRESTConfig: servicesCatalogCfg,
ProjectRESTConfig: servicesProjectCfg,
Project: func() (string, error) {
project, _, _, err := factory.ConfigFlags.ResolvedScope()
return project, err
},
})
servicesCmd.GroupID = "other"
rootCmd.AddCommand(servicesCmd)

docsCmd := docs.Command(rootCmd)
docsCmd.GroupID = "other"
rootCmd.AddCommand(docsCmd)
Expand Down Expand Up @@ -737,6 +752,25 @@ Specify the resource type and name to view its history.`
// the root command pointer so concurrent test invocations don't collide.
var activeUpdateChecker = map[*cobra.Command]*updatecheck.Checker{}

// servicesRESTConfigs builds the two lazy REST-config resolvers the services
// command needs from one factory: Service lives only at the platform-wide root
// while ServiceEntitlement lives only in a project VCP, so there is no single
// scope that serves both. The catalog resolver temporarily forces
// platform-wide scope on the shared flags and restores them afterward.
func servicesRESTConfigs(factory *client.DatumCloudFactory) (catalog, project func() (*rest.Config, error)) {
flags := factory.ConfigFlags
catalog = func() (*rest.Config, error) {
origProject, origOrg, origPlatform := *flags.Project, *flags.Organization, *flags.PlatformWide
*flags.Project, *flags.Organization, *flags.PlatformWide = "", "", true
defer func() { *flags.Project, *flags.Organization, *flags.PlatformWide = origProject, origOrg, origPlatform }()
return flags.ToRESTConfig()
}
project = func() (*rest.Config, error) {
return flags.ToRESTConfig()
}
return
}

func startUpdateCheck(cmd *cobra.Command) {
if updatecheck.SkipFromEnvironment() {
return
Expand Down
3 changes: 2 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"github.com/spf13/cobra"
"go.datum.net/datumctl/internal/cmd"
customerrors "go.datum.net/datumctl/internal/errors"
"go.miloapis.com/service-catalog/pkg/activation"
"k8s.io/component-base/cli"
"k8s.io/component-base/logs"
kubectlcmd "k8s.io/kubectl/pkg/cmd"
Expand Down Expand Up @@ -39,7 +40,7 @@ func main() {

if err := cli.RunNoErrOutput(rootCmd); err != nil {
customerrors.Format(os.Stderr, err, formatFor(rootCmd), verbosity())
os.Exit(1)
os.Exit(activation.ExitCodeOf(err))
}
}

Expand Down