From d73338780dd8fe4d5302de6561b8681c7624b72e Mon Sep 17 00:00:00 2001 From: Ken Sipe Date: Wed, 11 Sep 2019 15:19:15 -0500 Subject: [PATCH] Richer Maintainer Metadata (#762) * Fixes Operator Maintainer Metadata to be more rich with a breakdown of name and email. * We also move the community repository (likely temporarily) from: https://kudo-repository.storage.googleapis.com to `https://kudo-repository.storage.googleapis.com/0.7.0` --- config/crds/kudo_v1alpha1_operator.yaml | 7 ++++- config/samples/first-operator/operator.yaml | 3 +- go.sum | 4 +++ pkg/apis/kudo/v1alpha1/operator_types.go | 20 +++++++++----- .../kudo/v1alpha1/zz_generated.deepcopy.go | 26 ++++++++++++++++-- pkg/bundle/operator.go | 2 +- pkg/kudoctl/bundle/bundle.go | 2 ++ .../testdata/zk-crd-golden1/operator.golden | 9 ++++-- .../testdata/zk-crd-golden2/operator.golden | 9 ++++-- pkg/kudoctl/bundle/testdata/zk.tar.gz | Bin 1724 -> 1733 bytes pkg/kudoctl/bundle/testdata/zk/operator.yaml | 9 ++++-- pkg/kudoctl/cmd/init/crds.go | 12 ++++++-- .../cmd/testdata/deploy-kudo.yaml.golden | 8 ++++-- pkg/kudoctl/cmd/testdata/repo-list.golden | 4 +-- .../cmd/testdata/skip-check-add-list.golden | 6 ++-- pkg/kudoctl/util/repo/index.go | 8 +----- pkg/kudoctl/util/repo/index_test.go | 10 +++---- pkg/kudoctl/util/repo/repo.go | 17 ++---------- .../repo/testdata/repositories.yaml.golden | 2 +- .../cli-install-operator/operator.yaml | 3 +- .../first-operator/operator.yaml | 3 +- .../second-operator/operator.yaml | 3 +- 22 files changed, 107 insertions(+), 60 deletions(-) diff --git a/config/crds/kudo_v1alpha1_operator.yaml b/config/crds/kudo_v1alpha1_operator.yaml index 60367cb7b..10d5029dc 100644 --- a/config/crds/kudo_v1alpha1_operator.yaml +++ b/config/crds/kudo_v1alpha1_operator.yaml @@ -36,7 +36,12 @@ spec: type: string maintainers: items: - type: string + properties: + name: + type: string + email: + type: string + type: object type: array url: type: string diff --git a/config/samples/first-operator/operator.yaml b/config/samples/first-operator/operator.yaml index ef587c17c..7a27e439a 100644 --- a/config/samples/first-operator/operator.yaml +++ b/config/samples/first-operator/operator.yaml @@ -1,7 +1,8 @@ name: "first-operator" version: "0.1.0" maintainers: - - Your name + - name: Your name + email: url: https://kudo.dev tasks: app: diff --git a/go.sum b/go.sum index a13e0eebf..52e1d567a 100644 --- a/go.sum +++ b/go.sum @@ -100,6 +100,9 @@ github.com/go-playground/universal-translator v0.16.0/go.mod h1:1AnU7NaIRDWWzGEK github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= github.com/go-test/deep v1.0.1 h1:UQhStjbkDClarlmv0am7OXXO4/GaPdCGiUiMTvi28sg= github.com/go-test/deep v1.0.1/go.mod h1:wGDj63lr65AM2AQyKZd/NYHGb0R+1RLqB8NKt3aSFNA= +github.com/gobuffalo/envy v1.6.5/go.mod h1:N+GkhhZ/93bGZc6ZKhJLP6+m+tCNPKwgSpH9kaifseQ= +github.com/gobuffalo/envy v1.6.15 h1:OsV5vOpHYUpP7ZLS6sem1y40/lNX1BZj+ynMiRi21lQ= +github.com/gobuffalo/envy v1.6.15/go.mod h1:n7DRkBerg/aorDM8kbduw5dN3oXGswK5liaSCx4T5NI= github.com/gobuffalo/flect v0.1.5 h1:xpKq9ap8MbYfhuPCF0dBH854Gp9CxZjr/IocxELFflo= github.com/gobuffalo/flect v0.1.5/go.mod h1:W3K3X9ksuZfir8f/LrfVtWmCDQFfayuylOJ7sz/Fj80= github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= @@ -441,6 +444,7 @@ sigs.k8s.io/controller-runtime v0.2.0 h1:5gL30PXOisGZl+Osi4CmLhvMUj77BO3wJeouKF2 sigs.k8s.io/controller-runtime v0.2.0/go.mod h1:ZHqrRDZi3f6BzONcvlUxkqCKgwasGk5FZrnSv9TVZF4= sigs.k8s.io/controller-tools v0.2.0 h1:AmQ/0JKBJAjyAiPAkrAf9QW06jkx2lc5hpxMjamsFpw= sigs.k8s.io/controller-tools v0.2.0/go.mod h1:8t/X+FVWvk6TaBcsa+UKUBbn7GMtvyBKX30SGl4em6Y= +sigs.k8s.io/controller-tools v0.2.1 h1:HoCik83vXOpPi7KSJWdPRmiGntyOzK0v0BTV4U+pl8o= sigs.k8s.io/kind v0.4.0 h1:C/QMxmF5Sp3yyKkTJ5+VJPcclZyu/JV8wLyihZbsHaI= sigs.k8s.io/kind v0.4.0/go.mod h1:bgGo2cWxKGQ7esVxtGp9H17Ttlexju92CTMjCg08HNQ= sigs.k8s.io/kustomize v2.0.3+incompatible h1:JUufWFNlI44MdtnjUqVnvh29rR37PQFzPbLXqhyOyX0= diff --git a/pkg/apis/kudo/v1alpha1/operator_types.go b/pkg/apis/kudo/v1alpha1/operator_types.go index d3ea7b5cf..5f0536ac2 100644 --- a/pkg/apis/kudo/v1alpha1/operator_types.go +++ b/pkg/apis/kudo/v1alpha1/operator_types.go @@ -21,15 +21,21 @@ import ( // OperatorSpec defines the desired state of Operator type OperatorSpec struct { - Description string `json:"description,omitempty"` - KudoVersion string `json:"kudoVersion,omitempty"` - KubernetesVersion string `json:"kubernetesVersion,omitempty"` - Maintainers []Maintainer `json:"maintainers,omitempty"` - URL string `json:"url,omitempty"` + Description string `json:"description,omitempty"` + KudoVersion string `json:"kudoVersion,omitempty"` + KubernetesVersion string `json:"kubernetesVersion,omitempty"` + Maintainers []*Maintainer `json:"maintainers,omitempty"` + URL string `json:"url,omitempty"` } -// Maintainer contains contact info for the maintainer of the Operator -type Maintainer string +// Maintainer describes an Operator maintainer. +type Maintainer struct { + // Name is a user name or organization name. + Name string `json:"name,omitempty"` + + // Email is an optional email address to contact the named maintainer. + Email string `json:"email,omitempty"` +} // OperatorStatus defines the observed state of Operator type OperatorStatus struct { diff --git a/pkg/apis/kudo/v1alpha1/zz_generated.deepcopy.go b/pkg/apis/kudo/v1alpha1/zz_generated.deepcopy.go index ca52189e0..cef05d382 100644 --- a/pkg/apis/kudo/v1alpha1/zz_generated.deepcopy.go +++ b/pkg/apis/kudo/v1alpha1/zz_generated.deepcopy.go @@ -228,6 +228,22 @@ func (in *InstanceStatus) DeepCopy() *InstanceStatus { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Maintainer) DeepCopyInto(out *Maintainer) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Maintainer. +func (in *Maintainer) DeepCopy() *Maintainer { + if in == nil { + return nil + } + out := new(Maintainer) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Network) DeepCopyInto(out *Network) { *out = *in @@ -361,8 +377,14 @@ func (in *OperatorSpec) DeepCopyInto(out *OperatorSpec) { *out = *in if in.Maintainers != nil { in, out := &in.Maintainers, &out.Maintainers - *out = make([]Maintainer, len(*in)) - copy(*out, *in) + *out = make([]*Maintainer, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(Maintainer) + **out = **in + } + } } return } diff --git a/pkg/bundle/operator.go b/pkg/bundle/operator.go index 7f097964e..6a982d069 100644 --- a/pkg/bundle/operator.go +++ b/pkg/bundle/operator.go @@ -12,7 +12,7 @@ type Operator struct { AppVersion string `json:"appVersion,omitempty"` KUDOVersion string `json:"kudoVersion,omitempty"` KubernetesVersion string `json:"kubernetesVersion,omitempty"` - Maintainers []v1alpha1.Maintainer `json:"maintainers,omitempty"` + Maintainers []*v1alpha1.Maintainer `json:"maintainers,omitempty"` URL string `json:"url,omitempty"` Tasks map[string]v1alpha1.TaskSpec `json:"tasks"` Plans map[string]v1alpha1.Plan `json:"plans"` diff --git a/pkg/kudoctl/bundle/bundle.go b/pkg/kudoctl/bundle/bundle.go index e6b495735..d228a463b 100644 --- a/pkg/kudoctl/bundle/bundle.go +++ b/pkg/kudoctl/bundle/bundle.go @@ -102,6 +102,8 @@ func (b fileBundle) GetPkgFiles() (*PackageFiles, error) { func ToTarBundle(fs afero.Fs, path string, destination string, overwrite bool) (string, error) { pkg, err := fromFolder(fs, path) if err != nil { + //TODO (kensipe): use wrapped err at high verbosity + //return "", fmt.Errorf("invalid operator in path: %v error: %v", path, err) return "", fmt.Errorf("invalid operator in path: %v", path) } diff --git a/pkg/kudoctl/bundle/testdata/zk-crd-golden1/operator.golden b/pkg/kudoctl/bundle/testdata/zk-crd-golden1/operator.golden index 50ae85312..df1731ccc 100644 --- a/pkg/kudoctl/bundle/testdata/zk-crd-golden1/operator.golden +++ b/pkg/kudoctl/bundle/testdata/zk-crd-golden1/operator.golden @@ -7,8 +7,11 @@ metadata: spec: url: https://zookeeper.apache.org/ maintainers: - - Alena Varkockova - - Tom Runyon - - Ken Sipe + - name: Alena Varkockova + email: avarkockova@mesosphere.com + - name: Tom Runyon + email: runyontr@gmail.com + - name: Ken Sipe + email: kensipe@gmail.com kudoVersion: 0.2.0 kubernetesVersion: 1.15.0 diff --git a/pkg/kudoctl/bundle/testdata/zk-crd-golden2/operator.golden b/pkg/kudoctl/bundle/testdata/zk-crd-golden2/operator.golden index 50ae85312..df1731ccc 100644 --- a/pkg/kudoctl/bundle/testdata/zk-crd-golden2/operator.golden +++ b/pkg/kudoctl/bundle/testdata/zk-crd-golden2/operator.golden @@ -7,8 +7,11 @@ metadata: spec: url: https://zookeeper.apache.org/ maintainers: - - Alena Varkockova - - Tom Runyon - - Ken Sipe + - name: Alena Varkockova + email: avarkockova@mesosphere.com + - name: Tom Runyon + email: runyontr@gmail.com + - name: Ken Sipe + email: kensipe@gmail.com kudoVersion: 0.2.0 kubernetesVersion: 1.15.0 diff --git a/pkg/kudoctl/bundle/testdata/zk.tar.gz b/pkg/kudoctl/bundle/testdata/zk.tar.gz index 089cb0dde0e59f1e676511e61feb999a110ea07f..7d2fb58575bc277fe791e4892cc5a4a9193150b9 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3wOmeNt?nNA)$q!P; zL>JCiLBEo(1dpSFnojNo!!&rGC$4$fyBUsA>vXFj7DBWSQB0omIdp^m?7jn?{tgo) zZ$qDS|NfHOmxLTAiLKr%YA!4W1_lNO1_lNO1_lNO1_lNO1_lNO1_lNO1_lNO1_lNO S1_lNOhrxeaUtP%nPyhg)7EU(+ diff --git a/pkg/kudoctl/bundle/testdata/zk/operator.yaml b/pkg/kudoctl/bundle/testdata/zk/operator.yaml index 131edb5b1..76e747cba 100644 --- a/pkg/kudoctl/bundle/testdata/zk/operator.yaml +++ b/pkg/kudoctl/bundle/testdata/zk/operator.yaml @@ -4,9 +4,12 @@ appVersion: "3.4.10" kudoVersion: 0.2.0 kubernetesVersion: 1.15.0 maintainers: -- Alena Varkockova -- Tom Runyon -- Ken Sipe + - name: Alena Varkockova + email: avarkockova@mesosphere.com + - name: Tom Runyon + email: runyontr@gmail.com + - name: Ken Sipe + email: kensipe@gmail.com url: https://zookeeper.apache.org/ tasks: infra: diff --git a/pkg/kudoctl/cmd/init/crds.go b/pkg/kudoctl/cmd/init/crds.go index 6d48e26a8..93acef73e 100644 --- a/pkg/kudoctl/cmd/init/crds.go +++ b/pkg/kudoctl/cmd/init/crds.go @@ -67,14 +67,22 @@ func operatorCrd() *apiextv1beta1.CustomResourceDefinition { } func generateOperator() *apiextv1beta1.CustomResourceDefinition { + + maintainers := map[string]apiextv1beta1.JSONSchemaProps{ + "name": apiextv1beta1.JSONSchemaProps{Type: "string"}, + "email": apiextv1beta1.JSONSchemaProps{Type: "string"}, + } + crd := generateCrd("Operator", "operators") specProps := map[string]apiextv1beta1.JSONSchemaProps{ "description": apiextv1beta1.JSONSchemaProps{Type: "string"}, "kubernetesVersion": apiextv1beta1.JSONSchemaProps{Type: "string"}, "kudoVersion": apiextv1beta1.JSONSchemaProps{Type: "string"}, "maintainers": apiextv1beta1.JSONSchemaProps{ - Type: "array", - Items: &apiextv1beta1.JSONSchemaPropsOrArray{Schema: &apiextv1beta1.JSONSchemaProps{Type: "string"}, JSONSchemas: []apiextv1beta1.JSONSchemaProps{}}, + Items: &apiextv1beta1.JSONSchemaPropsOrArray{Schema: &apiextv1beta1.JSONSchemaProps{ + Type: "object", + Properties: maintainers, + }, JSONSchemas: []apiextv1beta1.JSONSchemaProps{}}, }, "url": apiextv1beta1.JSONSchemaProps{Type: "string"}, } diff --git a/pkg/kudoctl/cmd/testdata/deploy-kudo.yaml.golden b/pkg/kudoctl/cmd/testdata/deploy-kudo.yaml.golden index da7e0f01c..a1ab77213 100644 --- a/pkg/kudoctl/cmd/testdata/deploy-kudo.yaml.golden +++ b/pkg/kudoctl/cmd/testdata/deploy-kudo.yaml.golden @@ -78,8 +78,12 @@ spec: type: string maintainers: items: - type: string - type: array + properties: + email: + type: string + name: + type: string + type: object url: type: string type: object diff --git a/pkg/kudoctl/cmd/testdata/repo-list.golden b/pkg/kudoctl/cmd/testdata/repo-list.golden index f9555a29a..fdc1aacb9 100644 --- a/pkg/kudoctl/cmd/testdata/repo-list.golden +++ b/pkg/kudoctl/cmd/testdata/repo-list.golden @@ -1,2 +1,2 @@ -NAME URL -*community https://kudo-repository.storage.googleapis.com +NAME URL +*community https://kudo-repository.storage.googleapis.com/0.7.0 diff --git a/pkg/kudoctl/cmd/testdata/skip-check-add-list.golden b/pkg/kudoctl/cmd/testdata/skip-check-add-list.golden index 5a7d91297..8071b762c 100644 --- a/pkg/kudoctl/cmd/testdata/skip-check-add-list.golden +++ b/pkg/kudoctl/cmd/testdata/skip-check-add-list.golden @@ -1,3 +1,3 @@ -NAME URL -*community https://kudo-repository.storage.googleapis.com -foo badurl +NAME URL +*community https://kudo-repository.storage.googleapis.com/0.7.0 +foo badurl diff --git a/pkg/kudoctl/util/repo/index.go b/pkg/kudoctl/util/repo/index.go index 6191657f2..6d05f5b4f 100644 --- a/pkg/kudoctl/util/repo/index.go +++ b/pkg/kudoctl/util/repo/index.go @@ -180,18 +180,12 @@ func ToPackageVersion(pf *bundle.PackageFiles, digest string, url string) *Packa url = url + "/" } url = fmt.Sprintf("%s%s-%v.tgz", url, o.Name, o.Version) - m := make([]*Maintainer, len(o.Maintainers)) - for i, maintainer := range o.Maintainers { - m[i] = &Maintainer{ - Name: string(maintainer), - } - } pv := PackageVersion{ Metadata: &Metadata{ Name: o.Name, Version: o.Version, Description: o.Description, - Maintainers: m, + Maintainers: o.Maintainers, AppVersion: o.AppVersion, }, URLs: []string{url}, diff --git a/pkg/kudoctl/util/repo/index_test.go b/pkg/kudoctl/util/repo/index_test.go index 80f528a9e..5f220de83 100644 --- a/pkg/kudoctl/util/repo/index_test.go +++ b/pkg/kudoctl/util/repo/index_test.go @@ -118,10 +118,10 @@ func getTestBundleVersion(name string, version string) PackageVersion { Sources: []string{"https://github.com/kudobuilder/kudo"}, Description: "fancy description is here", Deprecated: false, - Maintainers: []*Maintainer{ - &Maintainer{Name: "Fabian Baier", Email: ""}, - &Maintainer{Name: "Tom Runyon", Email: ""}, - &Maintainer{Name: "Ken Sipe", Email: ""}}, + Maintainers: []*v1alpha1.Maintainer{ + &v1alpha1.Maintainer{Name: "Fabian Baier", Email: ""}, + &v1alpha1.Maintainer{Name: "Tom Runyon", Email: ""}, + &v1alpha1.Maintainer{Name: "Ken Sipe", Email: ""}}, }, URLs: urls, Removed: false, @@ -164,7 +164,7 @@ func TestMapPackageFileToPackageVersion(t *testing.T) { AppVersion: "2.2.2", KUDOVersion: "0.5.0", KubernetesVersion: "1.15", - Maintainers: []v1alpha1.Maintainer{"kensipe@gmail.com"}, + Maintainers: []*v1alpha1.Maintainer{&v1alpha1.Maintainer{Name: "Ken Sipe"}}, URL: "http://kudo.dev/kafka", } pf := bundle.PackageFiles{ diff --git a/pkg/kudoctl/util/repo/repo.go b/pkg/kudoctl/util/repo/repo.go index de150c664..367720e1d 100644 --- a/pkg/kudoctl/util/repo/repo.go +++ b/pkg/kudoctl/util/repo/repo.go @@ -4,6 +4,7 @@ import ( "fmt" "os" + "github.com/kudobuilder/kudo/pkg/apis/kudo/v1alpha1" "github.com/kudobuilder/kudo/pkg/kudoctl/kudohome" "github.com/spf13/afero" @@ -37,7 +38,7 @@ type Repositories struct { // Default initialized repository. var Default = &Configuration{ Name: defaultRepoName, - URL: "https://kudo-repository.storage.googleapis.com", + URL: "https://kudo-repository.storage.googleapis.com/0.7.0", } // NewRepositories creates a new repo with only defaults populated @@ -166,20 +167,8 @@ type Metadata struct { Description string `json:"description,omitempty"` // Maintainers is a list of name and URL/email addresses of the maintainer(s). - Maintainers []*Maintainer `json:"maintainers,omitempty"` + Maintainers []*v1alpha1.Maintainer `json:"maintainers,omitempty"` // Deprecated reflects whether this operator is deprecated. Deprecated bool `json:"deprecated,omitempty"` } - -// Maintainer describes an Operator maintainer. -type Maintainer struct { - // Name is a user name or organization name. - Name string `json:"name,omitempty"` - - // Email is an optional email address to contact the named maintainer. - Email string `json:"email,omitempty"` - - // URL is an optional URL to an address for the named maintainer. - URL string `json:"url,omitempty"` -} diff --git a/pkg/kudoctl/util/repo/testdata/repositories.yaml.golden b/pkg/kudoctl/util/repo/testdata/repositories.yaml.golden index d3f52bf9f..d6f535ec5 100644 --- a/pkg/kudoctl/util/repo/testdata/repositories.yaml.golden +++ b/pkg/kudoctl/util/repo/testdata/repositories.yaml.golden @@ -2,4 +2,4 @@ context: community repoVersion: v1 repositories: - name: community - url: https://kudo-repository.storage.googleapis.com + url: https://kudo-repository.storage.googleapis.com/0.7.0 diff --git a/test/integration/cli-install/cli-install-operator/operator.yaml b/test/integration/cli-install/cli-install-operator/operator.yaml index 6b1449dd0..1cebb5d3e 100644 --- a/test/integration/cli-install/cli-install-operator/operator.yaml +++ b/test/integration/cli-install/cli-install-operator/operator.yaml @@ -3,7 +3,8 @@ version: "0.1.0" kudoVersion: 0.3.0 kubernetesVersion: 1.5.1 maintainers: - - Justin Taylor-Barrick + - name: Justin Taylor-Barrick + email: jbarrick-mesosphere@mesosphere.com tasks: infra: resources: diff --git a/test/integration/upgrade-command/first-operator/operator.yaml b/test/integration/upgrade-command/first-operator/operator.yaml index bea0c5863..655178afe 100644 --- a/test/integration/upgrade-command/first-operator/operator.yaml +++ b/test/integration/upgrade-command/first-operator/operator.yaml @@ -1,7 +1,8 @@ name: "upgrade-operator" version: "0.1.0" maintainers: - - Your name + - name: Your name + email: url: https://kudo.dev tasks: app: diff --git a/test/integration/upgrade-command/second-operator/operator.yaml b/test/integration/upgrade-command/second-operator/operator.yaml index 6616f9716..3a5c50621 100644 --- a/test/integration/upgrade-command/second-operator/operator.yaml +++ b/test/integration/upgrade-command/second-operator/operator.yaml @@ -1,7 +1,8 @@ name: "upgrade-operator" version: "0.2.0" maintainers: - - Your name + - name: Your name + email: url: https://kudo.dev tasks: app: