feat: add repository type
This commit is contained in:
17 files changed
+489
-153
No files matched your search
@@ -1,3 +1,4 @@
|
||||
.PHONY: generate
|
||||
generate:
|
||||
rm -rf ./pkg/apis
|
||||
@grafana-app-sdk generate -g ./pkg/apis --kindgrouping=group --postprocess --crdencoding none
|
||||
@@ -1,17 +1,17 @@
|
||||
package core
|
||||
|
||||
externalName: {
|
||||
kind: "NoOp"
|
||||
pluralName: "NoOps"
|
||||
group: "gituisync"
|
||||
kind: "Repository"
|
||||
pluralName: "Repositories"
|
||||
group: "gituisync"
|
||||
apiResource: {
|
||||
groupOverride: "gituisync.grafana.app"
|
||||
mutation: operations: ["create","update"]
|
||||
validation: operations: ["create","update"]
|
||||
mutation: operations: ["create", "update"]
|
||||
validation: operations: ["create", "update"]
|
||||
}
|
||||
codegen: {
|
||||
frontend: false
|
||||
backend: true
|
||||
backend: true
|
||||
}
|
||||
|
||||
current: "v0alpha1"
|
||||
@@ -19,9 +19,27 @@ externalName: {
|
||||
"v0alpha1": {
|
||||
schema: {
|
||||
spec: {
|
||||
noop_value_here: bool
|
||||
#LocalRepo: {
|
||||
type: "local"
|
||||
path: string
|
||||
}
|
||||
#S3Repo: {
|
||||
type: "s3"
|
||||
// TODO: Add ACL?
|
||||
// TODO: Encryption??
|
||||
bucket: string
|
||||
}
|
||||
#GitHubRepo: {
|
||||
// TODO: github or just 'git'??
|
||||
type: "github"
|
||||
// TODO: Do we want an SSH url instead maybe?
|
||||
owner: string
|
||||
repository: string
|
||||
// TODO: On-prem GitHub Enterprise support?
|
||||
}
|
||||
repository: #LocalRepo | #S3Repo | #GitHubRepo
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1 +1,4 @@
|
||||
module: "github.com/grafana/grafana/apps/gituisync/kinds"
|
||||
module: "github.com/grafana/grafana/apps/gituisync/kinds"
|
||||
language: {
|
||||
version: "v0.9.0"
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
apiVersion: gituisync.grafana.app/v0alpha1
|
||||
kind: Repository
|
||||
metadata:
|
||||
name: local-test-repo
|
||||
namespace: default
|
||||
spec:
|
||||
repository:
|
||||
type: local
|
||||
path: ./test-repo
|
||||
@@ -1,34 +0,0 @@
|
||||
//
|
||||
// Code generated by grafana-app-sdk. DO NOT EDIT.
|
||||
//
|
||||
|
||||
package v0alpha1
|
||||
|
||||
import (
|
||||
"github.com/grafana/grafana-app-sdk/resource"
|
||||
)
|
||||
|
||||
// schema is unexported to prevent accidental overwrites
|
||||
var (
|
||||
schemaNoOp = resource.NewSimpleSchema("gituisync.grafana.app", "v0alpha1", &NoOp{}, &NoOpList{}, resource.WithKind("NoOp"),
|
||||
resource.WithPlural("noops"), resource.WithScope(resource.NamespacedScope))
|
||||
kindNoOp = resource.Kind{
|
||||
Schema: schemaNoOp,
|
||||
Codecs: map[resource.KindEncoding]resource.Codec{
|
||||
resource.KindEncodingJSON: &NoOpJSONCodec{},
|
||||
},
|
||||
}
|
||||
)
|
||||
|
||||
// Kind returns a resource.Kind for this Schema with a JSON codec
|
||||
func NoOpKind() resource.Kind {
|
||||
return kindNoOp
|
||||
}
|
||||
|
||||
// Schema returns a resource.SimpleSchema representation of NoOp
|
||||
func NoOpSchema() *resource.SimpleSchema {
|
||||
return schemaNoOp
|
||||
}
|
||||
|
||||
// Interface compliance checks
|
||||
var _ resource.Schema = kindNoOp
|
||||
@@ -1,7 +0,0 @@
|
||||
package v0alpha1
|
||||
|
||||
// NoOpSpec defines model for NoOpSpec.
|
||||
// +k8s:openapi-gen=true
|
||||
type NoOpSpec struct {
|
||||
NoopValueHere bool `json:"noop_value_here"`
|
||||
}
|
||||
+5
-5
@@ -11,18 +11,18 @@ import (
|
||||
"github.com/grafana/grafana-app-sdk/resource"
|
||||
)
|
||||
|
||||
// NoOpJSONCodec is an implementation of resource.Codec for kubernetes JSON encoding
|
||||
type NoOpJSONCodec struct{}
|
||||
// RepositoryJSONCodec is an implementation of resource.Codec for kubernetes JSON encoding
|
||||
type RepositoryJSONCodec struct{}
|
||||
|
||||
// Read reads JSON-encoded bytes from `reader` and unmarshals them into `into`
|
||||
func (*NoOpJSONCodec) Read(reader io.Reader, into resource.Object) error {
|
||||
func (*RepositoryJSONCodec) Read(reader io.Reader, into resource.Object) error {
|
||||
return json.NewDecoder(reader).Decode(into)
|
||||
}
|
||||
|
||||
// Write writes JSON-encoded bytes into `writer` marshaled from `from`
|
||||
func (*NoOpJSONCodec) Write(writer io.Writer, from resource.Object) error {
|
||||
func (*RepositoryJSONCodec) Write(writer io.Writer, from resource.Object) error {
|
||||
return json.NewEncoder(writer).Encode(from)
|
||||
}
|
||||
|
||||
// Interface compliance checks
|
||||
var _ resource.Codec = &NoOpJSONCodec{}
|
||||
var _ resource.Codec = &RepositoryJSONCodec{}
|
||||
+3
-3
@@ -4,8 +4,8 @@ import (
|
||||
"time"
|
||||
)
|
||||
|
||||
// NoOpMetadata defines model for NoOpMetadata.
|
||||
type NoOpMetadata struct {
|
||||
// RepositoryMetadata defines model for RepositoryMetadata.
|
||||
type RepositoryMetadata struct {
|
||||
CreatedBy string `json:"createdBy"`
|
||||
CreationTimestamp time.Time `json:"creationTimestamp"`
|
||||
DeletionTimestamp *time.Time `json:"deletionTimestamp,omitempty"`
|
||||
@@ -21,7 +21,7 @@ type NoOpMetadata struct {
|
||||
// _kubeObjectMetadata is metadata found in a kubernetes object's metadata field.
|
||||
// It is not exhaustive and only includes fields which may be relevant to a kind's implementation,
|
||||
// As it is also intended to be generic enough to function with any API Server.
|
||||
type NoOpKubeObjectMetadata struct {
|
||||
type RepositoryKubeObjectMetadata struct {
|
||||
CreationTimestamp time.Time `json:"creationTimestamp"`
|
||||
DeletionTimestamp *time.Time `json:"deletionTimestamp,omitempty"`
|
||||
Finalizers []string `json:"finalizers"`
|
||||
+39
-39
@@ -15,19 +15,19 @@ import (
|
||||
)
|
||||
|
||||
// +k8s:openapi-gen=true
|
||||
type NoOp struct {
|
||||
type Repository struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ObjectMeta `json:"metadata"`
|
||||
Spec NoOpSpec `json:"spec"`
|
||||
NoOpStatus NoOpStatus `json:"status"`
|
||||
Spec RepositorySpec `json:"spec"`
|
||||
RepositoryStatus RepositoryStatus `json:"status"`
|
||||
}
|
||||
|
||||
func (o *NoOp) GetSpec() any {
|
||||
func (o *Repository) GetSpec() any {
|
||||
return o.Spec
|
||||
}
|
||||
|
||||
func (o *NoOp) SetSpec(spec any) error {
|
||||
cast, ok := spec.(NoOpSpec)
|
||||
func (o *Repository) SetSpec(spec any) error {
|
||||
cast, ok := spec.(RepositorySpec)
|
||||
if !ok {
|
||||
return fmt.Errorf("cannot set spec type %#v, not of type Spec", spec)
|
||||
}
|
||||
@@ -35,36 +35,36 @@ func (o *NoOp) SetSpec(spec any) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (o *NoOp) GetSubresources() map[string]any {
|
||||
func (o *Repository) GetSubresources() map[string]any {
|
||||
return map[string]any{
|
||||
"status": o.NoOpStatus,
|
||||
"status": o.RepositoryStatus,
|
||||
}
|
||||
}
|
||||
|
||||
func (o *NoOp) GetSubresource(name string) (any, bool) {
|
||||
func (o *Repository) GetSubresource(name string) (any, bool) {
|
||||
switch name {
|
||||
case "status":
|
||||
return o.NoOpStatus, true
|
||||
return o.RepositoryStatus, true
|
||||
default:
|
||||
return nil, false
|
||||
}
|
||||
}
|
||||
|
||||
func (o *NoOp) SetSubresource(name string, value any) error {
|
||||
func (o *Repository) SetSubresource(name string, value any) error {
|
||||
switch name {
|
||||
case "status":
|
||||
cast, ok := value.(NoOpStatus)
|
||||
cast, ok := value.(RepositoryStatus)
|
||||
if !ok {
|
||||
return fmt.Errorf("cannot set status type %#v, not of type NoOpStatus", value)
|
||||
return fmt.Errorf("cannot set status type %#v, not of type RepositoryStatus", value)
|
||||
}
|
||||
o.NoOpStatus = cast
|
||||
o.RepositoryStatus = cast
|
||||
return nil
|
||||
default:
|
||||
return fmt.Errorf("subresource '%s' does not exist", name)
|
||||
}
|
||||
}
|
||||
|
||||
func (o *NoOp) GetStaticMetadata() resource.StaticMetadata {
|
||||
func (o *Repository) GetStaticMetadata() resource.StaticMetadata {
|
||||
gvk := o.GroupVersionKind()
|
||||
return resource.StaticMetadata{
|
||||
Name: o.ObjectMeta.Name,
|
||||
@@ -75,7 +75,7 @@ func (o *NoOp) GetStaticMetadata() resource.StaticMetadata {
|
||||
}
|
||||
}
|
||||
|
||||
func (o *NoOp) SetStaticMetadata(metadata resource.StaticMetadata) {
|
||||
func (o *Repository) SetStaticMetadata(metadata resource.StaticMetadata) {
|
||||
o.Name = metadata.Name
|
||||
o.Namespace = metadata.Namespace
|
||||
o.SetGroupVersionKind(schema.GroupVersionKind{
|
||||
@@ -85,7 +85,7 @@ func (o *NoOp) SetStaticMetadata(metadata resource.StaticMetadata) {
|
||||
})
|
||||
}
|
||||
|
||||
func (o *NoOp) GetCommonMetadata() resource.CommonMetadata {
|
||||
func (o *Repository) GetCommonMetadata() resource.CommonMetadata {
|
||||
dt := o.DeletionTimestamp
|
||||
var deletionTimestamp *time.Time
|
||||
if dt != nil {
|
||||
@@ -117,7 +117,7 @@ func (o *NoOp) GetCommonMetadata() resource.CommonMetadata {
|
||||
}
|
||||
}
|
||||
|
||||
func (o *NoOp) SetCommonMetadata(metadata resource.CommonMetadata) {
|
||||
func (o *Repository) SetCommonMetadata(metadata resource.CommonMetadata) {
|
||||
o.UID = types.UID(metadata.UID)
|
||||
o.ResourceVersion = metadata.ResourceVersion
|
||||
o.Generation = metadata.Generation
|
||||
@@ -162,7 +162,7 @@ func (o *NoOp) SetCommonMetadata(metadata resource.CommonMetadata) {
|
||||
}
|
||||
}
|
||||
|
||||
func (o *NoOp) GetCreatedBy() string {
|
||||
func (o *Repository) GetCreatedBy() string {
|
||||
if o.ObjectMeta.Annotations == nil {
|
||||
o.ObjectMeta.Annotations = make(map[string]string)
|
||||
}
|
||||
@@ -170,7 +170,7 @@ func (o *NoOp) GetCreatedBy() string {
|
||||
return o.ObjectMeta.Annotations["grafana.com/createdBy"]
|
||||
}
|
||||
|
||||
func (o *NoOp) SetCreatedBy(createdBy string) {
|
||||
func (o *Repository) SetCreatedBy(createdBy string) {
|
||||
if o.ObjectMeta.Annotations == nil {
|
||||
o.ObjectMeta.Annotations = make(map[string]string)
|
||||
}
|
||||
@@ -178,7 +178,7 @@ func (o *NoOp) SetCreatedBy(createdBy string) {
|
||||
o.ObjectMeta.Annotations["grafana.com/createdBy"] = createdBy
|
||||
}
|
||||
|
||||
func (o *NoOp) GetUpdateTimestamp() time.Time {
|
||||
func (o *Repository) GetUpdateTimestamp() time.Time {
|
||||
if o.ObjectMeta.Annotations == nil {
|
||||
o.ObjectMeta.Annotations = make(map[string]string)
|
||||
}
|
||||
@@ -187,7 +187,7 @@ func (o *NoOp) GetUpdateTimestamp() time.Time {
|
||||
return parsed
|
||||
}
|
||||
|
||||
func (o *NoOp) SetUpdateTimestamp(updateTimestamp time.Time) {
|
||||
func (o *Repository) SetUpdateTimestamp(updateTimestamp time.Time) {
|
||||
if o.ObjectMeta.Annotations == nil {
|
||||
o.ObjectMeta.Annotations = make(map[string]string)
|
||||
}
|
||||
@@ -195,7 +195,7 @@ func (o *NoOp) SetUpdateTimestamp(updateTimestamp time.Time) {
|
||||
o.ObjectMeta.Annotations["grafana.com/updateTimestamp"] = updateTimestamp.Format(time.RFC3339)
|
||||
}
|
||||
|
||||
func (o *NoOp) GetUpdatedBy() string {
|
||||
func (o *Repository) GetUpdatedBy() string {
|
||||
if o.ObjectMeta.Annotations == nil {
|
||||
o.ObjectMeta.Annotations = make(map[string]string)
|
||||
}
|
||||
@@ -203,7 +203,7 @@ func (o *NoOp) GetUpdatedBy() string {
|
||||
return o.ObjectMeta.Annotations["grafana.com/updatedBy"]
|
||||
}
|
||||
|
||||
func (o *NoOp) SetUpdatedBy(updatedBy string) {
|
||||
func (o *Repository) SetUpdatedBy(updatedBy string) {
|
||||
if o.ObjectMeta.Annotations == nil {
|
||||
o.ObjectMeta.Annotations = make(map[string]string)
|
||||
}
|
||||
@@ -211,43 +211,43 @@ func (o *NoOp) SetUpdatedBy(updatedBy string) {
|
||||
o.ObjectMeta.Annotations["grafana.com/updatedBy"] = updatedBy
|
||||
}
|
||||
|
||||
func (o *NoOp) Copy() resource.Object {
|
||||
func (o *Repository) Copy() resource.Object {
|
||||
return resource.CopyObject(o)
|
||||
}
|
||||
|
||||
func (o *NoOp) DeepCopyObject() runtime.Object {
|
||||
func (o *Repository) DeepCopyObject() runtime.Object {
|
||||
return o.Copy()
|
||||
}
|
||||
|
||||
// Interface compliance compile-time check
|
||||
var _ resource.Object = &NoOp{}
|
||||
var _ resource.Object = &Repository{}
|
||||
|
||||
// +k8s:openapi-gen=true
|
||||
type NoOpList struct {
|
||||
type RepositoryList struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ListMeta `json:"metadata"`
|
||||
Items []NoOp `json:"items"`
|
||||
Items []Repository `json:"items"`
|
||||
}
|
||||
|
||||
func (o *NoOpList) DeepCopyObject() runtime.Object {
|
||||
func (o *RepositoryList) DeepCopyObject() runtime.Object {
|
||||
return o.Copy()
|
||||
}
|
||||
|
||||
func (o *NoOpList) Copy() resource.ListObject {
|
||||
cpy := &NoOpList{
|
||||
func (o *RepositoryList) Copy() resource.ListObject {
|
||||
cpy := &RepositoryList{
|
||||
TypeMeta: o.TypeMeta,
|
||||
Items: make([]NoOp, len(o.Items)),
|
||||
Items: make([]Repository, len(o.Items)),
|
||||
}
|
||||
o.ListMeta.DeepCopyInto(&cpy.ListMeta)
|
||||
for i := 0; i < len(o.Items); i++ {
|
||||
if item, ok := o.Items[i].Copy().(*NoOp); ok {
|
||||
if item, ok := o.Items[i].Copy().(*Repository); ok {
|
||||
cpy.Items[i] = *item
|
||||
}
|
||||
}
|
||||
return cpy
|
||||
}
|
||||
|
||||
func (o *NoOpList) GetItems() []resource.Object {
|
||||
func (o *RepositoryList) GetItems() []resource.Object {
|
||||
items := make([]resource.Object, len(o.Items))
|
||||
for i := 0; i < len(o.Items); i++ {
|
||||
items[i] = &o.Items[i]
|
||||
@@ -255,12 +255,12 @@ func (o *NoOpList) GetItems() []resource.Object {
|
||||
return items
|
||||
}
|
||||
|
||||
func (o *NoOpList) SetItems(items []resource.Object) {
|
||||
o.Items = make([]NoOp, len(items))
|
||||
func (o *RepositoryList) SetItems(items []resource.Object) {
|
||||
o.Items = make([]Repository, len(items))
|
||||
for i := 0; i < len(items); i++ {
|
||||
o.Items[i] = *items[i].(*NoOp)
|
||||
o.Items[i] = *items[i].(*Repository)
|
||||
}
|
||||
}
|
||||
|
||||
// Interface compliance compile-time check
|
||||
var _ resource.ListObject = &NoOpList{}
|
||||
var _ resource.ListObject = &RepositoryList{}
|
||||
@@ -0,0 +1,34 @@
|
||||
//
|
||||
// Code generated by grafana-app-sdk. DO NOT EDIT.
|
||||
//
|
||||
|
||||
package v0alpha1
|
||||
|
||||
import (
|
||||
"github.com/grafana/grafana-app-sdk/resource"
|
||||
)
|
||||
|
||||
// schema is unexported to prevent accidental overwrites
|
||||
var (
|
||||
schemaRepository = resource.NewSimpleSchema("gituisync.grafana.app", "v0alpha1", &Repository{}, &RepositoryList{}, resource.WithKind("Repository"),
|
||||
resource.WithPlural("repositories"), resource.WithScope(resource.NamespacedScope))
|
||||
kindRepository = resource.Kind{
|
||||
Schema: schemaRepository,
|
||||
Codecs: map[resource.KindEncoding]resource.Codec{
|
||||
resource.KindEncodingJSON: &RepositoryJSONCodec{},
|
||||
},
|
||||
}
|
||||
)
|
||||
|
||||
// Kind returns a resource.Kind for this Schema with a JSON codec
|
||||
func RepositoryKind() resource.Kind {
|
||||
return kindRepository
|
||||
}
|
||||
|
||||
// Schema returns a resource.SimpleSchema representation of Repository
|
||||
func RepositorySchema() *resource.SimpleSchema {
|
||||
return schemaRepository
|
||||
}
|
||||
|
||||
// Interface compliance checks
|
||||
var _ resource.Schema = kindRepository
|
||||
@@ -0,0 +1,119 @@
|
||||
package v0alpha1
|
||||
|
||||
// Defines values for RepositoryGitHubRepoType.
|
||||
const (
|
||||
RepositoryGitHubRepoTypeGithub RepositoryGitHubRepoType = "github"
|
||||
)
|
||||
|
||||
// Defines values for RepositoryLocalRepoType.
|
||||
const (
|
||||
RepositoryLocalRepoTypeLocal RepositoryLocalRepoType = "local"
|
||||
)
|
||||
|
||||
// Defines values for RepositoryS3RepoType.
|
||||
const (
|
||||
RepositoryS3RepoTypeS3 RepositoryS3RepoType = "s3"
|
||||
)
|
||||
|
||||
// Defines values for RepositoryspecGitHubRepoType.
|
||||
const (
|
||||
RepositoryspecGitHubRepoTypeGithub RepositoryspecGitHubRepoType = "github"
|
||||
)
|
||||
|
||||
// Defines values for RepositoryspecLocalRepoType.
|
||||
const (
|
||||
RepositoryspecLocalRepoTypeLocal RepositoryspecLocalRepoType = "local"
|
||||
)
|
||||
|
||||
// Defines values for RepositoryspecS3RepoType.
|
||||
const (
|
||||
RepositoryspecS3RepoTypeS3 RepositoryspecS3RepoType = "s3"
|
||||
)
|
||||
|
||||
// RepositoryGitHubRepo defines model for RepositoryGitHubRepo.
|
||||
// +k8s:openapi-gen=true
|
||||
type RepositoryGitHubRepo struct {
|
||||
// TODO: Do we want an SSH url instead maybe?
|
||||
Owner string `json:"owner"`
|
||||
|
||||
// TODO: On-prem GitHub Enterprise support?
|
||||
Repository string `json:"repository"`
|
||||
|
||||
// TODO: github or just 'git'??
|
||||
Type RepositoryGitHubRepoType `json:"type"`
|
||||
}
|
||||
|
||||
// TODO: github or just 'git'??
|
||||
// +k8s:openapi-gen=true
|
||||
type RepositoryGitHubRepoType string
|
||||
|
||||
// RepositoryLocalRepo defines model for RepositoryLocalRepo.
|
||||
// +k8s:openapi-gen=true
|
||||
type RepositoryLocalRepo struct {
|
||||
Path string `json:"path"`
|
||||
Type RepositoryLocalRepoType `json:"type"`
|
||||
}
|
||||
|
||||
// RepositoryLocalRepoType defines model for RepositoryLocalRepo.Type.
|
||||
// +k8s:openapi-gen=true
|
||||
type RepositoryLocalRepoType string
|
||||
|
||||
// RepositoryS3Repo defines model for RepositoryS3Repo.
|
||||
// +k8s:openapi-gen=true
|
||||
type RepositoryS3Repo struct {
|
||||
// TODO: Add ACL?
|
||||
// TODO: Encryption??
|
||||
Bucket string `json:"bucket"`
|
||||
Type RepositoryS3RepoType `json:"type"`
|
||||
}
|
||||
|
||||
// RepositoryS3RepoType defines model for RepositoryS3Repo.Type.
|
||||
// +k8s:openapi-gen=true
|
||||
type RepositoryS3RepoType string
|
||||
|
||||
// RepositorySpec defines model for RepositorySpec.
|
||||
// +k8s:openapi-gen=true
|
||||
type RepositorySpec struct {
|
||||
Repository interface{} `json:"repository"`
|
||||
}
|
||||
|
||||
// RepositoryspecGitHubRepo defines model for Repositoryspec.#GitHubRepo.
|
||||
// +k8s:openapi-gen=true
|
||||
type RepositoryspecGitHubRepo struct {
|
||||
// TODO: Do we want an SSH url instead maybe?
|
||||
Owner string `json:"owner"`
|
||||
|
||||
// TODO: On-prem GitHub Enterprise support?
|
||||
Repository string `json:"repository"`
|
||||
|
||||
// TODO: github or just 'git'??
|
||||
Type RepositoryspecGitHubRepoType `json:"type"`
|
||||
}
|
||||
|
||||
// TODO: github or just 'git'??
|
||||
// +k8s:openapi-gen=true
|
||||
type RepositoryspecGitHubRepoType string
|
||||
|
||||
// RepositoryspecLocalRepo defines model for Repositoryspec.#LocalRepo.
|
||||
// +k8s:openapi-gen=true
|
||||
type RepositoryspecLocalRepo struct {
|
||||
Path string `json:"path"`
|
||||
Type RepositoryspecLocalRepoType `json:"type"`
|
||||
}
|
||||
|
||||
// RepositoryspecLocalRepoType defines model for RepositoryspecLocalRepo.Type.
|
||||
// +k8s:openapi-gen=true
|
||||
type RepositoryspecLocalRepoType string
|
||||
|
||||
// RepositoryspecS3Repo defines model for Repositoryspec.#S3Repo.
|
||||
// +k8s:openapi-gen=true
|
||||
type RepositoryspecS3Repo struct {
|
||||
// TODO: Add ACL?
|
||||
// TODO: Encryption??
|
||||
Bucket string `json:"bucket"`
|
||||
Type RepositoryspecS3RepoType `json:"type"`
|
||||
}
|
||||
|
||||
// RepositoryspecS3RepoType defines model for RepositoryspecS3Repo.Type.
|
||||
// +k8s:openapi-gen=true
|
||||
type RepositoryspecS3RepoType string
|
||||
+21
-21
@@ -1,22 +1,22 @@
|
||||
package v0alpha1
|
||||
|
||||
// Defines values for NoOpOperatorStateState.
|
||||
// Defines values for RepositoryOperatorStateState.
|
||||
const (
|
||||
NoOpOperatorStateStateFailed NoOpOperatorStateState = "failed"
|
||||
NoOpOperatorStateStateInProgress NoOpOperatorStateState = "in_progress"
|
||||
NoOpOperatorStateStateSuccess NoOpOperatorStateState = "success"
|
||||
RepositoryOperatorStateStateFailed RepositoryOperatorStateState = "failed"
|
||||
RepositoryOperatorStateStateInProgress RepositoryOperatorStateState = "in_progress"
|
||||
RepositoryOperatorStateStateSuccess RepositoryOperatorStateState = "success"
|
||||
)
|
||||
|
||||
// Defines values for NoOpstatusOperatorStateState.
|
||||
// Defines values for RepositorystatusOperatorStateState.
|
||||
const (
|
||||
NoOpstatusOperatorStateStateFailed NoOpstatusOperatorStateState = "failed"
|
||||
NoOpstatusOperatorStateStateInProgress NoOpstatusOperatorStateState = "in_progress"
|
||||
NoOpstatusOperatorStateStateSuccess NoOpstatusOperatorStateState = "success"
|
||||
RepositorystatusOperatorStateStateFailed RepositorystatusOperatorStateState = "failed"
|
||||
RepositorystatusOperatorStateStateInProgress RepositorystatusOperatorStateState = "in_progress"
|
||||
RepositorystatusOperatorStateStateSuccess RepositorystatusOperatorStateState = "success"
|
||||
)
|
||||
|
||||
// NoOpOperatorState defines model for NoOpOperatorState.
|
||||
// RepositoryOperatorState defines model for RepositoryOperatorState.
|
||||
// +k8s:openapi-gen=true
|
||||
type NoOpOperatorState struct {
|
||||
type RepositoryOperatorState struct {
|
||||
// descriptiveState is an optional more descriptive state field which has no requirements on format
|
||||
DescriptiveState *string `json:"descriptiveState,omitempty"`
|
||||
|
||||
@@ -28,28 +28,28 @@ type NoOpOperatorState struct {
|
||||
|
||||
// state describes the state of the lastEvaluation.
|
||||
// It is limited to three possible states for machine evaluation.
|
||||
State NoOpOperatorStateState `json:"state"`
|
||||
State RepositoryOperatorStateState `json:"state"`
|
||||
}
|
||||
|
||||
// NoOpOperatorStateState state describes the state of the lastEvaluation.
|
||||
// RepositoryOperatorStateState state describes the state of the lastEvaluation.
|
||||
// It is limited to three possible states for machine evaluation.
|
||||
// +k8s:openapi-gen=true
|
||||
type NoOpOperatorStateState string
|
||||
type RepositoryOperatorStateState string
|
||||
|
||||
// NoOpStatus defines model for NoOpStatus.
|
||||
// RepositoryStatus defines model for RepositoryStatus.
|
||||
// +k8s:openapi-gen=true
|
||||
type NoOpStatus struct {
|
||||
type RepositoryStatus struct {
|
||||
// additionalFields is reserved for future use
|
||||
AdditionalFields map[string]interface{} `json:"additionalFields,omitempty"`
|
||||
|
||||
// operatorStates is a map of operator ID to operator state evaluations.
|
||||
// Any operator which consumes this kind SHOULD add its state evaluation information to this field.
|
||||
OperatorStates map[string]NoOpstatusOperatorState `json:"operatorStates,omitempty"`
|
||||
OperatorStates map[string]RepositorystatusOperatorState `json:"operatorStates,omitempty"`
|
||||
}
|
||||
|
||||
// NoOpstatusOperatorState defines model for NoOpstatus.#OperatorState.
|
||||
// RepositorystatusOperatorState defines model for Repositorystatus.#OperatorState.
|
||||
// +k8s:openapi-gen=true
|
||||
type NoOpstatusOperatorState struct {
|
||||
type RepositorystatusOperatorState struct {
|
||||
// descriptiveState is an optional more descriptive state field which has no requirements on format
|
||||
DescriptiveState *string `json:"descriptiveState,omitempty"`
|
||||
|
||||
@@ -61,10 +61,10 @@ type NoOpstatusOperatorState struct {
|
||||
|
||||
// state describes the state of the lastEvaluation.
|
||||
// It is limited to three possible states for machine evaluation.
|
||||
State NoOpstatusOperatorStateState `json:"state"`
|
||||
State RepositorystatusOperatorStateState `json:"state"`
|
||||
}
|
||||
|
||||
// NoOpstatusOperatorStateState state describes the state of the lastEvaluation.
|
||||
// RepositorystatusOperatorStateState state describes the state of the lastEvaluation.
|
||||
// It is limited to three possible states for machine evaluation.
|
||||
// +k8s:openapi-gen=true
|
||||
type NoOpstatusOperatorStateState string
|
||||
type RepositorystatusOperatorStateState string
|
||||
@@ -12,16 +12,22 @@ import (
|
||||
|
||||
func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenAPIDefinition {
|
||||
return map[string]common.OpenAPIDefinition{
|
||||
"github.com/grafana/grafana/apps/gituisync/pkg/apis/gituisync/v0alpha1.NoOp": schema_pkg_apis_gituisync_v0alpha1_NoOp(ref),
|
||||
"github.com/grafana/grafana/apps/gituisync/pkg/apis/gituisync/v0alpha1.NoOpList": schema_pkg_apis_gituisync_v0alpha1_NoOpList(ref),
|
||||
"github.com/grafana/grafana/apps/gituisync/pkg/apis/gituisync/v0alpha1.NoOpOperatorState": schema_pkg_apis_gituisync_v0alpha1_NoOpOperatorState(ref),
|
||||
"github.com/grafana/grafana/apps/gituisync/pkg/apis/gituisync/v0alpha1.NoOpSpec": schema_pkg_apis_gituisync_v0alpha1_NoOpSpec(ref),
|
||||
"github.com/grafana/grafana/apps/gituisync/pkg/apis/gituisync/v0alpha1.NoOpStatus": schema_pkg_apis_gituisync_v0alpha1_NoOpStatus(ref),
|
||||
"github.com/grafana/grafana/apps/gituisync/pkg/apis/gituisync/v0alpha1.NoOpstatusOperatorState": schema_pkg_apis_gituisync_v0alpha1_NoOpstatusOperatorState(ref),
|
||||
"github.com/grafana/grafana/apps/gituisync/pkg/apis/gituisync/v0alpha1.Repository": schema_pkg_apis_gituisync_v0alpha1_Repository(ref),
|
||||
"github.com/grafana/grafana/apps/gituisync/pkg/apis/gituisync/v0alpha1.RepositoryGitHubRepo": schema_pkg_apis_gituisync_v0alpha1_RepositoryGitHubRepo(ref),
|
||||
"github.com/grafana/grafana/apps/gituisync/pkg/apis/gituisync/v0alpha1.RepositoryList": schema_pkg_apis_gituisync_v0alpha1_RepositoryList(ref),
|
||||
"github.com/grafana/grafana/apps/gituisync/pkg/apis/gituisync/v0alpha1.RepositoryLocalRepo": schema_pkg_apis_gituisync_v0alpha1_RepositoryLocalRepo(ref),
|
||||
"github.com/grafana/grafana/apps/gituisync/pkg/apis/gituisync/v0alpha1.RepositoryOperatorState": schema_pkg_apis_gituisync_v0alpha1_RepositoryOperatorState(ref),
|
||||
"github.com/grafana/grafana/apps/gituisync/pkg/apis/gituisync/v0alpha1.RepositoryS3Repo": schema_pkg_apis_gituisync_v0alpha1_RepositoryS3Repo(ref),
|
||||
"github.com/grafana/grafana/apps/gituisync/pkg/apis/gituisync/v0alpha1.RepositorySpec": schema_pkg_apis_gituisync_v0alpha1_RepositorySpec(ref),
|
||||
"github.com/grafana/grafana/apps/gituisync/pkg/apis/gituisync/v0alpha1.RepositoryStatus": schema_pkg_apis_gituisync_v0alpha1_RepositoryStatus(ref),
|
||||
"github.com/grafana/grafana/apps/gituisync/pkg/apis/gituisync/v0alpha1.RepositoryspecGitHubRepo": schema_pkg_apis_gituisync_v0alpha1_RepositoryspecGitHubRepo(ref),
|
||||
"github.com/grafana/grafana/apps/gituisync/pkg/apis/gituisync/v0alpha1.RepositoryspecLocalRepo": schema_pkg_apis_gituisync_v0alpha1_RepositoryspecLocalRepo(ref),
|
||||
"github.com/grafana/grafana/apps/gituisync/pkg/apis/gituisync/v0alpha1.RepositoryspecS3Repo": schema_pkg_apis_gituisync_v0alpha1_RepositoryspecS3Repo(ref),
|
||||
"github.com/grafana/grafana/apps/gituisync/pkg/apis/gituisync/v0alpha1.RepositorystatusOperatorState": schema_pkg_apis_gituisync_v0alpha1_RepositorystatusOperatorState(ref),
|
||||
}
|
||||
}
|
||||
|
||||
func schema_pkg_apis_gituisync_v0alpha1_NoOp(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
func schema_pkg_apis_gituisync_v0alpha1_Repository(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
return common.OpenAPIDefinition{
|
||||
Schema: spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
@@ -50,13 +56,13 @@ func schema_pkg_apis_gituisync_v0alpha1_NoOp(ref common.ReferenceCallback) commo
|
||||
"spec": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Default: map[string]interface{}{},
|
||||
Ref: ref("github.com/grafana/grafana/apps/gituisync/pkg/apis/gituisync/v0alpha1.NoOpSpec"),
|
||||
Ref: ref("github.com/grafana/grafana/apps/gituisync/pkg/apis/gituisync/v0alpha1.RepositorySpec"),
|
||||
},
|
||||
},
|
||||
"status": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Default: map[string]interface{}{},
|
||||
Ref: ref("github.com/grafana/grafana/apps/gituisync/pkg/apis/gituisync/v0alpha1.NoOpStatus"),
|
||||
Ref: ref("github.com/grafana/grafana/apps/gituisync/pkg/apis/gituisync/v0alpha1.RepositoryStatus"),
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -64,11 +70,46 @@ func schema_pkg_apis_gituisync_v0alpha1_NoOp(ref common.ReferenceCallback) commo
|
||||
},
|
||||
},
|
||||
Dependencies: []string{
|
||||
"github.com/grafana/grafana/apps/gituisync/pkg/apis/gituisync/v0alpha1.NoOpSpec", "github.com/grafana/grafana/apps/gituisync/pkg/apis/gituisync/v0alpha1.NoOpStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"},
|
||||
"github.com/grafana/grafana/apps/gituisync/pkg/apis/gituisync/v0alpha1.RepositorySpec", "github.com/grafana/grafana/apps/gituisync/pkg/apis/gituisync/v0alpha1.RepositoryStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"},
|
||||
}
|
||||
}
|
||||
|
||||
func schema_pkg_apis_gituisync_v0alpha1_NoOpList(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
func schema_pkg_apis_gituisync_v0alpha1_RepositoryGitHubRepo(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
return common.OpenAPIDefinition{
|
||||
Schema: spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "RepositoryGitHubRepo defines model for RepositoryGitHubRepo.",
|
||||
Type: []string{"object"},
|
||||
Properties: map[string]spec.Schema{
|
||||
"owner": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Default: "",
|
||||
Type: []string{"string"},
|
||||
Format: "",
|
||||
},
|
||||
},
|
||||
"repository": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Default: "",
|
||||
Type: []string{"string"},
|
||||
Format: "",
|
||||
},
|
||||
},
|
||||
"type": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Default: "",
|
||||
Type: []string{"string"},
|
||||
Format: "",
|
||||
},
|
||||
},
|
||||
},
|
||||
Required: []string{"owner", "repository", "type"},
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func schema_pkg_apis_gituisync_v0alpha1_RepositoryList(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
return common.OpenAPIDefinition{
|
||||
Schema: spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
@@ -101,7 +142,7 @@ func schema_pkg_apis_gituisync_v0alpha1_NoOpList(ref common.ReferenceCallback) c
|
||||
Schema: &spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Default: map[string]interface{}{},
|
||||
Ref: ref("github.com/grafana/grafana/apps/gituisync/pkg/apis/gituisync/v0alpha1.NoOp"),
|
||||
Ref: ref("github.com/grafana/grafana/apps/gituisync/pkg/apis/gituisync/v0alpha1.Repository"),
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -112,15 +153,43 @@ func schema_pkg_apis_gituisync_v0alpha1_NoOpList(ref common.ReferenceCallback) c
|
||||
},
|
||||
},
|
||||
Dependencies: []string{
|
||||
"github.com/grafana/grafana/apps/gituisync/pkg/apis/gituisync/v0alpha1.NoOp", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"},
|
||||
"github.com/grafana/grafana/apps/gituisync/pkg/apis/gituisync/v0alpha1.Repository", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"},
|
||||
}
|
||||
}
|
||||
|
||||
func schema_pkg_apis_gituisync_v0alpha1_NoOpOperatorState(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
func schema_pkg_apis_gituisync_v0alpha1_RepositoryLocalRepo(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
return common.OpenAPIDefinition{
|
||||
Schema: spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "NoOpOperatorState defines model for NoOpOperatorState.",
|
||||
Description: "RepositoryLocalRepo defines model for RepositoryLocalRepo.",
|
||||
Type: []string{"object"},
|
||||
Properties: map[string]spec.Schema{
|
||||
"path": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Default: "",
|
||||
Type: []string{"string"},
|
||||
Format: "",
|
||||
},
|
||||
},
|
||||
"type": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Default: "",
|
||||
Type: []string{"string"},
|
||||
Format: "",
|
||||
},
|
||||
},
|
||||
},
|
||||
Required: []string{"path", "type"},
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func schema_pkg_apis_gituisync_v0alpha1_RepositoryOperatorState(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
return common.OpenAPIDefinition{
|
||||
Schema: spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "RepositoryOperatorState defines model for RepositoryOperatorState.",
|
||||
Type: []string{"object"},
|
||||
Properties: map[string]spec.Schema{
|
||||
"descriptiveState": {
|
||||
@@ -168,32 +237,59 @@ func schema_pkg_apis_gituisync_v0alpha1_NoOpOperatorState(ref common.ReferenceCa
|
||||
}
|
||||
}
|
||||
|
||||
func schema_pkg_apis_gituisync_v0alpha1_NoOpSpec(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
func schema_pkg_apis_gituisync_v0alpha1_RepositoryS3Repo(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
return common.OpenAPIDefinition{
|
||||
Schema: spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "NoOpSpec defines model for NoOpSpec.",
|
||||
Description: "RepositoryS3Repo defines model for RepositoryS3Repo.",
|
||||
Type: []string{"object"},
|
||||
Properties: map[string]spec.Schema{
|
||||
"noop_value_here": {
|
||||
"bucket": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Default: false,
|
||||
Type: []string{"boolean"},
|
||||
Default: "",
|
||||
Type: []string{"string"},
|
||||
Format: "",
|
||||
},
|
||||
},
|
||||
"type": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Default: "",
|
||||
Type: []string{"string"},
|
||||
Format: "",
|
||||
},
|
||||
},
|
||||
},
|
||||
Required: []string{"noop_value_here"},
|
||||
Required: []string{"bucket", "type"},
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func schema_pkg_apis_gituisync_v0alpha1_NoOpStatus(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
func schema_pkg_apis_gituisync_v0alpha1_RepositorySpec(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
return common.OpenAPIDefinition{
|
||||
Schema: spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "NoOpStatus defines model for NoOpStatus.",
|
||||
Description: "RepositorySpec defines model for RepositorySpec.",
|
||||
Type: []string{"object"},
|
||||
Properties: map[string]spec.Schema{
|
||||
"repository": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Type: []string{"object"},
|
||||
Format: "",
|
||||
},
|
||||
},
|
||||
},
|
||||
Required: []string{"repository"},
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func schema_pkg_apis_gituisync_v0alpha1_RepositoryStatus(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
return common.OpenAPIDefinition{
|
||||
Schema: spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "RepositoryStatus defines model for RepositoryStatus.",
|
||||
Type: []string{"object"},
|
||||
Properties: map[string]spec.Schema{
|
||||
"additionalFields": {
|
||||
@@ -220,7 +316,7 @@ func schema_pkg_apis_gituisync_v0alpha1_NoOpStatus(ref common.ReferenceCallback)
|
||||
Schema: &spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Default: map[string]interface{}{},
|
||||
Ref: ref("github.com/grafana/grafana/apps/gituisync/pkg/apis/gituisync/v0alpha1.NoOpstatusOperatorState"),
|
||||
Ref: ref("github.com/grafana/grafana/apps/gituisync/pkg/apis/gituisync/v0alpha1.RepositorystatusOperatorState"),
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -230,15 +326,106 @@ func schema_pkg_apis_gituisync_v0alpha1_NoOpStatus(ref common.ReferenceCallback)
|
||||
},
|
||||
},
|
||||
Dependencies: []string{
|
||||
"github.com/grafana/grafana/apps/gituisync/pkg/apis/gituisync/v0alpha1.NoOpstatusOperatorState"},
|
||||
"github.com/grafana/grafana/apps/gituisync/pkg/apis/gituisync/v0alpha1.RepositorystatusOperatorState"},
|
||||
}
|
||||
}
|
||||
|
||||
func schema_pkg_apis_gituisync_v0alpha1_NoOpstatusOperatorState(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
func schema_pkg_apis_gituisync_v0alpha1_RepositoryspecGitHubRepo(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
return common.OpenAPIDefinition{
|
||||
Schema: spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "NoOpstatusOperatorState defines model for NoOpstatus.#OperatorState.",
|
||||
Description: "RepositoryspecGitHubRepo defines model for Repositoryspec.#GitHubRepo.",
|
||||
Type: []string{"object"},
|
||||
Properties: map[string]spec.Schema{
|
||||
"owner": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Default: "",
|
||||
Type: []string{"string"},
|
||||
Format: "",
|
||||
},
|
||||
},
|
||||
"repository": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Default: "",
|
||||
Type: []string{"string"},
|
||||
Format: "",
|
||||
},
|
||||
},
|
||||
"type": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Default: "",
|
||||
Type: []string{"string"},
|
||||
Format: "",
|
||||
},
|
||||
},
|
||||
},
|
||||
Required: []string{"owner", "repository", "type"},
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func schema_pkg_apis_gituisync_v0alpha1_RepositoryspecLocalRepo(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
return common.OpenAPIDefinition{
|
||||
Schema: spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "RepositoryspecLocalRepo defines model for Repositoryspec.#LocalRepo.",
|
||||
Type: []string{"object"},
|
||||
Properties: map[string]spec.Schema{
|
||||
"path": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Default: "",
|
||||
Type: []string{"string"},
|
||||
Format: "",
|
||||
},
|
||||
},
|
||||
"type": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Default: "",
|
||||
Type: []string{"string"},
|
||||
Format: "",
|
||||
},
|
||||
},
|
||||
},
|
||||
Required: []string{"path", "type"},
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func schema_pkg_apis_gituisync_v0alpha1_RepositoryspecS3Repo(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
return common.OpenAPIDefinition{
|
||||
Schema: spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "RepositoryspecS3Repo defines model for Repositoryspec.#S3Repo.",
|
||||
Type: []string{"object"},
|
||||
Properties: map[string]spec.Schema{
|
||||
"bucket": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Default: "",
|
||||
Type: []string{"string"},
|
||||
Format: "",
|
||||
},
|
||||
},
|
||||
"type": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Default: "",
|
||||
Type: []string{"string"},
|
||||
Format: "",
|
||||
},
|
||||
},
|
||||
},
|
||||
Required: []string{"bucket", "type"},
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func schema_pkg_apis_gituisync_v0alpha1_RepositorystatusOperatorState(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
return common.OpenAPIDefinition{
|
||||
Schema: spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "RepositorystatusOperatorState defines model for Repositorystatus.#OperatorState.",
|
||||
Type: []string{"object"},
|
||||
Properties: map[string]spec.Schema{
|
||||
"descriptiveState": {
|
||||
|
||||
@@ -12,9 +12,9 @@ import (
|
||||
)
|
||||
|
||||
var (
|
||||
rawSchemaNoOpv0alpha1 = []byte(`{"spec":{"properties":{"noop_value_here":{"type":"boolean"}},"required":["noop_value_here"],"type":"object"},"status":{"properties":{"additionalFields":{"description":"additionalFields is reserved for future use","type":"object","x-kubernetes-preserve-unknown-fields":true},"operatorStates":{"additionalProperties":{"properties":{"descriptiveState":{"description":"descriptiveState is an optional more descriptive state field which has no requirements on format","type":"string"},"details":{"description":"details contains any extra information that is operator-specific","type":"object","x-kubernetes-preserve-unknown-fields":true},"lastEvaluation":{"description":"lastEvaluation is the ResourceVersion last evaluated","type":"string"},"state":{"description":"state describes the state of the lastEvaluation.\nIt is limited to three possible states for machine evaluation.","enum":["success","in_progress","failed"],"type":"string"}},"required":["lastEvaluation","state"],"type":"object"},"description":"operatorStates is a map of operator ID to operator state evaluations.\nAny operator which consumes this kind SHOULD add its state evaluation information to this field.","type":"object"}},"type":"object","x-kubernetes-preserve-unknown-fields":true}}`)
|
||||
versionSchemaNoOpv0alpha1 app.VersionSchema
|
||||
_ = json.Unmarshal(rawSchemaNoOpv0alpha1, &versionSchemaNoOpv0alpha1)
|
||||
rawSchemaRepositoryv0alpha1 = []byte(`{"spec":{"properties":{"repository":{"oneOf":[{"required":["type","path"]},{"required":["type","bucket"]},{"required":["type","owner","repository"]}],"properties":{"bucket":{"description":"TODO: Add ACL?\nTODO: Encryption??","type":"string"},"owner":{"description":"TODO: Do we want an SSH url instead maybe?","type":"string"},"path":{"type":"string"},"repository":{"description":"TODO: On-prem GitHub Enterprise support?","type":"string"},"type":{"description":"TODO: github or just 'git'??"}},"type":"object"}},"required":["repository"],"type":"object"},"status":{"properties":{"additionalFields":{"description":"additionalFields is reserved for future use","type":"object","x-kubernetes-preserve-unknown-fields":true},"operatorStates":{"additionalProperties":{"properties":{"descriptiveState":{"description":"descriptiveState is an optional more descriptive state field which has no requirements on format","type":"string"},"details":{"description":"details contains any extra information that is operator-specific","type":"object","x-kubernetes-preserve-unknown-fields":true},"lastEvaluation":{"description":"lastEvaluation is the ResourceVersion last evaluated","type":"string"},"state":{"description":"state describes the state of the lastEvaluation.\nIt is limited to three possible states for machine evaluation.","enum":["success","in_progress","failed"],"type":"string"}},"required":["lastEvaluation","state"],"type":"object"},"description":"operatorStates is a map of operator ID to operator state evaluations.\nAny operator which consumes this kind SHOULD add its state evaluation information to this field.","type":"object"}},"type":"object","x-kubernetes-preserve-unknown-fields":true}}`)
|
||||
versionSchemaRepositoryv0alpha1 app.VersionSchema
|
||||
_ = json.Unmarshal(rawSchemaRepositoryv0alpha1, &versionSchemaRepositoryv0alpha1)
|
||||
)
|
||||
|
||||
var appManifestData = app.ManifestData{
|
||||
@@ -22,7 +22,7 @@ var appManifestData = app.ManifestData{
|
||||
Group: "gituisync.grafana.app",
|
||||
Kinds: []app.ManifestKind{
|
||||
{
|
||||
Kind: "NoOp",
|
||||
Kind: "Repository",
|
||||
Scope: "Namespaced",
|
||||
Conversion: false,
|
||||
Versions: []app.ManifestKindVersion{
|
||||
@@ -42,7 +42,7 @@ var appManifestData = app.ManifestData{
|
||||
},
|
||||
},
|
||||
},
|
||||
Schema: &versionSchemaNoOpv0alpha1,
|
||||
Schema: &versionSchemaRepositoryv0alpha1,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
@@ -11,7 +11,13 @@ import (
|
||||
"k8s.io/klog/v2"
|
||||
)
|
||||
|
||||
type GitUISyncConfig struct {
|
||||
}
|
||||
|
||||
func New(cfg app.Config) (app.App, error) {
|
||||
gitSyncConfig, ok := cfg.SpecificConfig.(*GitUISyncConfig)
|
||||
klog.InfoS("got a specific config", "cfg", gitSyncConfig, "ok", ok)
|
||||
|
||||
simpleConfig := simple.AppConfig{
|
||||
Name: "gituisync",
|
||||
KubeConfig: cfg.KubeConfig,
|
||||
@@ -22,7 +28,7 @@ func New(cfg app.Config) (app.App, error) {
|
||||
},
|
||||
ManagedKinds: []simple.AppManagedKind{
|
||||
{
|
||||
Kind: v0alpha1.NoOpKind(),
|
||||
Kind: v0alpha1.RepositoryKind(),
|
||||
Watcher: &simple.Watcher{},
|
||||
Mutator: &simple.Mutator{
|
||||
MutateFunc: func(ctx context.Context, ar *app.AdmissionRequest) (*app.MutatingResponse, error) {
|
||||
@@ -53,7 +59,7 @@ func New(cfg app.Config) (app.App, error) {
|
||||
|
||||
func GetKinds() map[schema.GroupVersion]resource.Kind {
|
||||
kinds := []resource.Kind{
|
||||
v0alpha1.NoOpKind(),
|
||||
v0alpha1.RepositoryKind(),
|
||||
}
|
||||
kindMap := make(map[schema.GroupVersion]resource.Kind, len(kinds))
|
||||
for _, kind := range kinds {
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
module: "github.com/grafana/grafana"
|
||||
@@ -18,6 +18,7 @@ func RegisterApp() *GitUISyncAppProvider {
|
||||
appCfg := &runner.AppBuilderConfig{
|
||||
OpenAPIDefGetter: v0alpha1.GetOpenAPIDefinitions,
|
||||
ManagedKinds: gituisyncapp.GetKinds(),
|
||||
CustomConfig: any(&gituisyncapp.GitUISyncConfig{}),
|
||||
}
|
||||
provider.Provider = simple.NewAppProvider(apis.LocalManifest(), appCfg, gituisyncapp.New)
|
||||
return provider
|
||||
|
||||
Reference in new issue
Block a user