Provisioning: Update types (#100722)

* Provisioning: Remove S3

* Provisioning: Use URL for GitHub

Co-Authored-By: Ryan McKinley <ryantxu@gmail.com>
Co-Authored-By: Alex Khomenko <Clarity-89@users.noreply.github.com>

* Provisioning: Use workflow list

Co-Authored-By: =?UTF-8?q?Roberto=20Jim=C3=A9nez=20S=C3=A1nchez?= <roberto.jimenez@grafana.com>

* Provisioning: Model secrets

* Provisioning: Define a total in the job summary

* Provisioning: Generate code

* Provisioning: Update testdata

---------

Co-authored-by: Ryan McKinley <ryantxu@gmail.com>
Co-authored-by: Alex Khomenko <Clarity-89@users.noreply.github.com>
Co-authored-by: =?UTF-8?q?Roberto=20Jim=C3=A9nez=20S=C3=A1nchez?= <roberto.jimenez@grafana.com>
This commit is contained in:
Mariell Hoversholm
2025-02-17 12:45:23 +01:00
committed by GitHub
co-authored by Ryan McKinley Alex Khomenko Roberto Jiménez Sánchez
parent a05ba6ff41
commit f535a7804f
13 changed files with 174 additions and 198 deletions
+1
View File
@@ -125,6 +125,7 @@ type JobStatus struct {
type JobResourceSummary struct {
Group string `json:"group,omitempty"`
Resource string `json:"resource,omitempty"`
Total int64 `json:"total,omitempty"` // the count (if known)
Create int64 `json:"create,omitempty"`
Update int64 `json:"update,omitempty"`
+1 -4
View File
@@ -2,7 +2,6 @@ package v0alpha1
import (
"errors"
"fmt"
"time"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
@@ -40,10 +39,8 @@ var RepositoryResourceInfo = utils.NewResourceInfo(GROUP, VERSION,
switch m.Spec.Type {
case LocalRepositoryType:
target = m.Spec.Local.Path
case S3RepositoryType:
target = m.Spec.S3.Bucket
case GitHubRepositoryType:
target = fmt.Sprintf("%s/%s", m.Spec.GitHub.Owner, m.Spec.GitHub.Repository)
target = m.Spec.GitHub.URL
}
return []interface{}{
+25 -24
View File
@@ -23,36 +23,41 @@ type LocalRepositoryConfig struct {
Path string `json:"path,omitempty"`
}
type S3RepositoryConfig struct {
Region string `json:"region,omitempty"`
Bucket string `json:"bucket,omitempty"`
// Workflow used for changes in the repository.
// +enum
type Workflow string
// TODO: Add ACL?
// TODO: Encryption??
// TODO: How do we define access? Secrets?
}
const (
// BranchWorkflow creates a branch for changes
BranchWorkflow Workflow = "branch"
// PushWorkflow pushes changes directly the configured branch
PushWorkflow Workflow = "push"
)
type GitHubRepositoryConfig struct {
// The owner of the repository (e.g. example in `example/test` or `https://github.com/example/test`).
Owner string `json:"owner,omitempty"`
// The name of the repository (e.g. test in `example/test` or `https://github.com/example/test`).
Repository string `json:"repository,omitempty"`
// The repository URL (e.g. `https://github.com/example/test`).
URL string `json:"url,omitempty"`
// The branch to use in the repository.
// By default, this is the main branch.
Branch string `json:"branch,omitempty"`
// Token for accessing the repository.
// TODO: this should be part of secrets and a simple reference.
// Token for accessing the repository. If set, it will be encrypted into encryptedToken, then set to an empty string again.
Token string `json:"token,omitempty"`
// TODO: Do we want an SSH url instead maybe?
// TODO: On-prem GitHub Enterprise support?
// Token for accessing the repository, but encrypted. This is not possible to read back to a user decrypted.
// +listType=atomic
EncryptedToken []byte `json:"encryptedToken,omitempty"`
// Workflow allowed for changes to the repository.
// The order is relevant for defining the precedence of the workflows.
// Possible values: pull-request, branch, push.
Workflows []Workflow `json:"workflows,omitempty"`
// Whether we should commit to change branches and use a Pull Request flow to achieve this.
// By default, this is false (i.e. we will commit straight to the main branch).
BranchWorkflow bool `json:"branchWorkflow,omitempty"`
// Whether we should show dashboard previews in the pull requests caused by the BranchWorkflow option.
// Whether we should show dashboard previews for pull requests.
// By default, this is false (i.e. we will not create previews).
// This option is a no-op if BranchWorkflow is `false` or default.
GenerateDashboardPreviews bool `json:"generateDashboardPreviews,omitempty"`
}
@@ -63,7 +68,6 @@ type RepositoryType string
// RepositoryType values
const (
LocalRepositoryType RepositoryType = "local"
S3RepositoryType RepositoryType = "s3"
GitHubRepositoryType RepositoryType = "github"
)
@@ -84,15 +88,11 @@ type RepositorySpec struct {
Type RepositoryType `json:"type"`
// The repository on the local file system.
// Mutually exclusive with local | s3 | github.
// Mutually exclusive with local | github.
Local *LocalRepositoryConfig `json:"local,omitempty"`
// The repository in an S3 bucket.
// Mutually exclusive with local | s3 | github.
S3 *S3RepositoryConfig `json:"s3,omitempty"`
// The repository on GitHub.
// Mutually exclusive with local | s3 | github.
// Mutually exclusive with local | github.
// TODO: github or just 'git'??
GitHub *GitHubRepositoryConfig `json:"github,omitempty"`
}
@@ -194,6 +194,7 @@ type WebhookStatus struct {
ID int64 `json:"id,omitempty"`
URL string `json:"url,omitempty"`
Secret string `json:"secret,omitempty"`
EncryptedSecret []byte `json:"encryptedSecret,omitempty"`
SubscribedEvents []string `json:"subscribedEvents,omitempty"`
}
@@ -93,6 +93,16 @@ func (in *FileList) DeepCopyObject() runtime.Object {
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *GitHubRepositoryConfig) DeepCopyInto(out *GitHubRepositoryConfig) {
*out = *in
if in.EncryptedToken != nil {
in, out := &in.EncryptedToken, &out.EncryptedToken
*out = make([]byte, len(*in))
copy(*out, *in)
}
if in.Workflows != nil {
in, out := &in.Workflows, &out.Workflows
*out = make([]Workflow, len(*in))
copy(*out, *in)
}
return
}
@@ -440,15 +450,10 @@ func (in *RepositorySpec) DeepCopyInto(out *RepositorySpec) {
*out = new(LocalRepositoryConfig)
**out = **in
}
if in.S3 != nil {
in, out := &in.S3, &out.S3
*out = new(S3RepositoryConfig)
**out = **in
}
if in.GitHub != nil {
in, out := &in.GitHub, &out.GitHub
*out = new(GitHubRepositoryConfig)
**out = **in
(*in).DeepCopyInto(*out)
}
return
}
@@ -707,22 +712,6 @@ func (in *ResourceWrapper) DeepCopyObject() runtime.Object {
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *S3RepositoryConfig) DeepCopyInto(out *S3RepositoryConfig) {
*out = *in
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new S3RepositoryConfig.
func (in *S3RepositoryConfig) DeepCopy() *S3RepositoryConfig {
if in == nil {
return nil
}
out := new(S3RepositoryConfig)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *SyncJobOptions) DeepCopyInto(out *SyncJobOptions) {
*out = *in
@@ -843,6 +832,11 @@ func (in *WebhookResponse) DeepCopyObject() runtime.Object {
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *WebhookStatus) DeepCopyInto(out *WebhookStatus) {
*out = *in
if in.EncryptedSecret != nil {
in, out := &in.EncryptedSecret, &out.EncryptedSecret
*out = make([]byte, len(*in))
copy(*out, *in)
}
if in.SubscribedEvents != nil {
in, out := &in.SubscribedEvents, &out.SubscribedEvents
*out = make([]string, len(*in))
@@ -43,7 +43,6 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA
"github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.ResourceStats": schema_pkg_apis_provisioning_v0alpha1_ResourceStats(ref),
"github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.ResourceType": schema_pkg_apis_provisioning_v0alpha1_ResourceType(ref),
"github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.ResourceWrapper": schema_pkg_apis_provisioning_v0alpha1_ResourceWrapper(ref),
"github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.S3RepositoryConfig": schema_pkg_apis_provisioning_v0alpha1_S3RepositoryConfig(ref),
"github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.SyncJobOptions": schema_pkg_apis_provisioning_v0alpha1_SyncJobOptions(ref),
"github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.SyncOptions": schema_pkg_apis_provisioning_v0alpha1_SyncOptions(ref),
"github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.SyncStatus": schema_pkg_apis_provisioning_v0alpha1_SyncStatus(ref),
@@ -238,16 +237,9 @@ func schema_pkg_apis_provisioning_v0alpha1_GitHubRepositoryConfig(ref common.Ref
SchemaProps: spec.SchemaProps{
Type: []string{"object"},
Properties: map[string]spec.Schema{
"owner": {
"url": {
SchemaProps: spec.SchemaProps{
Description: "The owner of the repository (e.g. example in `example/test` or `https://github.com/example/test`).",
Type: []string{"string"},
Format: "",
},
},
"repository": {
SchemaProps: spec.SchemaProps{
Description: "The name of the repository (e.g. test in `example/test` or `https://github.com/example/test`).",
Description: "The repository URL (e.g. `https://github.com/example/test`).",
Type: []string{"string"},
Format: "",
},
@@ -261,11 +253,39 @@ func schema_pkg_apis_provisioning_v0alpha1_GitHubRepositoryConfig(ref common.Ref
},
"token": {
SchemaProps: spec.SchemaProps{
Description: "Token for accessing the repository.",
Description: "Token for accessing the repository. If set, it will be encrypted into encryptedToken, then set to an empty string again.",
Type: []string{"string"},
Format: "",
},
},
"encryptedToken": {
VendorExtensible: spec.VendorExtensible{
Extensions: spec.Extensions{
"x-kubernetes-list-type": "atomic",
},
},
SchemaProps: spec.SchemaProps{
Description: "Token for accessing the repository, but encrypted. This is not possible to read back to a user decrypted.",
Type: []string{"string"},
Format: "byte",
},
},
"workflows": {
SchemaProps: spec.SchemaProps{
Description: "Workflow allowed for changes to the repository. The order is relevant for defining the precedence of the workflows. Possible values: pull-request, branch, push.",
Type: []string{"array"},
Items: &spec.SchemaOrArray{
Schema: &spec.Schema{
SchemaProps: spec.SchemaProps{
Default: "",
Type: []string{"string"},
Format: "",
Enum: []interface{}{"branch", "push"},
},
},
},
},
},
"branchWorkflow": {
SchemaProps: spec.SchemaProps{
Description: "Whether we should commit to change branches and use a Pull Request flow to achieve this. By default, this is false (i.e. we will commit straight to the main branch).",
@@ -275,7 +295,7 @@ func schema_pkg_apis_provisioning_v0alpha1_GitHubRepositoryConfig(ref common.Ref
},
"generateDashboardPreviews": {
SchemaProps: spec.SchemaProps{
Description: "Whether we should show dashboard previews in the pull requests caused by the BranchWorkflow option. By default, this is false (i.e. we will not create previews). This option is a no-op if BranchWorkflow is `false` or default.",
Description: "Whether we should show dashboard previews for pull requests. By default, this is false (i.e. we will not create previews).",
Type: []string{"boolean"},
Format: "",
},
@@ -553,6 +573,12 @@ func schema_pkg_apis_provisioning_v0alpha1_JobResourceSummary(ref common.Referen
Format: "",
},
},
"total": {
SchemaProps: spec.SchemaProps{
Type: []string{"integer"},
Format: "int64",
},
},
"create": {
SchemaProps: spec.SchemaProps{
Type: []string{"integer"},
@@ -968,28 +994,22 @@ func schema_pkg_apis_provisioning_v0alpha1_RepositorySpec(ref common.ReferenceCa
},
"type": {
SchemaProps: spec.SchemaProps{
Description: "The repository type. When selected oneOf the values below should be non-nil\n\nPossible enum values:\n - `\"github\"`\n - `\"local\"`\n - `\"s3\"`",
Description: "The repository type. When selected oneOf the values below should be non-nil\n\nPossible enum values:\n - `\"github\"`\n - `\"local\"`",
Default: "",
Type: []string{"string"},
Format: "",
Enum: []interface{}{"github", "local", "s3"},
Enum: []interface{}{"github", "local"},
},
},
"local": {
SchemaProps: spec.SchemaProps{
Description: "The repository on the local file system. Mutually exclusive with local | s3 | github.",
Description: "The repository on the local file system. Mutually exclusive with local | github.",
Ref: ref("github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.LocalRepositoryConfig"),
},
},
"s3": {
SchemaProps: spec.SchemaProps{
Description: "The repository in an S3 bucket. Mutually exclusive with local | s3 | github.",
Ref: ref("github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.S3RepositoryConfig"),
},
},
"github": {
SchemaProps: spec.SchemaProps{
Description: "The repository on GitHub. Mutually exclusive with local | s3 | github.",
Description: "The repository on GitHub. Mutually exclusive with local | github.",
Ref: ref("github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.GitHubRepositoryConfig"),
},
},
@@ -998,7 +1018,7 @@ func schema_pkg_apis_provisioning_v0alpha1_RepositorySpec(ref common.ReferenceCa
},
},
Dependencies: []string{
"github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.GitHubRepositoryConfig", "github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.LocalRepositoryConfig", "github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.S3RepositoryConfig", "github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.SyncOptions"},
"github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.GitHubRepositoryConfig", "github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.LocalRepositoryConfig", "github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.SyncOptions"},
}
}
@@ -1097,11 +1117,11 @@ func schema_pkg_apis_provisioning_v0alpha1_RepositoryView(ref common.ReferenceCa
},
"type": {
SchemaProps: spec.SchemaProps{
Description: "The repository type\n\nPossible enum values:\n - `\"github\"`\n - `\"local\"`\n - `\"s3\"`",
Description: "The repository type\n\nPossible enum values:\n - `\"github\"`\n - `\"local\"`",
Default: "",
Type: []string{"string"},
Format: "",
Enum: []interface{}{"github", "local", "s3"},
Enum: []interface{}{"github", "local"},
},
},
"target": {
@@ -1576,30 +1596,6 @@ func schema_pkg_apis_provisioning_v0alpha1_ResourceWrapper(ref common.ReferenceC
}
}
func schema_pkg_apis_provisioning_v0alpha1_S3RepositoryConfig(ref common.ReferenceCallback) common.OpenAPIDefinition {
return common.OpenAPIDefinition{
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
Type: []string{"object"},
Properties: map[string]spec.Schema{
"region": {
SchemaProps: spec.SchemaProps{
Type: []string{"string"},
Format: "",
},
},
"bucket": {
SchemaProps: spec.SchemaProps{
Type: []string{"string"},
Format: "",
},
},
},
},
},
}
}
func schema_pkg_apis_provisioning_v0alpha1_SyncJobOptions(ref common.ReferenceCallback) common.OpenAPIDefinition {
return common.OpenAPIDefinition{
Schema: spec.Schema{
@@ -1881,6 +1877,12 @@ func schema_pkg_apis_provisioning_v0alpha1_WebhookStatus(ref common.ReferenceCal
Format: "",
},
},
"encryptedSecret": {
SchemaProps: spec.SchemaProps{
Type: []string{"string"},
Format: "byte",
},
},
"subscribedEvents": {
SchemaProps: spec.SchemaProps{
Type: []string{"array"},
@@ -1,4 +1,5 @@
API rule violation: list_type_missing,github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1,FileList,Items
API rule violation: list_type_missing,github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1,GitHubRepositoryConfig,Workflows
API rule violation: list_type_missing,github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1,HistoryList,Items
API rule violation: list_type_missing,github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1,JobResourceSummary,Errors
API rule violation: list_type_missing,github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1,JobStatus,Errors
@@ -4,15 +4,20 @@
package v0alpha1
import (
provisioningv0alpha1 "github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1"
)
// GitHubRepositoryConfigApplyConfiguration represents a declarative configuration of the GitHubRepositoryConfig type for use
// with apply.
type GitHubRepositoryConfigApplyConfiguration struct {
Owner *string `json:"owner,omitempty"`
Repository *string `json:"repository,omitempty"`
Branch *string `json:"branch,omitempty"`
Token *string `json:"token,omitempty"`
BranchWorkflow *bool `json:"branchWorkflow,omitempty"`
GenerateDashboardPreviews *bool `json:"generateDashboardPreviews,omitempty"`
URL *string `json:"url,omitempty"`
Branch *string `json:"branch,omitempty"`
Token *string `json:"token,omitempty"`
EncryptedToken []byte `json:"encryptedToken,omitempty"`
Workflows []provisioningv0alpha1.Workflow `json:"workflows,omitempty"`
BranchWorkflow *bool `json:"branchWorkflow,omitempty"`
GenerateDashboardPreviews *bool `json:"generateDashboardPreviews,omitempty"`
}
// GitHubRepositoryConfigApplyConfiguration constructs a declarative configuration of the GitHubRepositoryConfig type for use with
@@ -21,19 +26,11 @@ func GitHubRepositoryConfig() *GitHubRepositoryConfigApplyConfiguration {
return &GitHubRepositoryConfigApplyConfiguration{}
}
// WithOwner sets the Owner field in the declarative configuration to the given value
// WithURL sets the URL field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the Owner field is set to the value of the last call.
func (b *GitHubRepositoryConfigApplyConfiguration) WithOwner(value string) *GitHubRepositoryConfigApplyConfiguration {
b.Owner = &value
return b
}
// WithRepository sets the Repository field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the Repository field is set to the value of the last call.
func (b *GitHubRepositoryConfigApplyConfiguration) WithRepository(value string) *GitHubRepositoryConfigApplyConfiguration {
b.Repository = &value
// If called multiple times, the URL field is set to the value of the last call.
func (b *GitHubRepositoryConfigApplyConfiguration) WithURL(value string) *GitHubRepositoryConfigApplyConfiguration {
b.URL = &value
return b
}
@@ -53,6 +50,26 @@ func (b *GitHubRepositoryConfigApplyConfiguration) WithToken(value string) *GitH
return b
}
// WithEncryptedToken adds the given value to the EncryptedToken field in the declarative configuration
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
// If called multiple times, values provided by each call will be appended to the EncryptedToken field.
func (b *GitHubRepositoryConfigApplyConfiguration) WithEncryptedToken(values ...byte) *GitHubRepositoryConfigApplyConfiguration {
for i := range values {
b.EncryptedToken = append(b.EncryptedToken, values[i])
}
return b
}
// WithWorkflows adds the given value to the Workflows field in the declarative configuration
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
// If called multiple times, values provided by each call will be appended to the Workflows field.
func (b *GitHubRepositoryConfigApplyConfiguration) WithWorkflows(values ...provisioningv0alpha1.Workflow) *GitHubRepositoryConfigApplyConfiguration {
for i := range values {
b.Workflows = append(b.Workflows, values[i])
}
return b
}
// WithBranchWorkflow sets the BranchWorkflow field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the BranchWorkflow field is set to the value of the last call.
@@ -17,7 +17,6 @@ type RepositorySpecApplyConfiguration struct {
Sync *SyncOptionsApplyConfiguration `json:"sync,omitempty"`
Type *provisioningv0alpha1.RepositoryType `json:"type,omitempty"`
Local *LocalRepositoryConfigApplyConfiguration `json:"local,omitempty"`
S3 *S3RepositoryConfigApplyConfiguration `json:"s3,omitempty"`
GitHub *GitHubRepositoryConfigApplyConfiguration `json:"github,omitempty"`
}
@@ -75,14 +74,6 @@ func (b *RepositorySpecApplyConfiguration) WithLocal(value *LocalRepositoryConfi
return b
}
// WithS3 sets the S3 field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the S3 field is set to the value of the last call.
func (b *RepositorySpecApplyConfiguration) WithS3(value *S3RepositoryConfigApplyConfiguration) *RepositorySpecApplyConfiguration {
b.S3 = value
return b
}
// WithGitHub sets the GitHub field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the GitHub field is set to the value of the last call.
@@ -1,34 +0,0 @@
// SPDX-License-Identifier: AGPL-3.0-only
// Code generated by applyconfiguration-gen. DO NOT EDIT.
package v0alpha1
// S3RepositoryConfigApplyConfiguration represents a declarative configuration of the S3RepositoryConfig type for use
// with apply.
type S3RepositoryConfigApplyConfiguration struct {
Region *string `json:"region,omitempty"`
Bucket *string `json:"bucket,omitempty"`
}
// S3RepositoryConfigApplyConfiguration constructs a declarative configuration of the S3RepositoryConfig type for use with
// apply.
func S3RepositoryConfig() *S3RepositoryConfigApplyConfiguration {
return &S3RepositoryConfigApplyConfiguration{}
}
// WithRegion sets the Region field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the Region field is set to the value of the last call.
func (b *S3RepositoryConfigApplyConfiguration) WithRegion(value string) *S3RepositoryConfigApplyConfiguration {
b.Region = &value
return b
}
// WithBucket sets the Bucket field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the Bucket field is set to the value of the last call.
func (b *S3RepositoryConfigApplyConfiguration) WithBucket(value string) *S3RepositoryConfigApplyConfiguration {
b.Bucket = &value
return b
}
@@ -10,6 +10,7 @@ type WebhookStatusApplyConfiguration struct {
ID *int64 `json:"id,omitempty"`
URL *string `json:"url,omitempty"`
Secret *string `json:"secret,omitempty"`
EncryptedSecret []byte `json:"encryptedSecret,omitempty"`
SubscribedEvents []string `json:"subscribedEvents,omitempty"`
}
@@ -43,6 +44,16 @@ func (b *WebhookStatusApplyConfiguration) WithSecret(value string) *WebhookStatu
return b
}
// WithEncryptedSecret adds the given value to the EncryptedSecret field in the declarative configuration
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
// If called multiple times, values provided by each call will be appended to the EncryptedSecret field.
func (b *WebhookStatusApplyConfiguration) WithEncryptedSecret(values ...byte) *WebhookStatusApplyConfiguration {
for i := range values {
b.EncryptedSecret = append(b.EncryptedSecret, values[i])
}
return b
}
// WithSubscribedEvents adds the given value to the SubscribedEvents field in the declarative configuration
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
// If called multiple times, values provided by each call will be appended to the SubscribedEvents field.
@@ -34,8 +34,6 @@ func ForKind(kind schema.GroupVersionKind) interface{} {
return &provisioningv0alpha1.RepositoryStatusApplyConfiguration{}
case v0alpha1.SchemeGroupVersion.WithKind("ResourceCount"):
return &provisioningv0alpha1.ResourceCountApplyConfiguration{}
case v0alpha1.SchemeGroupVersion.WithKind("S3RepositoryConfig"):
return &provisioningv0alpha1.S3RepositoryConfigApplyConfiguration{}
case v0alpha1.SchemeGroupVersion.WithKind("SyncOptions"):
return &provisioningv0alpha1.SyncOptionsApplyConfiguration{}
case v0alpha1.SchemeGroupVersion.WithKind("SyncStatus"):
@@ -1306,21 +1306,35 @@
"description": "Whether we should commit to change branches and use a Pull Request flow to achieve this. By default, this is false (i.e. we will commit straight to the main branch).",
"type": "boolean"
},
"encryptedToken": {
"description": "Token for accessing the repository, but encrypted. This is not possible to read back to a user decrypted.",
"type": "string",
"format": "byte",
"x-kubernetes-list-type": "atomic"
},
"generateDashboardPreviews": {
"description": "Whether we should show dashboard previews in the pull requests caused by the BranchWorkflow option. By default, this is false (i.e. we will not create previews). This option is a no-op if BranchWorkflow is `false` or default.",
"description": "Whether we should show dashboard previews for pull requests. By default, this is false (i.e. we will not create previews).",
"type": "boolean"
},
"owner": {
"description": "The owner of the repository (e.g. example in `example/test` or `https://github.com/example/test`).",
"type": "string"
},
"repository": {
"description": "The name of the repository (e.g. test in `example/test` or `https://github.com/example/test`).",
"type": "string"
},
"token": {
"description": "Token for accessing the repository.",
"description": "Token for accessing the repository. If set, it will be encrypted into encryptedToken, then set to an empty string again.",
"type": "string"
},
"url": {
"description": "The repository URL (e.g. `https://github.com/example/test`).",
"type": "string"
},
"workflows": {
"description": "Workflow allowed for changes to the repository. The order is relevant for defining the precedence of the workflows. Possible values: pull-request, branch, push.",
"type": "array",
"items": {
"type": "string",
"default": "",
"enum": [
"branch",
"push"
]
}
}
}
},
@@ -1468,7 +1482,7 @@
"type": "string"
},
"github": {
"description": "The repository on GitHub. Mutually exclusive with local | s3 | github.",
"description": "The repository on GitHub. Mutually exclusive with local | github.",
"allOf": [
{
"$ref": "#/components/schemas/com.github.grafana.grafana.pkg.apis.provisioning.v0alpha1.GitHubRepositoryConfig"
@@ -1476,7 +1490,7 @@
]
},
"local": {
"description": "The repository on the local file system. Mutually exclusive with local | s3 | github.",
"description": "The repository on the local file system. Mutually exclusive with local | github.",
"allOf": [
{
"$ref": "#/components/schemas/com.github.grafana.grafana.pkg.apis.provisioning.v0alpha1.LocalRepositoryConfig"
@@ -1488,14 +1502,6 @@
"type": "boolean",
"default": false
},
"s3": {
"description": "The repository in an S3 bucket. Mutually exclusive with local | s3 | github.",
"allOf": [
{
"$ref": "#/components/schemas/com.github.grafana.grafana.pkg.apis.provisioning.v0alpha1.S3RepositoryConfig"
}
]
},
"sync": {
"description": "Sync settings -- how values are pulled from the repository into grafana",
"default": {},
@@ -1511,13 +1517,12 @@
"default": ""
},
"type": {
"description": "The repository type. When selected oneOf the values below should be non-nil\n\nPossible enum values:\n - `\"github\"`\n - `\"local\"`\n - `\"s3\"`",
"description": "The repository type. When selected oneOf the values below should be non-nil\n\nPossible enum values:\n - `\"github\"`\n - `\"local\"`",
"type": "string",
"default": "",
"enum": [
"github",
"local",
"s3"
"local"
]
}
}
@@ -1605,17 +1610,6 @@
}
}
},
"com.github.grafana.grafana.pkg.apis.provisioning.v0alpha1.S3RepositoryConfig": {
"type": "object",
"properties": {
"bucket": {
"type": "string"
},
"region": {
"type": "string"
}
}
},
"com.github.grafana.grafana.pkg.apis.provisioning.v0alpha1.SyncOptions": {
"type": "object",
"required": [
@@ -1703,6 +1697,10 @@
"com.github.grafana.grafana.pkg.apis.provisioning.v0alpha1.WebhookStatus": {
"type": "object",
"properties": {
"encryptedSecret": {
"type": "string",
"format": "byte"
},
"id": {
"type": "integer",
"format": "int64"
+1 -2
View File
@@ -9,8 +9,7 @@
"description": "load resources from github",
"type": "github",
"github": {
"owner": "grafana",
"repository": "git-ui-sync-demo",
"url": "https://github.com/grafana/git-ui-sync-demo",
"branch": "dummy-branch",
"branchWorkflow": true,
"generateDashboardPreviews": true,