diff --git a/generate/generate.sh b/generate/generate.sh index 5bb907f..483d1c3 100755 --- a/generate/generate.sh +++ b/generate/generate.sh @@ -16,5 +16,5 @@ echo $GO_SUBDIRS cd .. -go run -tags generate github.com/google/addlicense -v -c 'Upbound Inc' -ignore service/spaces/crossplane/supported_versions.yaml *.go $(echo ${GO_SUBDIRS} | xargs) +go run -tags generate github.com/google/addlicense -v -c 'Upbound Inc' *.go $(echo ${GO_SUBDIRS} | xargs) cd generate diff --git a/go.mod b/go.mod index 206d724..f1b32ed 100644 --- a/go.mod +++ b/go.mod @@ -3,14 +3,12 @@ module github.com/upbound/up-sdk-go go 1.23.1 require ( - github.com/Masterminds/semver/v3 v3.2.1 github.com/crossplane/crossplane-runtime v1.15.1 github.com/google/addlicense v1.1.1 github.com/google/go-cmp v0.6.0 github.com/google/uuid v1.6.0 github.com/pkg/errors v0.9.1 github.com/upbound/up-sdk-go/apis v1.8.0 - gopkg.in/yaml.v3 v3.0.1 k8s.io/apimachinery v0.29.1 ) @@ -49,6 +47,7 @@ require ( google.golang.org/protobuf v1.32.0 // indirect gopkg.in/inf.v0 v0.9.1 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect k8s.io/api v0.29.1 // indirect k8s.io/client-go v0.29.1 // indirect k8s.io/klog/v2 v2.120.1 // indirect diff --git a/go.sum b/go.sum index 1148a6e..060bf0b 100644 --- a/go.sum +++ b/go.sum @@ -1,7 +1,5 @@ dario.cat/mergo v1.0.0 h1:AGCNq9Evsj31mOgNPcLyXc+4PNABt905YmuqPYYpBWk= dario.cat/mergo v1.0.0/go.mod h1:uNxQE+84aUszobStD9th8a29P2fMDhsBdgRYvZOxGmk= -github.com/Masterminds/semver/v3 v3.2.1 h1:RN9w6+7QoMeJVGyfmbcgs28Br8cvmnucEXnY0rYXWg0= -github.com/Masterminds/semver/v3 v3.2.1/go.mod h1:qvl/7zhW3nngYb5+80sSMF+FG2BjYrf8m9wsX0PNOMQ= github.com/bmatcuk/doublestar/v4 v4.0.2 h1:X0krlUVAVmtr2cRoTqR8aDMrDqnB36ht8wpWTiQ3jsA= github.com/bmatcuk/doublestar/v4 v4.0.2/go.mod h1:xBQ8jztBU6kakFMg+8WGxn0c6z1fTSPVIjEY1Wr7jzc= github.com/crossplane/crossplane-runtime v1.15.1 h1:g1h75tNYOQT152IUNxs8ZgSsRFQKrZN9z69KefMujXs= diff --git a/service/spaces/crossplane/supported_versions.yaml b/service/spaces/crossplane/supported_versions.yaml deleted file mode 100644 index 00fbacb..0000000 --- a/service/spaces/crossplane/supported_versions.yaml +++ /dev/null @@ -1,49 +0,0 @@ -apiVersion: v1 -supportedVersions: - - spacesVersion: 1.4.0 - crossplaneVersions: - - version: 1.15.2-up.1 - - version: 1.15.1-up.1 - - version: 1.15.0-up.1 - - version: 1.14.8-up.1 - - version: 1.14.7-up.1 - - version: 1.14.6-up.1 - - version: 1.14.5-up.1 - - version: 1.14.4-up.1 - - version: 1.14.3-up.1 - - version: 1.14.2-up.1 - - version: 1.14.1-up.1 - - version: 1.13.2-up.3 - - version: 1.13.2-up.2 - - version: 1.13.2-up.1 - - spacesVersion: 1.3.0 - crossplaneVersions: - - version: 1.15.2-up.1 - - version: 1.15.1-up.1 - - version: 1.15.0-up.1 - - version: 1.14.8-up.1 - - version: 1.14.7-up.1 - - version: 1.14.6-up.1 - - version: 1.14.5-up.1 - - version: 1.14.4-up.1 - - version: 1.14.3-up.1 - - version: 1.14.2-up.1 - - version: 1.14.1-up.1 - - version: 1.13.2-up.3 - - version: 1.13.2-up.2 - - version: 1.13.2-up.1 - - spacesVersion: 1.2.4 - crossplaneVersions: - - version: 1.15.2-up.1 - - version: 1.15.1-up.1 - - version: 1.15.0-up.1 - - version: 1.14.8-up.1 - - version: 1.14.7-up.1 - - version: 1.14.5-up.1 - - version: 1.14.4-up.1 - - version: 1.14.3-up.1 - - version: 1.14.2-up.1 - - version: 1.14.1-up.1 - - version: 1.13.2-up.3 - - version: 1.13.2-up.2 - - version: 1.13.2-up.1 diff --git a/service/spaces/crossplane/versions.go b/service/spaces/crossplane/versions.go deleted file mode 100644 index ff9cbcd..0000000 --- a/service/spaces/crossplane/versions.go +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright 2024 Upbound Inc -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package crossplane - -// SupportedVersionsFile represents the structure of supported_versions.yaml file -// which contains the supported versions of Crossplane for a given Spaces version. -type SupportedVersionsFile struct { - // APIVersion is the version of the file format. - APIVersion string `json:"apiVersion" yaml:"apiVersion"` - // SupportedVersions is a list of supported versions of Crossplane for a given Spaces version. - SupportVersions []VersionMatrix `json:"supportedVersions" yaml:"supportedVersions"` -} - -// VersionMatrix represents the supported versions of Crossplane for a given -// Spaces version. -type VersionMatrix struct { - // SpacesVersion is the version of Spaces. - SpacesVersion string `json:"spacesVersion" yaml:"spacesVersion"` - // CrossplaneVersions is a list of supported versions of Crossplane for a given Spaces version. - CrossplaneVersions []CrossplaneVersion `json:"crossplaneVersions" yaml:"crossplaneVersions"` -} - -// CrossplaneVersion represents the supported version of Crossplane. -type CrossplaneVersion struct { // nolint: golint // Dropping Crossplane prefix and calling it Version feels odd, version everywhere. - Version string `json:"version" yaml:"version"` -} diff --git a/service/spaces/crossplane/versions_test.go b/service/spaces/crossplane/versions_test.go deleted file mode 100644 index 6aae7c0..0000000 --- a/service/spaces/crossplane/versions_test.go +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright 2024 Upbound Inc -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package crossplane - -import ( - _ "embed" - "testing" - - "github.com/Masterminds/semver/v3" - "gopkg.in/yaml.v3" -) - -//go:embed supported_versions.yaml -var supportedVersionsFile string - -func TestVersionFileValid(t *testing.T) { - f := &SupportedVersionsFile{} - if err := yaml.Unmarshal([]byte(supportedVersionsFile), f); err != nil { - t.Fatalf("cannot parse supported_versions.yaml: %v", err) - } - if f.APIVersion != "v1" { - t.Fatalf("expected APIVersion v1alpha1, got %s", f.APIVersion) - } - if len(f.SupportVersions) == 0 { - t.Fatalf("expected non-empty SupportVersions") - } - for _, v := range f.SupportVersions { - _, err := semver.NewVersion(v.SpacesVersion) - if err != nil { - t.Fatalf("expected valid semver version for SpacesVersion, got %s", v.SpacesVersion) - } - if len(v.CrossplaneVersions) == 0 { - t.Fatalf("expected non-empty CrossplaneVersions") - } - for _, cv := range v.CrossplaneVersions { - _, err = semver.NewVersion(cv.Version) - if err != nil { - t.Fatalf("expected valid semver version for CrossplaneVersions, got %s", cv) - } - } - } -}