upbound / up

The @upbound CLI
Apache License 2.0
52 stars 41 forks source link

feat(cli): add sos-report option in cli #438

Closed haarchri closed 4 months ago

haarchri commented 7 months ago

Description of your changes

Whenever I tackle incidents, I find myself repeatedly asking the same set of questions: what version of XP/UXP is in use along with the arguments, which providers and functions are present, and could I see the revisions, etc. To streamline this process this PR will do:

configurations.pkg.crossplane.io
configurationrevisions.pkg.crossplane.io
controllerconfigs.pkg.crossplane.io
deploymentruntimeconfigs.pkg.crossplane.io
functions.pkg.crossplane.io
functionrevisions.pkg.crossplane.io
locks.pkg.crossplane.io                 
providers.pkg.crossplane.io             
providerrevisions.pkg.crossplane.io    

Fixes #

I have:

How has this code been tested

up alpha sos export
Starting SOS Report...
  ✓   Scanning control plane... 23 types found! 👀                                                                                                                                                                                                                                                  
  ✓   Exporting sos report resources...  exported! 📤                                                                                                                                                                                                                                               
  ✓   Report state... archived to "xp-sos-report.tar.gz"! 📦                                                                                                                                                                                                                                        

Successfully exported SOS Report!
33396286 -rw-------@  1 haarchri  staff    6961 Mar  8 14:43 xp-sos-report.tar.gz
├── configurationrevisions.pkg.crossplane.io
│   ├── cluster
│   │   ├── mxp-control-plane-9b247788e429.yaml
│   │   ├── mxp-host-cluster-4095fee546e3.yaml
│   │   └── provider-host-cluster-143e26de42cf.yaml
│   └── metadata.yaml
├── configurations.pkg.crossplane.io
│   ├── cluster
│   │   ├── mxp-control-plane.yaml
│   │   ├── mxp-host-cluster.yaml
│   │   └── provider-host-cluster.yaml
│   └── metadata.yaml
├── deploymentruntimeconfigs.pkg.crossplane.io
│   ├── cluster
│   │   ├── default.yaml
│   │   ├── provider-helm.yaml
│   │   └── provider-kubernetes.yaml
│   └── metadata.yaml
├── functionrevisions.pkg.crossplane.io
│   ├── cluster
│   │   ├── function-auto-ready-59637c63012e.yaml
│   │   └── function-sequencer-addb5d6142dd.yaml
│   └── metadata.yaml
├── functions.pkg.crossplane.io
│   ├── cluster
│   │   ├── function-auto-ready.yaml
│   │   ├── function-sequencer.yaml
│   │   └── spaces-composer.yaml
│   └── metadata.yaml
├── information.yaml
├── locks.pkg.crossplane.io
│   ├── cluster
│   │   └── lock.yaml
│   └── metadata.yaml
├── providerrevisions.pkg.crossplane.io
│   ├── cluster
│   │   ├── provider-helm-839e04a83ec3.yaml
│   │   └── provider-kubernetes-6ef2ebb6f1db.yaml
│   └── metadata.yaml
└── providers.pkg.crossplane.io
    ├── cluster
    │   ├── provider-helm.yaml
    │   └── provider-kubernetes.yaml
    └── metadata.yaml

17 directories, 29 file
version: v1alpha1
exportedAt: 2024-03-08T13:43:30.768132Z
crossplane:
    distribution: universal-crossplane-1.14.6-up.1
    namespace: upbound-system
    version: 1.14.6-up.1
    featureFlags:
        - --enable-usages
providers:
    - name: provider-helm
      package: xpkg.upbound.io/crossplane-contrib/provider-helm:v0.17.0
    - name: provider-kubernetes
      package: xpkg.upbound.io/crossplane-contrib/provider-kubernetes:v0.12.1
functions:
    - name: function-auto-ready
      package: xpkg.upbound.io/upbound/function-auto-ready:v0.2.1
    - name: function-sequencer
      package: xpkg.upbound.io/crossplane-contrib/function-sequencer:v0.1.1
stats:
    total: 756
    customResources:
        compositeresourcedefinitions.apiextensions.crossplane.io: 6
        compositionrevisions.apiextensions.crossplane.io: 6
        compositions.apiextensions.crossplane.io: 6
        configurationrevisions.pkg.crossplane.io: 3
        configurations.pkg.crossplane.io: 3
        controllerconfigs.pkg.crossplane.io: 0
        deploymentruntimeconfigs.pkg.crossplane.io: 3
        environmentconfigs.apiextensions.crossplane.io: 0
        functionrevisions.pkg.crossplane.io: 3
        functions.pkg.crossplane.io: 3
        gotemplates.gotemplating.fn.crossplane.io: 0
        inputs.sequencer.fn.crossplane.io: 0
        locks.pkg.crossplane.io: 1
        objects.kubernetes.crossplane.io: 264
        providerconfigs.helm.crossplane.io: 9
        providerconfigs.kubernetes.crossplane.io: 10
        providerconfigusages.helm.crossplane.io: 78
        providerconfigusages.kubernetes.crossplane.io: 264
        providerrevisions.pkg.crossplane.io: 2
        providers.pkg.crossplane.io: 2
        releases.helm.crossplane.io: 78
        storeconfigs.secrets.crossplane.io: 1
        usages.apiextensions.crossplane.io: 14
cwilhit commented 6 months ago

Having a CLI command to collect diagnostic to send back to Upbound seems helpful at both control plane level and space level. Given that, would it make sense to have these nested under up ctp? That is, up alpha ctp .... And then we could have separate similar commands for self-hosted Spaces (whenever thay may be)

Also would having the command be diagnostic instead of sos make more sense? Broader understanding, in my opinion.

haarchri commented 6 months ago

the command uses the current context - so that could be Crossplane, UXP, Spaces or a managed CTP - i am open to switch the command if we have same understanding

haarchri commented 6 months ago

btw redhat is going the way with sosreport https://access.redhat.com/solutions/3592

cwilhit commented 6 months ago

OK fair enough, I'm on board