From 8ac47deda760e53f3405d82ba7f5b399216f0134 Mon Sep 17 00:00:00 2001 From: b-jhoreman Date: Wed, 10 Jan 2024 11:48:20 -0800 Subject: [PATCH] adding 2023-11-22 stable --- .sha256sum | 2 +- pkg/api/v20231122/openshiftcluster.go | 6 -- pkg/api/v20231122/openshiftcluster_convert.go | 38 --------- .../openshiftcluster_validatestatic.go | 46 +---------- .../mgmt/2023-11-22/redhatopenshift/models.go | 28 ------- .../redhatopenshift/openshiftclusters.go | 54 +++++++++++++ .../openshiftclusters_addons.go | 72 +++++++++++++++++ .../2023-11-22/redhatopenshift/operations.go | 48 ++++++++++++ .../redhatopenshift/operations_addons.go | 33 ++++++++ pkg/util/cluster/cluster.go | 22 +++--- .../v2023_11_22/models/__init__.py | 6 -- .../v2023_11_22/models/_models.py | 70 ----------------- .../v2023_11_22/models/_models_py3.py | 77 ------------------- .../stable/2023-11-22/redhatopenshift.json | 41 ---------- 14 files changed, 223 insertions(+), 320 deletions(-) create mode 100644 pkg/util/azureclient/mgmt/redhatopenshift/2023-11-22/redhatopenshift/openshiftclusters.go create mode 100644 pkg/util/azureclient/mgmt/redhatopenshift/2023-11-22/redhatopenshift/openshiftclusters_addons.go create mode 100644 pkg/util/azureclient/mgmt/redhatopenshift/2023-11-22/redhatopenshift/operations.go create mode 100644 pkg/util/azureclient/mgmt/redhatopenshift/2023-11-22/redhatopenshift/operations_addons.go diff --git a/.sha256sum b/.sha256sum index 1f308d74a62..29d20d7987d 100644 --- a/.sha256sum +++ b/.sha256sum @@ -5,4 +5,4 @@ b1f1de0fe40d05de90742b17928968923b936adc294000f58974f50a297581dd swagger/redhat 01ba9562a8dac2824998ff0ad0d2465f79e6a66597bdb321e9409b9f2d12d222 swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2023-04-01/redhatopenshift.json c023515341196746454c0ae7af077d40d3ec13f6b88b33cb558f0a7ab17a5a24 swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/preview/2023-07-01-preview/redhatopenshift.json 440748951dd1c3b34b5ccbdcb7cd966e3b89490887a1f1d64429561fad789515 swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2023-09-04/redhatopenshift.json -695bf8dea5e971d23b77e9468f64cbc8abf877b86cd1486b84d6150b5e717ce0 swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2023-11-22/redhatopenshift.json +98b241e3225ff4bbe96f4046aea98dae06c2bac2cc0e25ab8d85583bfc7f1861 swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2023-11-22/redhatopenshift.json diff --git a/pkg/api/v20231122/openshiftcluster.go b/pkg/api/v20231122/openshiftcluster.go index 73b68fb1d65..583af85e698 100644 --- a/pkg/api/v20231122/openshiftcluster.go +++ b/pkg/api/v20231122/openshiftcluster.go @@ -152,12 +152,6 @@ type LoadBalancerProfile struct { ManagedOutboundIPs *ManagedOutboundIPs `json:"managedOutboundIps,omitempty" mutable:"true"` // The list of effective outbound IP addresses of the public load balancer. EffectiveOutboundIPs []EffectiveOutboundIP `json:"effectiveOutboundIps,omitempty" swagger:"readOnly"` - // The desired outbound IP resources for the cluster load balancer. - OutboundIPs []OutboundIP `json:"outboundIps,omitempty" mutable:"true"` - // The desired outbound IP Prefix resources for the cluster load balancer. - OutboundIPPrefixes []OutboundIPPrefix `json:"outboundIpPrefixes,omitempty" mutable:"true"` - // The desired number of allocated SNAT ports per VM. Allowed values are in the range of 0 to 64000 (inclusive). The default value is 1024. - AllocatedOutboundPorts *int `json:"allocatedOutboundPorts,omitempty" mutable:"true"` } // EffectiveOutboundIP represents an effective outbound IP resource of the cluster public load balancer. diff --git a/pkg/api/v20231122/openshiftcluster_convert.go b/pkg/api/v20231122/openshiftcluster_convert.go index 539213f1de9..3cb76a517a8 100644 --- a/pkg/api/v20231122/openshiftcluster_convert.go +++ b/pkg/api/v20231122/openshiftcluster_convert.go @@ -58,10 +58,6 @@ func (c openShiftClusterConverter) ToExternal(oc *api.OpenShiftCluster) interfac if oc.Properties.NetworkProfile.LoadBalancerProfile != nil { out.Properties.NetworkProfile.LoadBalancerProfile = &LoadBalancerProfile{} - if oc.Properties.NetworkProfile.LoadBalancerProfile.AllocatedOutboundPorts != nil { - out.Properties.NetworkProfile.LoadBalancerProfile.AllocatedOutboundPorts = oc.Properties.NetworkProfile.LoadBalancerProfile.AllocatedOutboundPorts - } - if oc.Properties.NetworkProfile.LoadBalancerProfile.ManagedOutboundIPs != nil { out.Properties.NetworkProfile.LoadBalancerProfile.ManagedOutboundIPs = &ManagedOutboundIPs{ Count: oc.Properties.NetworkProfile.LoadBalancerProfile.ManagedOutboundIPs.Count, @@ -76,24 +72,6 @@ func (c openShiftClusterConverter) ToExternal(oc *api.OpenShiftCluster) interfac }) } } - - if oc.Properties.NetworkProfile.LoadBalancerProfile.OutboundIPs != nil { - out.Properties.NetworkProfile.LoadBalancerProfile.OutboundIPs = make([]OutboundIP, 0, len(oc.Properties.NetworkProfile.LoadBalancerProfile.OutboundIPs)) - for _, outboundIP := range oc.Properties.NetworkProfile.LoadBalancerProfile.OutboundIPs { - out.Properties.NetworkProfile.LoadBalancerProfile.OutboundIPs = append(out.Properties.NetworkProfile.LoadBalancerProfile.OutboundIPs, OutboundIP{ - ID: outboundIP.ID, - }) - } - } - - if oc.Properties.NetworkProfile.LoadBalancerProfile.OutboundIPPrefixes != nil { - out.Properties.NetworkProfile.LoadBalancerProfile.OutboundIPPrefixes = make([]OutboundIPPrefix, 0, len(oc.Properties.NetworkProfile.LoadBalancerProfile.OutboundIPPrefixes)) - for _, outboundIPPrefix := range oc.Properties.NetworkProfile.LoadBalancerProfile.OutboundIPPrefixes { - out.Properties.NetworkProfile.LoadBalancerProfile.OutboundIPPrefixes = append(out.Properties.NetworkProfile.LoadBalancerProfile.OutboundIPPrefixes, OutboundIPPrefix{ - ID: outboundIPPrefix.ID, - }) - } - } } if oc.Properties.WorkerProfiles != nil { @@ -216,27 +194,11 @@ func (c openShiftClusterConverter) ToInternal(_oc interface{}, out *api.OpenShif out.Properties.NetworkProfile.LoadBalancerProfile = &loadBalancerProfile - if oc.Properties.NetworkProfile.LoadBalancerProfile.AllocatedOutboundPorts != nil { - out.Properties.NetworkProfile.LoadBalancerProfile.AllocatedOutboundPorts = oc.Properties.NetworkProfile.LoadBalancerProfile.AllocatedOutboundPorts - } - if oc.Properties.NetworkProfile.LoadBalancerProfile.ManagedOutboundIPs != nil { out.Properties.NetworkProfile.LoadBalancerProfile.ManagedOutboundIPs = &api.ManagedOutboundIPs{ Count: oc.Properties.NetworkProfile.LoadBalancerProfile.ManagedOutboundIPs.Count, } } - if oc.Properties.NetworkProfile.LoadBalancerProfile.OutboundIPs != nil { - out.Properties.NetworkProfile.LoadBalancerProfile.OutboundIPs = make([]api.OutboundIP, len(oc.Properties.NetworkProfile.LoadBalancerProfile.OutboundIPs)) - for i := range oc.Properties.NetworkProfile.LoadBalancerProfile.OutboundIPs { - out.Properties.NetworkProfile.LoadBalancerProfile.OutboundIPs[i].ID = oc.Properties.NetworkProfile.LoadBalancerProfile.OutboundIPs[i].ID - } - } - if oc.Properties.NetworkProfile.LoadBalancerProfile.OutboundIPPrefixes != nil { - out.Properties.NetworkProfile.LoadBalancerProfile.OutboundIPPrefixes = make([]api.OutboundIPPrefix, len(oc.Properties.NetworkProfile.LoadBalancerProfile.OutboundIPPrefixes)) - for i := range oc.Properties.NetworkProfile.LoadBalancerProfile.OutboundIPPrefixes { - out.Properties.NetworkProfile.LoadBalancerProfile.OutboundIPPrefixes[i].ID = oc.Properties.NetworkProfile.LoadBalancerProfile.OutboundIPPrefixes[i].ID - } - } if oc.Properties.NetworkProfile.LoadBalancerProfile.EffectiveOutboundIPs != nil { out.Properties.NetworkProfile.LoadBalancerProfile.EffectiveOutboundIPs = make([]api.EffectiveOutboundIP, len(oc.Properties.NetworkProfile.LoadBalancerProfile.EffectiveOutboundIPs)) for i := range oc.Properties.NetworkProfile.LoadBalancerProfile.EffectiveOutboundIPs { diff --git a/pkg/api/v20231122/openshiftcluster_validatestatic.go b/pkg/api/v20231122/openshiftcluster_validatestatic.go index c8cab37fb0a..6a3fb6ab4b9 100644 --- a/pkg/api/v20231122/openshiftcluster_validatestatic.go +++ b/pkg/api/v20231122/openshiftcluster_validatestatic.go @@ -98,6 +98,9 @@ func (sv openShiftClusterStaticValidator) validateProperties(path string, p *Ope if err := sv.validateNetworkProfile(path+".networkProfile", &p.NetworkProfile, p.APIServerProfile.Visibility, p.IngressProfiles[0].Visibility); err != nil { return err } + if err := sv.validateLoadBalancerProfile(path+".networkProfile.loadBalancerProfile", p.NetworkProfile.LoadBalancerProfile, isCreate); err != nil { + return err + } if err := sv.validateMasterProfile(path+".masterProfile", &p.MasterProfile); err != nil { return err } @@ -245,33 +248,13 @@ func (sv openShiftClusterStaticValidator) validateLoadBalancerProfile(path strin return nil } - err := checkPickedExactlyOne(path, lbp) - if err != nil { - return err - } - switch { case lbp.ManagedOutboundIPs != nil: err := validateManagedOutboundIPs(path, *lbp.ManagedOutboundIPs) if err != nil { return err } - case lbp.OutboundIPs != nil: - err := validateOutboundIPs(path, lbp.OutboundIPs) - if err != nil { - return err - } - case lbp.OutboundIPPrefixes != nil: - err := validateOutboundIPPrefixes(path, lbp.OutboundIPPrefixes) - if err != nil { - return err - } } - - if lbp.AllocatedOutboundPorts != nil { - return api.NewCloudError(http.StatusBadRequest, api.CloudErrorCodeInvalidParameter, path+".allocatedOutboundPorts", "The field allocatedOutboundPorts is not implemented at this time, please check back later.") - } - // Prevents EffectiveOutboundIPs from being set during create, // during update validateDelta will prevent the field from being changed. if lbp.EffectiveOutboundIPs != nil && isCreate { @@ -280,21 +263,6 @@ func (sv openShiftClusterStaticValidator) validateLoadBalancerProfile(path strin return nil } -func checkPickedExactlyOne(path string, lbp *LoadBalancerProfile) error { - var isManagedOutboundIPCount = lbp.ManagedOutboundIPs != nil - var isOutboundIPs = lbp.OutboundIPs != nil - var isOutboundIPPrefixes = lbp.OutboundIPPrefixes != nil - - if !isManagedOutboundIPCount && !isOutboundIPPrefixes && !isOutboundIPs { - return api.NewCloudError(http.StatusBadRequest, api.CloudErrorCodeInvalidParameter, path, "The provided loadBalancerProfile is invalid: must specify one of managedOutboundIps, outboundIps, or outboundIpPrefixes.") - } else if !((isManagedOutboundIPCount && !isOutboundIPs && !isOutboundIPPrefixes) || - (!isManagedOutboundIPCount && isOutboundIPs && !isOutboundIPPrefixes) || - (!isManagedOutboundIPCount && !isOutboundIPs && isOutboundIPPrefixes)) { - return api.NewCloudError(http.StatusBadRequest, api.CloudErrorCodeInvalidParameter, path, "The provided loadBalancerProfile is invalid: can only use one of managedOutboundIps, outboundIps, or outboundIpPrefixes at a time.") - } - return nil -} - func validateManagedOutboundIPs(path string, managedOutboundIPs ManagedOutboundIPs) error { if !(managedOutboundIPs.Count > 0 && managedOutboundIPs.Count <= 20) { return api.NewCloudError(http.StatusBadRequest, api.CloudErrorCodeInvalidParameter, path+".managedOutboundIps.count", "The provided managedOutboundIps.count %d is invalid: managedOutboundIps.count must be in the range of 1 to 20 (inclusive).", managedOutboundIPs.Count) @@ -302,14 +270,6 @@ func validateManagedOutboundIPs(path string, managedOutboundIPs ManagedOutboundI return nil } -func validateOutboundIPs(path string, outboundIPs []OutboundIP) error { - return api.NewCloudError(http.StatusBadRequest, api.CloudErrorCodeInvalidParameter, path+".outboundIps", "The field outboundIps is not implemented at this time, please check back later.") -} - -func validateOutboundIPPrefixes(path string, outboundIPPrefixes []OutboundIPPrefix) error { - return api.NewCloudError(http.StatusBadRequest, api.CloudErrorCodeInvalidParameter, path+".outboundIpPrefixes", "The field outboundIpPrefixes is not implemented at this time, please check back later.") -} - func (sv openShiftClusterStaticValidator) validateMasterProfile(path string, mp *MasterProfile) error { if !validate.VMSizeIsValid(api.VMSize(mp.VMSize), sv.requireD2sV3Workers, true) { return api.NewCloudError(http.StatusBadRequest, api.CloudErrorCodeInvalidParameter, path+".vmSize", "The provided master VM size '%s' is invalid.", mp.VMSize) diff --git a/pkg/client/services/redhatopenshift/mgmt/2023-11-22/redhatopenshift/models.go b/pkg/client/services/redhatopenshift/mgmt/2023-11-22/redhatopenshift/models.go index 384b598fcd1..0b52821a121 100644 --- a/pkg/client/services/redhatopenshift/mgmt/2023-11-22/redhatopenshift/models.go +++ b/pkg/client/services/redhatopenshift/mgmt/2023-11-22/redhatopenshift/models.go @@ -135,12 +135,6 @@ type LoadBalancerProfile struct { ManagedOutboundIps *ManagedOutboundIPs `json:"managedOutboundIps,omitempty"` // EffectiveOutboundIps - READ-ONLY; The list of effective outbound IP addresses of the public load balancer. EffectiveOutboundIps *[]EffectiveOutboundIP `json:"effectiveOutboundIps,omitempty"` - // OutboundIps - The desired outbound IP resources for the cluster load balancer. - OutboundIps *[]OutboundIP `json:"outboundIps,omitempty"` - // OutboundIPPrefixes - The desired outbound IP Prefix resources for the cluster load balancer. - OutboundIPPrefixes *[]OutboundIPPrefix `json:"outboundIpPrefixes,omitempty"` - // AllocatedOutboundPorts - The desired number of allocated SNAT ports per VM. Allowed values are in the range of 0 to 64000 (inclusive). The default value is 1024. - AllocatedOutboundPorts *int32 `json:"allocatedOutboundPorts,omitempty"` } // MarshalJSON is the custom marshaler for LoadBalancerProfile. @@ -149,15 +143,6 @@ func (lbp LoadBalancerProfile) MarshalJSON() ([]byte, error) { if lbp.ManagedOutboundIps != nil { objectMap["managedOutboundIps"] = lbp.ManagedOutboundIps } - if lbp.OutboundIps != nil { - objectMap["outboundIps"] = lbp.OutboundIps - } - if lbp.OutboundIPPrefixes != nil { - objectMap["outboundIpPrefixes"] = lbp.OutboundIPPrefixes - } - if lbp.AllocatedOutboundPorts != nil { - objectMap["allocatedOutboundPorts"] = lbp.AllocatedOutboundPorts - } return json.Marshal(objectMap) } @@ -1441,19 +1426,6 @@ func NewOperationListPage(cur OperationList, getNextPage func(context.Context, O } } -// OutboundIP outboundIP represents a desired outbound IP resource for the cluster load balancer. -type OutboundIP struct { - // ID - The fully qualified Azure resource id of an IP address resource. - ID *string `json:"id,omitempty"` -} - -// OutboundIPPrefix outboundIPPrefix represents a desired outbound IP Prefix resource for the cluster load -// balancer. -type OutboundIPPrefix struct { - // ID - The fully qualified Azure resource id of an IP address resource. - ID *string `json:"id,omitempty"` -} - // ProxyResource the resource model definition for a Azure Resource Manager proxy resource. It will not // have tags and a location type ProxyResource struct { diff --git a/pkg/util/azureclient/mgmt/redhatopenshift/2023-11-22/redhatopenshift/openshiftclusters.go b/pkg/util/azureclient/mgmt/redhatopenshift/2023-11-22/redhatopenshift/openshiftclusters.go new file mode 100644 index 00000000000..8161800aa09 --- /dev/null +++ b/pkg/util/azureclient/mgmt/redhatopenshift/2023-11-22/redhatopenshift/openshiftclusters.go @@ -0,0 +1,54 @@ +package redhatopenshift + +// Copyright (c) Microsoft Corporation. +// Licensed under the Apache License 2.0. + +import ( + "context" + "crypto/tls" + "net/http" + "time" + + "github.com/Azure/go-autorest/autorest" + + mgmtredhatopenshift20231122 "github.com/Azure/ARO-RP/pkg/client/services/redhatopenshift/mgmt/2023-11-22/redhatopenshift" + "github.com/Azure/ARO-RP/pkg/env" + "github.com/Azure/ARO-RP/pkg/util/azureclient" +) + +// OpenShiftClustersClient is a minimal interface for azure OpenshiftClustersClient +type OpenShiftClustersClient interface { + ListCredentials(ctx context.Context, resourceGroupName string, resourceName string) (result mgmtredhatopenshift20231122.OpenShiftClusterCredentials, err error) + Get(ctx context.Context, resourceGroupName string, resourceName string) (result mgmtredhatopenshift20231122.OpenShiftCluster, err error) + OpenShiftClustersClientAddons +} + +type openShiftClustersClient struct { + mgmtredhatopenshift20231122.OpenShiftClustersClient +} + +var _ OpenShiftClustersClient = &openShiftClustersClient{} + +// NewOpenShiftClustersClient creates a new OpenShiftClustersClient +func NewOpenShiftClustersClient(environment *azureclient.AROEnvironment, subscriptionID string, authorizer autorest.Authorizer) OpenShiftClustersClient { + var client mgmtredhatopenshift20231122.OpenShiftClustersClient + if env.IsLocalDevelopmentMode() { + client = mgmtredhatopenshift20231122.NewOpenShiftClustersClientWithBaseURI("https://localhost:8443", subscriptionID) + client.Sender = &http.Client{ + Transport: &http.Transport{ + TLSClientConfig: &tls.Config{ + InsecureSkipVerify: true, // #nosec G402 + }, + }, + } + } else { + client = mgmtredhatopenshift20231122.NewOpenShiftClustersClientWithBaseURI(environment.ResourceManagerEndpoint, subscriptionID) + client.Authorizer = authorizer + } + client.PollingDelay = 10 * time.Second + client.PollingDuration = 2 * time.Hour + + return &openShiftClustersClient{ + OpenShiftClustersClient: client, + } +} diff --git a/pkg/util/azureclient/mgmt/redhatopenshift/2023-11-22/redhatopenshift/openshiftclusters_addons.go b/pkg/util/azureclient/mgmt/redhatopenshift/2023-11-22/redhatopenshift/openshiftclusters_addons.go new file mode 100644 index 00000000000..990d196f71a --- /dev/null +++ b/pkg/util/azureclient/mgmt/redhatopenshift/2023-11-22/redhatopenshift/openshiftclusters_addons.go @@ -0,0 +1,72 @@ +package redhatopenshift + +// Copyright (c) Microsoft Corporation. +// Licensed under the Apache License 2.0. + +import ( + "context" + + mgmtredhatopenshift20231122 "github.com/Azure/ARO-RP/pkg/client/services/redhatopenshift/mgmt/2023-11-22/redhatopenshift" +) + +// OpenShiftClustersClientAddons contains addons for OpenShiftClustersClient +type OpenShiftClustersClientAddons interface { + CreateOrUpdateAndWait(ctx context.Context, resourceGroupName string, resourceName string, parameters mgmtredhatopenshift20231122.OpenShiftCluster) error + DeleteAndWait(ctx context.Context, resourceGroupName string, resourceName string) error + List(ctx context.Context) (clusters []mgmtredhatopenshift20231122.OpenShiftCluster, err error) + ListByResourceGroup(ctx context.Context, resourceGroupName string) (clusters []mgmtredhatopenshift20231122.OpenShiftCluster, err error) +} + +func (c *openShiftClustersClient) CreateOrUpdateAndWait(ctx context.Context, resourceGroupName string, resourceName string, parameters mgmtredhatopenshift20231122.OpenShiftCluster) error { + future, err := c.CreateOrUpdate(ctx, resourceGroupName, resourceName, parameters) + if err != nil { + return err + } + + return future.WaitForCompletionRef(ctx, c.Client) +} + +func (c *openShiftClustersClient) DeleteAndWait(ctx context.Context, resourceGroupName string, resourceName string) error { + future, err := c.Delete(ctx, resourceGroupName, resourceName) + if err != nil { + return err + } + + return future.WaitForCompletionRef(ctx, c.Client) +} + +func (c *openShiftClustersClient) List(ctx context.Context) (clusters []mgmtredhatopenshift20231122.OpenShiftCluster, err error) { + page, err := c.OpenShiftClustersClient.List(ctx) + if err != nil { + return nil, err + } + + for page.NotDone() { + clusters = append(clusters, page.Values()...) + + err = page.NextWithContext(ctx) + if err != nil { + return nil, err + } + } + + return clusters, nil +} + +func (c *openShiftClustersClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (clusters []mgmtredhatopenshift20231122.OpenShiftCluster, err error) { + page, err := c.OpenShiftClustersClient.ListByResourceGroup(ctx, resourceGroupName) + if err != nil { + return nil, err + } + + for page.NotDone() { + clusters = append(clusters, page.Values()...) + + err = page.NextWithContext(ctx) + if err != nil { + return nil, err + } + } + + return clusters, nil +} diff --git a/pkg/util/azureclient/mgmt/redhatopenshift/2023-11-22/redhatopenshift/operations.go b/pkg/util/azureclient/mgmt/redhatopenshift/2023-11-22/redhatopenshift/operations.go new file mode 100644 index 00000000000..9fd1ed394b8 --- /dev/null +++ b/pkg/util/azureclient/mgmt/redhatopenshift/2023-11-22/redhatopenshift/operations.go @@ -0,0 +1,48 @@ +package redhatopenshift + +// Copyright (c) Microsoft Corporation. +// Licensed under the Apache License 2.0. + +import ( + "crypto/tls" + "net/http" + + "github.com/Azure/go-autorest/autorest" + + mgmtredhatopenshift20231122 "github.com/Azure/ARO-RP/pkg/client/services/redhatopenshift/mgmt/2023-11-22/redhatopenshift" + "github.com/Azure/ARO-RP/pkg/env" + "github.com/Azure/ARO-RP/pkg/util/azureclient" +) + +// OperationsClient is a minimal interface for azure OperationsClient +type OperationsClient interface { + OperationsClientAddons +} + +type operationsClient struct { + mgmtredhatopenshift20231122.OperationsClient +} + +var _ OperationsClient = &operationsClient{} + +// NewOperationsClient creates a new OperationsClient +func NewOperationsClient(environment *azureclient.AROEnvironment, subscriptionID string, authorizer autorest.Authorizer) OperationsClient { + var client mgmtredhatopenshift20231122.OperationsClient + if env.IsLocalDevelopmentMode() { + client = mgmtredhatopenshift20231122.NewOperationsClientWithBaseURI("https://localhost:8443", subscriptionID) + client.Sender = &http.Client{ + Transport: &http.Transport{ + TLSClientConfig: &tls.Config{ + InsecureSkipVerify: true, // #nosec G402 + }, + }, + } + } else { + client = mgmtredhatopenshift20231122.NewOperationsClientWithBaseURI(environment.ResourceManagerEndpoint, subscriptionID) + client.Authorizer = authorizer + } + + return &operationsClient{ + OperationsClient: client, + } +} diff --git a/pkg/util/azureclient/mgmt/redhatopenshift/2023-11-22/redhatopenshift/operations_addons.go b/pkg/util/azureclient/mgmt/redhatopenshift/2023-11-22/redhatopenshift/operations_addons.go new file mode 100644 index 00000000000..56960e23f5f --- /dev/null +++ b/pkg/util/azureclient/mgmt/redhatopenshift/2023-11-22/redhatopenshift/operations_addons.go @@ -0,0 +1,33 @@ +package redhatopenshift + +// Copyright (c) Microsoft Corporation. +// Licensed under the Apache License 2.0. + +import ( + "context" + + mgmtredhatopenshift20231122 "github.com/Azure/ARO-RP/pkg/client/services/redhatopenshift/mgmt/2023-11-22/redhatopenshift" +) + +// OperationsClientAddons contains addons for OperationsClient +type OperationsClientAddons interface { + List(ctx context.Context) (operations []mgmtredhatopenshift20231122.Operation, err error) +} + +func (c *operationsClient) List(ctx context.Context) (operations []mgmtredhatopenshift20231122.Operation, err error) { + page, err := c.OperationsClient.List(ctx) + if err != nil { + return nil, err + } + + for page.NotDone() { + operations = append(operations, page.Values()...) + + err = page.NextWithContext(ctx) + if err != nil { + return nil, err + } + } + + return operations, nil +} diff --git a/pkg/util/cluster/cluster.go b/pkg/util/cluster/cluster.go index 888cf9496b1..fe0d5cd8e27 100644 --- a/pkg/util/cluster/cluster.go +++ b/pkg/util/cluster/cluster.go @@ -28,8 +28,8 @@ import ( "k8s.io/apimachinery/pkg/util/wait" "github.com/Azure/ARO-RP/pkg/api" - v20220904 "github.com/Azure/ARO-RP/pkg/api/v20220904" - mgmtredhatopenshift20220904 "github.com/Azure/ARO-RP/pkg/client/services/redhatopenshift/mgmt/2022-09-04/redhatopenshift" + v20231122 "github.com/Azure/ARO-RP/pkg/api/v20231122" + mgmtredhatopenshift20231122 "github.com/Azure/ARO-RP/pkg/client/services/redhatopenshift/mgmt/2023-11-22/redhatopenshift" "github.com/Azure/ARO-RP/pkg/deploy/assets" "github.com/Azure/ARO-RP/pkg/deploy/generator" "github.com/Azure/ARO-RP/pkg/env" @@ -41,7 +41,7 @@ import ( redhatopenshift20200430 "github.com/Azure/ARO-RP/pkg/util/azureclient/mgmt/redhatopenshift/2020-04-30/redhatopenshift" redhatopenshift20210901preview "github.com/Azure/ARO-RP/pkg/util/azureclient/mgmt/redhatopenshift/2021-09-01-preview/redhatopenshift" redhatopenshift20220401 "github.com/Azure/ARO-RP/pkg/util/azureclient/mgmt/redhatopenshift/2022-04-01/redhatopenshift" - redhatopenshift20220904 "github.com/Azure/ARO-RP/pkg/util/azureclient/mgmt/redhatopenshift/2022-09-04/redhatopenshift" + redhatopenshift20231122 "github.com/Azure/ARO-RP/pkg/util/azureclient/mgmt/redhatopenshift/2023-11-22/redhatopenshift" utilgraph "github.com/Azure/ARO-RP/pkg/util/graph" "github.com/Azure/ARO-RP/pkg/util/rbac" "github.com/Azure/ARO-RP/pkg/util/uuid" @@ -60,7 +60,8 @@ type Cluster struct { openshiftclustersv20200430 redhatopenshift20200430.OpenShiftClustersClient openshiftclustersv20210901preview redhatopenshift20210901preview.OpenShiftClustersClient openshiftclustersv20220401 redhatopenshift20220401.OpenShiftClustersClient - openshiftclustersv20220904 redhatopenshift20220904.OpenShiftClustersClient + openshiftclustersv20220904 redhatopenshift20231122.OpenShiftClustersClient + openshiftclustersv20231122 redhatopenshift20231122.OpenShiftClustersClient securitygroups network.SecurityGroupsClient subnets network.SubnetsClient routetables network.RouteTablesClient @@ -115,7 +116,8 @@ func New(log *logrus.Entry, environment env.Core, ci bool) (*Cluster, error) { openshiftclustersv20200430: redhatopenshift20200430.NewOpenShiftClustersClient(environment.Environment(), environment.SubscriptionID(), authorizer), openshiftclustersv20210901preview: redhatopenshift20210901preview.NewOpenShiftClustersClient(environment.Environment(), environment.SubscriptionID(), authorizer), openshiftclustersv20220401: redhatopenshift20220401.NewOpenShiftClustersClient(environment.Environment(), environment.SubscriptionID(), authorizer), - openshiftclustersv20220904: redhatopenshift20220904.NewOpenShiftClustersClient(environment.Environment(), environment.SubscriptionID(), authorizer), + openshiftclustersv20220904: redhatopenshift20231122.NewOpenShiftClustersClient(environment.Environment(), environment.SubscriptionID(), authorizer), + openshiftclustersv20231122: redhatopenshift20231122.NewOpenShiftClustersClient(environment.Environment(), environment.SubscriptionID(), authorizer), securitygroups: network.NewSecurityGroupsClient(environment.Environment(), environment.SubscriptionID(), authorizer), subnets: network.NewSubnetsClient(environment.Environment(), environment.SubscriptionID(), authorizer), routetables: network.NewRouteTablesClient(environment.Environment(), environment.SubscriptionID(), authorizer), @@ -140,9 +142,9 @@ func New(log *logrus.Entry, environment env.Core, ci bool) (*Cluster, error) { } func (c *Cluster) Create(ctx context.Context, vnetResourceGroup, clusterName string, osClusterVersion string) error { - clusterGet, err := c.openshiftclustersv20220904.Get(ctx, vnetResourceGroup, clusterName) + clusterGet, err := c.openshiftclustersv20231122.Get(ctx, vnetResourceGroup, clusterName) if err == nil { - if clusterGet.ProvisioningState == mgmtredhatopenshift20220904.Failed { + if clusterGet.ProvisioningState == mgmtredhatopenshift20231122.Failed { return fmt.Errorf("cluster exists and is in failed provisioning state, please delete and retry") } c.log.Print("cluster already exists, skipping create") @@ -501,19 +503,19 @@ func (c *Cluster) createCluster(ctx context.Context, vnetResourceGroup, clusterN oc.Properties.WorkerProfiles[0].VMSize = api.VMSizeStandardD2sV3 } - ext := api.APIs[v20220904.APIVersion].OpenShiftClusterConverter.ToExternal(&oc) + ext := api.APIs[v20231122.APIVersion].OpenShiftClusterConverter.ToExternal(&oc) data, err := json.Marshal(ext) if err != nil { return err } - ocExt := mgmtredhatopenshift20220904.OpenShiftCluster{} + ocExt := mgmtredhatopenshift20231122.OpenShiftCluster{} err = json.Unmarshal(data, &ocExt) if err != nil { return err } - return c.openshiftclustersv20220904.CreateOrUpdateAndWait(ctx, vnetResourceGroup, clusterName, ocExt) + return c.openshiftclustersv20231122.CreateOrUpdateAndWait(ctx, vnetResourceGroup, clusterName, ocExt) } func (c *Cluster) registerSubscription(ctx context.Context) error { diff --git a/python/client/azure/mgmt/redhatopenshift/v2023_11_22/models/__init__.py b/python/client/azure/mgmt/redhatopenshift/v2023_11_22/models/__init__.py index 04fa6db30f2..f06920c51cb 100644 --- a/python/client/azure/mgmt/redhatopenshift/v2023_11_22/models/__init__.py +++ b/python/client/azure/mgmt/redhatopenshift/v2023_11_22/models/__init__.py @@ -38,8 +38,6 @@ from ._models_py3 import OpenShiftVersionList from ._models_py3 import Operation from ._models_py3 import OperationList - from ._models_py3 import OutboundIP - from ._models_py3 import OutboundIPPrefix from ._models_py3 import ProxyResource from ._models_py3 import Resource from ._models_py3 import Secret @@ -79,8 +77,6 @@ from ._models import OpenShiftVersionList # type: ignore from ._models import Operation # type: ignore from ._models import OperationList # type: ignore - from ._models import OutboundIP # type: ignore - from ._models import OutboundIPPrefix # type: ignore from ._models import ProxyResource # type: ignore from ._models import Resource # type: ignore from ._models import Secret # type: ignore @@ -131,8 +127,6 @@ 'OpenShiftVersionList', 'Operation', 'OperationList', - 'OutboundIP', - 'OutboundIPPrefix', 'ProxyResource', 'Resource', 'Secret', diff --git a/python/client/azure/mgmt/redhatopenshift/v2023_11_22/models/_models.py b/python/client/azure/mgmt/redhatopenshift/v2023_11_22/models/_models.py index e79467eec33..b182f547a86 100644 --- a/python/client/azure/mgmt/redhatopenshift/v2023_11_22/models/_models.py +++ b/python/client/azure/mgmt/redhatopenshift/v2023_11_22/models/_models.py @@ -285,15 +285,6 @@ class LoadBalancerProfile(msrest.serialization.Model): balancer. :vartype effective_outbound_ips: list[~azure.mgmt.redhatopenshift.v2023_11_22.models.EffectiveOutboundIP] - :ivar outbound_ips: The desired outbound IP resources for the cluster load balancer. - :vartype outbound_ips: list[~azure.mgmt.redhatopenshift.v2023_11_22.models.OutboundIP] - :ivar outbound_ip_prefixes: The desired outbound IP Prefix resources for the cluster load - balancer. - :vartype outbound_ip_prefixes: - list[~azure.mgmt.redhatopenshift.v2023_11_22.models.OutboundIPPrefix] - :ivar allocated_outbound_ports: The desired number of allocated SNAT ports per VM. Allowed - values are in the range of 0 to 64000 (inclusive). The default value is 1024. - :vartype allocated_outbound_ports: int """ _validation = { @@ -303,9 +294,6 @@ class LoadBalancerProfile(msrest.serialization.Model): _attribute_map = { 'managed_outbound_ips': {'key': 'managedOutboundIps', 'type': 'ManagedOutboundIPs'}, 'effective_outbound_ips': {'key': 'effectiveOutboundIps', 'type': '[EffectiveOutboundIP]'}, - 'outbound_ips': {'key': 'outboundIps', 'type': '[OutboundIP]'}, - 'outbound_ip_prefixes': {'key': 'outboundIpPrefixes', 'type': '[OutboundIPPrefix]'}, - 'allocated_outbound_ports': {'key': 'allocatedOutboundPorts', 'type': 'int'}, } def __init__( @@ -317,22 +305,10 @@ def __init__( balancer. :paramtype managed_outbound_ips: ~azure.mgmt.redhatopenshift.v2023_11_22.models.ManagedOutboundIPs - :keyword outbound_ips: The desired outbound IP resources for the cluster load balancer. - :paramtype outbound_ips: list[~azure.mgmt.redhatopenshift.v2023_11_22.models.OutboundIP] - :keyword outbound_ip_prefixes: The desired outbound IP Prefix resources for the cluster load - balancer. - :paramtype outbound_ip_prefixes: - list[~azure.mgmt.redhatopenshift.v2023_11_22.models.OutboundIPPrefix] - :keyword allocated_outbound_ports: The desired number of allocated SNAT ports per VM. Allowed - values are in the range of 0 to 64000 (inclusive). The default value is 1024. - :paramtype allocated_outbound_ports: int """ super(LoadBalancerProfile, self).__init__(**kwargs) self.managed_outbound_ips = kwargs.get('managed_outbound_ips', None) self.effective_outbound_ips = None - self.outbound_ips = kwargs.get('outbound_ips', None) - self.outbound_ip_prefixes = kwargs.get('outbound_ip_prefixes', None) - self.allocated_outbound_ports = kwargs.get('allocated_outbound_ports', None) class Resource(msrest.serialization.Model): @@ -1159,52 +1135,6 @@ def __init__( self.next_link = kwargs.get('next_link', None) -class OutboundIP(msrest.serialization.Model): - """OutboundIP represents a desired outbound IP resource for the cluster load balancer. - - :ivar id: The fully qualified Azure resource id of an IP address resource. - :vartype id: str - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword id: The fully qualified Azure resource id of an IP address resource. - :paramtype id: str - """ - super(OutboundIP, self).__init__(**kwargs) - self.id = kwargs.get('id', None) - - -class OutboundIPPrefix(msrest.serialization.Model): - """OutboundIPPrefix represents a desired outbound IP Prefix resource for the cluster load balancer. - - :ivar id: The fully qualified Azure resource id of an IP address resource. - :vartype id: str - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword id: The fully qualified Azure resource id of an IP address resource. - :paramtype id: str - """ - super(OutboundIPPrefix, self).__init__(**kwargs) - self.id = kwargs.get('id', None) - - class Secret(ProxyResource): """Secret represents a secret. diff --git a/python/client/azure/mgmt/redhatopenshift/v2023_11_22/models/_models_py3.py b/python/client/azure/mgmt/redhatopenshift/v2023_11_22/models/_models_py3.py index 9948402c352..97c198d0319 100644 --- a/python/client/azure/mgmt/redhatopenshift/v2023_11_22/models/_models_py3.py +++ b/python/client/azure/mgmt/redhatopenshift/v2023_11_22/models/_models_py3.py @@ -318,15 +318,6 @@ class LoadBalancerProfile(msrest.serialization.Model): balancer. :vartype effective_outbound_ips: list[~azure.mgmt.redhatopenshift.v2023_11_22.models.EffectiveOutboundIP] - :ivar outbound_ips: The desired outbound IP resources for the cluster load balancer. - :vartype outbound_ips: list[~azure.mgmt.redhatopenshift.v2023_11_22.models.OutboundIP] - :ivar outbound_ip_prefixes: The desired outbound IP Prefix resources for the cluster load - balancer. - :vartype outbound_ip_prefixes: - list[~azure.mgmt.redhatopenshift.v2023_11_22.models.OutboundIPPrefix] - :ivar allocated_outbound_ports: The desired number of allocated SNAT ports per VM. Allowed - values are in the range of 0 to 64000 (inclusive). The default value is 1024. - :vartype allocated_outbound_ports: int """ _validation = { @@ -336,18 +327,12 @@ class LoadBalancerProfile(msrest.serialization.Model): _attribute_map = { 'managed_outbound_ips': {'key': 'managedOutboundIps', 'type': 'ManagedOutboundIPs'}, 'effective_outbound_ips': {'key': 'effectiveOutboundIps', 'type': '[EffectiveOutboundIP]'}, - 'outbound_ips': {'key': 'outboundIps', 'type': '[OutboundIP]'}, - 'outbound_ip_prefixes': {'key': 'outboundIpPrefixes', 'type': '[OutboundIPPrefix]'}, - 'allocated_outbound_ports': {'key': 'allocatedOutboundPorts', 'type': 'int'}, } def __init__( self, *, managed_outbound_ips: Optional["ManagedOutboundIPs"] = None, - outbound_ips: Optional[List["OutboundIP"]] = None, - outbound_ip_prefixes: Optional[List["OutboundIPPrefix"]] = None, - allocated_outbound_ports: Optional[int] = None, **kwargs ): """ @@ -355,22 +340,10 @@ def __init__( balancer. :paramtype managed_outbound_ips: ~azure.mgmt.redhatopenshift.v2023_11_22.models.ManagedOutboundIPs - :keyword outbound_ips: The desired outbound IP resources for the cluster load balancer. - :paramtype outbound_ips: list[~azure.mgmt.redhatopenshift.v2023_11_22.models.OutboundIP] - :keyword outbound_ip_prefixes: The desired outbound IP Prefix resources for the cluster load - balancer. - :paramtype outbound_ip_prefixes: - list[~azure.mgmt.redhatopenshift.v2023_11_22.models.OutboundIPPrefix] - :keyword allocated_outbound_ports: The desired number of allocated SNAT ports per VM. Allowed - values are in the range of 0 to 64000 (inclusive). The default value is 1024. - :paramtype allocated_outbound_ports: int """ super(LoadBalancerProfile, self).__init__(**kwargs) self.managed_outbound_ips = managed_outbound_ips self.effective_outbound_ips = None - self.outbound_ips = outbound_ips - self.outbound_ip_prefixes = outbound_ip_prefixes - self.allocated_outbound_ports = allocated_outbound_ports class Resource(msrest.serialization.Model): @@ -1263,56 +1236,6 @@ def __init__( self.next_link = next_link -class OutboundIP(msrest.serialization.Model): - """OutboundIP represents a desired outbound IP resource for the cluster load balancer. - - :ivar id: The fully qualified Azure resource id of an IP address resource. - :vartype id: str - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - } - - def __init__( - self, - *, - id: Optional[str] = None, - **kwargs - ): - """ - :keyword id: The fully qualified Azure resource id of an IP address resource. - :paramtype id: str - """ - super(OutboundIP, self).__init__(**kwargs) - self.id = id - - -class OutboundIPPrefix(msrest.serialization.Model): - """OutboundIPPrefix represents a desired outbound IP Prefix resource for the cluster load balancer. - - :ivar id: The fully qualified Azure resource id of an IP address resource. - :vartype id: str - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - } - - def __init__( - self, - *, - id: Optional[str] = None, - **kwargs - ): - """ - :keyword id: The fully qualified Azure resource id of an IP address resource. - :paramtype id: str - """ - super(OutboundIPPrefix, self).__init__(**kwargs) - self.id = id - - class Secret(ProxyResource): """Secret represents a secret. diff --git a/swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2023-11-22/redhatopenshift.json b/swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2023-11-22/redhatopenshift.json index e17e6e4ee9f..ef92b1dd5a7 100644 --- a/swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2023-11-22/redhatopenshift.json +++ b/swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2023-11-22/redhatopenshift.json @@ -1914,27 +1914,6 @@ }, "readOnly": true, "x-ms-identifiers": [] - }, - "outboundIps": { - "description": "The desired outbound IP resources for the cluster load balancer.", - "type": "array", - "items": { - "$ref": "#/definitions/OutboundIP" - }, - "x-ms-identifiers": [] - }, - "outboundIpPrefixes": { - "description": "The desired outbound IP Prefix resources for the cluster load balancer.", - "type": "array", - "items": { - "$ref": "#/definitions/OutboundIPPrefix" - }, - "x-ms-identifiers": [] - }, - "allocatedOutboundPorts": { - "format": "int32", - "description": "The desired number of allocated SNAT ports per VM. Allowed values are in the range of 0 to 64000 (inclusive). The default value is 1024.", - "type": "integer" } } }, @@ -2290,26 +2269,6 @@ } } }, - "OutboundIP": { - "description": "OutboundIP represents a desired outbound IP resource for the cluster load balancer.", - "type": "object", - "properties": { - "id": { - "description": "The fully qualified Azure resource id of an IP address resource.", - "type": "string" - } - } - }, - "OutboundIPPrefix": { - "description": "OutboundIPPrefix represents a desired outbound IP Prefix resource for the cluster load balancer.", - "type": "object", - "properties": { - "id": { - "description": "The fully qualified Azure resource id of an IP address resource.", - "type": "string" - } - } - }, "OutboundType": { "description": "The outbound routing strategy used to provide your cluster egress to the internet.", "enum": [