Skip to content

Commit b4a10b9

Browse files
committed
Merge remote-tracking branch 'origin/main' into emosbaugh/sc-127648/spike-simplify-ec-release-process
2 parents 85d8efb + 43b02c3 commit b4a10b9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+1703
-165
lines changed

.github/workflows/ci.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -860,6 +860,7 @@ jobs:
860860
e2e:
861861
name: E2E # this name is used by .github/workflows/automated-prs-manager.yaml
862862
runs-on: ${{ matrix.runner || 'ubuntu-22.04' }}
863+
continue-on-error: ${{ matrix.continue-on-error || false }}
863864
needs:
864865
- build-install
865866
- build-upgrade
@@ -894,6 +895,8 @@ jobs:
894895
is-lxd: true
895896
- test: TestInstallWithMITMProxy
896897
is-lxd: true
898+
- test: TestSingleNodeNetworkReport
899+
continue-on-error: true
897900
steps:
898901
- name: Checkout
899902
uses: actions/checkout@v5

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ go.work.sum
1919
*.tmp
2020
.envrc
2121
.DS_Store
22+
.vscode
2223

2324
# Ignore preflight bundles generated during local dev
2425
preflightbundle*

Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -164,10 +164,10 @@ output/bins/kubectl-kots-%:
164164
output/bins/kubectl-kots-override:
165165
mkdir -p output/bins
166166
mkdir -p output/tmp
167-
if [[ "$(KOTS_BINARY_URL_OVERRIDE)" == ttl.sh* ]]; then \
168-
oras pull "$(KOTS_BINARY_URL_OVERRIDE)" --output output/tmp ; \
169-
else \
167+
if [[ "$(KOTS_BINARY_URL_OVERRIDE)" == http://* ]] || [[ "$(KOTS_BINARY_URL_OVERRIDE)" == https://* ]]; then \
170168
curl --retry 5 --retry-all-errors -fL -o output/tmp/kots.tar.gz "$(KOTS_BINARY_URL_OVERRIDE)" ; \
169+
else \
170+
oras pull "$(KOTS_BINARY_URL_OVERRIDE)" --output output/tmp ; \
171171
fi
172172
tar -xzf output/tmp/kots.tar.gz -C output/tmp
173173
mv output/tmp/kots $@

api/controllers/app/install/apppreflight.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import (
1717
type RunAppPreflightOptions struct {
1818
PreflightBinaryPath string
1919
ProxySpec *ecv1beta1.ProxySpec
20+
RegistrySettings *types.RegistrySettings
2021
ExtraPaths []string
2122
CleanupBinary bool
2223
}
@@ -47,7 +48,7 @@ func (c *InstallController) RunAppPreflights(ctx context.Context, opts RunAppPre
4748
}
4849

4950
// Extract app preflight spec from Helm charts
50-
appPreflightSpec, err := c.appReleaseManager.ExtractAppPreflightSpec(ctx, configValues, opts.ProxySpec)
51+
appPreflightSpec, err := c.appReleaseManager.ExtractAppPreflightSpec(ctx, configValues, opts.ProxySpec, opts.RegistrySettings)
5152
if err != nil {
5253
return fmt.Errorf("extract app preflight spec: %w", err)
5354
}

api/controllers/app/install/controller.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import (
1616
"github.com/replicatedhq/embedded-cluster/pkg/release"
1717
kotsv1beta1 "github.com/replicatedhq/kotskinds/apis/kots/v1beta1"
1818
"github.com/sirupsen/logrus"
19+
"k8s.io/cli-runtime/pkg/genericclioptions"
1920
kyaml "sigs.k8s.io/yaml"
2021
)
2122

@@ -47,6 +48,8 @@ type InstallController struct {
4748
clusterID string
4849
airgapBundle string
4950
privateCACertConfigMapName string
51+
restClientGetter genericclioptions.RESTClientGetter
52+
kubeConfigPath string
5053
}
5154

5255
type InstallControllerOption func(*InstallController)
@@ -129,6 +132,18 @@ func WithPrivateCACertConfigMapName(configMapName string) InstallControllerOptio
129132
}
130133
}
131134

135+
func WithRESTClientGetter(restClientGetter genericclioptions.RESTClientGetter) InstallControllerOption {
136+
return func(c *InstallController) {
137+
c.restClientGetter = restClientGetter
138+
}
139+
}
140+
141+
func WithKubeConfigPath(kubeConfigPath string) InstallControllerOption {
142+
return func(c *InstallController) {
143+
c.kubeConfigPath = kubeConfigPath
144+
}
145+
}
146+
132147
func NewInstallController(opts ...InstallControllerOption) (*InstallController, error) {
133148
controller := &InstallController{
134149
logger: logger.NewDiscardLogger(),
@@ -205,6 +220,8 @@ func NewInstallController(opts ...InstallControllerOption) (*InstallController,
205220
appinstallmanager.WithClusterID(controller.clusterID),
206221
appinstallmanager.WithAirgapBundle(controller.airgapBundle),
207222
appinstallmanager.WithAppInstallStore(controller.store.AppInstallStore()),
223+
appinstallmanager.WithRESTClientGetter(controller.restClientGetter),
224+
appinstallmanager.WithKubeConfigPath(controller.kubeConfigPath),
208225
)
209226
if err != nil {
210227
return nil, fmt.Errorf("create app install manager: %w", err)

api/controllers/app/install/test_suite.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ func (s *AppInstallControllerTestSuite) TestRunAppPreflights() {
190190
setupMocks: func(apm *apppreflightmanager.MockAppPreflightManager, arm *appreleasemanager.MockAppReleaseManager, acm *appconfig.MockAppConfigManager) {
191191
mock.InOrder(
192192
acm.On("GetConfigValues").Return(types.AppConfigValues{"test-item": types.AppConfigValue{Value: "test-value"}}, nil),
193-
arm.On("ExtractAppPreflightSpec", mock.Anything, types.AppConfigValues{"test-item": types.AppConfigValue{Value: "test-value"}}, mock.Anything).Return(expectedAPF, nil),
193+
arm.On("ExtractAppPreflightSpec", mock.Anything, types.AppConfigValues{"test-item": types.AppConfigValue{Value: "test-value"}}, mock.Anything, mock.Anything).Return(expectedAPF, nil),
194194
apm.On("RunAppPreflights", mock.Anything, mock.MatchedBy(func(opts apppreflightmanager.RunAppPreflightOptions) bool {
195195
return expectedAPF == opts.AppPreflightSpec
196196
})).Return(nil),
@@ -216,7 +216,7 @@ func (s *AppInstallControllerTestSuite) TestRunAppPreflights() {
216216
setupMocks: func(apm *apppreflightmanager.MockAppPreflightManager, arm *appreleasemanager.MockAppReleaseManager, acm *appconfig.MockAppConfigManager) {
217217
mock.InOrder(
218218
acm.On("GetConfigValues").Return(types.AppConfigValues{"test-item": types.AppConfigValue{Value: "test-value"}}, nil),
219-
arm.On("ExtractAppPreflightSpec", mock.Anything, types.AppConfigValues{"test-item": types.AppConfigValue{Value: "test-value"}}, mock.Anything).Return(expectedAPF, nil),
219+
arm.On("ExtractAppPreflightSpec", mock.Anything, types.AppConfigValues{"test-item": types.AppConfigValue{Value: "test-value"}}, mock.Anything, mock.Anything).Return(expectedAPF, nil),
220220
apm.On("RunAppPreflights", mock.Anything, mock.MatchedBy(func(opts apppreflightmanager.RunAppPreflightOptions) bool {
221221
return expectedAPF == opts.AppPreflightSpec
222222
})).Return(nil),
@@ -242,7 +242,7 @@ func (s *AppInstallControllerTestSuite) TestRunAppPreflights() {
242242
setupMocks: func(apm *apppreflightmanager.MockAppPreflightManager, arm *appreleasemanager.MockAppReleaseManager, acm *appconfig.MockAppConfigManager) {
243243
mock.InOrder(
244244
acm.On("GetConfigValues").Return(types.AppConfigValues{"test-item": types.AppConfigValue{Value: "test-value"}}, nil),
245-
arm.On("ExtractAppPreflightSpec", mock.Anything, types.AppConfigValues{"test-item": types.AppConfigValue{Value: "test-value"}}, mock.Anything).Return(expectedAPF, nil),
245+
arm.On("ExtractAppPreflightSpec", mock.Anything, types.AppConfigValues{"test-item": types.AppConfigValue{Value: "test-value"}}, mock.Anything, mock.Anything).Return(expectedAPF, nil),
246246
apm.On("RunAppPreflights", mock.Anything, mock.MatchedBy(func(opts apppreflightmanager.RunAppPreflightOptions) bool {
247247
return expectedAPF == opts.AppPreflightSpec
248248
})).Return(nil),
@@ -268,7 +268,7 @@ func (s *AppInstallControllerTestSuite) TestRunAppPreflights() {
268268
setupMocks: func(apm *apppreflightmanager.MockAppPreflightManager, arm *appreleasemanager.MockAppReleaseManager, acm *appconfig.MockAppConfigManager) {
269269
mock.InOrder(
270270
acm.On("GetConfigValues").Return(types.AppConfigValues{"test-item": types.AppConfigValue{Value: "test-value"}}, nil),
271-
arm.On("ExtractAppPreflightSpec", mock.Anything, types.AppConfigValues{"test-item": types.AppConfigValue{Value: "test-value"}}, mock.Anything).Return(expectedAPF, nil),
271+
arm.On("ExtractAppPreflightSpec", mock.Anything, types.AppConfigValues{"test-item": types.AppConfigValue{Value: "test-value"}}, mock.Anything, mock.Anything).Return(expectedAPF, nil),
272272
apm.On("RunAppPreflights", mock.Anything, mock.MatchedBy(func(opts apppreflightmanager.RunAppPreflightOptions) bool {
273273
return expectedAPF == opts.AppPreflightSpec
274274
})).Return(nil),
@@ -294,7 +294,7 @@ func (s *AppInstallControllerTestSuite) TestRunAppPreflights() {
294294
setupMocks: func(apm *apppreflightmanager.MockAppPreflightManager, arm *appreleasemanager.MockAppReleaseManager, acm *appconfig.MockAppConfigManager) {
295295
mock.InOrder(
296296
acm.On("GetConfigValues").Return(types.AppConfigValues{"test-item": types.AppConfigValue{Value: "test-value"}}, nil),
297-
arm.On("ExtractAppPreflightSpec", mock.Anything, types.AppConfigValues{"test-item": types.AppConfigValue{Value: "test-value"}}, mock.Anything).Return(expectedAPF, nil),
297+
arm.On("ExtractAppPreflightSpec", mock.Anything, types.AppConfigValues{"test-item": types.AppConfigValue{Value: "test-value"}}, mock.Anything, mock.Anything).Return(expectedAPF, nil),
298298
apm.On("RunAppPreflights", mock.Anything, mock.MatchedBy(func(opts apppreflightmanager.RunAppPreflightOptions) bool {
299299
return expectedAPF == opts.AppPreflightSpec
300300
})).Return(nil),
@@ -313,7 +313,7 @@ func (s *AppInstallControllerTestSuite) TestRunAppPreflights() {
313313
setupMocks: func(apm *apppreflightmanager.MockAppPreflightManager, arm *appreleasemanager.MockAppReleaseManager, acm *appconfig.MockAppConfigManager) {
314314
mock.InOrder(
315315
acm.On("GetConfigValues").Return(types.AppConfigValues{"test-item": types.AppConfigValue{Value: "test-value"}}, nil),
316-
arm.On("ExtractAppPreflightSpec", mock.Anything, types.AppConfigValues{"test-item": types.AppConfigValue{Value: "test-value"}}, mock.Anything).Return(expectedAPF, nil),
316+
arm.On("ExtractAppPreflightSpec", mock.Anything, types.AppConfigValues{"test-item": types.AppConfigValue{Value: "test-value"}}, mock.Anything, mock.Anything).Return(expectedAPF, nil),
317317
apm.On("RunAppPreflights", mock.Anything, mock.MatchedBy(func(opts apppreflightmanager.RunAppPreflightOptions) bool {
318318
return expectedAPF == opts.AppPreflightSpec
319319
})).Return(nil),
@@ -332,7 +332,7 @@ func (s *AppInstallControllerTestSuite) TestRunAppPreflights() {
332332
setupMocks: func(apm *apppreflightmanager.MockAppPreflightManager, arm *appreleasemanager.MockAppReleaseManager, acm *appconfig.MockAppConfigManager) {
333333
mock.InOrder(
334334
acm.On("GetConfigValues").Return(types.AppConfigValues{"test-item": types.AppConfigValue{Value: "test-value"}}, nil),
335-
arm.On("ExtractAppPreflightSpec", mock.Anything, types.AppConfigValues{"test-item": types.AppConfigValue{Value: "test-value"}}, mock.Anything).Return(expectedAPF, nil),
335+
arm.On("ExtractAppPreflightSpec", mock.Anything, types.AppConfigValues{"test-item": types.AppConfigValue{Value: "test-value"}}, mock.Anything, mock.Anything).Return(expectedAPF, nil),
336336
apm.On("RunAppPreflights", mock.Anything, mock.MatchedBy(func(opts apppreflightmanager.RunAppPreflightOptions) bool {
337337
return expectedAPF == opts.AppPreflightSpec
338338
})).Return(nil),
@@ -358,7 +358,7 @@ func (s *AppInstallControllerTestSuite) TestRunAppPreflights() {
358358
setupMocks: func(apm *apppreflightmanager.MockAppPreflightManager, arm *appreleasemanager.MockAppReleaseManager, acm *appconfig.MockAppConfigManager) {
359359
mock.InOrder(
360360
acm.On("GetConfigValues").Return(types.AppConfigValues{"test-item": types.AppConfigValue{Value: "test-value"}}, nil),
361-
arm.On("ExtractAppPreflightSpec", mock.Anything, types.AppConfigValues{"test-item": types.AppConfigValue{Value: "test-value"}}, mock.Anything).Return(nil, errors.New("extraction error")),
361+
arm.On("ExtractAppPreflightSpec", mock.Anything, types.AppConfigValues{"test-item": types.AppConfigValue{Value: "test-value"}}, mock.Anything, mock.Anything).Return(nil, errors.New("extraction error")),
362362
)
363363
},
364364
expectedErr: true,
@@ -373,7 +373,7 @@ func (s *AppInstallControllerTestSuite) TestRunAppPreflights() {
373373
setupMocks: func(apm *apppreflightmanager.MockAppPreflightManager, arm *appreleasemanager.MockAppReleaseManager, acm *appconfig.MockAppConfigManager) {
374374
mock.InOrder(
375375
acm.On("GetConfigValues").Return(types.AppConfigValues{"test-item": types.AppConfigValue{Value: "test-value"}}, nil),
376-
arm.On("ExtractAppPreflightSpec", mock.Anything, types.AppConfigValues{"test-item": types.AppConfigValue{Value: "test-value"}}, mock.Anything).Return(expectedAPF, nil),
376+
arm.On("ExtractAppPreflightSpec", mock.Anything, types.AppConfigValues{"test-item": types.AppConfigValue{Value: "test-value"}}, mock.Anything, mock.Anything).Return(expectedAPF, nil),
377377
apm.On("RunAppPreflights", mock.Anything, mock.MatchedBy(func(opts apppreflightmanager.RunAppPreflightOptions) bool {
378378
return expectedAPF == opts.AppPreflightSpec
379379
})).Return(errors.New("run preflights error")),

api/controllers/kubernetes/install/controller.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,7 @@ func NewInstallController(opts ...InstallControllerOption) (*InstallController,
192192
appcontroller.WithConfigValues(controller.configValues),
193193
appcontroller.WithAirgapBundle(controller.airgapBundle),
194194
appcontroller.WithPrivateCACertConfigMapName(""), // Private CA ConfigMap functionality not yet implemented for Kubernetes installations
195+
appcontroller.WithRESTClientGetter(controller.restClientGetter),
195196
)
196197
if err != nil {
197198
return nil, fmt.Errorf("create app install controller: %w", err)

api/controllers/linux/install/controller.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ type Controller interface {
3434
GetHostPreflightTitles(ctx context.Context) ([]string, error)
3535
SetupInfra(ctx context.Context, ignoreHostPreflights bool) error
3636
GetInfra(ctx context.Context) (types.Infra, error)
37+
CalculateRegistrySettings(ctx context.Context) (*types.RegistrySettings, error)
3738
// App controller methods
3839
appcontroller.Controller
3940
}
@@ -239,6 +240,7 @@ func NewInstallController(opts ...InstallControllerOption) (*InstallController,
239240
installation.WithInstallationStore(controller.store.LinuxInstallationStore()),
240241
installation.WithLicense(controller.license),
241242
installation.WithAirgapBundle(controller.airgapBundle),
243+
installation.WithReleaseData(controller.releaseData),
242244
installation.WithHostUtils(controller.hostUtils),
243245
installation.WithNetUtils(controller.netUtils),
244246
)
@@ -264,6 +266,7 @@ func NewInstallController(opts ...InstallControllerOption) (*InstallController,
264266
appcontroller.WithClusterID(controller.clusterID),
265267
appcontroller.WithAirgapBundle(controller.airgapBundle),
266268
appcontroller.WithPrivateCACertConfigMapName(adminconsole.PrivateCASConfigMapName), // Linux installations use the ConfigMap
269+
appcontroller.WithKubeConfigPath(controller.rc.PathToKubeConfig()),
267270
)
268271
if err != nil {
269272
return nil, fmt.Errorf("create app install controller: %w", err)

api/controllers/linux/install/controller_mock.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,3 +152,12 @@ func (m *MockController) GetAppInstallStatus(ctx context.Context) (types.AppInst
152152
args := m.Called(ctx)
153153
return args.Get(0).(types.AppInstall), args.Error(1)
154154
}
155+
156+
// CalculateRegistrySettings mocks the CalculateRegistrySettings method
157+
func (m *MockController) CalculateRegistrySettings(ctx context.Context) (*types.RegistrySettings, error) {
158+
args := m.Called(ctx)
159+
if args.Get(0) == nil {
160+
return nil, args.Error(1)
161+
}
162+
return args.Get(0).(*types.RegistrySettings), args.Error(1)
163+
}

api/controllers/linux/install/installation.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,3 +171,7 @@ func (c *InstallController) computeCIDRs(config *types.LinuxInstallationConfig)
171171
func (c *InstallController) GetInstallationStatus(ctx context.Context) (types.Status, error) {
172172
return c.installationManager.GetStatus()
173173
}
174+
175+
func (c *InstallController) CalculateRegistrySettings(ctx context.Context) (*types.RegistrySettings, error) {
176+
return c.installationManager.CalculateRegistrySettings(ctx, c.rc)
177+
}

0 commit comments

Comments
 (0)