There are several helper structs that are thin wrappers around kubernetes primitives. These structs don't add any members and are being used to create methods that extend the original kubernetes structs. This behavior could be made simpler by removing the extra struct declarations and instead making these types.
For example, in core/deploymentconfigs/deploymentconfigs.go this:
type ODeploymentConfig struct {
api.DeploymentConfig
}
would be refactored into
type ODeploymentConfig api.DeploymentConfig
To make this change we will need to adjust how some of the methods that operate on the underlying struct work. Primarily, we should rename methods that have the same name as underlying members. These methods should change their names to reflect their status as setters.
For example, in helpers/containers/containers.go this:
func (c *OContainer) Command(args ...string) *OContainer {
c.Container.Command = args
return c
}
would be refactored into
func (c *OContainer) SetCommand(args ...string) *OContainer {
c.Command = args
return c
}
This would make the code more explicit in its functionality and allow access to the kubernetes primitives in a cleaner manner.
migrated from radanalyticsio/oshinko-rest#65
There are several helper structs that are thin wrappers around kubernetes primitives. These structs don't add any members and are being used to create methods that extend the original kubernetes structs. This behavior could be made simpler by removing the extra struct declarations and instead making these types.
For example, in
core/deploymentconfigs/deploymentconfigs.gothis:would be refactored into
To make this change we will need to adjust how some of the methods that operate on the underlying struct work. Primarily, we should rename methods that have the same name as underlying members. These methods should change their names to reflect their status as setters.
For example, in
helpers/containers/containers.gothis:would be refactored into
This would make the code more explicit in its functionality and allow access to the kubernetes primitives in a cleaner manner.
migrated from radanalyticsio/oshinko-rest#65