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

Container Service - Add OpenShift support #3712

Merged
merged 28 commits into from
Oct 15, 2018
Merged

Container Service - Add OpenShift support #3712

merged 28 commits into from
Oct 15, 2018

Conversation

julienstroheker
Copy link
Contributor

This checklist is used to make sure that common issues in a pull request are addressed. This will expedite the process of getting your pull request merged and avoid extra work on your part to fix issues discovered during the review process.

PR information

  • The title of the PR is clear and informative.
  • There are a small number of commits, each of which have an informative message. This means that previously merged commits do not appear in the history of the PR. For information on cleaning up the commits in your pull request, see this page.
  • Except for special cases involving multiple contributors, the PR is started from a fork of the main repository, not a branch.
  • If applicable, the PR references the bug/issue that it fixes.
  • Swagger files are correctly named (e.g. the api-version in the path should match the api-version in the spec).

Quality of Swagger

@AutorestCI
Copy link

AutorestCI commented Aug 23, 2018

Automation for azure-sdk-for-python

A PR has been created for you based on this PR content.

Once this PR will be merged, content will be added to your service PR:
Azure/azure-sdk-for-python#3378

@azuresdkci
Copy link
Contributor

Can one of the admins verify this patch?

@AutorestCI
Copy link

AutorestCI commented Aug 23, 2018

Automation for azure-sdk-for-ruby

Nothing to generate for azure-sdk-for-ruby

@AutorestCI
Copy link

AutorestCI commented Aug 23, 2018

Automation for azure-sdk-for-go

The initial PR has been merged into your service PR:
Azure/azure-sdk-for-go#3013

@AutorestCI
Copy link

AutorestCI commented Aug 23, 2018

Automation for azure-sdk-for-node

A PR has been created for you:
Azure/azure-sdk-for-node#3411

@AutorestCI
Copy link

AutorestCI commented Aug 23, 2018

Automation for azure-sdk-for-java

Nothing to generate for azure-sdk-for-java

@annatisch
Copy link
Member

Thanks @julienstroheker - please ping me when you've finished updating the spec (i.e. no longer WIP) so I can tag for ARM review. :)

@lmazuel
Copy link
Member

lmazuel commented Sep 7, 2018

@AutorestCI rebuild azure-sdk-for-python

@AutorestCI
Copy link

AutorestCI commented Sep 20, 2018

Automation for azure-sdk-for-js

The initial PR has been merged into your service PR:
Azure/azure-sdk-for-js#181

@annatisch annatisch added the DoNotMerge <valid label in PR review process> use to hold merge after approval label Sep 21, 2018
@julienstroheker julienstroheker changed the title [WIP] - Container Service - Add OpenShift support Container Service - Add OpenShift support Sep 24, 2018
@julienstroheker
Copy link
Contributor Author

@amanohar @mboersma

Copy link
Member

@annatisch annatisch left a comment

Choose a reason for hiding this comment

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

Hi @julienstroheker - I just did a preliminary look over while we're waiting on ARM signoff.

},
"description": "Tags object for patch operations."
},
"OpenShiftManagedClusterListResult": {
Copy link
Member

Choose a reason for hiding this comment

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

This definition is never used? Perhaps missing a "list" operation?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch. Not for now but for sure later. I'll remove it for now.

],
"description": "OpenShift Managed cluster."
},
"OpenShiftManagedClusterServiceAADIdentityProvider": {
Copy link
Member

Choose a reason for hiding this comment

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

This definition is never used?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is used in OpenShiftManagedClusterIdentityProviders in the provider field as object we are planning to support more auth in the future

Copy link
Member

Choose a reason for hiding this comment

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

But this generated model will not be used in response deserialization?

Copy link
Contributor Author

@julienstroheker julienstroheker Sep 25, 2018

Choose a reason for hiding this comment

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

It will be used by the sdk to create an authentication model? Makes sense ?

Copy link
Member

Choose a reason for hiding this comment

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

Hi @julienstroheker ,
Yes and no - technically this will work, however the standard approach here is to use polymorphic models. I see for example, that OpenShiftManagedClusterServiceAADIdentityProvider has a "kind" property. We generally consider this to be a discriminator (as I suspect this should be a constant value?). If all your intended "IdentityProvider" models will likely have a "kind" property - then I would recommend that you restructure this to use an "OpenShiftManagedClusterServiceIdentityProvider" base class.

Here is an example:
https://github.com/Azure/azure-rest-api-specs/blob/master/specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/postgresql.json#L1355

You can see the base class "ServerPropertiesForCreate" defines the descriminator "createMode" (in your case this would be "kind") which is then set for each of the children using the "x-ms-discriminator-value" extension. In this example the base class has additional common properties - but that's not required depending on your case.

Here is an additional example:
https://github.com/Azure/azure-rest-api-specs/blob/master/specification/graphrbac/data-plane/stable/1.6/graphrbac.json#L2327

In this case, like yours, the base class only has one available child class at present - which leaves them the option to add more later.

Copy link
Member

Choose a reason for hiding this comment

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

Thanks @julienstroheker - But making the model polymorphic doesn't change the interface?

What is the expected value of "kind" for the AAD provider? It seems that at a minimum this should be a constant (i.e. an enum with a single option) so that a user doesn't have to set this value.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This should works indeed ! Let me run some tests with it ! Thanks @annatisch

Copy link
Contributor Author

@julienstroheker julienstroheker Oct 11, 2018

Choose a reason for hiding this comment

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

@annatisch I just pushed the modification, can you check and tell me if it is ok?

Copy link
Member

Choose a reason for hiding this comment

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

Thanks @julienstroheker - not quite - You can remove the x-ms-enum extension and it also needs to be marked as required.
Take a look at the docs here:
https://github.com/Azure/autorest/blob/bc0dcde0a05606a1b102c0e08c1798fa4da4dcc8/docs/extensions/readme.md#single-value-enum-as-a-constant

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What about now ? :)

"description": "Type of authentication profile to use."
}
},
"description": "OpenShiftManagedClusterAuthProfile defines all possible authentication profiles for the OpenShift cluster."
Copy link
Member

Choose a reason for hiding this comment

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

Try to avoid using the name of the model or property in the description (i.e. OpenShiftManagedClusterAuthProfile) as this may not be the way it appears in a generated SDK depending on the naming conventions of the language.

In this instance I think you could simply removed it:
"description": "Defines all possible authentication profiles for the OpenShift cluster"

"description": "Configuration of the provider."
}
},
"description": "OpenShiftManagedClusterIdentityProvider is heavily cut down equivalent to IdentityProvider in the upstream."
Copy link
Member

Choose a reason for hiding this comment

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

This description would be a bit confusing to a developer using the SDK.
I think it would be better to give a simple description of its role, e.g. "Basic/Essential/etc details of an Identity Provider"

"count",
"vmSize"
],
"description": "OpenShiftManagedClusterAgentPoolProfile represents configuration of OpenShift cluster VMs."
Copy link
Member

Choose a reason for hiding this comment

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

Try to avoid using the name of the model or property in the description (i.e. OpenShiftManagedClusterAgentPoolProfile) as this may not be the way it appears in a generated SDK depending on the naming conventions of the language.

In this instance I think you could simply removed it:
"description": "Represents configuration of OpenShift cluster VMs."

}
},
"definitions": {
"OperationListResult": {
Copy link
Member

Choose a reason for hiding this comment

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

This spec does not include any "Operations" requests - so I don't think this and the next two models need to be here.

"maximum": 5,
"minimum": 1,
"description": "Number of agents (VMs) to host docker containers. Allowed values must be in the range of 1 to 5 (inclusive). The default value is 1. ",
"default": 1
Copy link
Member

Choose a reason for hiding this comment

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

I quick comment on the use of "defaults". I see you have a couple of them in the spec, so I wont leave a comment for every one.
It's important to note that how "defaults" are handled can vary from language to language.
Some languages will send the default values in the request body (regardless of whether it's set by the user) and other languages will leave these fields in the request as empty, and use the default purely to document the service behavior.

So please make sure that your service API will handle both scenarios the same way - i.e. it will treat a request with an empty field and a request with a default value exactly the same.

@annatisch
Copy link
Member

ping @ravbhatnagar

@julienstroheker
Copy link
Contributor Author

@annatisch @ravbhatnagar any news on this ? Thanks

Copy link
Contributor

@ravbhatnagar ravbhatnagar left a comment

Choose a reason for hiding this comment

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

Few notes added. please take a look.

"description": "Parameters supplied to the Create or Update an OpenShift Managed Cluster operation."
}
],
"responses": {
Copy link
Contributor

Choose a reason for hiding this comment

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

please model the default response to capture all the error states. Sample can be found in batch RP swagger.

Copy link
Contributor

Choose a reason for hiding this comment

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

Schema has not been added for the default response. Please check Batch RP swagger for sample.

"description": "The name of the openshift managed cluster resource."
}
],
"responses": {
Copy link
Contributor

Choose a reason for hiding this comment

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

model the 200 response. 204 will indicate that the resource to be deleted was not found. and 200 will indicate that the resource was found and deleted successfully.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi @ravbhatnagar we don't have a 200 response here, only 202 or 204. is it ok ?

Copy link
Contributor

Choose a reason for hiding this comment

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

so as per ARM Resource provider contract, 204 on a delete must be returned when the requested resourceId was not found. 200 is returned in case where resource was successfully deleted.

}
}
},
"paths": {
Copy link
Contributor

Choose a reason for hiding this comment

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

GET APIs to list all openShiftManagedClusters under a resource group and under a subscription missing. Please add.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is not implemented yet in our RP.

Copy link
Contributor

Choose a reason for hiding this comment

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

ok, please note that having this is a requirement as clients like portal will have issues if these APIs were not supported.

@ravbhatnagar
Copy link
Contributor

Only one outstanding item- adding the schema for the default response. Conditionally Signing off from ARM side.

@ravbhatnagar ravbhatnagar added ARMSignedOff <valid label in PR review process>add this label when ARM approve updates after review and removed ARMReviewInProgress WaitForARMFeedback <valid label in PR review process> add this label when ARM review is required labels Oct 8, 2018
@julienstroheker
Copy link
Contributor Author

@ravbhatnagar @annatisch I added the schema for the default response. Please let me know if it is ok ? Thanks

@annatisch
Copy link
Member

Thanks for the updates @julienstroheker - I'm just about to do a final review.
I see that you've bumped the Python version as a patch release - just checking, are you aware that in some languages there are potentially breaking changes in this PR?

@annatisch annatisch merged commit d37ec27 into Azure:master Oct 15, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ARMSignedOff <valid label in PR review process>add this label when ARM approve updates after review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants