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

Code Clean Up for Platfrom Controller #1375

Closed
wants to merge 1 commit into from

Conversation

SuyogShinde942
Copy link
Contributor

This PR resolves issues #1371 and #1370:

Cleanup Unused Resource Policy Controller (#1371):

Removed the unused resourcepolicycontroller.go file.
Deleted commented-out references to resourcepolicycontroller in main.go, as it was never utilized.
Enhancements in Resource Composition Handling (#1370):

Improved PlatformController by ensuring the handleCRD method registers the CRD defined in the ResourceComposition spec.

break
}
_, err := c.platformStackclientset.WorkflowsV1alpha1().ResourceCompositions(namespace).Update(context.Background(), fooCopy, metav1.UpdateOptions{})
//_, err := c.sampleclientset.MoodlecontrollerV1().Moodles(foo.Namespace).Update(fooCopy)
Copy link
Contributor

Choose a reason for hiding this comment

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

We can remove this commented out line.

@@ -566,15 +566,15 @@ func createResourcePolicy(resPolicySpec interface{}, namespace string) {
}
}

func deleteResourcePolicy(resPolicySpec interface{}, namespace string) {
func deleteResourcePolicy(resPolicySpec interface{}, namespace string) {
fmt.Println("Inside deleteResourcePolicy.")
resPolicyObject := resPolicySpec.(platformworkflowv1alpha1.ResourcePolicy)
inputResPolicyName := resPolicyObject.ObjectMeta.Name
/*namespace := resPolicyObject.ObjectMeta.Namespace
Copy link
Contributor

Choose a reason for hiding this comment

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

We can delete these commented out lines as well.

/* _, err1 := crdClient.CustomResourceDefinitions().Create(context.Background(), crd, metav1.CreateOptions{})
if err1 != nil {
panic(err1.Error())
/* _, err1 := crdClient.CustomResourceDefinitions().Create(context.Background(), crd, metav1.CreateOptions{})
Copy link
Contributor

Choose a reason for hiding this comment

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

We can delete these commented out lines (732-736).

@devdattakulkarni
Copy link
Contributor

@SuyogShinde942 Mostly looks good. There are some commented lines that we can delete as well.

@SuyogShinde942
Copy link
Contributor Author

I have removed the commented and some debugging code

@@ -58,10 +57,10 @@ func main() {
}()

/*
Copy link
Contributor

Choose a reason for hiding this comment

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

We can also remove the comment strings (/* */)

@@ -603,57 +594,50 @@ func deleteResourcePolicy(resPolicySpec interface{}, namespace string) {

func flatten(yaml_contents map[string]interface{}, types_dict map[string]apiextensionsv1beta1.JSONSchemaProps) map[string]apiextensionsv1beta1.JSONSchemaProps {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you verify if flatten method is being referred to anywhere?
If not, we can delete it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sure

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We are using it in the getChartValueTypes function

Copy link
Contributor

Choose a reason for hiding this comment

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

But getChartValueTypes() is part of the commented out code that you have removed.
So I think we can safely remove flatten().

@devdattakulkarni
Copy link
Contributor

@SuyogShinde942 I have added some more comments.


types_dict[key] = jsonSchemaInner
}

}
//fmt.Println(types_dict)
return types_dict
}

func getChartValueTypes(data []byte) map[string]apiextensionsv1beta1.JSONSchemaProps {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we can get rid of this method as well.

@devdattakulkarni
Copy link
Contributor

@SuyogShinde942 I have added couple of more comments.

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.

2 participants