Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Plural
platform
plural-operator
Commits
29ecfc8c
Commit
29ecfc8c
authored
3 years ago
by
michaelguarino
Browse files
Options
Download
Email Patches
Plain Diff
more runbook schema
parent
4c091a74
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
api/platform/v1alpha1/runbook_types.go
+22
-2
api/platform/v1alpha1/runbook_types.go
api/platform/v1alpha1/zz_generated.deepcopy.go
+232
-0
api/platform/v1alpha1/zz_generated.deepcopy.go
config/crd/bases/platform.plural.sh_runbooks.yaml
+20
-0
config/crd/bases/platform.plural.sh_runbooks.yaml
main.go
+0
-1
main.go
with
274 additions
and
3 deletions
+274
-3
api/platform/v1alpha1/runbook_types.go
+
22
-
2
View file @
29ecfc8c
...
...
@@ -21,7 +21,7 @@ import (
)
// the type for this datasource
// +kubebuilder:validation:Enum=prometheus;kubernetes
// +kubebuilder:validation:Enum=prometheus;kubernetes
;nodes
type
DatasourceType
string
// the type for this runbook action
...
...
@@ -32,19 +32,35 @@ type ActionType string
// +kubebuilder:validation:Enum=deployment;statefulset
type
ResourceType
string
// the format for a prometheus datasource value
// +kubebuilder:validation:Enum=cpu;memory;none
type
FormatType
string
const
(
PrometheusDatasourceType
DatasourceType
=
"prometheus"
KubernetesDatasourceType
DatasourceType
=
"kubernetes"
NodesDatasourceType
DatasourceType
=
"nodes"
ConfigurationActionType
ActionType
=
"config"
DeploymentResourceType
ResourceType
=
"deployment"
StatefulsetResourceType
ResourceType
=
"statefulset"
CPUFormatType
FormatType
=
"cpu"
MemoryFormatType
FormatType
=
"memory"
NoFormatType
FormatType
=
"none"
)
// PrometheusDatasource represents a query to prometheus to be used as a runbook datasource
type
PrometheusDatasource
struct
{
// the prometheus query
Query
string
`json:"query"`
// the format for the value returned
Format
FormatType
`json:"format"`
// the legend to use in the graph of this metric
Legend
string
`json:"legend"`
}
// KubernetesDatasource represents a query to the kubernetes api. It only supports individual resources
...
...
@@ -69,13 +85,17 @@ type PathUpdate struct {
type
ConfigurationAction
struct
{
// The updates you want to perform
Updates
[]
*
PathUpdate
`json:"updates"`
// stateful sets to clean before rebuilding (for pvc resizes)
// +optional
StatefulSets
[]
string
`json:"statefulSets"`
}
// RunbookAction represents an action to be performed in a runbook
type
RunbookAction
struct
{
// The name to reference this action
Name
string
`json:"name"`
// The type of this action, eg config or kubernetes
Action
ActionType
`json:"action"`
...
...
This diff is collapsed.
Click to expand it.
api/platform/v1alpha1/zz_generated.deepcopy.go
+
232
-
0
View file @
29ecfc8c
...
...
@@ -24,6 +24,32 @@ import (
runtime
"k8s.io/apimachinery/pkg/runtime"
)
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func
(
in
*
ConfigurationAction
)
DeepCopyInto
(
out
*
ConfigurationAction
)
{
*
out
=
*
in
if
in
.
Updates
!=
nil
{
in
,
out
:=
&
in
.
Updates
,
&
out
.
Updates
*
out
=
make
([]
*
PathUpdate
,
len
(
*
in
))
for
i
:=
range
*
in
{
if
(
*
in
)[
i
]
!=
nil
{
in
,
out
:=
&
(
*
in
)[
i
],
&
(
*
out
)[
i
]
*
out
=
new
(
PathUpdate
)
(
*
in
)
.
DeepCopyInto
(
*
out
)
}
}
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ConfigurationAction.
func
(
in
*
ConfigurationAction
)
DeepCopy
()
*
ConfigurationAction
{
if
in
==
nil
{
return
nil
}
out
:=
new
(
ConfigurationAction
)
in
.
DeepCopyInto
(
out
)
return
out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func
(
in
*
Credentials
)
DeepCopyInto
(
out
*
Credentials
)
{
*
out
=
*
in
...
...
@@ -236,6 +262,21 @@ func (in *GraphQuery) DeepCopy() *GraphQuery {
return
out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func
(
in
*
KubernetesDatasource
)
DeepCopyInto
(
out
*
KubernetesDatasource
)
{
*
out
=
*
in
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KubernetesDatasource.
func
(
in
*
KubernetesDatasource
)
DeepCopy
()
*
KubernetesDatasource
{
if
in
==
nil
{
return
nil
}
out
:=
new
(
KubernetesDatasource
)
in
.
DeepCopyInto
(
out
)
return
out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func
(
in
*
LabelQuery
)
DeepCopyInto
(
out
*
LabelQuery
)
{
*
out
=
*
in
...
...
@@ -455,6 +496,41 @@ func (in *LogTailStatus) DeepCopy() *LogTailStatus {
return
out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func
(
in
*
PathUpdate
)
DeepCopyInto
(
out
*
PathUpdate
)
{
*
out
=
*
in
if
in
.
Path
!=
nil
{
in
,
out
:=
&
in
.
Path
,
&
out
.
Path
*
out
=
make
([]
string
,
len
(
*
in
))
copy
(
*
out
,
*
in
)
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PathUpdate.
func
(
in
*
PathUpdate
)
DeepCopy
()
*
PathUpdate
{
if
in
==
nil
{
return
nil
}
out
:=
new
(
PathUpdate
)
in
.
DeepCopyInto
(
out
)
return
out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func
(
in
*
PrometheusDatasource
)
DeepCopyInto
(
out
*
PrometheusDatasource
)
{
*
out
=
*
in
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PrometheusDatasource.
func
(
in
*
PrometheusDatasource
)
DeepCopy
()
*
PrometheusDatasource
{
if
in
==
nil
{
return
nil
}
out
:=
new
(
PrometheusDatasource
)
in
.
DeepCopyInto
(
out
)
return
out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func
(
in
*
Proxy
)
DeepCopyInto
(
out
*
Proxy
)
{
*
out
=
*
in
...
...
@@ -564,6 +640,162 @@ func (in *ProxyStatus) DeepCopy() *ProxyStatus {
return
out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func
(
in
*
Runbook
)
DeepCopyInto
(
out
*
Runbook
)
{
*
out
=
*
in
out
.
TypeMeta
=
in
.
TypeMeta
in
.
ObjectMeta
.
DeepCopyInto
(
&
out
.
ObjectMeta
)
in
.
Spec
.
DeepCopyInto
(
&
out
.
Spec
)
out
.
Status
=
in
.
Status
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Runbook.
func
(
in
*
Runbook
)
DeepCopy
()
*
Runbook
{
if
in
==
nil
{
return
nil
}
out
:=
new
(
Runbook
)
in
.
DeepCopyInto
(
out
)
return
out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func
(
in
*
Runbook
)
DeepCopyObject
()
runtime
.
Object
{
if
c
:=
in
.
DeepCopy
();
c
!=
nil
{
return
c
}
return
nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func
(
in
*
RunbookAction
)
DeepCopyInto
(
out
*
RunbookAction
)
{
*
out
=
*
in
if
in
.
Configuration
!=
nil
{
in
,
out
:=
&
in
.
Configuration
,
&
out
.
Configuration
*
out
=
new
(
ConfigurationAction
)
(
*
in
)
.
DeepCopyInto
(
*
out
)
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RunbookAction.
func
(
in
*
RunbookAction
)
DeepCopy
()
*
RunbookAction
{
if
in
==
nil
{
return
nil
}
out
:=
new
(
RunbookAction
)
in
.
DeepCopyInto
(
out
)
return
out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func
(
in
*
RunbookDatasource
)
DeepCopyInto
(
out
*
RunbookDatasource
)
{
*
out
=
*
in
if
in
.
Prometheus
!=
nil
{
in
,
out
:=
&
in
.
Prometheus
,
&
out
.
Prometheus
*
out
=
new
(
PrometheusDatasource
)
**
out
=
**
in
}
if
in
.
Kubernetes
!=
nil
{
in
,
out
:=
&
in
.
Kubernetes
,
&
out
.
Kubernetes
*
out
=
new
(
KubernetesDatasource
)
**
out
=
**
in
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RunbookDatasource.
func
(
in
*
RunbookDatasource
)
DeepCopy
()
*
RunbookDatasource
{
if
in
==
nil
{
return
nil
}
out
:=
new
(
RunbookDatasource
)
in
.
DeepCopyInto
(
out
)
return
out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func
(
in
*
RunbookList
)
DeepCopyInto
(
out
*
RunbookList
)
{
*
out
=
*
in
out
.
TypeMeta
=
in
.
TypeMeta
in
.
ListMeta
.
DeepCopyInto
(
&
out
.
ListMeta
)
if
in
.
Items
!=
nil
{
in
,
out
:=
&
in
.
Items
,
&
out
.
Items
*
out
=
make
([]
Runbook
,
len
(
*
in
))
for
i
:=
range
*
in
{
(
*
in
)[
i
]
.
DeepCopyInto
(
&
(
*
out
)[
i
])
}
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RunbookList.
func
(
in
*
RunbookList
)
DeepCopy
()
*
RunbookList
{
if
in
==
nil
{
return
nil
}
out
:=
new
(
RunbookList
)
in
.
DeepCopyInto
(
out
)
return
out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func
(
in
*
RunbookList
)
DeepCopyObject
()
runtime
.
Object
{
if
c
:=
in
.
DeepCopy
();
c
!=
nil
{
return
c
}
return
nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func
(
in
*
RunbookSpec
)
DeepCopyInto
(
out
*
RunbookSpec
)
{
*
out
=
*
in
if
in
.
Datasources
!=
nil
{
in
,
out
:=
&
in
.
Datasources
,
&
out
.
Datasources
*
out
=
make
([]
*
RunbookDatasource
,
len
(
*
in
))
for
i
:=
range
*
in
{
if
(
*
in
)[
i
]
!=
nil
{
in
,
out
:=
&
(
*
in
)[
i
],
&
(
*
out
)[
i
]
*
out
=
new
(
RunbookDatasource
)
(
*
in
)
.
DeepCopyInto
(
*
out
)
}
}
}
if
in
.
Actions
!=
nil
{
in
,
out
:=
&
in
.
Actions
,
&
out
.
Actions
*
out
=
make
([]
*
RunbookAction
,
len
(
*
in
))
for
i
:=
range
*
in
{
if
(
*
in
)[
i
]
!=
nil
{
in
,
out
:=
&
(
*
in
)[
i
],
&
(
*
out
)[
i
]
*
out
=
new
(
RunbookAction
)
(
*
in
)
.
DeepCopyInto
(
*
out
)
}
}
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RunbookSpec.
func
(
in
*
RunbookSpec
)
DeepCopy
()
*
RunbookSpec
{
if
in
==
nil
{
return
nil
}
out
:=
new
(
RunbookSpec
)
in
.
DeepCopyInto
(
out
)
return
out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func
(
in
*
RunbookStatus
)
DeepCopyInto
(
out
*
RunbookStatus
)
{
*
out
=
*
in
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RunbookStatus.
func
(
in
*
RunbookStatus
)
DeepCopy
()
*
RunbookStatus
{
if
in
==
nil
{
return
nil
}
out
:=
new
(
RunbookStatus
)
in
.
DeepCopyInto
(
out
)
return
out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func
(
in
*
SecretSync
)
DeepCopyInto
(
out
*
SecretSync
)
{
*
out
=
*
in
...
...
This diff is collapsed.
Click to expand it.
config/crd/bases/platform.plural.sh_runbooks.yaml
+
20
-
0
View file @
29ecfc8c
...
...
@@ -51,6 +51,12 @@ spec:
configuration
:
description
:
The details of a configuration action
properties
:
statefulSets
:
description
:
stateful sets to clean before rebuilding (for
pvc resizes)
items
:
type
:
string
type
:
array
updates
:
description
:
The updates you want to perform
items
:
...
...
@@ -113,9 +119,22 @@ spec:
prometheus
:
description
:
a prometheus query spec
properties
:
format
:
description
:
the format for the value returned
enum
:
-
cpu
-
memory
-
none
type
:
string
legend
:
description
:
the legend to use in the graph of this metric
type
:
string
query
:
description
:
the prometheus query
type
:
string
required
:
-
format
-
legend
-
query
type
:
object
type
:
...
...
@@ -123,6 +142,7 @@ spec:
enum
:
-
prometheus
-
kubernetes
-
nodes
type
:
string
required
:
-
name
...
...
This diff is collapsed.
Click to expand it.
main.go
+
0
-
1
View file @
29ecfc8c
...
...
@@ -32,7 +32,6 @@ import (
"sigs.k8s.io/controller-runtime/pkg/log/zap"
platformv1alpha1
"github.com/pluralsh/plural-operator/api/platform/v1alpha1"
platformv1alpha1
"github.com/pluralsh/plural-operator/apis/platform/v1alpha1"
"github.com/pluralsh/plural-operator/controllers"
//+kubebuilder:scaffold:imports
)
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment