Skip to content

Conversation

@dexhorthy
Copy link
Contributor

this uses go template with to skip these on non-kots apps. I really want these install scripits to be sent down from the server side, but for now they are built by the client in vendor.replicated.com, so we'll build them in the client here as well.

$ replicated channel inspect dextestxxxxx
ID:             _-0LiRWGjBG2-VtJIr0F127QPiuR7T6M
NAME:           dextestxxxxx
DESCRIPTION:
RELEASE:        11
VERSION:        0.0.1
EXISTING:

    curl -fsSL https://kots.io/install | bash
    kubectl kots install kots-dex/dextestxxxxx

EMBEDDED:

    curl -fsSL https://k8s.kurl.sh/kots-dex-dextestxxxxx | sudo bash

AIRGAP:

   curl -fsSL -o kots-dex-dextestxxxxx.tar.gz https://k8s.kurl.sh/bundle/kots-dex-dextestxxxxx.tar.gz
   tar xvf kots-dex-dextestxxxxx.tar.gz
   sudo bash ./install.sh airgap

Other stuff

  • Move KOTS ListChannels call to vendor v3 API, this involved passing app slug down into a bunch of methods
  • added appSlug to *cmd.runner during the Pre-Run function
  • refactored the common "find channel by name" logic onto Client instead of duplicating it on each client impl

)

func (c *Client) ListChannels(appID string, appType string) ([]types.Channel, error) {
func (c *Client) ListChannels(appID string, appType string, appSlug string) ([]types.Channel, error) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you're gonna start seeing appSlug passed in everywhere because the vendor/v3 endpoint uses it to list channels.

}

func (c *Client) GetChannelByName(appID string, appType string, name string, description string, createIfAbsent bool) (*types.Channel, error) {
func (c *Client) GetOrCreateChannelByName(appID string, appType string, appSlug string, name string, description string, createIfAbsent bool) (*types.Channel, error) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method is refactored from each individual Platform/Ship/KOTS client, because the logic is basically the same.


return fmt.Sprintf(` curl -fsSL -o %s.tar.gz %s
tar xvf %s.tar.gz
sudo bash ./install.sh airgap`, slug, kurlURL, slug)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm just spitballin over here folks but this seems useful

Channels []*KotsChannel `json:"channels"`
}

func (c *HTTPClient) ListChannels(appID string, appSlug string) ([]types.Channel, error) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here's the new vendor v3 impl, it also attaches the install commands 🙂

this uses go template `with` to skip these on non-kots apps. I really want these install scripits to be sent down from the server side, but for now they are built by the client in vendor.replicated.com, so we'll build them in the client here as well.

```
$ replicated channel inspect dextestxxxxx
ID:             _-0LiRWGjBG2-VtJIr0F127QPiuR7T6M
NAME:           dextestxxxxx
DESCRIPTION:
RELEASE:        11
VERSION:        0.0.1
EXISTING:

    curl -fsSL https://kots.io/install | bash
    kubectl kots install kots-dex/dextestxxxxx

EMBEDDED:

    curl -fsSL https://k8s.kurl.sh/kots-dex-dextestxxxxx | sudo bash

AIRGAP:

   curl -fsSL -o kots-dex-dextestxxxxx.tar.gz https://k8s.kurl.sh/bundle/kots-dex-dextestxxxxx.tar.gz
   tar xvf kots-dex-dextestxxxxx.tar.gz
   sudo bash ./install.sh airgap

```

Other stuff
----------

- Move KOTS ListChannels call to vendor v3 API, this involved passing app slug down into a bunch of methods
- added appSlug to `*cmd.runner` during the Pre-Run function
- refactored the common "find channel by name" logic onto `Client` instead of duplicating it on each client impl
@dexhorthy dexhorthy requested a review from laverya August 26, 2020 02:37
go.mod Outdated
golang.org/x/crypto v0.0.0-20200728195943-123391ffb6de
golang.org/x/sys v0.0.0-20200413165638-669c56c373c4 // indirect
gopkg.in/yaml.v2 v2.3.0 // indirect
github.com/ulikunitz/xz v0.5.8
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this feels improperly formatted
not really a problem

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no it was bothering me too I'll fix it

@dexhorthy dexhorthy merged commit 11dc336 into master Sep 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants