-
Notifications
You must be signed in to change notification settings - Fork 6
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
Read actual system configs during k8s upgrade #579
Conversation
Because under k8s the actual real system is mounted into a dir, the configs that we are reading by default are not the ones in the system but the ones on the upgrade container, which is running under / This patch introduces a check to see if we are running under k8s, and if we are it tries to get the host dir where the system is mounted. then it will prepend that host dir to the config scan so we can actually scan the system configs. Int he case we are out of k8s, this should not affect the upgrade as it will return an empty string resulting in the ususal dirs being scanned Signed-off-by: Itxaka <[email protected]>
Signed-off-by: Itxaka <[email protected]>
thanks tests Signed-off-by: Itxaka <[email protected]>
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #579 +/- ##
==========================================
- Coverage 49.96% 49.94% -0.03%
==========================================
Files 48 48
Lines 4653 4655 +2
==========================================
Hits 2325 2325
- Misses 2051 2054 +3
+ Partials 277 276 -1 ☔ View full report in Codecov by Sentry. |
pkg/config/spec.go
Outdated
hostDir = "/host" | ||
} | ||
hostDir := k8sutils.GetHostDirForK8s() | ||
config.Logger.Logger.Debug().Bool("status", underKubernetes).Str("hostdir", hostDir).Msg("Running under kubernetes host directory") |
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.
There is no if
anymore. This will always read "Running under kubernetes host directory" no? Or is Bool()
a conditions on whether to print this or not?
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.
yes, indeed, I will change the msg.
this is just to show the values of the kubernetes and hostdirectory for debug purposes as it can happen that its doing it worngly and we have no visibility onto it
pkg/utils/k8s/common.go
Outdated
return "/host" | ||
} | ||
} else { | ||
// We return an empty string so any filepath.join does nto alter the paths |
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.
// We return an empty string so any filepath.join does nto alter the paths | |
// We return an empty string so any filepath.join does not alter the paths |
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.
fixed
Signed-off-by: Itxaka <[email protected]>
Because under k8s the actual real system is mounted into a dir, the configs that we are reading by default are not the ones in the system but the ones on the upgrade container, which is running under /
This patch introduces a check to see if we are running under k8s, and if we are it tries to get the host dir where the system is mounted. then it will prepend that host dir to the config scan so we can actually scan the system configs.
Int he case we are out of k8s, this should not affect the upgrade as it will return an empty string resulting in the ususal dirs being scanned
Fixes kairos-io/kairos#2944 and probably others lol