Skip to content
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

(feat): Adding dynamic client & deploymentconfig object support #199

Merged
merged 5 commits into from
May 7, 2020

Conversation

imrajdas
Copy link
Member

@imrajdas imrajdas commented May 5, 2020

Signed-off-by: Raj raj.das@mayadata.io
Issue- litmuschaos/litmus#1406

  • Adding Openshift's Deploymentconfig annotation check support.
  • Adding dynamic client for using openshift & k8s resources

Signed-off-by: Raj <raj.das@mayadata.io>
Signed-off-by: Raj <raj.das@mayadata.io>
@imrajdas imrajdas force-pushed the deploymentconfig branch 4 times, most recently from 5acb04a to 1e7d2c8 Compare May 7, 2020 06:49
pkg/controller/resource/deploymentconfig.go Outdated Show resolved Hide resolved
go.mod Outdated Show resolved Hide resolved
pkg/controller/resource/deploymentconfig.go Outdated Show resolved Hide resolved
pkg/controller/resource/deploymentconfig.go Outdated Show resolved Hide resolved
Signed-off-by: Raj <raj.das@mayadata.io>
)

var (
gvr = schema.GroupVersionResource{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you name this a little Better? deploymentConfigGVR

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was there, @chandankumar4 told to change it to gvr

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gvr is also good, As this variable is already inside the deploymentconfig file

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gvr is too generic, still would be better to change it something suitable.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gvr is GroupVersionResource still the variable doesn't explain for which resource GVR we have.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then we can name it as deploymentConfigGVR earlier it was dcGVR

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, thanks @chandankumar4

}
)
// CheckDeploymentAnnotation will check the annotation of deployment
func CheckDeploymentConfigAnnotation(clientSet dynamic.Interface, engine *chaosTypes.EngineInfo) (*chaosTypes.EngineInfo, error) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use this variable dynamicClient instead to clientSet

Copy link
Member Author

@imrajdas imrajdas May 7, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In future we will migrating to dynamic-client, its good to have this name

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still we will use dynamicClient and remove clientSet

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dynamicClient set is very different from normal clientSet thats why it would be better to let anyone going through the code know that this function is using dynamicClient


// This will check and count the total chaos enabled application
func checkForChaosEnabledDeploymentConfig(deploymentConfigList *unstructured.UnstructuredList, engine *chaosTypes.EngineInfo) (*chaosTypes.EngineInfo, int, error) {

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we validate that the GVR of *unstructured.UnstructuredList matches with deploymentConfig GVR, and then start to validate.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or add the validation in its above function

// This will check and count the total chaos enabled application
func checkForChaosEnabledDeploymentConfig(deploymentConfigList *unstructured.UnstructuredList, engine *chaosTypes.EngineInfo) (*chaosTypes.EngineInfo, int, error) {

chaosEnabledDeploymentConfig := 0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a nil check for *unstructured.UnstructuredList before iterating into items

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will raised another Pr for this

pkg/dynamic/dynamic.go Show resolved Hide resolved
@ksatchit ksatchit merged commit 7901608 into litmuschaos:master May 7, 2020
@imrajdas imrajdas deleted the deploymentconfig branch May 7, 2020 18:45
rahulchheda pushed a commit to rahulchheda/chaos-operator that referenced this pull request May 21, 2020
…uschaos#199)

* Adding deploymentconfig annotation check support

Signed-off-by: Raj <raj.das@mayadata.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants