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

2021-01-31 kickoff #1191

Merged
merged 2 commits into from
Dec 4, 2020
Merged

2021-01-31 kickoff #1191

merged 2 commits into from
Dec 4, 2020

Conversation

mjudeikis
Copy link
Contributor

@mjudeikis mjudeikis commented Nov 25, 2020

Which issue this PR addresses:

Enables us to start developing new API 2020-01-31-preview and test it in dev

What this PR does / why we need it:

This will make an extension to call preview API exclusively.
If you are using an extension to interact with production RP - this will stop working. Please offload the extension for these activities.
Pulled back ^ as we might want to discuss more. But I have a feeling this will be "Told you so". Sometimes we have to break things for sake of progress...
All E2E in dev will be running on preview API.
All E2E in PROD and INT will be running on stable API

Next will be swagger and cli generation WITH new fields and submission initial swagger for review: https://github.com/Azure/ARO-RP/compare/master...mjudeikis:api.skeleton?expand=1

Test plan for issue:

In development

Is there any documentation that needs to be updated for this PR?

This is just the beginning. Later - yet.

@mjudeikis
Copy link
Contributor Author

/azp run e2e

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@@ -0,0 +1,53 @@
package redhatopenshiftpreview
Copy link
Member

Choose a reason for hiding this comment

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

shall we just admit defeat and go to pkg/util/azureclient/mgmt/redhatopenshift/2021-01-31-preview/redhatopenshift ?

groups features.ResourceGroupsClient
applications graphrbac.ApplicationsClient
serviceprincipals graphrbac.ServicePrincipalClient
openshiftclusters redhatopenshift.OpenShiftClustersClient
Copy link
Member

Choose a reason for hiding this comment

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

call this something awful like openshiftclusters20200430 or something

@@ -368,6 +388,54 @@ func (c *Cluster) createCluster(ctx context.Context, clusterName, clientID, clie
return c.openshiftclusters.CreateOrUpdateAndWait(ctx, c.ResourceGroup(), clusterName, oc)
}

func (c *Cluster) createClusterPreview(ctx context.Context, clusterName, clientID, clientSecret string) error {
Copy link
Member

Choose a reason for hiding this comment

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

investigate to see if we can define the cluster in the internal representation and use api converters to generate the correct api manifest for the version of client that's being used

Comment on lines 286 to 294
err = c.openshiftclusterspreview.DeleteAndWait(ctx, c.ResourceGroup(), clusterName)
if err != nil {
errs = append(errs, err)
}
} else {
err := c.openshiftclusters.DeleteAndWait(ctx, c.ResourceGroup(), clusterName)
if err != nil {
errs = append(errs, err)
}
Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure this is worth it

@@ -4,7 +4,7 @@
import urllib3

from azext_aro.custom import rp_mode_development
from azext_aro.vendored_sdks.azure.mgmt.redhatopenshift.v2020_04_30 import AzureRedHatOpenShiftClient
from azext_aro.vendored_sdks.azure.mgmt.redhatopenshift.v2021_01_31_preview import AzureRedHatOpenShiftClient
Copy link
Member

Choose a reason for hiding this comment

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

Let's think about and discuss the az side of this a bit more.

@github-actions github-actions bot added the needs-rebase branch needs a rebase label Nov 26, 2020
@github-actions
Copy link

Please rebase pull request.

Comment on lines +25 to +29
"github.com/Azure/ARO-RP/pkg/api"
v20200430 "github.com/Azure/ARO-RP/pkg/api/v20200430"
v2021131preview "github.com/Azure/ARO-RP/pkg/api/v20210131preview"
mgmtopenshiftclustersv20200430 "github.com/Azure/ARO-RP/pkg/client/services/redhatopenshift/mgmt/2020-04-30/redhatopenshift"
mgmtopenshiftclustersv20210131preview "github.com/Azure/ARO-RP/pkg/client/services/redhatopenshift/mgmt/2021-01-31-preview/redhatopenshift"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I dont know what is better. Keeping this or having createCluster 2 methods...

Comment on lines +389 to +401
ext := api.APIs[v20200430.APIVersion].OpenShiftClusterConverter().ToExternal(&oc)
data, err := json.Marshal(ext)
if err != nil {
return err
}

ocExt := mgmtopenshiftclustersv20200430.OpenShiftCluster{}
err = json.Unmarshal(data, &ocExt)
if err != nil {
return err
}

return c.openshiftclustersv20200430.CreateOrUpdateAndWait(ctx, c.env.ResourceGroup(), clusterName, ocExt)
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 where create magic happens.

@@ -4,7 +4,7 @@
import random
import os

import azext_aro.vendored_sdks.azure.mgmt.redhatopenshift.v2020_04_30.models as v2020_04_30
import azext_aro.vendored_sdks.azure.mgmt.redhatopenshift.v2020_04_30.models as openshiftcluster
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will make future renames easier when we agree what we want to do with this

@@ -26,7 +26,7 @@ var _ = Describe("[Admin API] List Azure resources action", func() {
resourceID := resourceIDFromEnv()

By("getting the resource group where cluster resources live in")
oc, err := clients.OpenshiftClusters.Get(ctx, _env.ResourceGroup(), clusterName)
oc, err := clients.OpenshiftClustersv20200430.Get(ctx, _env.ResourceGroup(), clusterName)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

For now E2E are using old API. So this basically scatters our e2e. Cluster will be created with new API. So any new future tests should be not API binded. In example.
If we create FIPs cluster, we should write tests which currently run in dev only and uses Kubernetes API to check it. Not ARO...

💩 a bit. Not sure how we can do this without copy-paste test cases.

Copy link
Member

Choose a reason for hiding this comment

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

I don't agree with this or see the problem. Let's discuss tomorrow.

@mjudeikis
Copy link
Contributor Author

/azp run e2e

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Copy link
Member

@jim-minter jim-minter left a comment

Choose a reason for hiding this comment

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

Minor fixes requested. I'm OK with this.

swagger/redhatopenshift/resource-manager/readme.md Outdated Show resolved Hide resolved
swagger/redhatopenshift/resource-manager/readme.go.md Outdated Show resolved Hide resolved
@@ -26,7 +26,7 @@ var _ = Describe("[Admin API] List Azure resources action", func() {
resourceID := resourceIDFromEnv()

By("getting the resource group where cluster resources live in")
oc, err := clients.OpenshiftClusters.Get(ctx, _env.ResourceGroup(), clusterName)
oc, err := clients.OpenshiftClustersv20200430.Get(ctx, _env.ResourceGroup(), clusterName)
Copy link
Member

Choose a reason for hiding this comment

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

I don't agree with this or see the problem. Let's discuss tomorrow.

@mjudeikis mjudeikis force-pushed the api.kickoff branch 2 times, most recently from cdc2237 to bf946be Compare December 2, 2020 13:27
jim-minter
jim-minter previously approved these changes Dec 4, 2020
Copy link
Member

@jim-minter jim-minter left a comment

Choose a reason for hiding this comment

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

I believe this is good, if @mjudeikis does.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants