-
Notifications
You must be signed in to change notification settings - Fork 158
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
chore: moves config map creation logic from Feature pkg #909
chore: moves config map creation logic from Feature pkg #909
Conversation
The aim of this commit is to clean up structure of the resource creation logic by: - adding CreateConfigMap func to be used in service-mesh refs logic - moving MetaOption and related object "decorators" to a single place (meta.go) - introducing WithOwnerReference decorator - opening up secret creation function for optional meta decorators
In addition it reuses generic purpose CreateConfigMap func introduced as part of this PR.
We have missed a few tests because of that...
and moved the suite to the package.
Might be good to merge #907 first :) |
Makefile
Outdated
@@ -321,7 +321,7 @@ toolbox: ## Create a toolbox instance with the proper Golang and Operator SDK ve | |||
toolbox create opendatahub-toolbox --image localhost/opendatahub-toolbox:latest | |||
|
|||
# Run tests. | |||
TEST_SRC=./controllers/... ./tests/integration/features/... ./pkg/feature/... | |||
TEST_SRC=./controllers/... ./tests/integration/features/... ./pkg/... |
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.
Will be gone when #907 is merged.
@@ -110,7 +110,7 @@ func configureServiceMeshFeatures() feature.FeaturesProvider { | |||
PostConditions( | |||
feature.WaitForPodsToBeReady(serviceMeshSpec.ControlPlane.Namespace), | |||
func(f *feature.Feature) error { | |||
return feature.WaitForPodsToBeReady(f.Spec.Auth.Namespace)(f) | |||
return feature.WaitForPodsToBeReady(handler.DSCInitializationSpec.ServiceMesh.Auth.Namespace)(f) |
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.
No need to use feature struct here.
/retest |
} | ||
} | ||
|
||
func WithLabels(labels ...string) MetaOptions { |
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.
WithAnnotations is probably a good candidate here as well.
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.
Sure, but we can add it when we need it. Or do you think we should just provide it?
} | ||
} | ||
|
||
func WithLabels(labels ...string) MetaOptions { |
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.
In some other package probably, but maybe a higher level version as well for unified labeling; WithUnifedLables(dsci, dsc, component)?
"config-regs", | ||
"default", | ||
data, | ||
cluster.WithLabels("apps.kubernetes.io/part-of", "opendatahub"), |
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 like the DSL bit of it but could we incorporate the same type of functions into the Feature.Manifest processing for instance, so that we have 1 API here not two depending on what you're doing?
feature.Create()..
.Metadata(WithLabels(), WithOwnerRef())
.Manifests()..
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 like the idea. Can we do it as subsequent PR?
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.
of course
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.
OK, this makes sense to me, as ConfigMap creation code looks misplaced in the Feature.
@@ -88,7 +88,7 @@ func configureServiceMeshFeatures() feature.FeaturesProvider { | |||
|
|||
cfgMapErr := feature.CreateFeature("mesh-shared-configmap"). | |||
For(handler). | |||
WithResources(servicemesh.ConfigMaps). | |||
WithResources(servicemesh.MeshRefs, servicemesh.AuthRefs). |
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 hope this resolves Wen feedback in a previos PR about that this ConfigMaps
wasn't really a good name :-)
@@ -88,7 +88,7 @@ func configureServiceMeshFeatures() feature.FeaturesProvider { | |||
|
|||
cfgMapErr := feature.CreateFeature("mesh-shared-configmap"). | |||
For(handler). | |||
WithResources(servicemesh.ConfigMaps). | |||
WithResources(servicemesh.MeshRefs, servicemesh.AuthRefs). |
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.
@bartoszmajsak should we perhaps consider splitting servicemesh and auth?
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: aslakknutsen, israel-hdez The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
623285e
into
opendatahub-io:incubation
…-services#909) #### Refactors cluster resource creation funcs Cleans up the structure of the resource creation logic by: - adding CreateConfigMap func to be used in service-mesh refs logic - moving MetaOption and related object "decorators" to a single place (`meta.go`) - introducing `WithOwnerReference` decorator - opening up secret creation function for optional meta decorators #### Splits service mesh-related config map creation In addition, it reuses the generic purpose `CreateConfigMap` func introduced as part of this PR. #### Adds config map creation test and moves the suite to the package.
…io#909) #### Refactors cluster resource creation funcs Cleans up the structure of the resource creation logic by: - adding CreateConfigMap func to be used in service-mesh refs logic - moving MetaOption and related object "decorators" to a single place (`meta.go`) - introducing `WithOwnerReference` decorator - opening up secret creation function for optional meta decorators #### Splits service mesh-related config map creation In addition, it reuses the generic purpose `CreateConfigMap` func introduced as part of this PR. #### Adds config map creation test and moves the suite to the package. (cherry picked from commit d7074eb)
Refactors cluster resource creation funcs
Cleans up structure of the resource creation logic by:
meta.go
)WithOwnerReference
decoratorSplits service mesh-related config map creation
In addition, it reuses generic purpose
CreateConfigMap
func introduced as part of this PR.Adds config map creation test
and moves the suite to the package.