зеркало из https://github.com/Azure/ARO-RP.git
Merge pull request #2404 from ross-bryan/multi-version-refactor
Multi version refactor
This commit is contained in:
Коммит
d897df3534
|
@ -1,4 +1,4 @@
|
||||||
468fa0da0a50d50640ec57843ad288af343128b39f5bf23e76e4e336580883d4 swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2020-04-30/redhatopenshift.json
|
468fa0da0a50d50640ec57843ad288af343128b39f5bf23e76e4e336580883d4 swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2020-04-30/redhatopenshift.json
|
||||||
c323c84befa5ea11da50a2407050abed6540ea01e796720bc2241604ce80567c swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/preview/2021-09-01-preview/redhatopenshift.json
|
c323c84befa5ea11da50a2407050abed6540ea01e796720bc2241604ce80567c swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/preview/2021-09-01-preview/redhatopenshift.json
|
||||||
e4e522e41855de71c0318db31cbd96c8713e7a74e7c81911bb494f0b194b3f43 swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2022-04-01/redhatopenshift.json
|
e4e522e41855de71c0318db31cbd96c8713e7a74e7c81911bb494f0b194b3f43 swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2022-04-01/redhatopenshift.json
|
||||||
70e23386b8277aea07a1babd61fb2c1252cff46ad032f700b02074fb46a58c4c swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2022-09-04/redhatopenshift.json
|
009e7ade338aa2803cb5ef94e3d6057b7093af7ed9b194e51b86e4eb71b4ac05 swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2022-09-04/redhatopenshift.json
|
||||||
|
|
|
@ -31,10 +31,12 @@ func getLatestOCPVersions(ctx context.Context, log *logrus.Entry) ([]api.OpenShi
|
||||||
var (
|
var (
|
||||||
OpenshiftVersions = []api.OpenShiftVersion{
|
OpenshiftVersions = []api.OpenShiftVersion{
|
||||||
{
|
{
|
||||||
Version: version.InstallStream.Version.String(),
|
Properties: api.OpenShiftVersionProperties{
|
||||||
OpenShiftPullspec: version.InstallStream.PullSpec,
|
Version: version.InstallStream.Version.String(),
|
||||||
InstallerPullspec: dstRepo + "/aro-installer:release-4.10",
|
OpenShiftPullspec: version.InstallStream.PullSpec,
|
||||||
Enabled: true,
|
InstallerPullspec: dstRepo + "/aro-installer:release-4.10",
|
||||||
|
Enabled: true,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
@ -121,13 +123,13 @@ func updateOpenShiftVersions(ctx context.Context, dbOpenShiftVersions database.O
|
||||||
|
|
||||||
newVersions := make(map[string]api.OpenShiftVersion)
|
newVersions := make(map[string]api.OpenShiftVersion)
|
||||||
for _, doc := range latestVersions {
|
for _, doc := range latestVersions {
|
||||||
newVersions[doc.Version] = doc
|
newVersions[doc.Properties.Version] = doc
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, doc := range existingVersions.OpenShiftVersionDocuments {
|
for _, doc := range existingVersions.OpenShiftVersionDocuments {
|
||||||
existing, found := newVersions[doc.OpenShiftVersion.Version]
|
existing, found := newVersions[doc.OpenShiftVersion.Properties.Version]
|
||||||
if found {
|
if found {
|
||||||
log.Printf("Found Version %q, patching", existing.Version)
|
log.Printf("Found Version %q, patching", existing.Properties.Version)
|
||||||
_, err := dbOpenShiftVersions.Patch(ctx, doc.ID, func(inFlightDoc *api.OpenShiftVersionDocument) error {
|
_, err := dbOpenShiftVersions.Patch(ctx, doc.ID, func(inFlightDoc *api.OpenShiftVersionDocument) error {
|
||||||
inFlightDoc.OpenShiftVersion = &existing
|
inFlightDoc.OpenShiftVersion = &existing
|
||||||
return nil
|
return nil
|
||||||
|
@ -135,12 +137,12 @@ func updateOpenShiftVersions(ctx context.Context, dbOpenShiftVersions database.O
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
log.Printf("Version %q found", existing.Version)
|
log.Printf("Version %q found", existing.Properties.Version)
|
||||||
delete(newVersions, existing.Version)
|
delete(newVersions, existing.Properties.Version)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Printf("Version %q not found, deleting", doc.OpenShiftVersion.Version)
|
log.Printf("Version %q not found, deleting", doc.OpenShiftVersion.Properties.Version)
|
||||||
err := dbOpenShiftVersions.Delete(ctx, doc)
|
err := dbOpenShiftVersions.Delete(ctx, doc)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
@ -148,7 +150,7 @@ func updateOpenShiftVersions(ctx context.Context, dbOpenShiftVersions database.O
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, doc := range newVersions {
|
for _, doc := range newVersions {
|
||||||
log.Printf("Version %q not found in database, creating", doc.Version)
|
log.Printf("Version %q not found in database, creating", doc.Properties.Version)
|
||||||
newDoc := api.OpenShiftVersionDocument{
|
newDoc := api.OpenShiftVersionDocument{
|
||||||
ID: dbOpenShiftVersions.NewUUID(),
|
ID: dbOpenShiftVersions.NewUUID(),
|
||||||
OpenShiftVersion: &doc,
|
OpenShiftVersion: &doc,
|
||||||
|
|
|
@ -216,6 +216,15 @@
|
||||||
curl -X GET -k "https://localhost:8443/admin/subscriptions/$AZURE_SUBSCRIPTION_ID/resourceGroups/$RESOURCEGROUP/providers/Microsoft.RedHatOpenShift/openShiftClusters/$CLUSTER/kubernetespodlogs?podname=$POD&namespace=$NAMESPACE&container=$CONTAINER"
|
curl -X GET -k "https://localhost:8443/admin/subscriptions/$AZURE_SUBSCRIPTION_ID/resourceGroups/$RESOURCEGROUP/providers/Microsoft.RedHatOpenShift/openShiftClusters/$CLUSTER/kubernetespodlogs?podname=$POD&namespace=$NAMESPACE&container=$CONTAINER"
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## OpenShift Version
|
||||||
|
|
||||||
|
* We have a cosmos container which contains supported installable OCP versions, more information on the definition in `pkg/api/openshiftversion.go`.
|
||||||
|
|
||||||
|
* Populate the `OpenShiftVersions` container via admin api
|
||||||
|
```bash
|
||||||
|
curl -X PUT -k "https://localhost:8443/admin/versions" --header "Content-Type: application/json" -d '{ "properties": { "version": "4.10.0", "enabled": true, "openShiftPullspec": "test.com/a:b", "installerPullspec": "test.com/a:b" }}'
|
||||||
|
```
|
||||||
|
|
||||||
## OpenShift Cluster Manager (OCM) Configuration API Actions
|
## OpenShift Cluster Manager (OCM) Configuration API Actions
|
||||||
|
|
||||||
* Create a new OCM configuration
|
* Create a new OCM configuration
|
||||||
|
|
|
@ -10,6 +10,19 @@ type OpenShiftVersionList struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
type OpenShiftVersion struct {
|
type OpenShiftVersion struct {
|
||||||
|
// The ID for the resource.
|
||||||
|
ID string `json:"id,omitempty"`
|
||||||
|
|
||||||
|
// Name of the resource.
|
||||||
|
Name string `json:"name,omitempty"`
|
||||||
|
|
||||||
|
// The properties for the OpenShiftVersion resource.
|
||||||
|
Properties OpenShiftVersionProperties `json:"properties,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// OpenShiftVersionProperties represents the properties of an OpenShiftVersion.
|
||||||
|
type OpenShiftVersionProperties struct {
|
||||||
|
// Version represents the version to create the cluster at.
|
||||||
Version string `json:"version,omitempty"`
|
Version string `json:"version,omitempty"`
|
||||||
OpenShiftPullspec string `json:"openShiftPullspec,omitempty" mutable:"true"`
|
OpenShiftPullspec string `json:"openShiftPullspec,omitempty" mutable:"true"`
|
||||||
InstallerPullspec string `json:"installerPullspec,omitempty" mutable:"true"`
|
InstallerPullspec string `json:"installerPullspec,omitempty" mutable:"true"`
|
||||||
|
|
|
@ -16,10 +16,12 @@ type openShiftVersionConverter struct{}
|
||||||
// returned objects.
|
// returned objects.
|
||||||
func (openShiftVersionConverter) ToExternal(v *api.OpenShiftVersion) interface{} {
|
func (openShiftVersionConverter) ToExternal(v *api.OpenShiftVersion) interface{} {
|
||||||
out := &OpenShiftVersion{
|
out := &OpenShiftVersion{
|
||||||
Version: v.Version,
|
Properties: OpenShiftVersionProperties{
|
||||||
OpenShiftPullspec: v.OpenShiftPullspec,
|
Version: v.Properties.Version,
|
||||||
InstallerPullspec: v.InstallerPullspec,
|
OpenShiftPullspec: v.Properties.OpenShiftPullspec,
|
||||||
Enabled: v.Enabled,
|
InstallerPullspec: v.Properties.InstallerPullspec,
|
||||||
|
Enabled: v.Properties.Enabled,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
return out
|
return out
|
||||||
|
@ -46,8 +48,8 @@ func (c openShiftVersionConverter) ToExternalList(vers []*api.OpenShiftVersion)
|
||||||
func (c openShiftVersionConverter) ToInternal(_new interface{}, out *api.OpenShiftVersion) {
|
func (c openShiftVersionConverter) ToInternal(_new interface{}, out *api.OpenShiftVersion) {
|
||||||
new := _new.(*OpenShiftVersion)
|
new := _new.(*OpenShiftVersion)
|
||||||
|
|
||||||
out.Enabled = new.Enabled
|
out.Properties.Enabled = new.Properties.Enabled
|
||||||
out.InstallerPullspec = new.InstallerPullspec
|
out.Properties.InstallerPullspec = new.Properties.InstallerPullspec
|
||||||
out.OpenShiftPullspec = new.OpenShiftPullspec
|
out.Properties.OpenShiftPullspec = new.Properties.OpenShiftPullspec
|
||||||
out.Version = new.Version
|
out.Properties.Version = new.Properties.Version
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,15 +34,15 @@ func (sv openShiftVersionStaticValidator) Static(_new interface{}, _current *api
|
||||||
}
|
}
|
||||||
|
|
||||||
func (sv openShiftVersionStaticValidator) validate(new *OpenShiftVersion, isCreate bool) error {
|
func (sv openShiftVersionStaticValidator) validate(new *OpenShiftVersion, isCreate bool) error {
|
||||||
if new.Version == "" {
|
if new.Properties.Version == "" {
|
||||||
return api.NewCloudError(http.StatusBadRequest, api.CloudErrorCodeInvalidParameter, "version", "Must be provided")
|
return api.NewCloudError(http.StatusBadRequest, api.CloudErrorCodeInvalidParameter, "version", "Must be provided")
|
||||||
}
|
}
|
||||||
|
|
||||||
if new.InstallerPullspec == "" {
|
if new.Properties.InstallerPullspec == "" {
|
||||||
return api.NewCloudError(http.StatusBadRequest, api.CloudErrorCodeInvalidParameter, "installerPullspec", "Must be provided")
|
return api.NewCloudError(http.StatusBadRequest, api.CloudErrorCodeInvalidParameter, "installerPullspec", "Must be provided")
|
||||||
}
|
}
|
||||||
|
|
||||||
if new.OpenShiftPullspec == "" {
|
if new.Properties.OpenShiftPullspec == "" {
|
||||||
return api.NewCloudError(http.StatusBadRequest, api.CloudErrorCodeInvalidParameter, "openShiftPullspec", "Must be provided")
|
return api.NewCloudError(http.StatusBadRequest, api.CloudErrorCodeInvalidParameter, "openShiftPullspec", "Must be provided")
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
|
|
|
@ -1,16 +0,0 @@
|
||||||
package installversion
|
|
||||||
|
|
||||||
// Copyright (c) Microsoft Corporation.
|
|
||||||
// Licensed under the Apache License 2.0.
|
|
||||||
|
|
||||||
// OpenShiftCluster represents the portion of the OpenShift cluster
|
|
||||||
// representation which provides the cluster installation version.
|
|
||||||
type openShiftCluster struct {
|
|
||||||
Properties openShiftClusterProperties `json:"properties,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// OpenShiftClusterProperties represents an OpenShift cluster's properties.
|
|
||||||
type openShiftClusterProperties struct {
|
|
||||||
// The cluster install version.
|
|
||||||
InstallVersion string `json:"installVersion,omitempty"`
|
|
||||||
}
|
|
|
@ -1,19 +0,0 @@
|
||||||
package installversion
|
|
||||||
|
|
||||||
// Copyright (c) Microsoft Corporation.
|
|
||||||
// Licensed under the Apache License 2.0.
|
|
||||||
|
|
||||||
import (
|
|
||||||
"encoding/json"
|
|
||||||
)
|
|
||||||
|
|
||||||
func FromExternalBytes(body []byte) (*openShiftCluster, error) {
|
|
||||||
r := &openShiftCluster{}
|
|
||||||
|
|
||||||
err := json.Unmarshal(body, &r)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
return r, nil
|
|
||||||
}
|
|
|
@ -1,83 +0,0 @@
|
||||||
package installversion
|
|
||||||
|
|
||||||
// Copyright (c) Microsoft Corporation.
|
|
||||||
// Licensed under the Apache License 2.0.
|
|
||||||
|
|
||||||
import (
|
|
||||||
"encoding/json"
|
|
||||||
"testing"
|
|
||||||
|
|
||||||
v20200430 "github.com/Azure/ARO-RP/pkg/api/v20200430"
|
|
||||||
v20220904 "github.com/Azure/ARO-RP/pkg/api/v20220904"
|
|
||||||
)
|
|
||||||
|
|
||||||
func TestParsePreInstallAPI(t *testing.T) {
|
|
||||||
preInstallVersion := &v20200430.OpenShiftCluster{
|
|
||||||
Properties: v20200430.OpenShiftClusterProperties{
|
|
||||||
ClusterProfile: v20200430.ClusterProfile{
|
|
||||||
Domain: "example",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
b, err := json.Marshal(preInstallVersion)
|
|
||||||
if err != nil {
|
|
||||||
t.Fatal(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
ver, err := FromExternalBytes(b)
|
|
||||||
if err != nil {
|
|
||||||
t.Fatal(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
if ver.Properties.InstallVersion != "" {
|
|
||||||
t.Error(ver.Properties.InstallVersion)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestParsePostInstallAPI(t *testing.T) {
|
|
||||||
postInstallVersion := &v20220904.OpenShiftCluster{
|
|
||||||
Properties: v20220904.OpenShiftClusterProperties{
|
|
||||||
ClusterProfile: v20220904.ClusterProfile{
|
|
||||||
Domain: "example",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
b, err := json.Marshal(postInstallVersion)
|
|
||||||
if err != nil {
|
|
||||||
t.Fatal(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
ver, err := FromExternalBytes(b)
|
|
||||||
if err != nil {
|
|
||||||
t.Fatal(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
if ver.Properties.InstallVersion != "" {
|
|
||||||
t.Error(ver.Properties.InstallVersion)
|
|
||||||
}
|
|
||||||
|
|
||||||
postInstallVersionWithVersion := &v20220904.OpenShiftCluster{
|
|
||||||
Properties: v20220904.OpenShiftClusterProperties{
|
|
||||||
InstallVersion: "4.10.0",
|
|
||||||
ClusterProfile: v20220904.ClusterProfile{
|
|
||||||
Domain: "example",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
b, err = json.Marshal(postInstallVersionWithVersion)
|
|
||||||
if err != nil {
|
|
||||||
t.Fatal(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
ver, err = FromExternalBytes(b)
|
|
||||||
if err != nil {
|
|
||||||
t.Fatal(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
if ver.Properties.InstallVersion != "4.10.0" {
|
|
||||||
t.Error(ver.Properties.InstallVersion)
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -8,8 +8,17 @@ type OpenShiftVersion struct {
|
||||||
MissingFields
|
MissingFields
|
||||||
|
|
||||||
ID string `json:"id,omitempty"`
|
ID string `json:"id,omitempty"`
|
||||||
|
Name string `json:"name,omitempty"`
|
||||||
|
Type string `json:"type,omitempty"`
|
||||||
Deleting bool `json:"deleting,omitempty"` // https://docs.microsoft.com/en-us/azure/cosmos-db/change-feed-design-patterns#deletes
|
Deleting bool `json:"deleting,omitempty"` // https://docs.microsoft.com/en-us/azure/cosmos-db/change-feed-design-patterns#deletes
|
||||||
|
|
||||||
|
// The properties for the OpenShiftVersion resource.
|
||||||
|
Properties OpenShiftVersionProperties `json:"properties,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// OpenShiftVersionProperties represents the properties of an OpenShiftVersion.
|
||||||
|
type OpenShiftVersionProperties struct {
|
||||||
|
// Version represents the version to create the cluster at.
|
||||||
Version string `json:"version,omitempty"`
|
Version string `json:"version,omitempty"`
|
||||||
OpenShiftPullspec string `json:"openShiftPullspec,omitempty"`
|
OpenShiftPullspec string `json:"openShiftPullspec,omitempty"`
|
||||||
InstallerPullspec string `json:"installerPullspec,omitempty"`
|
InstallerPullspec string `json:"installerPullspec,omitempty"`
|
||||||
|
|
|
@ -0,0 +1,22 @@
|
||||||
|
package api
|
||||||
|
|
||||||
|
// Copyright (c) Microsoft Corporation.
|
||||||
|
// Licensed under the Apache License 2.0.
|
||||||
|
|
||||||
|
func ExampleOpenShiftVersionDocument() *OpenShiftVersionDocument {
|
||||||
|
return &OpenShiftVersionDocument{
|
||||||
|
MissingFields: MissingFields{},
|
||||||
|
ID: "00000000-0000-0000-0000-000000000000",
|
||||||
|
OpenShiftVersion: &OpenShiftVersion{
|
||||||
|
ID: "00000000-0000-0000-0000-000000000000",
|
||||||
|
Name: "default",
|
||||||
|
Type: "Microsoft.RedHatOpenShift/OpenShiftVersion",
|
||||||
|
Properties: OpenShiftVersionProperties{
|
||||||
|
Version: "4.10.20",
|
||||||
|
OpenShiftPullspec: "ab:c",
|
||||||
|
InstallerPullspec: "de:f",
|
||||||
|
Enabled: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
|
@ -35,10 +35,6 @@ type OpenShiftVersionConverter interface {
|
||||||
ToInternal(interface{}, *OpenShiftVersion)
|
ToInternal(interface{}, *OpenShiftVersion)
|
||||||
}
|
}
|
||||||
|
|
||||||
type InstallVersionsConverter interface {
|
|
||||||
ToExternal(*InstallVersions) interface{}
|
|
||||||
}
|
|
||||||
|
|
||||||
type OpenShiftVersionStaticValidator interface {
|
type OpenShiftVersionStaticValidator interface {
|
||||||
Static(interface{}, *OpenShiftVersion) error
|
Static(interface{}, *OpenShiftVersion) error
|
||||||
}
|
}
|
||||||
|
@ -52,7 +48,6 @@ type Version struct {
|
||||||
OpenShiftClusterAdminKubeconfigConverter OpenShiftClusterAdminKubeconfigConverter
|
OpenShiftClusterAdminKubeconfigConverter OpenShiftClusterAdminKubeconfigConverter
|
||||||
OpenShiftVersionConverter OpenShiftVersionConverter
|
OpenShiftVersionConverter OpenShiftVersionConverter
|
||||||
OpenShiftVersionStaticValidator OpenShiftVersionStaticValidator
|
OpenShiftVersionStaticValidator OpenShiftVersionStaticValidator
|
||||||
InstallVersionsConverter InstallVersionsConverter
|
|
||||||
OperationList OperationList
|
OperationList OperationList
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,6 @@ import (
|
||||||
"github.com/Azure/ARO-RP/pkg/util/pullsecret"
|
"github.com/Azure/ARO-RP/pkg/util/pullsecret"
|
||||||
"github.com/Azure/ARO-RP/pkg/util/subnet"
|
"github.com/Azure/ARO-RP/pkg/util/subnet"
|
||||||
"github.com/Azure/ARO-RP/pkg/util/uuid"
|
"github.com/Azure/ARO-RP/pkg/util/uuid"
|
||||||
"github.com/Azure/ARO-RP/pkg/util/version"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type openShiftClusterStaticValidator struct {
|
type openShiftClusterStaticValidator struct {
|
||||||
|
@ -149,10 +148,6 @@ func (sv openShiftClusterStaticValidator) validateClusterProfile(path string, cp
|
||||||
return api.NewCloudError(http.StatusBadRequest, api.CloudErrorCodeInvalidParameter, path+".domain", "The provided domain '%s' is invalid.", cp.Domain)
|
return api.NewCloudError(http.StatusBadRequest, api.CloudErrorCodeInvalidParameter, path+".domain", "The provided domain '%s' is invalid.", cp.Domain)
|
||||||
}
|
}
|
||||||
|
|
||||||
if isCreate && cp.Version != version.InstallStream.Version.String() {
|
|
||||||
return api.NewCloudError(http.StatusBadRequest, api.CloudErrorCodeInvalidParameter, path+".version", "The provided version '%s' is invalid.", cp.Version)
|
|
||||||
}
|
|
||||||
|
|
||||||
if !validate.RxResourceGroupID.MatchString(cp.ResourceGroupID) {
|
if !validate.RxResourceGroupID.MatchString(cp.ResourceGroupID) {
|
||||||
return api.NewCloudError(http.StatusBadRequest, api.CloudErrorCodeInvalidParameter, path+".resourceGroupId", "The provided resource group '%s' is invalid.", cp.ResourceGroupID)
|
return api.NewCloudError(http.StatusBadRequest, api.CloudErrorCodeInvalidParameter, path+".resourceGroupId", "The provided resource group '%s' is invalid.", cp.ResourceGroupID)
|
||||||
}
|
}
|
||||||
|
|
|
@ -317,13 +317,6 @@ func TestOpenShiftClusterStaticValidateClusterProfile(t *testing.T) {
|
||||||
oc.Properties.ClusterProfile.PullSecret = ""
|
oc.Properties.ClusterProfile.PullSecret = ""
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
|
||||||
name: "version invalid",
|
|
||||||
modify: func(oc *OpenShiftCluster) {
|
|
||||||
oc.Properties.ClusterProfile.Version = "invalid"
|
|
||||||
},
|
|
||||||
wantErr: "400: InvalidParameter: properties.clusterProfile.version: The provided version 'invalid' is invalid.",
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
name: "leading digit domain invalid",
|
name: "leading digit domain invalid",
|
||||||
modify: func(oc *OpenShiftCluster) {
|
modify: func(oc *OpenShiftCluster) {
|
||||||
|
|
|
@ -18,7 +18,6 @@ import (
|
||||||
"github.com/Azure/ARO-RP/pkg/util/pullsecret"
|
"github.com/Azure/ARO-RP/pkg/util/pullsecret"
|
||||||
"github.com/Azure/ARO-RP/pkg/util/subnet"
|
"github.com/Azure/ARO-RP/pkg/util/subnet"
|
||||||
"github.com/Azure/ARO-RP/pkg/util/uuid"
|
"github.com/Azure/ARO-RP/pkg/util/uuid"
|
||||||
"github.com/Azure/ARO-RP/pkg/util/version"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type openShiftClusterStaticValidator struct {
|
type openShiftClusterStaticValidator struct {
|
||||||
|
@ -152,10 +151,6 @@ func (sv openShiftClusterStaticValidator) validateClusterProfile(path string, cp
|
||||||
return api.NewCloudError(http.StatusBadRequest, api.CloudErrorCodeInvalidParameter, path+".domain", "The provided domain '%s' is invalid.", cp.Domain)
|
return api.NewCloudError(http.StatusBadRequest, api.CloudErrorCodeInvalidParameter, path+".domain", "The provided domain '%s' is invalid.", cp.Domain)
|
||||||
}
|
}
|
||||||
|
|
||||||
if isCreate && cp.Version != version.InstallStream.Version.String() {
|
|
||||||
return api.NewCloudError(http.StatusBadRequest, api.CloudErrorCodeInvalidParameter, path+".version", "The provided version '%s' is invalid.", cp.Version)
|
|
||||||
}
|
|
||||||
|
|
||||||
if !validate.RxResourceGroupID.MatchString(cp.ResourceGroupID) {
|
if !validate.RxResourceGroupID.MatchString(cp.ResourceGroupID) {
|
||||||
return api.NewCloudError(http.StatusBadRequest, api.CloudErrorCodeInvalidParameter, path+".resourceGroupId", "The provided resource group '%s' is invalid.", cp.ResourceGroupID)
|
return api.NewCloudError(http.StatusBadRequest, api.CloudErrorCodeInvalidParameter, path+".resourceGroupId", "The provided resource group '%s' is invalid.", cp.ResourceGroupID)
|
||||||
}
|
}
|
||||||
|
|
|
@ -317,13 +317,6 @@ func TestOpenShiftClusterStaticValidateClusterProfile(t *testing.T) {
|
||||||
oc.Properties.ClusterProfile.PullSecret = ""
|
oc.Properties.ClusterProfile.PullSecret = ""
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
|
||||||
name: "version invalid",
|
|
||||||
modify: func(oc *OpenShiftCluster) {
|
|
||||||
oc.Properties.ClusterProfile.Version = "invalid"
|
|
||||||
},
|
|
||||||
wantErr: "400: InvalidParameter: properties.clusterProfile.version: The provided version 'invalid' is invalid.",
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
name: "leading digit domain invalid",
|
name: "leading digit domain invalid",
|
||||||
modify: func(oc *OpenShiftCluster) {
|
modify: func(oc *OpenShiftCluster) {
|
||||||
|
|
|
@ -18,7 +18,6 @@ import (
|
||||||
"github.com/Azure/ARO-RP/pkg/util/pullsecret"
|
"github.com/Azure/ARO-RP/pkg/util/pullsecret"
|
||||||
"github.com/Azure/ARO-RP/pkg/util/subnet"
|
"github.com/Azure/ARO-RP/pkg/util/subnet"
|
||||||
"github.com/Azure/ARO-RP/pkg/util/uuid"
|
"github.com/Azure/ARO-RP/pkg/util/uuid"
|
||||||
"github.com/Azure/ARO-RP/pkg/util/version"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type openShiftClusterStaticValidator struct {
|
type openShiftClusterStaticValidator struct {
|
||||||
|
@ -152,10 +151,6 @@ func (sv openShiftClusterStaticValidator) validateClusterProfile(path string, cp
|
||||||
return api.NewCloudError(http.StatusBadRequest, api.CloudErrorCodeInvalidParameter, path+".domain", "The provided domain '%s' is invalid.", cp.Domain)
|
return api.NewCloudError(http.StatusBadRequest, api.CloudErrorCodeInvalidParameter, path+".domain", "The provided domain '%s' is invalid.", cp.Domain)
|
||||||
}
|
}
|
||||||
|
|
||||||
if isCreate && cp.Version != version.InstallStream.Version.String() {
|
|
||||||
return api.NewCloudError(http.StatusBadRequest, api.CloudErrorCodeInvalidParameter, path+".version", "The provided version '%s' is invalid.", cp.Version)
|
|
||||||
}
|
|
||||||
|
|
||||||
if !validate.RxResourceGroupID.MatchString(cp.ResourceGroupID) {
|
if !validate.RxResourceGroupID.MatchString(cp.ResourceGroupID) {
|
||||||
return api.NewCloudError(http.StatusBadRequest, api.CloudErrorCodeInvalidParameter, path+".resourceGroupId", "The provided resource group '%s' is invalid.", cp.ResourceGroupID)
|
return api.NewCloudError(http.StatusBadRequest, api.CloudErrorCodeInvalidParameter, path+".resourceGroupId", "The provided resource group '%s' is invalid.", cp.ResourceGroupID)
|
||||||
}
|
}
|
||||||
|
|
|
@ -334,13 +334,6 @@ func TestOpenShiftClusterStaticValidateClusterProfile(t *testing.T) {
|
||||||
oc.Properties.ClusterProfile.PullSecret = ""
|
oc.Properties.ClusterProfile.PullSecret = ""
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
|
||||||
name: "version invalid",
|
|
||||||
modify: func(oc *OpenShiftCluster) {
|
|
||||||
oc.Properties.ClusterProfile.Version = "invalid"
|
|
||||||
},
|
|
||||||
wantErr: "400: InvalidParameter: properties.clusterProfile.version: The provided version 'invalid' is invalid.",
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
name: "leading digit domain invalid",
|
name: "leading digit domain invalid",
|
||||||
modify: func(oc *OpenShiftCluster) {
|
modify: func(oc *OpenShiftCluster) {
|
||||||
|
|
|
@ -18,7 +18,6 @@ import (
|
||||||
"github.com/Azure/ARO-RP/pkg/util/pullsecret"
|
"github.com/Azure/ARO-RP/pkg/util/pullsecret"
|
||||||
"github.com/Azure/ARO-RP/pkg/util/subnet"
|
"github.com/Azure/ARO-RP/pkg/util/subnet"
|
||||||
"github.com/Azure/ARO-RP/pkg/util/uuid"
|
"github.com/Azure/ARO-RP/pkg/util/uuid"
|
||||||
"github.com/Azure/ARO-RP/pkg/util/version"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type openShiftClusterStaticValidator struct {
|
type openShiftClusterStaticValidator struct {
|
||||||
|
@ -152,10 +151,6 @@ func (sv openShiftClusterStaticValidator) validateClusterProfile(path string, cp
|
||||||
return api.NewCloudError(http.StatusBadRequest, api.CloudErrorCodeInvalidParameter, path+".domain", "The provided domain '%s' is invalid.", cp.Domain)
|
return api.NewCloudError(http.StatusBadRequest, api.CloudErrorCodeInvalidParameter, path+".domain", "The provided domain '%s' is invalid.", cp.Domain)
|
||||||
}
|
}
|
||||||
|
|
||||||
if isCreate && cp.Version != version.InstallStream.Version.String() {
|
|
||||||
return api.NewCloudError(http.StatusBadRequest, api.CloudErrorCodeInvalidParameter, path+".version", "The provided version '%s' is invalid.", cp.Version)
|
|
||||||
}
|
|
||||||
|
|
||||||
if !validate.RxResourceGroupID.MatchString(cp.ResourceGroupID) {
|
if !validate.RxResourceGroupID.MatchString(cp.ResourceGroupID) {
|
||||||
return api.NewCloudError(http.StatusBadRequest, api.CloudErrorCodeInvalidParameter, path+".resourceGroupId", "The provided resource group '%s' is invalid.", cp.ResourceGroupID)
|
return api.NewCloudError(http.StatusBadRequest, api.CloudErrorCodeInvalidParameter, path+".resourceGroupId", "The provided resource group '%s' is invalid.", cp.ResourceGroupID)
|
||||||
}
|
}
|
||||||
|
|
|
@ -348,13 +348,6 @@ func TestOpenShiftClusterStaticValidateClusterProfile(t *testing.T) {
|
||||||
oc.Properties.ClusterProfile.PullSecret = ""
|
oc.Properties.ClusterProfile.PullSecret = ""
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
|
||||||
name: "version invalid",
|
|
||||||
modify: func(oc *OpenShiftCluster) {
|
|
||||||
oc.Properties.ClusterProfile.Version = "invalid"
|
|
||||||
},
|
|
||||||
wantErr: "400: InvalidParameter: properties.clusterProfile.version: The provided version 'invalid' is invalid.",
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
name: "leading digit domain invalid",
|
name: "leading digit domain invalid",
|
||||||
modify: func(oc *OpenShiftCluster) {
|
modify: func(oc *OpenShiftCluster) {
|
||||||
|
|
|
@ -1,7 +0,0 @@
|
||||||
package v20220904
|
|
||||||
|
|
||||||
// Copyright (c) Microsoft Corporation.
|
|
||||||
// Licensed under the Apache License 2.0.
|
|
||||||
|
|
||||||
// InstallVersions represents a List of OpenShift installable versions.
|
|
||||||
type InstallVersions []InstallVersion
|
|
|
@ -1,12 +0,0 @@
|
||||||
package v20220904
|
|
||||||
|
|
||||||
import "github.com/Azure/ARO-RP/pkg/api"
|
|
||||||
|
|
||||||
// Copyright (c) Microsoft Corporation.
|
|
||||||
// Licensed under the Apache License 2.0.
|
|
||||||
|
|
||||||
type installVersionsConverter struct{}
|
|
||||||
|
|
||||||
func (installVersionsConverter) ToExternal(installVersions *api.InstallVersions) interface{} {
|
|
||||||
return installVersions
|
|
||||||
}
|
|
|
@ -1,10 +0,0 @@
|
||||||
package v20220904
|
|
||||||
|
|
||||||
// Copyright (c) Microsoft Corporation.
|
|
||||||
// Licensed under the Apache License 2.0.
|
|
||||||
|
|
||||||
// ExampleInstallVersions returns an example
|
|
||||||
// InstallVersions object i.e []string that the RP would return to an end-user.
|
|
||||||
func ExampleInstallVersionsResponse() interface{} {
|
|
||||||
return &InstallVersions{"4.10.20"}
|
|
||||||
}
|
|
|
@ -69,9 +69,6 @@ type OpenShiftClusterProperties struct {
|
||||||
|
|
||||||
// The cluster ingress profiles.
|
// The cluster ingress profiles.
|
||||||
IngressProfiles []IngressProfile `json:"ingressProfiles,omitempty"`
|
IngressProfiles []IngressProfile `json:"ingressProfiles,omitempty"`
|
||||||
|
|
||||||
// The cluster install version.
|
|
||||||
InstallVersion string `json:"installVersion,omitempty"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ProvisioningState represents a provisioning state.
|
// ProvisioningState represents a provisioning state.
|
||||||
|
@ -87,9 +84,6 @@ const (
|
||||||
ProvisioningStateFailed ProvisioningState = "Failed"
|
ProvisioningStateFailed ProvisioningState = "Failed"
|
||||||
)
|
)
|
||||||
|
|
||||||
// InstallVersion is the OpenShift installation version string.
|
|
||||||
type InstallVersion string
|
|
||||||
|
|
||||||
// FipsValidatedModules determines if FIPS is used.
|
// FipsValidatedModules determines if FIPS is used.
|
||||||
type FipsValidatedModules string
|
type FipsValidatedModules string
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,6 @@ func ExampleOpenShiftClusterPutParameter() interface{} {
|
||||||
oc.Properties.APIServerProfile.IP = ""
|
oc.Properties.APIServerProfile.IP = ""
|
||||||
oc.Properties.IngressProfiles[0].IP = ""
|
oc.Properties.IngressProfiles[0].IP = ""
|
||||||
oc.Properties.MasterProfile.EncryptionAtHost = EncryptionAtHost(EncryptionAtHostEnabled)
|
oc.Properties.MasterProfile.EncryptionAtHost = EncryptionAtHost(EncryptionAtHostEnabled)
|
||||||
oc.Properties.InstallVersion = ""
|
|
||||||
oc.SystemData = nil
|
oc.SystemData = nil
|
||||||
|
|
||||||
return oc
|
return oc
|
||||||
|
|
|
@ -151,10 +151,6 @@ func (sv openShiftClusterStaticValidator) validateClusterProfile(path string, cp
|
||||||
return api.NewCloudError(http.StatusBadRequest, api.CloudErrorCodeInvalidParameter, path+".domain", "The provided domain '%s' is invalid.", cp.Domain)
|
return api.NewCloudError(http.StatusBadRequest, api.CloudErrorCodeInvalidParameter, path+".domain", "The provided domain '%s' is invalid.", cp.Domain)
|
||||||
}
|
}
|
||||||
|
|
||||||
if isCreate && !validate.RxInstallVersion.MatchString(cp.Version) {
|
|
||||||
return api.NewCloudError(http.StatusBadRequest, api.CloudErrorCodeInvalidParameter, path+".version", "The provided version '%s' is invalid.", cp.Version)
|
|
||||||
}
|
|
||||||
|
|
||||||
if !validate.RxResourceGroupID.MatchString(cp.ResourceGroupID) {
|
if !validate.RxResourceGroupID.MatchString(cp.ResourceGroupID) {
|
||||||
return api.NewCloudError(http.StatusBadRequest, api.CloudErrorCodeInvalidParameter, path+".resourceGroupId", "The provided resource group '%s' is invalid.", cp.ResourceGroupID)
|
return api.NewCloudError(http.StatusBadRequest, api.CloudErrorCodeInvalidParameter, path+".resourceGroupId", "The provided resource group '%s' is invalid.", cp.ResourceGroupID)
|
||||||
}
|
}
|
||||||
|
|
|
@ -363,13 +363,6 @@ func TestOpenShiftClusterStaticValidateClusterProfile(t *testing.T) {
|
||||||
oc.Properties.ClusterProfile.PullSecret = ""
|
oc.Properties.ClusterProfile.PullSecret = ""
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
|
||||||
name: "version invalid",
|
|
||||||
modify: func(oc *OpenShiftCluster) {
|
|
||||||
oc.Properties.ClusterProfile.Version = "invalid"
|
|
||||||
},
|
|
||||||
wantErr: "400: InvalidParameter: properties.clusterProfile.version: The provided version 'invalid' is invalid.",
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
name: "leading digit domain invalid",
|
name: "leading digit domain invalid",
|
||||||
modify: func(oc *OpenShiftCluster) {
|
modify: func(oc *OpenShiftCluster) {
|
||||||
|
|
|
@ -0,0 +1,36 @@
|
||||||
|
package v20220904
|
||||||
|
|
||||||
|
// Copyright (c) Microsoft Corporation.
|
||||||
|
// Licensed under the Apache License 2.0.
|
||||||
|
|
||||||
|
// OpenShiftVersionList represents a List of available versions.
|
||||||
|
type OpenShiftVersionList struct {
|
||||||
|
// The List of available versions.
|
||||||
|
OpenShiftVersions []*OpenShiftVersion `json:"value"`
|
||||||
|
|
||||||
|
// Next Link to next operation.
|
||||||
|
NextLink string `json:"nextLink,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// OpenShiftVersion represents an OpenShift version that can be installed.
|
||||||
|
type OpenShiftVersion struct {
|
||||||
|
proxyResource bool
|
||||||
|
|
||||||
|
// The ID for the resource.
|
||||||
|
ID string `json:"id,omitempty" mutable:"case"`
|
||||||
|
|
||||||
|
// Name of the resource.
|
||||||
|
Name string `json:"name,omitempty" mutable:"case"`
|
||||||
|
|
||||||
|
// The resource type.
|
||||||
|
Type string `json:"type,omitempty" mutable:"case"`
|
||||||
|
|
||||||
|
// The properties for the OpenShiftVersion resource.
|
||||||
|
Properties OpenShiftVersionProperties `json:"properties,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// OpenShiftVersionProperties represents the properties of an OpenShiftVersion.
|
||||||
|
type OpenShiftVersionProperties struct {
|
||||||
|
// Version represents the version to create the cluster at.
|
||||||
|
Version string `json:"version,omitempty"`
|
||||||
|
}
|
|
@ -0,0 +1,49 @@
|
||||||
|
package v20220904
|
||||||
|
|
||||||
|
// Copyright (c) Microsoft Corporation.
|
||||||
|
// Licensed under the Apache License 2.0.
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/Azure/ARO-RP/pkg/api"
|
||||||
|
)
|
||||||
|
|
||||||
|
type openShiftVersionConverter struct{}
|
||||||
|
|
||||||
|
// openShiftVersionConverter.ToExternal returns a new external representation
|
||||||
|
// of the internal object, reading from the subset of the internal object's
|
||||||
|
// fields that appear in the external representation. ToExternal does not
|
||||||
|
// modify its argument; there is no pointer aliasing between the passed and
|
||||||
|
// returned objects.
|
||||||
|
func (openShiftVersionConverter) ToExternal(v *api.OpenShiftVersion) interface{} {
|
||||||
|
out := &OpenShiftVersion{
|
||||||
|
proxyResource: true,
|
||||||
|
Properties: OpenShiftVersionProperties{
|
||||||
|
Version: v.Properties.Version,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
return out
|
||||||
|
}
|
||||||
|
|
||||||
|
// ToExternalList returns a slice of external representations of the internal
|
||||||
|
// objects
|
||||||
|
func (c openShiftVersionConverter) ToExternalList(vers []*api.OpenShiftVersion) interface{} {
|
||||||
|
l := &OpenShiftVersionList{
|
||||||
|
OpenShiftVersions: make([]*OpenShiftVersion, 0, len(vers)),
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, ver := range vers {
|
||||||
|
l.OpenShiftVersions = append(l.OpenShiftVersions, c.ToExternal(ver).(*OpenShiftVersion))
|
||||||
|
}
|
||||||
|
|
||||||
|
return l
|
||||||
|
}
|
||||||
|
|
||||||
|
// ToInternal overwrites in place a pre-existing internal object, setting (only)
|
||||||
|
// all mapped fields from the external representation. ToInternal modifies its
|
||||||
|
// argument; there is no pointer aliasing between the passed and returned
|
||||||
|
// objects
|
||||||
|
func (c openShiftVersionConverter) ToInternal(_new interface{}, out *api.OpenShiftVersion) {
|
||||||
|
new := _new.(*OpenShiftVersion)
|
||||||
|
out.Properties.Version = new.Properties.Version
|
||||||
|
}
|
|
@ -0,0 +1,24 @@
|
||||||
|
package v20220904
|
||||||
|
|
||||||
|
// Copyright (c) Microsoft Corporation.
|
||||||
|
// Licensed under the Apache License 2.0.
|
||||||
|
|
||||||
|
import "github.com/Azure/ARO-RP/pkg/api"
|
||||||
|
|
||||||
|
func exampleOpenShiftVersion() *OpenShiftVersion {
|
||||||
|
doc := api.ExampleOpenShiftVersionDocument()
|
||||||
|
ext := (&openShiftVersionConverter{}).ToExternal(doc.OpenShiftVersion)
|
||||||
|
return ext.(*OpenShiftVersion)
|
||||||
|
}
|
||||||
|
|
||||||
|
func ExampleOpenShiftVersionResponse() interface{} {
|
||||||
|
return exampleOpenShiftVersion()
|
||||||
|
}
|
||||||
|
|
||||||
|
func ExampleOpenShiftVersionListResponse() interface{} {
|
||||||
|
return &OpenShiftVersionList{
|
||||||
|
OpenShiftVersions: []*OpenShiftVersion{
|
||||||
|
ExampleOpenShiftVersionResponse().(*OpenShiftVersion),
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
|
@ -21,7 +21,7 @@ func init() {
|
||||||
OpenShiftClusterStaticValidator: openShiftClusterStaticValidator{},
|
OpenShiftClusterStaticValidator: openShiftClusterStaticValidator{},
|
||||||
OpenShiftClusterCredentialsConverter: openShiftClusterCredentialsConverter{},
|
OpenShiftClusterCredentialsConverter: openShiftClusterCredentialsConverter{},
|
||||||
OpenShiftClusterAdminKubeconfigConverter: openShiftClusterAdminKubeconfigConverter{},
|
OpenShiftClusterAdminKubeconfigConverter: openShiftClusterAdminKubeconfigConverter{},
|
||||||
InstallVersionsConverter: installVersionsConverter{},
|
OpenShiftVersionConverter: openShiftVersionConverter{},
|
||||||
OperationList: api.OperationList{
|
OperationList: api.OperationList{
|
||||||
Operations: []api.Operation{
|
Operations: []api.Operation{
|
||||||
api.OperationResultsRead,
|
api.OperationResultsRead,
|
||||||
|
|
|
@ -122,12 +122,6 @@ type IngressProfile struct {
|
||||||
IP *string `json:"ip,omitempty"`
|
IP *string `json:"ip,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// ListString ...
|
|
||||||
type ListString struct {
|
|
||||||
autorest.Response `json:"-"`
|
|
||||||
Value *[]string `json:"value,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// MachinePool machinePool represents a MachinePool
|
// MachinePool machinePool represents a MachinePool
|
||||||
type MachinePool struct {
|
type MachinePool struct {
|
||||||
autorest.Response `json:"-"`
|
autorest.Response `json:"-"`
|
||||||
|
@ -754,8 +748,6 @@ type OpenShiftClusterProperties struct {
|
||||||
ApiserverProfile *APIServerProfile `json:"apiserverProfile,omitempty"`
|
ApiserverProfile *APIServerProfile `json:"apiserverProfile,omitempty"`
|
||||||
// IngressProfiles - The cluster ingress profiles.
|
// IngressProfiles - The cluster ingress profiles.
|
||||||
IngressProfiles *[]IngressProfile `json:"ingressProfiles,omitempty"`
|
IngressProfiles *[]IngressProfile `json:"ingressProfiles,omitempty"`
|
||||||
// InstallVersion - The cluster install version.
|
|
||||||
InstallVersion *string `json:"installVersion,omitempty"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// OpenShiftClustersCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a
|
// OpenShiftClustersCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a
|
||||||
|
@ -945,6 +937,44 @@ func (oscu *OpenShiftClusterUpdate) UnmarshalJSON(body []byte) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// OpenShiftVersion openShiftVersion represents an OpenShift version that can be installed.
|
||||||
|
type OpenShiftVersion struct {
|
||||||
|
// Properties - The properties for the OpenShiftVersion resource.
|
||||||
|
Properties *OpenShiftVersionProperties `json:"properties,omitempty"`
|
||||||
|
// ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
|
||||||
|
ID *string `json:"id,omitempty"`
|
||||||
|
// Name - READ-ONLY; The name of the resource
|
||||||
|
Name *string `json:"name,omitempty"`
|
||||||
|
// Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
|
||||||
|
Type *string `json:"type,omitempty"`
|
||||||
|
// SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information.
|
||||||
|
SystemData *SystemData `json:"systemData,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// MarshalJSON is the custom marshaler for OpenShiftVersion.
|
||||||
|
func (osv OpenShiftVersion) MarshalJSON() ([]byte, error) {
|
||||||
|
objectMap := make(map[string]interface{})
|
||||||
|
if osv.Properties != nil {
|
||||||
|
objectMap["properties"] = osv.Properties
|
||||||
|
}
|
||||||
|
return json.Marshal(objectMap)
|
||||||
|
}
|
||||||
|
|
||||||
|
// OpenShiftVersionList openShiftVersionList represents a List of available versions.
|
||||||
|
type OpenShiftVersionList struct {
|
||||||
|
autorest.Response `json:"-"`
|
||||||
|
// Value - The List of available versions.
|
||||||
|
Value *[]OpenShiftVersion `json:"value,omitempty"`
|
||||||
|
// NextLink - Next Link to next operation.
|
||||||
|
NextLink *string `json:"nextLink,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// OpenShiftVersionProperties openShiftVersionProperties represents the properties of an OpenShiftVersion.
|
||||||
|
type OpenShiftVersionProperties struct {
|
||||||
|
// Version - Version represents the version to create the cluster at.
|
||||||
|
Version *string `json:"version,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
// Operation operation represents an RP operation.
|
// Operation operation represents an RP operation.
|
||||||
type Operation struct {
|
type Operation struct {
|
||||||
// Name - Operation name: {provider}/{resource}/{operation}.
|
// Name - Operation name: {provider}/{resource}/{operation}.
|
||||||
|
|
|
@ -27,28 +27,29 @@ import (
|
||||||
"github.com/Azure/go-autorest/tracing"
|
"github.com/Azure/go-autorest/tracing"
|
||||||
)
|
)
|
||||||
|
|
||||||
// InstallVersionsClient is the rest API for Azure Red Hat OpenShift 4
|
// OpenShiftVersionsClient is the rest API for Azure Red Hat OpenShift 4
|
||||||
type InstallVersionsClient struct {
|
type OpenShiftVersionsClient struct {
|
||||||
BaseClient
|
BaseClient
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewInstallVersionsClient creates an instance of the InstallVersionsClient client.
|
// NewOpenShiftVersionsClient creates an instance of the OpenShiftVersionsClient client.
|
||||||
func NewInstallVersionsClient(subscriptionID string) InstallVersionsClient {
|
func NewOpenShiftVersionsClient(subscriptionID string) OpenShiftVersionsClient {
|
||||||
return NewInstallVersionsClientWithBaseURI(DefaultBaseURI, subscriptionID)
|
return NewOpenShiftVersionsClientWithBaseURI(DefaultBaseURI, subscriptionID)
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewInstallVersionsClientWithBaseURI creates an instance of the InstallVersionsClient client using a custom endpoint.
|
// NewOpenShiftVersionsClientWithBaseURI creates an instance of the OpenShiftVersionsClient client using a custom
|
||||||
// Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack).
|
// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure
|
||||||
func NewInstallVersionsClientWithBaseURI(baseURI string, subscriptionID string) InstallVersionsClient {
|
// stack).
|
||||||
return InstallVersionsClient{NewWithBaseURI(baseURI, subscriptionID)}
|
func NewOpenShiftVersionsClientWithBaseURI(baseURI string, subscriptionID string) OpenShiftVersionsClient {
|
||||||
|
return OpenShiftVersionsClient{NewWithBaseURI(baseURI, subscriptionID)}
|
||||||
}
|
}
|
||||||
|
|
||||||
// List the operation returns the installable OpenShift versions as strings.
|
// List the operation returns the installable OpenShift versions as strings.
|
||||||
// Parameters:
|
// Parameters:
|
||||||
// location - the name of Azure region.
|
// location - the name of Azure region.
|
||||||
func (client InstallVersionsClient) List(ctx context.Context, location string) (result ListString, err error) {
|
func (client OpenShiftVersionsClient) List(ctx context.Context, location string) (result OpenShiftVersionList, err error) {
|
||||||
if tracing.IsEnabled() {
|
if tracing.IsEnabled() {
|
||||||
ctx = tracing.StartSpan(ctx, fqdn+"/InstallVersionsClient.List")
|
ctx = tracing.StartSpan(ctx, fqdn+"/OpenShiftVersionsClient.List")
|
||||||
defer func() {
|
defer func() {
|
||||||
sc := -1
|
sc := -1
|
||||||
if result.Response.Response != nil {
|
if result.Response.Response != nil {
|
||||||
|
@ -62,25 +63,25 @@ func (client InstallVersionsClient) List(ctx context.Context, location string) (
|
||||||
Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
|
Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
|
||||||
{TargetValue: location,
|
{TargetValue: location,
|
||||||
Constraints: []validation.Constraint{{Target: "location", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil {
|
Constraints: []validation.Constraint{{Target: "location", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil {
|
||||||
return result, validation.NewError("redhatopenshift.InstallVersionsClient", "List", err.Error())
|
return result, validation.NewError("redhatopenshift.OpenShiftVersionsClient", "List", err.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
req, err := client.ListPreparer(ctx, location)
|
req, err := client.ListPreparer(ctx, location)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
err = autorest.NewErrorWithError(err, "redhatopenshift.InstallVersionsClient", "List", nil, "Failure preparing request")
|
err = autorest.NewErrorWithError(err, "redhatopenshift.OpenShiftVersionsClient", "List", nil, "Failure preparing request")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
resp, err := client.ListSender(req)
|
resp, err := client.ListSender(req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
result.Response = autorest.Response{Response: resp}
|
result.Response = autorest.Response{Response: resp}
|
||||||
err = autorest.NewErrorWithError(err, "redhatopenshift.InstallVersionsClient", "List", resp, "Failure sending request")
|
err = autorest.NewErrorWithError(err, "redhatopenshift.OpenShiftVersionsClient", "List", resp, "Failure sending request")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
result, err = client.ListResponder(resp)
|
result, err = client.ListResponder(resp)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
err = autorest.NewErrorWithError(err, "redhatopenshift.InstallVersionsClient", "List", resp, "Failure responding to request")
|
err = autorest.NewErrorWithError(err, "redhatopenshift.OpenShiftVersionsClient", "List", resp, "Failure responding to request")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -88,7 +89,7 @@ func (client InstallVersionsClient) List(ctx context.Context, location string) (
|
||||||
}
|
}
|
||||||
|
|
||||||
// ListPreparer prepares the List request.
|
// ListPreparer prepares the List request.
|
||||||
func (client InstallVersionsClient) ListPreparer(ctx context.Context, location string) (*http.Request, error) {
|
func (client OpenShiftVersionsClient) ListPreparer(ctx context.Context, location string) (*http.Request, error) {
|
||||||
pathParameters := map[string]interface{}{
|
pathParameters := map[string]interface{}{
|
||||||
"location": autorest.Encode("path", location),
|
"location": autorest.Encode("path", location),
|
||||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
|
@ -109,17 +110,17 @@ func (client InstallVersionsClient) ListPreparer(ctx context.Context, location s
|
||||||
|
|
||||||
// ListSender sends the List request. The method will close the
|
// ListSender sends the List request. The method will close the
|
||||||
// http.Response Body if it receives an error.
|
// http.Response Body if it receives an error.
|
||||||
func (client InstallVersionsClient) ListSender(req *http.Request) (*http.Response, error) {
|
func (client OpenShiftVersionsClient) ListSender(req *http.Request) (*http.Response, error) {
|
||||||
return client.Send(req, azure.DoRetryWithRegistration(client.Client))
|
return client.Send(req, azure.DoRetryWithRegistration(client.Client))
|
||||||
}
|
}
|
||||||
|
|
||||||
// ListResponder handles the response to the List request. The method always
|
// ListResponder handles the response to the List request. The method always
|
||||||
// closes the http.Response Body.
|
// closes the http.Response Body.
|
||||||
func (client InstallVersionsClient) ListResponder(resp *http.Response) (result ListString, err error) {
|
func (client OpenShiftVersionsClient) ListResponder(resp *http.Response) (result OpenShiftVersionList, err error) {
|
||||||
err = autorest.Respond(
|
err = autorest.Respond(
|
||||||
resp,
|
resp,
|
||||||
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||||
autorest.ByUnmarshallingJSON(&result.Value),
|
autorest.ByUnmarshallingJSON(&result),
|
||||||
autorest.ByClosing())
|
autorest.ByClosing())
|
||||||
result.Response = autorest.Response{Response: resp}
|
result.Response = autorest.Response{Response: resp}
|
||||||
return
|
return
|
|
@ -33,12 +33,12 @@ type OperationsClientAPI interface {
|
||||||
|
|
||||||
var _ OperationsClientAPI = (*redhatopenshift.OperationsClient)(nil)
|
var _ OperationsClientAPI = (*redhatopenshift.OperationsClient)(nil)
|
||||||
|
|
||||||
// InstallVersionsClientAPI contains the set of methods on the InstallVersionsClient type.
|
// OpenShiftVersionsClientAPI contains the set of methods on the OpenShiftVersionsClient type.
|
||||||
type InstallVersionsClientAPI interface {
|
type OpenShiftVersionsClientAPI interface {
|
||||||
List(ctx context.Context, location string) (result redhatopenshift.ListString, err error)
|
List(ctx context.Context, location string) (result redhatopenshift.OpenShiftVersionList, err error)
|
||||||
}
|
}
|
||||||
|
|
||||||
var _ InstallVersionsClientAPI = (*redhatopenshift.InstallVersionsClient)(nil)
|
var _ OpenShiftVersionsClientAPI = (*redhatopenshift.OpenShiftVersionsClient)(nil)
|
||||||
|
|
||||||
// OpenShiftClustersClientAPI contains the set of methods on the OpenShiftClustersClient type.
|
// OpenShiftClustersClientAPI contains the set of methods on the OpenShiftClustersClient type.
|
||||||
type OpenShiftClustersClientAPI interface {
|
type OpenShiftClustersClientAPI interface {
|
||||||
|
|
|
@ -23,7 +23,7 @@ func (m *manager) openShiftVersionFromVersion(ctx context.Context) (*api.OpenShi
|
||||||
|
|
||||||
activeOpenShiftVersions := make([]*api.OpenShiftVersion, 0)
|
activeOpenShiftVersions := make([]*api.OpenShiftVersion, 0)
|
||||||
for _, doc := range docs.OpenShiftVersionDocuments {
|
for _, doc := range docs.OpenShiftVersionDocuments {
|
||||||
if doc.OpenShiftVersion.Enabled {
|
if doc.OpenShiftVersion.Properties.Enabled {
|
||||||
activeOpenShiftVersions = append(activeOpenShiftVersions, doc.OpenShiftVersion)
|
activeOpenShiftVersions = append(activeOpenShiftVersions, doc.OpenShiftVersion)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -48,17 +48,18 @@ func (m *manager) openShiftVersionFromVersion(ctx context.Context) (*api.OpenShi
|
||||||
}
|
}
|
||||||
|
|
||||||
return &api.OpenShiftVersion{
|
return &api.OpenShiftVersion{
|
||||||
Version: version.InstallStream.Version.String(),
|
Properties: api.OpenShiftVersionProperties{
|
||||||
OpenShiftPullspec: openshiftPullSpec,
|
Version: version.InstallStream.Version.String(),
|
||||||
InstallerPullspec: installerPullSpec,
|
OpenShiftPullspec: openshiftPullSpec,
|
||||||
Enabled: true,
|
InstallerPullspec: installerPullSpec,
|
||||||
}, nil
|
Enabled: true,
|
||||||
|
}}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, active := range activeOpenShiftVersions {
|
for _, active := range activeOpenShiftVersions {
|
||||||
if requestedInstallVersion == active.Version {
|
if requestedInstallVersion == active.Properties.Version {
|
||||||
if m.installViaHive {
|
if m.installViaHive {
|
||||||
active.OpenShiftPullspec = strings.Replace(active.OpenShiftPullspec, "quay.io", m.env.ACRDomain(), 1)
|
active.Properties.OpenShiftPullspec = strings.Replace(active.Properties.OpenShiftPullspec, "quay.io", m.env.ACRDomain(), 1)
|
||||||
}
|
}
|
||||||
return active, nil
|
return active, nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,9 +50,11 @@ func TestGetOpenShiftVersionFromVersion(t *testing.T) {
|
||||||
},
|
},
|
||||||
wantErrString: "",
|
wantErrString: "",
|
||||||
want: &api.OpenShiftVersion{
|
want: &api.OpenShiftVersion{
|
||||||
Version: version.InstallStream.Version.String(),
|
Properties: api.OpenShiftVersionProperties{
|
||||||
OpenShiftPullspec: version.InstallStream.PullSpec,
|
Version: version.InstallStream.Version.String(),
|
||||||
InstallerPullspec: fmt.Sprintf("%s/aro-installer:release-%d.%d", testACRDomain, version.InstallStream.Version.V[0], version.InstallStream.Version.V[1]),
|
OpenShiftPullspec: version.InstallStream.PullSpec,
|
||||||
|
InstallerPullspec: fmt.Sprintf("%s/aro-installer:release-%d.%d", testACRDomain, version.InstallStream.Version.V[0], version.InstallStream.Version.V[1]),
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -61,13 +63,17 @@ func TestGetOpenShiftVersionFromVersion(t *testing.T) {
|
||||||
f.AddOpenShiftVersionDocuments(
|
f.AddOpenShiftVersionDocuments(
|
||||||
&api.OpenShiftVersionDocument{
|
&api.OpenShiftVersionDocument{
|
||||||
OpenShiftVersion: &api.OpenShiftVersion{
|
OpenShiftVersion: &api.OpenShiftVersion{
|
||||||
Version: "4.10.20",
|
Properties: api.OpenShiftVersionProperties{
|
||||||
Enabled: true,
|
Version: "4.10.20",
|
||||||
|
Enabled: true,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
}, &api.OpenShiftVersionDocument{
|
}, &api.OpenShiftVersionDocument{
|
||||||
OpenShiftVersion: &api.OpenShiftVersion{
|
OpenShiftVersion: &api.OpenShiftVersion{
|
||||||
Version: "4.10.27",
|
Properties: api.OpenShiftVersionProperties{
|
||||||
Enabled: true,
|
Version: "4.10.27",
|
||||||
|
Enabled: true,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
@ -123,9 +129,9 @@ func TestGetOpenShiftVersionFromVersion(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if tt.want != nil {
|
if tt.want != nil {
|
||||||
assert.Equal(t, tt.want.Version, version.Version, "Version does not match")
|
assert.Equal(t, tt.want.Properties.Version, version.Properties.Version, "Version does not match")
|
||||||
assert.Equal(t, tt.want.OpenShiftPullspec, version.OpenShiftPullspec, "OpenShiftPullspec does not match")
|
assert.Equal(t, tt.want.Properties.OpenShiftPullspec, version.Properties.OpenShiftPullspec, "OpenShiftPullspec does not match")
|
||||||
assert.Equal(t, tt.want.InstallerPullspec, version.InstallerPullspec, "InstallerPullspec does not match")
|
assert.Equal(t, tt.want.Properties.InstallerPullspec, version.Properties.InstallerPullspec, "InstallerPullspec does not match")
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,7 +37,9 @@ func (f *frontend) getAdminOpenShiftVersions(w http.ResponseWriter, r *http.Requ
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sort.Slice(vers, func(i, j int) bool { return semver.New(vers[i].Version).LessThan(*semver.New(vers[j].Version)) })
|
sort.Slice(vers, func(i, j int) bool {
|
||||||
|
return semver.New(vers[i].Properties.Version).LessThan(*semver.New(vers[j].Properties.Version))
|
||||||
|
})
|
||||||
|
|
||||||
b, err := json.MarshalIndent(converter.ToExternalList(vers), "", " ")
|
b, err := json.MarshalIndent(converter.ToExternalList(vers), "", " ")
|
||||||
adminReply(log, w, nil, b, err)
|
adminReply(log, w, nil, b, err)
|
||||||
|
|
|
@ -40,25 +40,33 @@ func TestOpenShiftVersionList(t *testing.T) {
|
||||||
f.AddOpenShiftVersionDocuments(
|
f.AddOpenShiftVersionDocuments(
|
||||||
&api.OpenShiftVersionDocument{
|
&api.OpenShiftVersionDocument{
|
||||||
OpenShiftVersion: &api.OpenShiftVersion{
|
OpenShiftVersion: &api.OpenShiftVersion{
|
||||||
Version: "4.10.0",
|
Properties: api.OpenShiftVersionProperties{
|
||||||
Enabled: true,
|
Version: "4.10.0",
|
||||||
OpenShiftPullspec: "a:a/b",
|
Enabled: true,
|
||||||
|
OpenShiftPullspec: "a:a/b",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
&api.OpenShiftVersionDocument{
|
&api.OpenShiftVersionDocument{
|
||||||
OpenShiftVersion: &api.OpenShiftVersion{
|
OpenShiftVersion: &api.OpenShiftVersion{
|
||||||
Version: "4.9.9",
|
Properties: api.OpenShiftVersionProperties{
|
||||||
Enabled: true,
|
|
||||||
OpenShiftPullspec: "a:a/b",
|
Version: "4.9.9",
|
||||||
InstallerPullspec: "b:b/c",
|
Enabled: true,
|
||||||
|
OpenShiftPullspec: "a:a/b",
|
||||||
|
InstallerPullspec: "b:b/c",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
&api.OpenShiftVersionDocument{
|
&api.OpenShiftVersionDocument{
|
||||||
OpenShiftVersion: &api.OpenShiftVersion{
|
OpenShiftVersion: &api.OpenShiftVersion{
|
||||||
Version: "4.10.1",
|
Properties: api.OpenShiftVersionProperties{
|
||||||
Enabled: false,
|
|
||||||
OpenShiftPullspec: "a:a/b",
|
Version: "4.10.1",
|
||||||
InstallerPullspec: "b:b/c",
|
Enabled: false,
|
||||||
|
OpenShiftPullspec: "a:a/b",
|
||||||
|
InstallerPullspec: "b:b/c",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
@ -67,21 +75,27 @@ func TestOpenShiftVersionList(t *testing.T) {
|
||||||
wantResponse: &admin.OpenShiftVersionList{
|
wantResponse: &admin.OpenShiftVersionList{
|
||||||
OpenShiftVersions: []*admin.OpenShiftVersion{
|
OpenShiftVersions: []*admin.OpenShiftVersion{
|
||||||
{
|
{
|
||||||
Version: "4.9.9",
|
Properties: admin.OpenShiftVersionProperties{
|
||||||
Enabled: true,
|
Version: "4.9.9",
|
||||||
OpenShiftPullspec: "a:a/b",
|
Enabled: true,
|
||||||
InstallerPullspec: "b:b/c",
|
OpenShiftPullspec: "a:a/b",
|
||||||
|
InstallerPullspec: "b:b/c",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Version: "4.10.0",
|
Properties: admin.OpenShiftVersionProperties{
|
||||||
Enabled: true,
|
Version: "4.10.0",
|
||||||
OpenShiftPullspec: "a:a/b",
|
Enabled: true,
|
||||||
|
OpenShiftPullspec: "a:a/b",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Version: "4.10.1",
|
Properties: admin.OpenShiftVersionProperties{
|
||||||
Enabled: false,
|
Version: "4.10.1",
|
||||||
OpenShiftPullspec: "a:a/b",
|
Enabled: false,
|
||||||
InstallerPullspec: "b:b/c",
|
OpenShiftPullspec: "a:a/b",
|
||||||
|
InstallerPullspec: "b:b/c",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
@ -47,7 +47,7 @@ func (f *frontend) putAdminOpenShiftVersion(w http.ResponseWriter, r *http.Reque
|
||||||
|
|
||||||
if docs != nil {
|
if docs != nil {
|
||||||
for _, doc := range docs.OpenShiftVersionDocuments {
|
for _, doc := range docs.OpenShiftVersionDocuments {
|
||||||
if doc.OpenShiftVersion.Version == version.Version {
|
if doc.OpenShiftVersion.Properties.Version == version.Properties.Version {
|
||||||
versionDoc = doc
|
versionDoc = doc
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,34 +34,42 @@ func TestOpenShiftVersionPut(t *testing.T) {
|
||||||
f.AddOpenShiftVersionDocuments(
|
f.AddOpenShiftVersionDocuments(
|
||||||
&api.OpenShiftVersionDocument{
|
&api.OpenShiftVersionDocument{
|
||||||
OpenShiftVersion: &api.OpenShiftVersion{
|
OpenShiftVersion: &api.OpenShiftVersion{
|
||||||
Version: "4.10.0",
|
Properties: api.OpenShiftVersionProperties{
|
||||||
Enabled: true,
|
Version: "4.10.0",
|
||||||
OpenShiftPullspec: "a:a/b",
|
Enabled: true,
|
||||||
|
OpenShiftPullspec: "a:a/b",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
body: &admin.OpenShiftVersion{
|
body: &admin.OpenShiftVersion{
|
||||||
Version: "4.10.0",
|
Properties: admin.OpenShiftVersionProperties{
|
||||||
Enabled: false,
|
Version: "4.10.0",
|
||||||
OpenShiftPullspec: "c:c/d",
|
Enabled: false,
|
||||||
InstallerPullspec: "d:d/e",
|
OpenShiftPullspec: "c:c/d",
|
||||||
|
InstallerPullspec: "d:d/e",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
wantStatusCode: http.StatusOK,
|
wantStatusCode: http.StatusOK,
|
||||||
wantResponse: &admin.OpenShiftVersion{
|
wantResponse: &admin.OpenShiftVersion{
|
||||||
Version: "4.10.0",
|
Properties: admin.OpenShiftVersionProperties{
|
||||||
Enabled: false,
|
Version: "4.10.0",
|
||||||
OpenShiftPullspec: "c:c/d",
|
Enabled: false,
|
||||||
InstallerPullspec: "d:d/e",
|
OpenShiftPullspec: "c:c/d",
|
||||||
|
InstallerPullspec: "d:d/e",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
wantDocuments: []*api.OpenShiftVersionDocument{
|
wantDocuments: []*api.OpenShiftVersionDocument{
|
||||||
{
|
{
|
||||||
ID: "07070707-0707-0707-0707-070707070001",
|
ID: "07070707-0707-0707-0707-070707070001",
|
||||||
OpenShiftVersion: &api.OpenShiftVersion{
|
OpenShiftVersion: &api.OpenShiftVersion{
|
||||||
Version: "4.10.0",
|
Properties: api.OpenShiftVersionProperties{
|
||||||
Enabled: false,
|
Version: "4.10.0",
|
||||||
OpenShiftPullspec: "c:c/d",
|
Enabled: false,
|
||||||
InstallerPullspec: "d:d/e",
|
OpenShiftPullspec: "c:c/d",
|
||||||
|
InstallerPullspec: "d:d/e",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -72,42 +80,52 @@ func TestOpenShiftVersionPut(t *testing.T) {
|
||||||
f.AddOpenShiftVersionDocuments(
|
f.AddOpenShiftVersionDocuments(
|
||||||
&api.OpenShiftVersionDocument{
|
&api.OpenShiftVersionDocument{
|
||||||
OpenShiftVersion: &api.OpenShiftVersion{
|
OpenShiftVersion: &api.OpenShiftVersion{
|
||||||
Version: "4.10.0",
|
Properties: api.OpenShiftVersionProperties{
|
||||||
Enabled: true,
|
Version: "4.10.0",
|
||||||
OpenShiftPullspec: "a:a/b",
|
Enabled: true,
|
||||||
|
OpenShiftPullspec: "a:a/b",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
body: &admin.OpenShiftVersion{
|
body: &admin.OpenShiftVersion{
|
||||||
Version: "4.10.1",
|
Properties: admin.OpenShiftVersionProperties{
|
||||||
Enabled: true,
|
Version: "4.10.1",
|
||||||
OpenShiftPullspec: "f:f/g",
|
Enabled: true,
|
||||||
InstallerPullspec: "g:g/h",
|
OpenShiftPullspec: "f:f/g",
|
||||||
|
InstallerPullspec: "g:g/h",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
wantStatusCode: http.StatusCreated,
|
wantStatusCode: http.StatusCreated,
|
||||||
wantResponse: &admin.OpenShiftVersion{
|
wantResponse: &admin.OpenShiftVersion{
|
||||||
Version: "4.10.1",
|
Properties: admin.OpenShiftVersionProperties{
|
||||||
Enabled: true,
|
Version: "4.10.1",
|
||||||
OpenShiftPullspec: "f:f/g",
|
Enabled: true,
|
||||||
InstallerPullspec: "g:g/h",
|
OpenShiftPullspec: "f:f/g",
|
||||||
|
InstallerPullspec: "g:g/h",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
wantDocuments: []*api.OpenShiftVersionDocument{
|
wantDocuments: []*api.OpenShiftVersionDocument{
|
||||||
{
|
{
|
||||||
ID: "07070707-0707-0707-0707-070707070001",
|
ID: "07070707-0707-0707-0707-070707070001",
|
||||||
OpenShiftVersion: &api.OpenShiftVersion{
|
OpenShiftVersion: &api.OpenShiftVersion{
|
||||||
Version: "4.10.0",
|
Properties: api.OpenShiftVersionProperties{
|
||||||
Enabled: true,
|
Version: "4.10.0",
|
||||||
OpenShiftPullspec: "a:a/b",
|
Enabled: true,
|
||||||
|
OpenShiftPullspec: "a:a/b",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ID: "07070707-0707-0707-0707-070707070002",
|
ID: "07070707-0707-0707-0707-070707070002",
|
||||||
OpenShiftVersion: &api.OpenShiftVersion{
|
OpenShiftVersion: &api.OpenShiftVersion{
|
||||||
Version: "4.10.1",
|
Properties: api.OpenShiftVersionProperties{
|
||||||
Enabled: true,
|
Version: "4.10.1",
|
||||||
OpenShiftPullspec: "f:f/g",
|
Enabled: true,
|
||||||
InstallerPullspec: "g:g/h",
|
OpenShiftPullspec: "f:f/g",
|
||||||
|
InstallerPullspec: "g:g/h",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -118,18 +136,22 @@ func TestOpenShiftVersionPut(t *testing.T) {
|
||||||
f.AddOpenShiftVersionDocuments(
|
f.AddOpenShiftVersionDocuments(
|
||||||
&api.OpenShiftVersionDocument{
|
&api.OpenShiftVersionDocument{
|
||||||
OpenShiftVersion: &api.OpenShiftVersion{
|
OpenShiftVersion: &api.OpenShiftVersion{
|
||||||
Version: "4.10.0",
|
Properties: api.OpenShiftVersionProperties{
|
||||||
Enabled: true,
|
Version: "4.10.0",
|
||||||
OpenShiftPullspec: "a:a/b",
|
Enabled: true,
|
||||||
InstallerPullspec: "d:d/e",
|
OpenShiftPullspec: "a:a/b",
|
||||||
|
InstallerPullspec: "d:d/e",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
body: &admin.OpenShiftVersion{
|
body: &admin.OpenShiftVersion{
|
||||||
Version: "4.10.0",
|
Properties: admin.OpenShiftVersionProperties{
|
||||||
Enabled: true,
|
Version: "4.10.0",
|
||||||
OpenShiftPullspec: "c:c/d",
|
Enabled: true,
|
||||||
|
OpenShiftPullspec: "c:c/d",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
wantStatusCode: http.StatusBadRequest,
|
wantStatusCode: http.StatusBadRequest,
|
||||||
wantError: "400: InvalidParameter: installerPullspec: Must be provided",
|
wantError: "400: InvalidParameter: installerPullspec: Must be provided",
|
||||||
|
@ -137,10 +159,12 @@ func TestOpenShiftVersionPut(t *testing.T) {
|
||||||
{
|
{
|
||||||
ID: "07070707-0707-0707-0707-070707070001",
|
ID: "07070707-0707-0707-0707-070707070001",
|
||||||
OpenShiftVersion: &api.OpenShiftVersion{
|
OpenShiftVersion: &api.OpenShiftVersion{
|
||||||
Version: "4.10.0",
|
Properties: api.OpenShiftVersionProperties{
|
||||||
Enabled: true,
|
Version: "4.10.0",
|
||||||
OpenShiftPullspec: "a:a/b",
|
Enabled: true,
|
||||||
InstallerPullspec: "d:d/e",
|
OpenShiftPullspec: "a:a/b",
|
||||||
|
InstallerPullspec: "d:d/e",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -151,18 +175,22 @@ func TestOpenShiftVersionPut(t *testing.T) {
|
||||||
f.AddOpenShiftVersionDocuments(
|
f.AddOpenShiftVersionDocuments(
|
||||||
&api.OpenShiftVersionDocument{
|
&api.OpenShiftVersionDocument{
|
||||||
OpenShiftVersion: &api.OpenShiftVersion{
|
OpenShiftVersion: &api.OpenShiftVersion{
|
||||||
Version: "4.10.0",
|
Properties: api.OpenShiftVersionProperties{
|
||||||
Enabled: true,
|
Version: "4.10.0",
|
||||||
OpenShiftPullspec: "a:a/b",
|
Enabled: true,
|
||||||
InstallerPullspec: "d:d/e",
|
OpenShiftPullspec: "a:a/b",
|
||||||
|
InstallerPullspec: "d:d/e",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
body: &admin.OpenShiftVersion{
|
body: &admin.OpenShiftVersion{
|
||||||
Version: "4.10.0",
|
Properties: admin.OpenShiftVersionProperties{
|
||||||
Enabled: true,
|
Version: "4.10.0",
|
||||||
InstallerPullspec: "c:c/d",
|
Enabled: true,
|
||||||
|
InstallerPullspec: "c:c/d",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
wantStatusCode: http.StatusBadRequest,
|
wantStatusCode: http.StatusBadRequest,
|
||||||
wantError: "400: InvalidParameter: openShiftPullspec: Must be provided",
|
wantError: "400: InvalidParameter: openShiftPullspec: Must be provided",
|
||||||
|
@ -170,10 +198,12 @@ func TestOpenShiftVersionPut(t *testing.T) {
|
||||||
{
|
{
|
||||||
ID: "07070707-0707-0707-0707-070707070001",
|
ID: "07070707-0707-0707-0707-070707070001",
|
||||||
OpenShiftVersion: &api.OpenShiftVersion{
|
OpenShiftVersion: &api.OpenShiftVersion{
|
||||||
Version: "4.10.0",
|
Properties: api.OpenShiftVersionProperties{
|
||||||
Enabled: true,
|
Version: "4.10.0",
|
||||||
OpenShiftPullspec: "a:a/b",
|
Enabled: true,
|
||||||
InstallerPullspec: "d:d/e",
|
OpenShiftPullspec: "a:a/b",
|
||||||
|
InstallerPullspec: "d:d/e",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
@ -65,11 +65,6 @@ func (f *frontend) _putOrPatchOpenShiftCluster(ctx context.Context, log *logrus.
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
installVersion, err := f.validateAndReturnInstallVersion(ctx, body)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
doc = &api.OpenShiftClusterDocument{
|
doc = &api.OpenShiftClusterDocument{
|
||||||
ID: f.dbOpenShiftClusters.NewUUID(),
|
ID: f.dbOpenShiftClusters.NewUUID(),
|
||||||
Key: path,
|
Key: path,
|
||||||
|
@ -83,9 +78,6 @@ func (f *frontend) _putOrPatchOpenShiftCluster(ctx context.Context, log *logrus.
|
||||||
CreatedAt: f.now().UTC(),
|
CreatedAt: f.now().UTC(),
|
||||||
CreatedBy: version.GitCommit,
|
CreatedBy: version.GitCommit,
|
||||||
ProvisionedBy: version.GitCommit,
|
ProvisionedBy: version.GitCommit,
|
||||||
ClusterProfile: api.ClusterProfile{
|
|
||||||
Version: installVersion,
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -178,6 +170,11 @@ func (f *frontend) _putOrPatchOpenShiftCluster(ctx context.Context, log *logrus.
|
||||||
f.systemDataClusterDocEnricher(doc, systemData)
|
f.systemDataClusterDocEnricher(doc, systemData)
|
||||||
|
|
||||||
if isCreate {
|
if isCreate {
|
||||||
|
err = f.validateInstallVersion(ctx, doc)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
// on create, make the cluster resourcegroup ID lower case to work
|
// on create, make the cluster resourcegroup ID lower case to work
|
||||||
// around LB/PLS bug
|
// around LB/PLS bug
|
||||||
doc.OpenShiftCluster.Properties.ClusterProfile.ResourceGroupID = strings.ToLower(doc.OpenShiftCluster.Properties.ClusterProfile.ResourceGroupID)
|
doc.OpenShiftCluster.Properties.ClusterProfile.ResourceGroupID = strings.ToLower(doc.OpenShiftCluster.Properties.ClusterProfile.ResourceGroupID)
|
||||||
|
@ -239,7 +236,7 @@ func (f *frontend) _putOrPatchOpenShiftCluster(ctx context.Context, log *logrus.
|
||||||
doc.OpenShiftCluster.Properties.ClusterProfile.PullSecret = ""
|
doc.OpenShiftCluster.Properties.ClusterProfile.PullSecret = ""
|
||||||
doc.OpenShiftCluster.Properties.ServicePrincipalProfile.ClientSecret = ""
|
doc.OpenShiftCluster.Properties.ServicePrincipalProfile.ClientSecret = ""
|
||||||
|
|
||||||
b, err := json.MarshalIndent(converter.ToExternal(doc.OpenShiftCluster), "", "\t")
|
b, err := json.MarshalIndent(converter.ToExternal(doc.OpenShiftCluster), "", " ")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -672,7 +672,7 @@ func TestPutOrPatchOpenShiftCluster(t *testing.T) {
|
||||||
{
|
{
|
||||||
name: "create a new cluster",
|
name: "create a new cluster",
|
||||||
request: func(oc *v20200430.OpenShiftCluster) {
|
request: func(oc *v20200430.OpenShiftCluster) {
|
||||||
oc.Properties.ClusterProfile.Version = "4.3.0"
|
oc.Properties.ClusterProfile.Version = "4.10.20"
|
||||||
},
|
},
|
||||||
fixture: func(f *testdatabase.Fixture) {
|
fixture: func(f *testdatabase.Fixture) {
|
||||||
f.AddSubscriptionDocuments(&api.SubscriptionDocument{
|
f.AddSubscriptionDocuments(&api.SubscriptionDocument{
|
||||||
|
@ -708,7 +708,7 @@ func TestPutOrPatchOpenShiftCluster(t *testing.T) {
|
||||||
CreatedAt: mockCurrentTime,
|
CreatedAt: mockCurrentTime,
|
||||||
CreatedBy: version.GitCommit,
|
CreatedBy: version.GitCommit,
|
||||||
ClusterProfile: api.ClusterProfile{
|
ClusterProfile: api.ClusterProfile{
|
||||||
Version: "4.3.0",
|
Version: "4.10.20",
|
||||||
FipsValidatedModules: api.FipsValidatedModulesDisabled,
|
FipsValidatedModules: api.FipsValidatedModulesDisabled,
|
||||||
},
|
},
|
||||||
NetworkProfile: api.NetworkProfile{
|
NetworkProfile: api.NetworkProfile{
|
||||||
|
@ -735,7 +735,7 @@ func TestPutOrPatchOpenShiftCluster(t *testing.T) {
|
||||||
Properties: v20200430.OpenShiftClusterProperties{
|
Properties: v20200430.OpenShiftClusterProperties{
|
||||||
ProvisioningState: v20200430.ProvisioningStateCreating,
|
ProvisioningState: v20200430.ProvisioningStateCreating,
|
||||||
ClusterProfile: v20200430.ClusterProfile{
|
ClusterProfile: v20200430.ClusterProfile{
|
||||||
Version: "4.3.0",
|
Version: "4.10.20",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -1314,7 +1314,7 @@ func TestPutOrPatchOpenShiftCluster(t *testing.T) {
|
||||||
Properties: api.OpenShiftClusterProperties{
|
Properties: api.OpenShiftClusterProperties{
|
||||||
ProvisioningState: api.ProvisioningStateCreating,
|
ProvisioningState: api.ProvisioningStateCreating,
|
||||||
ClusterProfile: api.ClusterProfile{
|
ClusterProfile: api.ClusterProfile{
|
||||||
Version: "4.3.0",
|
Version: "4.10.20",
|
||||||
ResourceGroupID: fmt.Sprintf("/subscriptions/%s/resourcegroups/aro-vjb21wca", mockSubID),
|
ResourceGroupID: fmt.Sprintf("/subscriptions/%s/resourcegroups/aro-vjb21wca", mockSubID),
|
||||||
FipsValidatedModules: api.FipsValidatedModulesDisabled,
|
FipsValidatedModules: api.FipsValidatedModulesDisabled,
|
||||||
},
|
},
|
||||||
|
@ -1359,7 +1359,7 @@ func TestPutOrPatchOpenShiftCluster(t *testing.T) {
|
||||||
Properties: api.OpenShiftClusterProperties{
|
Properties: api.OpenShiftClusterProperties{
|
||||||
ProvisioningState: api.ProvisioningStateCreating,
|
ProvisioningState: api.ProvisioningStateCreating,
|
||||||
ClusterProfile: api.ClusterProfile{
|
ClusterProfile: api.ClusterProfile{
|
||||||
Version: "4.3.0",
|
Version: "4.10.20",
|
||||||
FipsValidatedModules: api.FipsValidatedModulesDisabled,
|
FipsValidatedModules: api.FipsValidatedModulesDisabled,
|
||||||
},
|
},
|
||||||
NetworkProfile: api.NetworkProfile{
|
NetworkProfile: api.NetworkProfile{
|
||||||
|
|
|
@ -22,40 +22,44 @@ func (f *frontend) listInstallVersions(w http.ResponseWriter, r *http.Request) {
|
||||||
vars := mux.Vars(r)
|
vars := mux.Vars(r)
|
||||||
log := ctx.Value(middleware.ContextKeyLog).(*logrus.Entry)
|
log := ctx.Value(middleware.ContextKeyLog).(*logrus.Entry)
|
||||||
|
|
||||||
if f.apis[vars["api-version"]].InstallVersionsConverter == nil {
|
if f.apis[vars["api-version"]].OpenShiftVersionConverter == nil {
|
||||||
api.WriteError(w, http.StatusBadRequest, api.CloudErrorCodeInvalidResourceType, "", "The endpoint could not be found in the namespace '%s' for api version '%s'.", vars["resourceProviderNamespace"], vars["api-version"])
|
api.WriteError(w, http.StatusBadRequest, api.CloudErrorCodeInvalidResourceType, "", "The endpoint could not be found in the namespace '%s' for api version '%s'.", vars["resourceProviderNamespace"], vars["api-version"])
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
versions, err := f.getInstallVersions(ctx)
|
versions, err := f.getEnabledInstallVersions(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error(err)
|
log.Error(err)
|
||||||
api.WriteError(w, http.StatusInternalServerError, api.CloudErrorCodeInternalServerError, "", "Unable to list the available OpenShift versions in this region.")
|
api.WriteError(w, http.StatusInternalServerError, api.CloudErrorCodeInternalServerError, "", "Unable to list the available OpenShift versions in this region.")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
converter := f.apis[vars["api-version"]].InstallVersionsConverter
|
converter := f.apis[vars["api-version"]].OpenShiftVersionConverter
|
||||||
|
|
||||||
b, err := json.Marshal(converter.ToExternal((*api.InstallVersions)(&versions)))
|
b, err := json.MarshalIndent(converter.ToExternalList(([]*api.OpenShiftVersion)(versions)), "", " ")
|
||||||
reply(log, w, nil, b, err)
|
reply(log, w, nil, b, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (f *frontend) getInstallVersions(ctx context.Context) ([]string, error) {
|
func (f *frontend) getEnabledInstallVersions(ctx context.Context) ([]*api.OpenShiftVersion, error) {
|
||||||
docs, err := f.dbOpenShiftVersions.ListAll(ctx)
|
docs, err := f.dbOpenShiftVersions.ListAll(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("unable to list the entries in the OpenShift versions database: %s", err.Error())
|
return nil, fmt.Errorf("unable to list the entries in the OpenShift versions database: %s", err.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
versions := make([]string, 0)
|
versions := make([]*api.OpenShiftVersion, 0)
|
||||||
for _, doc := range docs.OpenShiftVersionDocuments {
|
for _, doc := range docs.OpenShiftVersionDocuments {
|
||||||
if doc.OpenShiftVersion.Enabled {
|
if doc.OpenShiftVersion.Properties.Enabled {
|
||||||
versions = append(versions, doc.OpenShiftVersion.Version)
|
versions = append(versions, doc.OpenShiftVersion)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// add the default from version.InstallStream, when we have no active versions
|
// add the default from version.InstallStream, when we have no active versions
|
||||||
if len(versions) == 0 {
|
if len(versions) == 0 {
|
||||||
versions = append(versions, version.InstallStream.Version.String())
|
versions = append(versions, &api.OpenShiftVersion{
|
||||||
|
Properties: api.OpenShiftVersionProperties{
|
||||||
|
Version: version.InstallStream.Version.String(),
|
||||||
|
},
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
return versions, nil
|
return versions, nil
|
|
@ -11,6 +11,8 @@ import (
|
||||||
"sort"
|
"sort"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
"github.com/coreos/go-semver/semver"
|
||||||
|
|
||||||
"github.com/Azure/ARO-RP/pkg/api"
|
"github.com/Azure/ARO-RP/pkg/api"
|
||||||
v20220904 "github.com/Azure/ARO-RP/pkg/api/v20220904"
|
v20220904 "github.com/Azure/ARO-RP/pkg/api/v20220904"
|
||||||
"github.com/Azure/ARO-RP/pkg/metrics/noop"
|
"github.com/Azure/ARO-RP/pkg/metrics/noop"
|
||||||
|
@ -28,7 +30,7 @@ func TestListInstallVersions(t *testing.T) {
|
||||||
name string
|
name string
|
||||||
fixture func(f *testdatabase.Fixture)
|
fixture func(f *testdatabase.Fixture)
|
||||||
wantStatusCode int
|
wantStatusCode int
|
||||||
wantResponse *v20220904.InstallVersions
|
wantResponse v20220904.OpenShiftVersionList
|
||||||
wantError string
|
wantError string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,8 +49,14 @@ func TestListInstallVersions(t *testing.T) {
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
wantStatusCode: http.StatusOK,
|
wantStatusCode: http.StatusOK,
|
||||||
wantResponse: &v20220904.InstallVersions{
|
wantResponse: v20220904.OpenShiftVersionList{
|
||||||
v20220904.InstallVersion((v20220904.InstallVersion)(version.InstallStream.Version.String())),
|
OpenShiftVersions: []*v20220904.OpenShiftVersion{
|
||||||
|
{
|
||||||
|
Properties: v20220904.OpenShiftVersionProperties{
|
||||||
|
Version: version.InstallStream.Version.String(),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -66,27 +74,43 @@ func TestListInstallVersions(t *testing.T) {
|
||||||
f.AddOpenShiftVersionDocuments(
|
f.AddOpenShiftVersionDocuments(
|
||||||
&api.OpenShiftVersionDocument{
|
&api.OpenShiftVersionDocument{
|
||||||
OpenShiftVersion: &api.OpenShiftVersion{
|
OpenShiftVersion: &api.OpenShiftVersion{
|
||||||
Version: "4.10.20",
|
Properties: api.OpenShiftVersionProperties{
|
||||||
Enabled: false,
|
Version: "4.10.20",
|
||||||
|
Enabled: false,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
}, &api.OpenShiftVersionDocument{
|
}, &api.OpenShiftVersionDocument{
|
||||||
OpenShiftVersion: &api.OpenShiftVersion{
|
OpenShiftVersion: &api.OpenShiftVersion{
|
||||||
Version: "4.10.27",
|
Properties: api.OpenShiftVersionProperties{
|
||||||
Enabled: true,
|
Version: "4.10.27",
|
||||||
|
Enabled: true,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
&api.OpenShiftVersionDocument{
|
&api.OpenShiftVersionDocument{
|
||||||
OpenShiftVersion: &api.OpenShiftVersion{
|
OpenShiftVersion: &api.OpenShiftVersion{
|
||||||
Version: "4.11.5",
|
Properties: api.OpenShiftVersionProperties{
|
||||||
Enabled: true,
|
Version: "4.11.5",
|
||||||
|
Enabled: true,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
wantStatusCode: http.StatusOK,
|
wantStatusCode: http.StatusOK,
|
||||||
wantResponse: &v20220904.InstallVersions{
|
wantResponse: v20220904.OpenShiftVersionList{
|
||||||
"4.10.27",
|
OpenShiftVersions: []*v20220904.OpenShiftVersion{
|
||||||
"4.11.5",
|
{
|
||||||
|
Properties: v20220904.OpenShiftVersionProperties{
|
||||||
|
Version: "4.10.27",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Properties: v20220904.OpenShiftVersionProperties{
|
||||||
|
Version: "4.11.5",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
} {
|
} {
|
||||||
|
@ -114,20 +138,31 @@ func TestListInstallVersions(t *testing.T) {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// sort the response as the version order might be changed
|
||||||
if b != nil {
|
if b != nil {
|
||||||
var v []string
|
var v v20220904.OpenShiftVersionList
|
||||||
if err = json.Unmarshal(b, &v); err != nil {
|
if err = json.Unmarshal(b, &v); err != nil {
|
||||||
t.Error(err)
|
t.Error(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
sort.Strings(v)
|
sort.Slice(v.OpenShiftVersions, func(i, j int) bool {
|
||||||
|
return semver.New(v.OpenShiftVersions[i].Properties.Version).LessThan(*semver.New(v.OpenShiftVersions[j].Properties.Version))
|
||||||
|
})
|
||||||
|
|
||||||
b, err = json.Marshal(v)
|
b, err = json.Marshal(v)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Error(err)
|
t.Error(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
err = validateResponse(resp, b, tt.wantStatusCode, tt.wantError, tt.wantResponse)
|
// marshal the expected response into a []byte otherwise
|
||||||
|
// it will compare zero values to omitempty json tags
|
||||||
|
want, err := json.Marshal(tt.wantResponse)
|
||||||
|
if err != nil {
|
||||||
|
t.Error(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
err = validateResponse(resp, b, tt.wantStatusCode, tt.wantError, want)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Error(err)
|
t.Error(err)
|
||||||
}
|
}
|
|
@ -12,7 +12,6 @@ import (
|
||||||
"github.com/Azure/go-autorest/autorest/azure"
|
"github.com/Azure/go-autorest/autorest/azure"
|
||||||
|
|
||||||
"github.com/Azure/ARO-RP/pkg/api"
|
"github.com/Azure/ARO-RP/pkg/api"
|
||||||
"github.com/Azure/ARO-RP/pkg/api/components/installversion"
|
|
||||||
"github.com/Azure/ARO-RP/pkg/api/validate"
|
"github.com/Azure/ARO-RP/pkg/api/validate"
|
||||||
"github.com/Azure/ARO-RP/pkg/database/cosmosdb"
|
"github.com/Azure/ARO-RP/pkg/database/cosmosdb"
|
||||||
utilnamespace "github.com/Azure/ARO-RP/pkg/util/namespace"
|
utilnamespace "github.com/Azure/ARO-RP/pkg/util/namespace"
|
||||||
|
@ -167,42 +166,41 @@ func validateAdminVMSize(vmSize string) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (f *frontend) validateAndReturnInstallVersion(ctx context.Context, body []byte) (string, error) {
|
// validateInstallVersion validates the install version set in the clusterprofile.version
|
||||||
oc, err := installversion.FromExternalBytes(body)
|
// TODO convert this into static validation instead of this receiver function in the vaidate for frontend.
|
||||||
if err != nil {
|
func (f *frontend) validateInstallVersion(ctx context.Context, doc *api.OpenShiftClusterDocument) error {
|
||||||
return "", api.NewCloudError(http.StatusBadRequest, api.CloudErrorCodeInvalidRequestContent, "", "The request content was invalid and could not be deserialized: %q.", err)
|
oc := doc.OpenShiftCluster
|
||||||
}
|
|
||||||
|
|
||||||
// If this request is from an older API or the user never specified
|
// If this request is from an older API or the user never specified
|
||||||
// the version to install we default to the InstallStream.Version
|
// the version to install we default to the InstallStream.Version
|
||||||
if len(oc.Properties.InstallVersion) == 0 {
|
if oc.Properties.ClusterProfile.Version == "" {
|
||||||
return version.InstallStream.Version.String(), nil
|
oc.Properties.ClusterProfile.Version = version.InstallStream.Version.String()
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
errInvalidVersion := api.NewCloudError(http.StatusBadRequest, api.CloudErrorCodeInvalidParameter, "properties.installversion", "The requested OpenShift version '%s' is invalid.", oc.Properties.InstallVersion)
|
errInvalidVersion := api.NewCloudError(http.StatusBadRequest, api.CloudErrorCodeInvalidParameter, "properties.clusterProfile.version", "The requested OpenShift version '%s' is invalid.", oc.Properties.ClusterProfile.Version)
|
||||||
|
|
||||||
if !validate.RxInstallVersion.MatchString(oc.Properties.InstallVersion) {
|
if !validate.RxInstallVersion.MatchString(oc.Properties.ClusterProfile.Version) {
|
||||||
return "", errInvalidVersion
|
return errInvalidVersion
|
||||||
}
|
}
|
||||||
|
|
||||||
docs, err := f.dbOpenShiftVersions.ListAll(ctx)
|
docs, err := f.dbOpenShiftVersions.ListAll(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
// If we have no OpenShiftVersion entries in CosmoDB, default to using the InstallStream.Version
|
// If we have no OpenShiftVersion entries in CosmoDB, default to using the InstallStream.Version
|
||||||
if len(docs.OpenShiftVersionDocuments) == 0 {
|
if len(docs.OpenShiftVersionDocuments) == 0 {
|
||||||
if oc.Properties.InstallVersion != version.InstallStream.Version.String() {
|
if oc.Properties.ClusterProfile.Version != version.InstallStream.Version.String() {
|
||||||
return "", errInvalidVersion
|
return errInvalidVersion
|
||||||
}
|
}
|
||||||
return version.InstallStream.Version.String(), nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, doc := range docs.OpenShiftVersionDocuments {
|
for _, doc := range docs.OpenShiftVersionDocuments {
|
||||||
if oc.Properties.InstallVersion == doc.OpenShiftVersion.Version {
|
if oc.Properties.ClusterProfile.Version == doc.OpenShiftVersion.Properties.Version {
|
||||||
return oc.Properties.InstallVersion, nil
|
return nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return "", errInvalidVersion
|
return errInvalidVersion
|
||||||
}
|
}
|
||||||
|
|
|
@ -187,8 +187,8 @@ func (c *clusterManager) clusterDeploymentForInstall(doc *api.OpenShiftClusterDo
|
||||||
Name: pullsecretSecretName,
|
Name: pullsecretSecretName,
|
||||||
},
|
},
|
||||||
Provisioning: &hivev1.Provisioning{
|
Provisioning: &hivev1.Provisioning{
|
||||||
InstallerImageOverride: version.InstallerPullspec,
|
InstallerImageOverride: version.Properties.InstallerPullspec,
|
||||||
ReleaseImage: version.OpenShiftPullspec,
|
ReleaseImage: version.Properties.OpenShiftPullspec,
|
||||||
InstallConfigSecretRef: &corev1.LocalObjectReference{
|
InstallConfigSecretRef: &corev1.LocalObjectReference{
|
||||||
Name: installConfigName,
|
Name: installConfigName,
|
||||||
},
|
},
|
||||||
|
|
|
@ -232,8 +232,8 @@ func (m *manager) generateInstallConfig(ctx context.Context) (*installconfig.Ins
|
||||||
}
|
}
|
||||||
|
|
||||||
image := &releaseimage.Image{}
|
image := &releaseimage.Image{}
|
||||||
if m.oc.Properties.ClusterProfile.Version == m.version.Version {
|
if m.oc.Properties.ClusterProfile.Version == m.version.Properties.Version {
|
||||||
image.PullSpec = m.version.OpenShiftPullspec
|
image.PullSpec = m.version.Properties.OpenShiftPullspec
|
||||||
} else {
|
} else {
|
||||||
return nil, nil, fmt.Errorf("unimplemented version %q", m.oc.Properties.ClusterProfile.Version)
|
return nil, nil, fmt.Errorf("unimplemented version %q", m.oc.Properties.ClusterProfile.Version)
|
||||||
}
|
}
|
||||||
|
|
|
@ -164,8 +164,8 @@ func (g *generator) generateExamples(outputDir string, s *Swagger) error {
|
||||||
body = g.exampleOpenShiftClusterListResponse()
|
body = g.exampleOpenShiftClusterListResponse()
|
||||||
case "#/definitions/OperationList":
|
case "#/definitions/OperationList":
|
||||||
body = g.exampleOperationListResponse()
|
body = g.exampleOperationListResponse()
|
||||||
case "#/definitions/InstallVersions":
|
case "#/definitions/OpenShiftVersionList":
|
||||||
body = g.exampleInstallVersions()
|
body = g.exampleOpenShiftVersionListResponse()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -41,7 +41,7 @@ type generator struct {
|
||||||
exampleOpenShiftClusterCredentialsResponse func() interface{}
|
exampleOpenShiftClusterCredentialsResponse func() interface{}
|
||||||
exampleOpenShiftClusterAdminKubeconfigResponse func() interface{}
|
exampleOpenShiftClusterAdminKubeconfigResponse func() interface{}
|
||||||
exampleOpenShiftClusterListResponse func() interface{}
|
exampleOpenShiftClusterListResponse func() interface{}
|
||||||
exampleInstallVersions func() interface{}
|
exampleOpenShiftVersionListResponse func() interface{}
|
||||||
exampleOperationListResponse func() interface{}
|
exampleOperationListResponse func() interface{}
|
||||||
|
|
||||||
systemData bool
|
systemData bool
|
||||||
|
@ -120,7 +120,7 @@ var apis = map[string]*generator{
|
||||||
exampleOpenShiftClusterCredentialsResponse: v20220904.ExampleOpenShiftClusterCredentialsResponse,
|
exampleOpenShiftClusterCredentialsResponse: v20220904.ExampleOpenShiftClusterCredentialsResponse,
|
||||||
exampleOpenShiftClusterListResponse: v20220904.ExampleOpenShiftClusterListResponse,
|
exampleOpenShiftClusterListResponse: v20220904.ExampleOpenShiftClusterListResponse,
|
||||||
exampleOpenShiftClusterAdminKubeconfigResponse: v20220904.ExampleOpenShiftClusterAdminKubeconfigResponse,
|
exampleOpenShiftClusterAdminKubeconfigResponse: v20220904.ExampleOpenShiftClusterAdminKubeconfigResponse,
|
||||||
exampleInstallVersions: v20220904.ExampleInstallVersionsResponse,
|
exampleOpenShiftVersionListResponse: v20220904.ExampleOpenShiftVersionListResponse,
|
||||||
exampleOperationListResponse: api.ExampleOperationListResponse,
|
exampleOperationListResponse: api.ExampleOperationListResponse,
|
||||||
|
|
||||||
xmsEnum: []string{"EncryptionAtHost", "FipsValidatedModules", "SoftwareDefinedNetwork", "Visibility"},
|
xmsEnum: []string{"EncryptionAtHost", "FipsValidatedModules", "SoftwareDefinedNetwork", "Visibility"},
|
||||||
|
|
|
@ -22,6 +22,7 @@ var proxyResources = []string{
|
||||||
"SyncIdentityProvider",
|
"SyncIdentityProvider",
|
||||||
"MachinePool",
|
"MachinePool",
|
||||||
"Secret",
|
"Secret",
|
||||||
|
"OpenShiftVersion",
|
||||||
}
|
}
|
||||||
|
|
||||||
func Run(api, outputDir string) error {
|
func Run(api, outputDir string) error {
|
||||||
|
@ -102,12 +103,12 @@ func Run(api, outputDir string) error {
|
||||||
if g.installVersionList {
|
if g.installVersionList {
|
||||||
s.Paths["/subscriptions/{subscriptionId}/providers/Microsoft.RedHatOpenShift/locations/{location}/listinstallversions"] = &PathItem{
|
s.Paths["/subscriptions/{subscriptionId}/providers/Microsoft.RedHatOpenShift/locations/{location}/listinstallversions"] = &PathItem{
|
||||||
Get: &Operation{
|
Get: &Operation{
|
||||||
Tags: []string{"InstallVersions"},
|
Tags: []string{"OpenShiftVersions"},
|
||||||
Summary: "Lists all OpenShift versions available to install in the specified location.",
|
Summary: "Lists all OpenShift versions available to install in the specified location.",
|
||||||
Description: "The operation returns the installable OpenShift versions as strings.",
|
Description: "The operation returns the installable OpenShift versions as strings.",
|
||||||
OperationID: "InstallVersions_List",
|
OperationID: "OpenShiftVersions_List",
|
||||||
Parameters: g.populateParameters(6, "InstallVersions", "Install Versions"),
|
Parameters: g.populateParameters(6, "OpenShiftVersionList", "OpenShift Versions"),
|
||||||
Responses: g.populateResponses("InstallVersions", false, http.StatusOK),
|
Responses: g.populateResponses("OpenShiftVersionList", false, http.StatusOK),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -127,7 +128,7 @@ func Run(api, outputDir string) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
if g.installVersionList {
|
if g.installVersionList {
|
||||||
names = append(names, "InstallVersions")
|
names = append(names, "OpenShiftVersionList")
|
||||||
}
|
}
|
||||||
|
|
||||||
if g.clusterManager {
|
if g.clusterManager {
|
||||||
|
|
|
@ -106,6 +106,8 @@ def aro_create(cmd, # pylint: disable=too-many-locals
|
||||||
resource_group_id=(f"/subscriptions/{subscription_id}"
|
resource_group_id=(f"/subscriptions/{subscription_id}"
|
||||||
f"/resourceGroups/{cluster_resource_group or 'aro-' + random_id}"),
|
f"/resourceGroups/{cluster_resource_group or 'aro-' + random_id}"),
|
||||||
fips_validated_modules='Enabled' if fips_validated_modules else 'Disabled',
|
fips_validated_modules='Enabled' if fips_validated_modules else 'Disabled',
|
||||||
|
install_version=install_version or '',
|
||||||
|
|
||||||
),
|
),
|
||||||
service_principal_profile=openshiftcluster.ServicePrincipalProfile(
|
service_principal_profile=openshiftcluster.ServicePrincipalProfile(
|
||||||
client_id=client_id,
|
client_id=client_id,
|
||||||
|
@ -142,7 +144,6 @@ def aro_create(cmd, # pylint: disable=too-many-locals
|
||||||
visibility=ingress_visibility or 'Public',
|
visibility=ingress_visibility or 'Public',
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
install_version=install_version or '',
|
|
||||||
)
|
)
|
||||||
|
|
||||||
sp_obj_ids = [client_sp_id, rp_client_sp_id]
|
sp_obj_ids = [client_sp_id, rp_client_sp_id]
|
||||||
|
@ -224,7 +225,11 @@ def aro_list_admin_credentials(cmd, client, resource_group_name, resource_name,
|
||||||
|
|
||||||
|
|
||||||
def aro_get_versions(client, location):
|
def aro_get_versions(client, location):
|
||||||
return client.install_versions.list(location)
|
openshift_verions = client.open_shift_versions.list(location)
|
||||||
|
versions = []
|
||||||
|
for ver in openshift_verions.additional_properties["value"]:
|
||||||
|
versions.append(ver["properties"]["version"])
|
||||||
|
return sorted(versions)
|
||||||
|
|
||||||
|
|
||||||
def aro_update(cmd,
|
def aro_update(cmd,
|
||||||
|
|
|
@ -23,7 +23,7 @@ from azure.mgmt.core import ARMPipelineClient
|
||||||
|
|
||||||
from . import models
|
from . import models
|
||||||
from ._configuration import AzureRedHatOpenShiftClientConfiguration
|
from ._configuration import AzureRedHatOpenShiftClientConfiguration
|
||||||
from .operations import InstallVersionsOperations, MachinePoolsOperations, OpenShiftClustersOperations, Operations, SecretsOperations, SyncIdentityProvidersOperations, SyncSetsOperations
|
from .operations import MachinePoolsOperations, OpenShiftClustersOperations, OpenShiftVersionsOperations, Operations, SecretsOperations, SyncIdentityProvidersOperations, SyncSetsOperations
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
# pylint: disable=unused-import,ungrouped-imports
|
# pylint: disable=unused-import,ungrouped-imports
|
||||||
|
@ -37,9 +37,9 @@ class AzureRedHatOpenShiftClient(object): # pylint: disable=too-many-instance
|
||||||
|
|
||||||
:ivar operations: Operations operations
|
:ivar operations: Operations operations
|
||||||
:vartype operations: azure.mgmt.redhatopenshift.v2022_09_04.operations.Operations
|
:vartype operations: azure.mgmt.redhatopenshift.v2022_09_04.operations.Operations
|
||||||
:ivar install_versions: InstallVersionsOperations operations
|
:ivar open_shift_versions: OpenShiftVersionsOperations operations
|
||||||
:vartype install_versions:
|
:vartype open_shift_versions:
|
||||||
azure.mgmt.redhatopenshift.v2022_09_04.operations.InstallVersionsOperations
|
azure.mgmt.redhatopenshift.v2022_09_04.operations.OpenShiftVersionsOperations
|
||||||
:ivar open_shift_clusters: OpenShiftClustersOperations operations
|
:ivar open_shift_clusters: OpenShiftClustersOperations operations
|
||||||
:vartype open_shift_clusters:
|
:vartype open_shift_clusters:
|
||||||
azure.mgmt.redhatopenshift.v2022_09_04.operations.OpenShiftClustersOperations
|
azure.mgmt.redhatopenshift.v2022_09_04.operations.OpenShiftClustersOperations
|
||||||
|
@ -82,7 +82,7 @@ class AzureRedHatOpenShiftClient(object): # pylint: disable=too-many-instance
|
||||||
self._deserialize = Deserializer(client_models)
|
self._deserialize = Deserializer(client_models)
|
||||||
self._serialize.client_side_validation = False
|
self._serialize.client_side_validation = False
|
||||||
self.operations = Operations(self._client, self._config, self._serialize, self._deserialize)
|
self.operations = Operations(self._client, self._config, self._serialize, self._deserialize)
|
||||||
self.install_versions = InstallVersionsOperations(self._client, self._config, self._serialize, self._deserialize)
|
self.open_shift_versions = OpenShiftVersionsOperations(self._client, self._config, self._serialize, self._deserialize)
|
||||||
self.open_shift_clusters = OpenShiftClustersOperations(self._client, self._config, self._serialize, self._deserialize)
|
self.open_shift_clusters = OpenShiftClustersOperations(self._client, self._config, self._serialize, self._deserialize)
|
||||||
self.machine_pools = MachinePoolsOperations(self._client, self._config, self._serialize, self._deserialize)
|
self.machine_pools = MachinePoolsOperations(self._client, self._config, self._serialize, self._deserialize)
|
||||||
self.secrets = SecretsOperations(self._client, self._config, self._serialize, self._deserialize)
|
self.secrets = SecretsOperations(self._client, self._config, self._serialize, self._deserialize)
|
||||||
|
|
|
@ -31,6 +31,9 @@ try:
|
||||||
from ._models_py3 import OpenShiftClusterCredentials
|
from ._models_py3 import OpenShiftClusterCredentials
|
||||||
from ._models_py3 import OpenShiftClusterList
|
from ._models_py3 import OpenShiftClusterList
|
||||||
from ._models_py3 import OpenShiftClusterUpdate
|
from ._models_py3 import OpenShiftClusterUpdate
|
||||||
|
from ._models_py3 import OpenShiftVersion
|
||||||
|
from ._models_py3 import OpenShiftVersionList
|
||||||
|
from ._models_py3 import OpenShiftVersionProperties
|
||||||
from ._models_py3 import Operation
|
from ._models_py3 import Operation
|
||||||
from ._models_py3 import OperationList
|
from ._models_py3 import OperationList
|
||||||
from ._models_py3 import ProxyResource
|
from ._models_py3 import ProxyResource
|
||||||
|
@ -65,6 +68,9 @@ except (SyntaxError, ImportError):
|
||||||
from ._models import OpenShiftClusterCredentials # type: ignore
|
from ._models import OpenShiftClusterCredentials # type: ignore
|
||||||
from ._models import OpenShiftClusterList # type: ignore
|
from ._models import OpenShiftClusterList # type: ignore
|
||||||
from ._models import OpenShiftClusterUpdate # type: ignore
|
from ._models import OpenShiftClusterUpdate # type: ignore
|
||||||
|
from ._models import OpenShiftVersion # type: ignore
|
||||||
|
from ._models import OpenShiftVersionList # type: ignore
|
||||||
|
from ._models import OpenShiftVersionProperties # type: ignore
|
||||||
from ._models import Operation # type: ignore
|
from ._models import Operation # type: ignore
|
||||||
from ._models import OperationList # type: ignore
|
from ._models import OperationList # type: ignore
|
||||||
from ._models import ProxyResource # type: ignore
|
from ._models import ProxyResource # type: ignore
|
||||||
|
@ -108,6 +114,9 @@ __all__ = [
|
||||||
'OpenShiftClusterCredentials',
|
'OpenShiftClusterCredentials',
|
||||||
'OpenShiftClusterList',
|
'OpenShiftClusterList',
|
||||||
'OpenShiftClusterUpdate',
|
'OpenShiftClusterUpdate',
|
||||||
|
'OpenShiftVersion',
|
||||||
|
'OpenShiftVersionList',
|
||||||
|
'OpenShiftVersionProperties',
|
||||||
'Operation',
|
'Operation',
|
||||||
'OperationList',
|
'OperationList',
|
||||||
'ProxyResource',
|
'ProxyResource',
|
||||||
|
|
|
@ -619,8 +619,6 @@ class OpenShiftCluster(TrackedResource):
|
||||||
:vartype apiserver_profile: ~azure.mgmt.redhatopenshift.v2022_09_04.models.APIServerProfile
|
:vartype apiserver_profile: ~azure.mgmt.redhatopenshift.v2022_09_04.models.APIServerProfile
|
||||||
:ivar ingress_profiles: The cluster ingress profiles.
|
:ivar ingress_profiles: The cluster ingress profiles.
|
||||||
:vartype ingress_profiles: list[~azure.mgmt.redhatopenshift.v2022_09_04.models.IngressProfile]
|
:vartype ingress_profiles: list[~azure.mgmt.redhatopenshift.v2022_09_04.models.IngressProfile]
|
||||||
:ivar install_version: The cluster install version.
|
|
||||||
:vartype install_version: str
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
_validation = {
|
_validation = {
|
||||||
|
@ -647,7 +645,6 @@ class OpenShiftCluster(TrackedResource):
|
||||||
'worker_profiles': {'key': 'properties.workerProfiles', 'type': '[WorkerProfile]'},
|
'worker_profiles': {'key': 'properties.workerProfiles', 'type': '[WorkerProfile]'},
|
||||||
'apiserver_profile': {'key': 'properties.apiserverProfile', 'type': 'APIServerProfile'},
|
'apiserver_profile': {'key': 'properties.apiserverProfile', 'type': 'APIServerProfile'},
|
||||||
'ingress_profiles': {'key': 'properties.ingressProfiles', 'type': '[IngressProfile]'},
|
'ingress_profiles': {'key': 'properties.ingressProfiles', 'type': '[IngressProfile]'},
|
||||||
'install_version': {'key': 'properties.installVersion', 'type': 'str'},
|
|
||||||
}
|
}
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
|
@ -681,8 +678,6 @@ class OpenShiftCluster(TrackedResource):
|
||||||
:keyword ingress_profiles: The cluster ingress profiles.
|
:keyword ingress_profiles: The cluster ingress profiles.
|
||||||
:paramtype ingress_profiles:
|
:paramtype ingress_profiles:
|
||||||
list[~azure.mgmt.redhatopenshift.v2022_09_04.models.IngressProfile]
|
list[~azure.mgmt.redhatopenshift.v2022_09_04.models.IngressProfile]
|
||||||
:keyword install_version: The cluster install version.
|
|
||||||
:paramtype install_version: str
|
|
||||||
"""
|
"""
|
||||||
super(OpenShiftCluster, self).__init__(**kwargs)
|
super(OpenShiftCluster, self).__init__(**kwargs)
|
||||||
self.provisioning_state = kwargs.get('provisioning_state', None)
|
self.provisioning_state = kwargs.get('provisioning_state', None)
|
||||||
|
@ -694,7 +689,6 @@ class OpenShiftCluster(TrackedResource):
|
||||||
self.worker_profiles = kwargs.get('worker_profiles', None)
|
self.worker_profiles = kwargs.get('worker_profiles', None)
|
||||||
self.apiserver_profile = kwargs.get('apiserver_profile', None)
|
self.apiserver_profile = kwargs.get('apiserver_profile', None)
|
||||||
self.ingress_profiles = kwargs.get('ingress_profiles', None)
|
self.ingress_profiles = kwargs.get('ingress_profiles', None)
|
||||||
self.install_version = kwargs.get('install_version', None)
|
|
||||||
|
|
||||||
|
|
||||||
class OpenShiftClusterAdminKubeconfig(msrest.serialization.Model):
|
class OpenShiftClusterAdminKubeconfig(msrest.serialization.Model):
|
||||||
|
@ -808,8 +802,6 @@ class OpenShiftClusterUpdate(msrest.serialization.Model):
|
||||||
:vartype apiserver_profile: ~azure.mgmt.redhatopenshift.v2022_09_04.models.APIServerProfile
|
:vartype apiserver_profile: ~azure.mgmt.redhatopenshift.v2022_09_04.models.APIServerProfile
|
||||||
:ivar ingress_profiles: The cluster ingress profiles.
|
:ivar ingress_profiles: The cluster ingress profiles.
|
||||||
:vartype ingress_profiles: list[~azure.mgmt.redhatopenshift.v2022_09_04.models.IngressProfile]
|
:vartype ingress_profiles: list[~azure.mgmt.redhatopenshift.v2022_09_04.models.IngressProfile]
|
||||||
:ivar install_version: The cluster install version.
|
|
||||||
:vartype install_version: str
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
_validation = {
|
_validation = {
|
||||||
|
@ -828,7 +820,6 @@ class OpenShiftClusterUpdate(msrest.serialization.Model):
|
||||||
'worker_profiles': {'key': 'properties.workerProfiles', 'type': '[WorkerProfile]'},
|
'worker_profiles': {'key': 'properties.workerProfiles', 'type': '[WorkerProfile]'},
|
||||||
'apiserver_profile': {'key': 'properties.apiserverProfile', 'type': 'APIServerProfile'},
|
'apiserver_profile': {'key': 'properties.apiserverProfile', 'type': 'APIServerProfile'},
|
||||||
'ingress_profiles': {'key': 'properties.ingressProfiles', 'type': '[IngressProfile]'},
|
'ingress_profiles': {'key': 'properties.ingressProfiles', 'type': '[IngressProfile]'},
|
||||||
'install_version': {'key': 'properties.installVersion', 'type': 'str'},
|
|
||||||
}
|
}
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
|
@ -860,8 +851,6 @@ class OpenShiftClusterUpdate(msrest.serialization.Model):
|
||||||
:keyword ingress_profiles: The cluster ingress profiles.
|
:keyword ingress_profiles: The cluster ingress profiles.
|
||||||
:paramtype ingress_profiles:
|
:paramtype ingress_profiles:
|
||||||
list[~azure.mgmt.redhatopenshift.v2022_09_04.models.IngressProfile]
|
list[~azure.mgmt.redhatopenshift.v2022_09_04.models.IngressProfile]
|
||||||
:keyword install_version: The cluster install version.
|
|
||||||
:paramtype install_version: str
|
|
||||||
"""
|
"""
|
||||||
super(OpenShiftClusterUpdate, self).__init__(**kwargs)
|
super(OpenShiftClusterUpdate, self).__init__(**kwargs)
|
||||||
self.tags = kwargs.get('tags', None)
|
self.tags = kwargs.get('tags', None)
|
||||||
|
@ -875,7 +864,106 @@ class OpenShiftClusterUpdate(msrest.serialization.Model):
|
||||||
self.worker_profiles = kwargs.get('worker_profiles', None)
|
self.worker_profiles = kwargs.get('worker_profiles', None)
|
||||||
self.apiserver_profile = kwargs.get('apiserver_profile', None)
|
self.apiserver_profile = kwargs.get('apiserver_profile', None)
|
||||||
self.ingress_profiles = kwargs.get('ingress_profiles', None)
|
self.ingress_profiles = kwargs.get('ingress_profiles', None)
|
||||||
self.install_version = kwargs.get('install_version', None)
|
|
||||||
|
|
||||||
|
class OpenShiftVersion(ProxyResource):
|
||||||
|
"""OpenShiftVersion represents an OpenShift version that can be installed.
|
||||||
|
|
||||||
|
Variables are only populated by the server, and will be ignored when sending a request.
|
||||||
|
|
||||||
|
:ivar id: Fully qualified resource ID for the resource. Ex -
|
||||||
|
/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}.
|
||||||
|
:vartype id: str
|
||||||
|
:ivar name: The name of the resource.
|
||||||
|
:vartype name: str
|
||||||
|
:ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or
|
||||||
|
"Microsoft.Storage/storageAccounts".
|
||||||
|
:vartype type: str
|
||||||
|
:ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy
|
||||||
|
information.
|
||||||
|
:vartype system_data: ~azure.mgmt.redhatopenshift.v2022_09_04.models.SystemData
|
||||||
|
:ivar properties: The properties for the OpenShiftVersion resource.
|
||||||
|
:vartype properties: ~azure.mgmt.redhatopenshift.v2022_09_04.models.OpenShiftVersionProperties
|
||||||
|
"""
|
||||||
|
|
||||||
|
_validation = {
|
||||||
|
'id': {'readonly': True},
|
||||||
|
'name': {'readonly': True},
|
||||||
|
'type': {'readonly': True},
|
||||||
|
'system_data': {'readonly': True},
|
||||||
|
}
|
||||||
|
|
||||||
|
_attribute_map = {
|
||||||
|
'id': {'key': 'id', 'type': 'str'},
|
||||||
|
'name': {'key': 'name', 'type': 'str'},
|
||||||
|
'type': {'key': 'type', 'type': 'str'},
|
||||||
|
'system_data': {'key': 'systemData', 'type': 'SystemData'},
|
||||||
|
'properties': {'key': 'properties', 'type': 'OpenShiftVersionProperties'},
|
||||||
|
}
|
||||||
|
|
||||||
|
def __init__(
|
||||||
|
self,
|
||||||
|
**kwargs
|
||||||
|
):
|
||||||
|
"""
|
||||||
|
:keyword properties: The properties for the OpenShiftVersion resource.
|
||||||
|
:paramtype properties:
|
||||||
|
~azure.mgmt.redhatopenshift.v2022_09_04.models.OpenShiftVersionProperties
|
||||||
|
"""
|
||||||
|
super(OpenShiftVersion, self).__init__(**kwargs)
|
||||||
|
self.properties = kwargs.get('properties', None)
|
||||||
|
|
||||||
|
|
||||||
|
class OpenShiftVersionList(msrest.serialization.Model):
|
||||||
|
"""OpenShiftVersionList represents a List of available versions.
|
||||||
|
|
||||||
|
:ivar value: The List of available versions.
|
||||||
|
:vartype value: list[~azure.mgmt.redhatopenshift.v2022_09_04.models.OpenShiftVersion]
|
||||||
|
:ivar next_link: Next Link to next operation.
|
||||||
|
:vartype next_link: str
|
||||||
|
"""
|
||||||
|
|
||||||
|
_attribute_map = {
|
||||||
|
'value': {'key': 'value', 'type': '[OpenShiftVersion]'},
|
||||||
|
'next_link': {'key': 'nextLink', 'type': 'str'},
|
||||||
|
}
|
||||||
|
|
||||||
|
def __init__(
|
||||||
|
self,
|
||||||
|
**kwargs
|
||||||
|
):
|
||||||
|
"""
|
||||||
|
:keyword value: The List of available versions.
|
||||||
|
:paramtype value: list[~azure.mgmt.redhatopenshift.v2022_09_04.models.OpenShiftVersion]
|
||||||
|
:keyword next_link: Next Link to next operation.
|
||||||
|
:paramtype next_link: str
|
||||||
|
"""
|
||||||
|
super(OpenShiftVersionList, self).__init__(**kwargs)
|
||||||
|
self.value = kwargs.get('value', None)
|
||||||
|
self.next_link = kwargs.get('next_link', None)
|
||||||
|
|
||||||
|
|
||||||
|
class OpenShiftVersionProperties(msrest.serialization.Model):
|
||||||
|
"""OpenShiftVersionProperties represents the properties of an OpenShiftVersion.
|
||||||
|
|
||||||
|
:ivar version: Version represents the version to create the cluster at.
|
||||||
|
:vartype version: str
|
||||||
|
"""
|
||||||
|
|
||||||
|
_attribute_map = {
|
||||||
|
'version': {'key': 'version', 'type': 'str'},
|
||||||
|
}
|
||||||
|
|
||||||
|
def __init__(
|
||||||
|
self,
|
||||||
|
**kwargs
|
||||||
|
):
|
||||||
|
"""
|
||||||
|
:keyword version: Version represents the version to create the cluster at.
|
||||||
|
:paramtype version: str
|
||||||
|
"""
|
||||||
|
super(OpenShiftVersionProperties, self).__init__(**kwargs)
|
||||||
|
self.version = kwargs.get('version', None)
|
||||||
|
|
||||||
|
|
||||||
class Operation(msrest.serialization.Model):
|
class Operation(msrest.serialization.Model):
|
||||||
|
|
|
@ -668,8 +668,6 @@ class OpenShiftCluster(TrackedResource):
|
||||||
:vartype apiserver_profile: ~azure.mgmt.redhatopenshift.v2022_09_04.models.APIServerProfile
|
:vartype apiserver_profile: ~azure.mgmt.redhatopenshift.v2022_09_04.models.APIServerProfile
|
||||||
:ivar ingress_profiles: The cluster ingress profiles.
|
:ivar ingress_profiles: The cluster ingress profiles.
|
||||||
:vartype ingress_profiles: list[~azure.mgmt.redhatopenshift.v2022_09_04.models.IngressProfile]
|
:vartype ingress_profiles: list[~azure.mgmt.redhatopenshift.v2022_09_04.models.IngressProfile]
|
||||||
:ivar install_version: The cluster install version.
|
|
||||||
:vartype install_version: str
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
_validation = {
|
_validation = {
|
||||||
|
@ -696,7 +694,6 @@ class OpenShiftCluster(TrackedResource):
|
||||||
'worker_profiles': {'key': 'properties.workerProfiles', 'type': '[WorkerProfile]'},
|
'worker_profiles': {'key': 'properties.workerProfiles', 'type': '[WorkerProfile]'},
|
||||||
'apiserver_profile': {'key': 'properties.apiserverProfile', 'type': 'APIServerProfile'},
|
'apiserver_profile': {'key': 'properties.apiserverProfile', 'type': 'APIServerProfile'},
|
||||||
'ingress_profiles': {'key': 'properties.ingressProfiles', 'type': '[IngressProfile]'},
|
'ingress_profiles': {'key': 'properties.ingressProfiles', 'type': '[IngressProfile]'},
|
||||||
'install_version': {'key': 'properties.installVersion', 'type': 'str'},
|
|
||||||
}
|
}
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
|
@ -713,7 +710,6 @@ class OpenShiftCluster(TrackedResource):
|
||||||
worker_profiles: Optional[List["WorkerProfile"]] = None,
|
worker_profiles: Optional[List["WorkerProfile"]] = None,
|
||||||
apiserver_profile: Optional["APIServerProfile"] = None,
|
apiserver_profile: Optional["APIServerProfile"] = None,
|
||||||
ingress_profiles: Optional[List["IngressProfile"]] = None,
|
ingress_profiles: Optional[List["IngressProfile"]] = None,
|
||||||
install_version: Optional[str] = None,
|
|
||||||
**kwargs
|
**kwargs
|
||||||
):
|
):
|
||||||
"""
|
"""
|
||||||
|
@ -743,8 +739,6 @@ class OpenShiftCluster(TrackedResource):
|
||||||
:keyword ingress_profiles: The cluster ingress profiles.
|
:keyword ingress_profiles: The cluster ingress profiles.
|
||||||
:paramtype ingress_profiles:
|
:paramtype ingress_profiles:
|
||||||
list[~azure.mgmt.redhatopenshift.v2022_09_04.models.IngressProfile]
|
list[~azure.mgmt.redhatopenshift.v2022_09_04.models.IngressProfile]
|
||||||
:keyword install_version: The cluster install version.
|
|
||||||
:paramtype install_version: str
|
|
||||||
"""
|
"""
|
||||||
super(OpenShiftCluster, self).__init__(tags=tags, location=location, **kwargs)
|
super(OpenShiftCluster, self).__init__(tags=tags, location=location, **kwargs)
|
||||||
self.provisioning_state = provisioning_state
|
self.provisioning_state = provisioning_state
|
||||||
|
@ -756,7 +750,6 @@ class OpenShiftCluster(TrackedResource):
|
||||||
self.worker_profiles = worker_profiles
|
self.worker_profiles = worker_profiles
|
||||||
self.apiserver_profile = apiserver_profile
|
self.apiserver_profile = apiserver_profile
|
||||||
self.ingress_profiles = ingress_profiles
|
self.ingress_profiles = ingress_profiles
|
||||||
self.install_version = install_version
|
|
||||||
|
|
||||||
|
|
||||||
class OpenShiftClusterAdminKubeconfig(msrest.serialization.Model):
|
class OpenShiftClusterAdminKubeconfig(msrest.serialization.Model):
|
||||||
|
@ -878,8 +871,6 @@ class OpenShiftClusterUpdate(msrest.serialization.Model):
|
||||||
:vartype apiserver_profile: ~azure.mgmt.redhatopenshift.v2022_09_04.models.APIServerProfile
|
:vartype apiserver_profile: ~azure.mgmt.redhatopenshift.v2022_09_04.models.APIServerProfile
|
||||||
:ivar ingress_profiles: The cluster ingress profiles.
|
:ivar ingress_profiles: The cluster ingress profiles.
|
||||||
:vartype ingress_profiles: list[~azure.mgmt.redhatopenshift.v2022_09_04.models.IngressProfile]
|
:vartype ingress_profiles: list[~azure.mgmt.redhatopenshift.v2022_09_04.models.IngressProfile]
|
||||||
:ivar install_version: The cluster install version.
|
|
||||||
:vartype install_version: str
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
_validation = {
|
_validation = {
|
||||||
|
@ -898,7 +889,6 @@ class OpenShiftClusterUpdate(msrest.serialization.Model):
|
||||||
'worker_profiles': {'key': 'properties.workerProfiles', 'type': '[WorkerProfile]'},
|
'worker_profiles': {'key': 'properties.workerProfiles', 'type': '[WorkerProfile]'},
|
||||||
'apiserver_profile': {'key': 'properties.apiserverProfile', 'type': 'APIServerProfile'},
|
'apiserver_profile': {'key': 'properties.apiserverProfile', 'type': 'APIServerProfile'},
|
||||||
'ingress_profiles': {'key': 'properties.ingressProfiles', 'type': '[IngressProfile]'},
|
'ingress_profiles': {'key': 'properties.ingressProfiles', 'type': '[IngressProfile]'},
|
||||||
'install_version': {'key': 'properties.installVersion', 'type': 'str'},
|
|
||||||
}
|
}
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
|
@ -914,7 +904,6 @@ class OpenShiftClusterUpdate(msrest.serialization.Model):
|
||||||
worker_profiles: Optional[List["WorkerProfile"]] = None,
|
worker_profiles: Optional[List["WorkerProfile"]] = None,
|
||||||
apiserver_profile: Optional["APIServerProfile"] = None,
|
apiserver_profile: Optional["APIServerProfile"] = None,
|
||||||
ingress_profiles: Optional[List["IngressProfile"]] = None,
|
ingress_profiles: Optional[List["IngressProfile"]] = None,
|
||||||
install_version: Optional[str] = None,
|
|
||||||
**kwargs
|
**kwargs
|
||||||
):
|
):
|
||||||
"""
|
"""
|
||||||
|
@ -942,8 +931,6 @@ class OpenShiftClusterUpdate(msrest.serialization.Model):
|
||||||
:keyword ingress_profiles: The cluster ingress profiles.
|
:keyword ingress_profiles: The cluster ingress profiles.
|
||||||
:paramtype ingress_profiles:
|
:paramtype ingress_profiles:
|
||||||
list[~azure.mgmt.redhatopenshift.v2022_09_04.models.IngressProfile]
|
list[~azure.mgmt.redhatopenshift.v2022_09_04.models.IngressProfile]
|
||||||
:keyword install_version: The cluster install version.
|
|
||||||
:paramtype install_version: str
|
|
||||||
"""
|
"""
|
||||||
super(OpenShiftClusterUpdate, self).__init__(**kwargs)
|
super(OpenShiftClusterUpdate, self).__init__(**kwargs)
|
||||||
self.tags = tags
|
self.tags = tags
|
||||||
|
@ -957,7 +944,113 @@ class OpenShiftClusterUpdate(msrest.serialization.Model):
|
||||||
self.worker_profiles = worker_profiles
|
self.worker_profiles = worker_profiles
|
||||||
self.apiserver_profile = apiserver_profile
|
self.apiserver_profile = apiserver_profile
|
||||||
self.ingress_profiles = ingress_profiles
|
self.ingress_profiles = ingress_profiles
|
||||||
self.install_version = install_version
|
|
||||||
|
|
||||||
|
class OpenShiftVersion(ProxyResource):
|
||||||
|
"""OpenShiftVersion represents an OpenShift version that can be installed.
|
||||||
|
|
||||||
|
Variables are only populated by the server, and will be ignored when sending a request.
|
||||||
|
|
||||||
|
:ivar id: Fully qualified resource ID for the resource. Ex -
|
||||||
|
/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}.
|
||||||
|
:vartype id: str
|
||||||
|
:ivar name: The name of the resource.
|
||||||
|
:vartype name: str
|
||||||
|
:ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or
|
||||||
|
"Microsoft.Storage/storageAccounts".
|
||||||
|
:vartype type: str
|
||||||
|
:ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy
|
||||||
|
information.
|
||||||
|
:vartype system_data: ~azure.mgmt.redhatopenshift.v2022_09_04.models.SystemData
|
||||||
|
:ivar properties: The properties for the OpenShiftVersion resource.
|
||||||
|
:vartype properties: ~azure.mgmt.redhatopenshift.v2022_09_04.models.OpenShiftVersionProperties
|
||||||
|
"""
|
||||||
|
|
||||||
|
_validation = {
|
||||||
|
'id': {'readonly': True},
|
||||||
|
'name': {'readonly': True},
|
||||||
|
'type': {'readonly': True},
|
||||||
|
'system_data': {'readonly': True},
|
||||||
|
}
|
||||||
|
|
||||||
|
_attribute_map = {
|
||||||
|
'id': {'key': 'id', 'type': 'str'},
|
||||||
|
'name': {'key': 'name', 'type': 'str'},
|
||||||
|
'type': {'key': 'type', 'type': 'str'},
|
||||||
|
'system_data': {'key': 'systemData', 'type': 'SystemData'},
|
||||||
|
'properties': {'key': 'properties', 'type': 'OpenShiftVersionProperties'},
|
||||||
|
}
|
||||||
|
|
||||||
|
def __init__(
|
||||||
|
self,
|
||||||
|
*,
|
||||||
|
properties: Optional["OpenShiftVersionProperties"] = None,
|
||||||
|
**kwargs
|
||||||
|
):
|
||||||
|
"""
|
||||||
|
:keyword properties: The properties for the OpenShiftVersion resource.
|
||||||
|
:paramtype properties:
|
||||||
|
~azure.mgmt.redhatopenshift.v2022_09_04.models.OpenShiftVersionProperties
|
||||||
|
"""
|
||||||
|
super(OpenShiftVersion, self).__init__(**kwargs)
|
||||||
|
self.properties = properties
|
||||||
|
|
||||||
|
|
||||||
|
class OpenShiftVersionList(msrest.serialization.Model):
|
||||||
|
"""OpenShiftVersionList represents a List of available versions.
|
||||||
|
|
||||||
|
:ivar value: The List of available versions.
|
||||||
|
:vartype value: list[~azure.mgmt.redhatopenshift.v2022_09_04.models.OpenShiftVersion]
|
||||||
|
:ivar next_link: Next Link to next operation.
|
||||||
|
:vartype next_link: str
|
||||||
|
"""
|
||||||
|
|
||||||
|
_attribute_map = {
|
||||||
|
'value': {'key': 'value', 'type': '[OpenShiftVersion]'},
|
||||||
|
'next_link': {'key': 'nextLink', 'type': 'str'},
|
||||||
|
}
|
||||||
|
|
||||||
|
def __init__(
|
||||||
|
self,
|
||||||
|
*,
|
||||||
|
value: Optional[List["OpenShiftVersion"]] = None,
|
||||||
|
next_link: Optional[str] = None,
|
||||||
|
**kwargs
|
||||||
|
):
|
||||||
|
"""
|
||||||
|
:keyword value: The List of available versions.
|
||||||
|
:paramtype value: list[~azure.mgmt.redhatopenshift.v2022_09_04.models.OpenShiftVersion]
|
||||||
|
:keyword next_link: Next Link to next operation.
|
||||||
|
:paramtype next_link: str
|
||||||
|
"""
|
||||||
|
super(OpenShiftVersionList, self).__init__(**kwargs)
|
||||||
|
self.value = value
|
||||||
|
self.next_link = next_link
|
||||||
|
|
||||||
|
|
||||||
|
class OpenShiftVersionProperties(msrest.serialization.Model):
|
||||||
|
"""OpenShiftVersionProperties represents the properties of an OpenShiftVersion.
|
||||||
|
|
||||||
|
:ivar version: Version represents the version to create the cluster at.
|
||||||
|
:vartype version: str
|
||||||
|
"""
|
||||||
|
|
||||||
|
_attribute_map = {
|
||||||
|
'version': {'key': 'version', 'type': 'str'},
|
||||||
|
}
|
||||||
|
|
||||||
|
def __init__(
|
||||||
|
self,
|
||||||
|
*,
|
||||||
|
version: Optional[str] = None,
|
||||||
|
**kwargs
|
||||||
|
):
|
||||||
|
"""
|
||||||
|
:keyword version: Version represents the version to create the cluster at.
|
||||||
|
:paramtype version: str
|
||||||
|
"""
|
||||||
|
super(OpenShiftVersionProperties, self).__init__(**kwargs)
|
||||||
|
self.version = version
|
||||||
|
|
||||||
|
|
||||||
class Operation(msrest.serialization.Model):
|
class Operation(msrest.serialization.Model):
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
# --------------------------------------------------------------------------
|
# --------------------------------------------------------------------------
|
||||||
|
|
||||||
from ._operations import Operations
|
from ._operations import Operations
|
||||||
from ._install_versions_operations import InstallVersionsOperations
|
from ._open_shift_versions_operations import OpenShiftVersionsOperations
|
||||||
from ._open_shift_clusters_operations import OpenShiftClustersOperations
|
from ._open_shift_clusters_operations import OpenShiftClustersOperations
|
||||||
from ._machine_pools_operations import MachinePoolsOperations
|
from ._machine_pools_operations import MachinePoolsOperations
|
||||||
from ._secrets_operations import SecretsOperations
|
from ._secrets_operations import SecretsOperations
|
||||||
|
@ -24,7 +24,7 @@ from ._sync_sets_operations import SyncSetsOperations
|
||||||
|
|
||||||
__all__ = [
|
__all__ = [
|
||||||
'Operations',
|
'Operations',
|
||||||
'InstallVersionsOperations',
|
'OpenShiftVersionsOperations',
|
||||||
'OpenShiftClustersOperations',
|
'OpenShiftClustersOperations',
|
||||||
'MachinePoolsOperations',
|
'MachinePoolsOperations',
|
||||||
'SecretsOperations',
|
'SecretsOperations',
|
||||||
|
|
|
@ -30,7 +30,7 @@ from .._vendor import _convert_request, _format_url_section
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
# pylint: disable=unused-import,ungrouped-imports
|
# pylint: disable=unused-import,ungrouped-imports
|
||||||
from typing import Any, Callable, Dict, List, Optional, TypeVar
|
from typing import Any, Callable, Dict, Optional, TypeVar
|
||||||
T = TypeVar('T')
|
T = TypeVar('T')
|
||||||
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
|
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
|
||||||
|
|
||||||
|
@ -73,8 +73,8 @@ def build_list_request(
|
||||||
)
|
)
|
||||||
|
|
||||||
# fmt: on
|
# fmt: on
|
||||||
class InstallVersionsOperations(object):
|
class OpenShiftVersionsOperations(object):
|
||||||
"""InstallVersionsOperations operations.
|
"""OpenShiftVersionsOperations operations.
|
||||||
|
|
||||||
You should not instantiate this class directly. Instead, you should create a Client instance that
|
You should not instantiate this class directly. Instead, you should create a Client instance that
|
||||||
instantiates it for you and attaches it as an attribute.
|
instantiates it for you and attaches it as an attribute.
|
||||||
|
@ -101,7 +101,7 @@ class InstallVersionsOperations(object):
|
||||||
location, # type: str
|
location, # type: str
|
||||||
**kwargs # type: Any
|
**kwargs # type: Any
|
||||||
):
|
):
|
||||||
# type: (...) -> List[str]
|
# type: (...) -> "_models.OpenShiftVersionList"
|
||||||
"""Lists all OpenShift versions available to install in the specified location.
|
"""Lists all OpenShift versions available to install in the specified location.
|
||||||
|
|
||||||
The operation returns the installable OpenShift versions as strings.
|
The operation returns the installable OpenShift versions as strings.
|
||||||
|
@ -109,11 +109,11 @@ class InstallVersionsOperations(object):
|
||||||
:param location: The name of Azure region.
|
:param location: The name of Azure region.
|
||||||
:type location: str
|
:type location: str
|
||||||
:keyword callable cls: A custom type or function that will be passed the direct response
|
:keyword callable cls: A custom type or function that will be passed the direct response
|
||||||
:return: list of str, or the result of cls(response)
|
:return: OpenShiftVersionList, or the result of cls(response)
|
||||||
:rtype: list[str]
|
:rtype: ~azure.mgmt.redhatopenshift.v2022_09_04.models.OpenShiftVersionList
|
||||||
:raises: ~azure.core.exceptions.HttpResponseError
|
:raises: ~azure.core.exceptions.HttpResponseError
|
||||||
"""
|
"""
|
||||||
cls = kwargs.pop('cls', None) # type: ClsType[List[str]]
|
cls = kwargs.pop('cls', None) # type: ClsType["_models.OpenShiftVersionList"]
|
||||||
error_map = {
|
error_map = {
|
||||||
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
|
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
|
||||||
}
|
}
|
||||||
|
@ -142,7 +142,7 @@ class InstallVersionsOperations(object):
|
||||||
map_error(status_code=response.status_code, response=response, error_map=error_map)
|
map_error(status_code=response.status_code, response=response, error_map=error_map)
|
||||||
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
|
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
|
||||||
|
|
||||||
deserialized = self._deserialize('[str]', pipeline_response)
|
deserialized = self._deserialize('OpenShiftVersionList', pipeline_response)
|
||||||
|
|
||||||
if cls:
|
if cls:
|
||||||
return cls(pipeline_response, deserialized, {})
|
return cls(pipeline_response, deserialized, {})
|
|
@ -6,9 +6,15 @@
|
||||||
},
|
},
|
||||||
"responses": {
|
"responses": {
|
||||||
"200": {
|
"200": {
|
||||||
"body": [
|
"body": {
|
||||||
"4.10.20"
|
"value": [
|
||||||
]
|
{
|
||||||
|
"properties": {
|
||||||
|
"version": "4.10.20"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -56,11 +56,11 @@
|
||||||
"/subscriptions/{subscriptionId}/providers/Microsoft.RedHatOpenShift/locations/{location}/listinstallversions": {
|
"/subscriptions/{subscriptionId}/providers/Microsoft.RedHatOpenShift/locations/{location}/listinstallversions": {
|
||||||
"get": {
|
"get": {
|
||||||
"tags": [
|
"tags": [
|
||||||
"InstallVersions"
|
"OpenShiftVersions"
|
||||||
],
|
],
|
||||||
"summary": "Lists all OpenShift versions available to install in the specified location.",
|
"summary": "Lists all OpenShift versions available to install in the specified location.",
|
||||||
"description": "The operation returns the installable OpenShift versions as strings.",
|
"description": "The operation returns the installable OpenShift versions as strings.",
|
||||||
"operationId": "InstallVersions_List",
|
"operationId": "OpenShiftVersions_List",
|
||||||
"parameters": [
|
"parameters": [
|
||||||
{
|
{
|
||||||
"$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter"
|
"$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter"
|
||||||
|
@ -76,7 +76,7 @@
|
||||||
"200": {
|
"200": {
|
||||||
"description": "OK",
|
"description": "OK",
|
||||||
"schema": {
|
"schema": {
|
||||||
"$ref": "#/definitions/InstallVersions"
|
"$ref": "#/definitions/OpenShiftVersionList"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"default": {
|
"default": {
|
||||||
|
@ -88,7 +88,7 @@
|
||||||
},
|
},
|
||||||
"x-ms-examples": {
|
"x-ms-examples": {
|
||||||
"Lists all OpenShift versions available to install in the specified location.": {
|
"Lists all OpenShift versions available to install in the specified location.": {
|
||||||
"$ref": "./examples/InstallVersions_List.json"
|
"$ref": "./examples/OpenShiftVersions_List.json"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1801,18 +1801,6 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"InstallVersion": {
|
|
||||||
"description": "InstallVersion is the OpenShift installation version string.",
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"InstallVersions": {
|
|
||||||
"description": "InstallVersions represents a List of OpenShift installable versions.",
|
|
||||||
"type": "array",
|
|
||||||
"items": {
|
|
||||||
"$ref": "#/definitions/InstallVersion"
|
|
||||||
},
|
|
||||||
"x-ms-identifiers": []
|
|
||||||
},
|
|
||||||
"MachinePool": {
|
"MachinePool": {
|
||||||
"description": "MachinePool represents a MachinePool",
|
"description": "MachinePool represents a MachinePool",
|
||||||
"type": "object",
|
"type": "object",
|
||||||
|
@ -2025,10 +2013,6 @@
|
||||||
"$ref": "#/definitions/IngressProfile"
|
"$ref": "#/definitions/IngressProfile"
|
||||||
},
|
},
|
||||||
"x-ms-identifiers": []
|
"x-ms-identifiers": []
|
||||||
},
|
|
||||||
"installVersion": {
|
|
||||||
"description": "The cluster install version.",
|
|
||||||
"type": "string"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -2052,6 +2036,61 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"OpenShiftVersion": {
|
||||||
|
"description": "OpenShiftVersion represents an OpenShift version that can be installed.",
|
||||||
|
"type": "object",
|
||||||
|
"allOf": [
|
||||||
|
{
|
||||||
|
"$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ProxyResource"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"properties": {
|
||||||
|
"id": {
|
||||||
|
"description": "The ID for the resource.",
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"name": {
|
||||||
|
"description": "Name of the resource.",
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"type": {
|
||||||
|
"description": "The resource type.",
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"properties": {
|
||||||
|
"$ref": "#/definitions/OpenShiftVersionProperties",
|
||||||
|
"description": "The properties for the OpenShiftVersion resource."
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"OpenShiftVersionList": {
|
||||||
|
"description": "OpenShiftVersionList represents a List of available versions.",
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"value": {
|
||||||
|
"description": "The List of available versions.",
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"$ref": "#/definitions/OpenShiftVersion"
|
||||||
|
},
|
||||||
|
"x-ms-identifiers": []
|
||||||
|
},
|
||||||
|
"nextLink": {
|
||||||
|
"description": "Next Link to next operation.",
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"OpenShiftVersionProperties": {
|
||||||
|
"description": "OpenShiftVersionProperties represents the properties of an OpenShiftVersion.",
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"version": {
|
||||||
|
"description": "Version represents the version to create the cluster at.",
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"Operation": {
|
"Operation": {
|
||||||
"description": "Operation represents an RP operation.",
|
"description": "Operation represents an RP operation.",
|
||||||
"type": "object",
|
"type": "object",
|
||||||
|
|
Загрузка…
Ссылка в новой задаче