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

feat: Collect license used to install cluster in support bundles #1601

Conversation

banjoh
Copy link
Member

@banjoh banjoh commented Dec 10, 2024

What this PR does / why we need it:

  • Store license file used to install cluster in <data-dir>
  • Add host collector spec to collect the license in support bundle

Demo: https://asciinema.org/a/uhpIRKKc5C9k7MtP1ovI69Kte

I missed showing the file permissions of license.yaml in the demo

[evans] $ make ssh-node0
root@node0:/replicatedhq/embedded-cluster# ls -al /root/ec-data-dir/license.yaml
-r-------- 1 root root 5514 Dec 23 16:24 /root/ec-data-dir/license.yaml
root@node0:/replicatedhq/embedded-cluster#

Which issue(s) this PR fixes:

sc-116758

Does this PR require a test?

NONE

Does this PR require a release note?

Store installer license file in data-dir and add collect when generating a support bundle

Does this PR require documentation?

NONE

@banjoh banjoh marked this pull request as draft December 10, 2024 14:16
@banjoh banjoh force-pushed the evansmungai/sc-116758/include-license-in-host-support-bundles-generated branch from 41f52a8 to e5596a3 Compare December 23, 2024 08:55
Copy link

github-actions bot commented Dec 23, 2024

This PR has been released (on staging) and is available for download with a embedded-cluster-smoke-test-staging-app license ID.

Online Installer:

curl "https://staging.replicated.app/embedded/embedded-cluster-smoke-test-staging-app/ci/appver-dev-2054de7" -H "Authorization: $EC_SMOKE_TEST_LICENSE_ID" -o embedded-cluster-smoke-test-staging-app-ci.tgz

Airgap Installer (may take a few minutes before the airgap bundle is built):

curl "https://staging.replicated.app/embedded/embedded-cluster-smoke-test-staging-app/ci-airgap/appver-dev-2054de7?airgap=true" -H "Authorization: $EC_SMOKE_TEST_LICENSE_ID" -o embedded-cluster-smoke-test-staging-app-ci.tgz

Happy debugging!

@banjoh banjoh marked this pull request as ready for review December 23, 2024 16:53
Copy link
Member

@JGAntunes JGAntunes left a comment

Choose a reason for hiding this comment

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

Change LGTM overall, wondering what you think about adding a test for this changes?

My suggestion would be to piggy back on the dryrun tests we have for the install command (which should be relatively quick to do) here:

  • func TestDefaultInstallation(t *testing.T) {
    dr := dryrunInstall(t)
    // --- validate os env --- //
    assertEnv(t, dr.OSEnv, map[string]string{
    "TMPDIR": "/var/lib/embedded-cluster/tmp",
    "KUBECONFIG": "/var/lib/embedded-cluster/k0s/pki/admin.conf",
    })
    // --- validate commands --- //
    assertCommands(t, dr.Commands,
    []interface{}{
    regexp.MustCompile(`k0s install controller .* --data-dir /var/lib/embedded-cluster/k0s`),
    },
    false,
    )
    // --- validate host preflight spec --- //
    assertCollectors(t, dr.HostPreflightSpec.Collectors, map[string]struct {
    match func(*troubleshootv1beta2.HostCollect) bool
    validate func(*troubleshootv1beta2.HostCollect)
    }{

JGAntunes
JGAntunes previously approved these changes Dec 24, 2024
laverya
laverya previously approved these changes Dec 30, 2024
@laverya laverya enabled auto-merge (squash) December 30, 2024 14:43
@laverya laverya dismissed stale reviews from JGAntunes and themself via 375a623 December 30, 2024 18:06
@laverya
Copy link
Member

laverya commented Dec 30, 2024

well, that solution.... did not work
(two reasons: one is that the new location for the check also encountered the 'previous-stable' tests, which don't have this code yet, and another is that it also ran after restores which don't have the file either)

Copy link
Contributor

@jtuchscherer jtuchscherer left a comment

Choose a reason for hiding this comment

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

Went through the change with Andrew in person. Passing the short sha variable is not great, but it's a good solution for now

@laverya laverya merged commit 1bf2f6b into main Dec 30, 2024
67 checks passed
@laverya laverya deleted the evansmungai/sc-116758/include-license-in-host-support-bundles-generated branch December 30, 2024 23:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants