Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Perses config types #7

Merged
merged 1 commit into from
Jan 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ checkunused:

.PHONY: manifests
manifests: controller-gen ## Generate WebhookConfiguration, ClusterRole and CustomResourceDefinition objects.
$(CONTROLLER_GEN) rbac:roleName=manager-role crd webhook paths="./..." output:crd:artifacts:config=config/crd/bases
$(CONTROLLER_GEN) rbac:roleName=manager-role crd:ignoreUnexportedFields=true webhook paths="./..." output:crd:artifacts:config=config/crd/bases

.PHONY: generate
generate: controller-gen ## Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations.
Expand Down
20 changes: 20 additions & 0 deletions api/v1alpha1/perses_config.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package v1alpha1

import (
"github.com/barkimedes/go-deepcopy"
"github.com/perses/perses/pkg/model/api/config"
)

type PersesConfig struct {
config.Config `json:",inline"`
}

func (in *PersesConfig) DeepCopyInto(out *PersesConfig) {
temp, err := deepcopy.Anything(in)

if err != nil {
panic(err)
}

*out = *(temp.(*PersesConfig))
}
36 changes: 0 additions & 36 deletions api/v1alpha1/perses_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,45 +17,9 @@ limitations under the License.
package v1alpha1

import (
"time"

metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

// +kubebuilder:validation:Enum=json;yaml
type FileExtension string

type File struct {
Folder string `json:"folder" yaml:"folder"`
Extension FileExtension `json:"extension" yaml:"extension"`
}

type Database struct {
File *File `json:"file,omitempty" yaml:"file,omitempty"`
}

type Schemas struct {
// +kubebuilder:validation:optional
PanelsPath string `json:"panels_path,omitempty" yaml:"panels_path,omitempty"`
// +kubebuilder:validation:optional
QueriesPath string `json:"queries_path,omitempty" yaml:"queries_path,omitempty"`
// +kubebuilder:validation:optional
DatasourcesPath string `json:"datasources_path,omitempty" yaml:"datasources_path,omitempty"`
// +kubebuilder:validation:optional
VariablesPath string `json:"variables_path,omitempty" yaml:"variables_path,omitempty"`
// +kubebuilder:validation:optional
Interval time.Duration `json:"interval,omitempty" yaml:"interval,omitempty"`
}

// TODO: import this from https://github.com/perses/perses/blob/main/internal/api/config/config.go#L51
type PersesConfig struct {
// +operator-sdk:csv:customresourcedefinitions:type=spec
// +kubebuilder:validation:optional
Readonly bool `json:"readonly" yaml:"readonly"`
Database Database `json:"database" yaml:"database"`
Schemas Schemas `json:"schemas" yaml:"schemas"`
}

// PersesSpec defines the desired state of Perses
type PersesSpec struct {
// +operator-sdk:csv:customresourcedefinitions:type=spec
Expand Down
57 changes: 0 additions & 57 deletions api/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading