-
Notifications
You must be signed in to change notification settings - Fork 6
chore: move proxy and network specs to runtime config #2296
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
Conversation
This PR has been released (on staging) and is available for download with a embedded-cluster-smoke-test-staging-app license ID. Online Installer:
Airgap Installer (may take a few minutes before the airgap bundle is built):
Happy debugging! |
3a0c26e
to
f7b7c01
Compare
[sc-124940] |
79c94f9
to
4672f1c
Compare
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.
Some questions/suggestions.
type EnvSetter interface { | ||
Setenv(key string, val string) error | ||
} |
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.
Wondering if it would make sense for this interface, the respective struct implementation and the mock implementation to live in api/pkg/utils
instead? 🤔
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.
moved to the runtimeconfig package
api/integration/install_test.go
Outdated
@@ -162,6 +162,7 @@ func TestConfigureInstallation(t *testing.T) { | |||
installController, err := install.NewInstallController( | |||
install.WithHostUtils(tc.mockHostUtils), | |||
install.WithRuntimeConfig(rc), | |||
install.WithEnvSetter(&testEnvSetter{}), |
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.
Wondering if we're missing a set of assertions here that validate:
- The environment variables are set
- All these runtime config fields are updated accordingly -
embedded-cluster/api/controllers/install/installation.go
Lines 65 to 69 in 4672f1c
c.rc.SetDataDir(config.DataDirectory) c.rc.SetLocalArtifactMirrorPort(config.LocalArtifactMirrorPort) c.rc.SetAdminConsolePort(config.AdminConsolePort) c.rc.SetProxySpec(proxy) c.rc.SetNetworkSpec(networkSpec)
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.
added
if os.Getuid() != 0 { | ||
return fmt.Errorf("update command must be run as root") | ||
} |
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.
Do we need this? If so the msg should be changed s/update/join
.
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.
changed
var err error | ||
rc, err = rcutil.GetRuntimeConfigFromCluster(ctx) | ||
if err != nil { | ||
return fmt.Errorf("failed to init runtime config from cluster: %w", err) | ||
} | ||
|
||
os.Setenv("TMPDIR", rc.EmbeddedClusterTmpSubDir()) | ||
|
||
return nil |
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.
Curious, is this only required now? Or was it already being done before but in a different place?
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.
I think this is a bug if we dont have this. The previous will not work for a non-default data directory.
@@ -356,8 +356,6 @@ func TestConfigureHost(t *testing.T) { | |||
hum.On("ConfigureHost", mock.Anything, hostutils.InitForInstallOptions{ | |||
LicenseFile: "license.yaml", | |||
AirgapBundle: "bundle.tar", | |||
PodCIDR: "10.0.0.0/16", | |||
ServiceCIDR: "10.1.0.0/16", | |||
}).Return(nil), |
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.
Should we validate the RC param VS keeping the mock.Anything
?
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.
done
.github/workflows/ci.yaml
Outdated
@@ -212,6 +212,9 @@ jobs: | |||
with: | |||
fetch-depth: 0 | |||
|
|||
- name: Free up runner disk space | |||
uses: ./.github/actions/free-disk-space |
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.
i've seen this action take ~10 minutes some times, have you seen the build fail due to low disk space?
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.
removed
@@ -857,3 +867,15 @@ func WithInfraManager(infraManager infra.InfraManager) InstallControllerOption { | |||
c.infraManager = infraManager | |||
} | |||
} | |||
|
|||
type testEnvSetter struct { |
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.
wonder if this should live in a utils package like Joao mentioned with a proper mock like the other interfaces
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.
moved to the runtimeconfig package
os.Setenv("KUBECONFIG", c.rc.PathToKubeConfig()) | ||
os.Setenv("TMPDIR", c.rc.EmbeddedClusterTmpSubDir()) | ||
_ = c.envSetter.Setenv("KUBECONFIG", c.rc.PathToKubeConfig()) | ||
_ = c.envSetter.Setenv("TMPDIR", c.rc.EmbeddedClusterTmpSubDir()) |
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.
why not handle the errors?
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.
(i know the old code didn't ,but that's probably a mistake if os.Setenv returns an error)
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.
handled
4672f1c
to
358c583
Compare
return fmt.Errorf("failed to init runtime config from cluster: %w", err) | ||
} | ||
|
||
os.Setenv("TMPDIR", rc.EmbeddedClusterTmpSubDir()) |
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.
Shoukd this use rc.Setenv?
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.
I didnt use setenv in places where we didnt set both env vars. we can refactor later
What this PR does / why we need it:
Add missing properties from the UI install config to the runtime config ahead of merging the two.
Related
replicatedhq/kots#5355
Which issue(s) this PR fixes:
Does this PR require a test?
Does this PR require a release note?
Does this PR require documentation?