-
Notifications
You must be signed in to change notification settings - Fork 362
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
Optimize k8s runtime #1600
Optimize k8s runtime #1600
Conversation
optimize k8s runtime optimize k8s runtime
pkg/registry/config.go
Outdated
|
||
func (c *Config) GenerateHtPasswd() (string, error) { | ||
if c.Username == "" || c.Password == "" { | ||
return "", fmt.Errorf("failed to generate htpasswd: registry username or passwodr is empty") |
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.
passwodr => password
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.
Ht?
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 func means to gen HTTP basic authentication with username and password. so it could be rename to "GenerateHttpBasicAuth"
pkg/registry/config.go
Outdated
return fmt.Sprintf("%s:%s", c.Domain, c.Port) | ||
} | ||
|
||
func GetConfig(rootfs string, defaultRegistryIP net.IP) *Config { |
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.
defaultRegistryIP => registryIP
pkg/registry/config.go
Outdated
} | ||
registryConfigPath := filepath.Join(rootfs, common.EtcDir, ConfigFile) | ||
if !osi.IsFileExist(registryConfigPath) { | ||
logrus.Debug("use default registry config") |
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.
default registry configuration is used: \n %+v, DefaultConfig
pkg/registry/config.go
Outdated
|
||
func GetConfig(rootfs string, defaultRegistryIP net.IP) *Config { | ||
var config Config | ||
var DefaultConfig = &Config{ |
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.
DefaultConfig => defaultConfig
pkg/registry/config.go
Outdated
if config.Domain == "" { | ||
config.Domain = DefaultConfig.Domain | ||
} | ||
logrus.Debugf("show registry info, IP: %s, Domain: %s", config.IP, config.Domain) |
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.
The ultimate registry configration is:
) | ||
|
||
var ( | ||
ContainerdShell = `if grep "SystemdCgroup = true" /etc/containerd/config.toml &> /dev/null; then |
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.
Is that possible we try not to write shell in go 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.
yes, We have too many operations done by the shell,it is hard to read and maintain. this pr only move out some code section nothing to do with the logic. I plan to optimize them in the next steps.
@@ -12,15 +12,15 @@ | |||
// See the License for the specific language governing permissions and | |||
// limitations under the License. | |||
|
|||
package kubernetes | |||
package version |
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.
"package version" makes me feel it's the version of sealer instead of "kube"
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.
this package under utils, rename it to "kubeVersion" ?
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.
Agree!
Codecov Report
@@ Coverage Diff @@
## main #1600 +/- ##
==========================================
+ Coverage 11.82% 13.98% +2.15%
==========================================
Files 91 80 -11
Lines 8112 6859 -1253
==========================================
Hits 959 959
+ Misses 7030 5777 -1253
Partials 123 123 Continue to review full report at Codecov.
|
So good to see the registry related part split from runtime. @kakaZhou719 👍🏻 LGTM after updated all the change request. |
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.
LGTM, if you have tested it fully. It made this module more clearly.
Describe what this PR does / why we need it
optimize k8s runtime
this pr only move out some code section nothing to do with the logic.
the next steps:
Redesign the runtime interface, make this module more clearly.
Does this pull request fix one issue?
Describe how you did it
Describe how to verify it
Special notes for reviews