-
Notifications
You must be signed in to change notification settings - Fork 5
feat: preflight storage needed to perform airgap install #2336
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
Merged
banjoh
merged 49 commits into
main
from
evansmungai/sc-123579/take-airgap-bundle-size-into-account-when
Jul 29, 2025
Merged
Changes from 24 commits
Commits
Show all changes
49 commits
Select commit
Hold shift + click to select a range
0b06490
Add airgap bundle size to Installation CRD
banjoh e270d49
Generate operator CRDs
banjoh d54331b
Create airgapinfo package to parse airgap bundle metadata
banjoh 2143149
Store airgap bundle size in Installation custom resource
banjoh 668b930
Add airgap storage space to host preflights for controller nodes
banjoh 473f5e1
Add controller airgap storage space calculation
banjoh 46ca2d3
Separate airgap storage space preflight for controller and worker nodes
banjoh b88f435
Extract airgap.yaml once
banjoh 5e53eca
Fix failing tests
banjoh 9911048
Add airgap bundle size to Installation CRD
banjoh 3fff57f
Generate operator CRDs
banjoh a1e8816
Create airgapinfo package to parse airgap bundle metadata
banjoh a3d3847
Store airgap bundle size in Installation custom resource
banjoh 367c093
Add airgap storage space to host preflights for controller nodes
banjoh 69038ae
Add controller airgap storage space calculation
banjoh a1e0ee4
Separate airgap storage space preflight for controller and worker nodes
banjoh ee7964f
Extract airgap.yaml once
banjoh d93f5cf
Fix failing tests
banjoh 8691b79
Merge branch 'evansmungai/sc-123579/take-airgap-bundle-size-into-acco…
banjoh fb4f1b5
Comment out CI jobs
banjoh 05f7910
Fix imports
banjoh fc96cf4
Revert ci.yaml
banjoh 30e78de
Pass airgap info to the api
banjoh f72e05c
Merge remote-tracking branch 'origin/main' into evansmungai/sc-123579…
banjoh 5206aab
Move airgapInfo to preRunInstall
banjoh 5235538
Merge remote-tracking branch 'origin/main' into evansmungai/sc-123579…
banjoh 00f00dc
A few more refactorings
banjoh 9f3562b
Pass airgap info to infra manager
banjoh a8f86ba
Merge remote-tracking branch 'origin/main' into evansmungai/sc-123579…
banjoh b263856
Commit missing changes
banjoh ea2604e
Include embedded assets and k0s image to preflight calculation
banjoh b3c5911
Regenerate CRDs
banjoh f973cf0
Merge remote-tracking branch 'origin/main' into evansmungai/sc-123579…
banjoh f5fa0e6
Run go mod tidy
banjoh 73e1766
Rerun CRD generation
banjoh 184e13f
Add k0s image to test airgap bundle
banjoh d5f93ab
Update failing tests
banjoh 1e822cc
Run go fmt
banjoh 1673f4e
Add k0s image to test airgap bundles
banjoh 24557bf
Fix failing test
banjoh 111980f
Update cmd/installer/goods/materializer.go
banjoh 759b11c
Update pkg/airgap/airgapinfo.go
banjoh bdcbb56
Update pkg/airgap/airgapinfo.go
banjoh 49dbcf2
Changes from PR comments
banjoh a6d574a
Fix failing test
banjoh a32155d
Merge remote-tracking branch 'origin/main' into evansmungai/sc-123579…
banjoh f1151ff
Changes from manual testing
banjoh 79d5191
Merge remote-tracking branch 'origin/main' into evansmungai/sc-123579…
banjoh 41dc001
Fix failing test
banjoh File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,6 +14,7 @@ import ( | |
"github.com/replicatedhq/embedded-cluster/pkg/addons" | ||
"github.com/replicatedhq/embedded-cluster/pkg/addons/registry" | ||
addontypes "github.com/replicatedhq/embedded-cluster/pkg/addons/types" | ||
"github.com/replicatedhq/embedded-cluster/pkg/airgap" | ||
"github.com/replicatedhq/embedded-cluster/pkg/extensions" | ||
"github.com/replicatedhq/embedded-cluster/pkg/helm" | ||
"github.com/replicatedhq/embedded-cluster/pkg/kubeutils" | ||
|
@@ -98,6 +99,15 @@ func (m *infraManager) install(ctx context.Context, rc runtimeconfig.RuntimeConf | |
return fmt.Errorf("parse license: %w", err) | ||
} | ||
|
||
var airgapInfo *kotsv1beta1.Airgap | ||
if m.airgapBundle != "" { | ||
var err error | ||
airgapInfo, err = airgap.AirgapInfoFromPath(m.airgapBundle) | ||
if err != nil { | ||
return fmt.Errorf("failed to get airgap info: %w", err) | ||
} | ||
} | ||
|
||
if err := m.initComponentsList(license, rc); err != nil { | ||
return fmt.Errorf("init components: %w", err) | ||
} | ||
|
@@ -123,7 +133,7 @@ func (m *infraManager) install(ctx context.Context, rc runtimeconfig.RuntimeConf | |
} | ||
defer hcli.Close() | ||
|
||
in, err := m.recordInstallation(ctx, kcli, license, rc) | ||
in, err := m.recordInstallation(ctx, kcli, license, rc, airgapInfo) | ||
if err != nil { | ||
return fmt.Errorf("record installation: %w", err) | ||
} | ||
|
@@ -218,21 +228,28 @@ func (m *infraManager) installK0s(ctx context.Context, rc runtimeconfig.RuntimeC | |
return k0sCfg, nil | ||
} | ||
|
||
func (m *infraManager) recordInstallation(ctx context.Context, kcli client.Client, license *kotsv1beta1.License, rc runtimeconfig.RuntimeConfig) (*ecv1beta1.Installation, error) { | ||
func (m *infraManager) recordInstallation(ctx context.Context, kcli client.Client, license *kotsv1beta1.License, rc runtimeconfig.RuntimeConfig, airgapInfo *kotsv1beta1.Airgap) (*ecv1beta1.Installation, error) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this will no longer need to be an argument as |
||
logFn := m.logFn("metadata") | ||
|
||
// get the configured custom domains | ||
ecDomains := utils.GetDomains(m.releaseData) | ||
|
||
// extract airgap uncompressed size if airgap info is provided | ||
var airgapUncompressedSize int64 | ||
if airgapInfo != nil { | ||
airgapUncompressedSize = airgapInfo.Spec.UncompressedSize | ||
} | ||
|
||
// record the installation | ||
logFn("recording installation") | ||
in, err := kubeutils.RecordInstallation(ctx, kcli, kubeutils.RecordInstallationOptions{ | ||
IsAirgap: m.airgapBundle != "", | ||
License: license, | ||
ConfigSpec: m.getECConfigSpec(), | ||
MetricsBaseURL: netutils.MaybeAddHTTPS(ecDomains.ReplicatedAppDomain), | ||
RuntimeConfig: rc.Get(), | ||
EndUserConfig: m.endUserConfig, | ||
IsAirgap: m.airgapBundle != "", | ||
License: license, | ||
ConfigSpec: m.getECConfigSpec(), | ||
MetricsBaseURL: netutils.MaybeAddHTTPS(ecDomains.ReplicatedAppDomain), | ||
RuntimeConfig: rc.Get(), | ||
EndUserConfig: m.endUserConfig, | ||
AirgapUncompressedSize: airgapUncompressedSize, | ||
}) | ||
if err != nil { | ||
return nil, fmt.Errorf("record installation: %w", err) | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you follow the same pattern described here where you make airgapInfo a property of the manager and pass it with the function WithAirgapInfo?