Skip to content

Commit 30416f2

Browse files
authored
Operator Spec PackageName (#80)
* add package name to spec, clear generated comments, run make, update sample CR * putting back todo to remind devs to add new fields
1 parent f29fb01 commit 30416f2

File tree

3 files changed

+10
-15
lines changed

3 files changed

+10
-15
lines changed

api/v1alpha1/operator_types.go

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,23 +20,15 @@ import (
2020
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2121
)
2222

23-
// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN!
24-
// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.
25-
2623
// OperatorSpec defines the desired state of Operator
2724
type OperatorSpec struct {
28-
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
29-
// Important: Run "make" to regenerate code after modifying this file
30-
31-
// Foo is an example field of Operator. Edit operator_types.go to remove/update
32-
Foo string `json:"foo,omitempty"`
25+
//+kubebuilder:validation:MaxLength:=48
26+
//+kubebuilder:validation:Pattern:=^[a-z0-9]+(-[a-z0-9]+)*$
27+
PackageName string `json:"packageName"`
3328
}
3429

3530
// OperatorStatus defines the observed state of Operator
36-
type OperatorStatus struct {
37-
// INSERT ADDITIONAL STATUS FIELD - define observed state of cluster
38-
// Important: Run "make" to regenerate code after modifying this file
39-
}
31+
type OperatorStatus struct{}
4032

4133
//+kubebuilder:object:root=true
4234
//+kubebuilder:subresource:status

config/crd/bases/operators.operatorframework.io_operators.yaml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,12 @@ spec:
3535
spec:
3636
description: OperatorSpec defines the desired state of Operator
3737
properties:
38-
foo:
39-
description: Foo is an example field of Operator. Edit operator_types.go
40-
to remove/update
38+
packageName:
39+
maxLength: 48
40+
pattern: ^[a-z0-9]+(-[a-z0-9]+)*$
4141
type: string
42+
required:
43+
- packageName
4244
type: object
4345
status:
4446
description: OperatorStatus defines the observed state of Operator

config/samples/operators_v1alpha1_operator.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,4 @@ metadata:
1010
name: operator-sample
1111
spec:
1212
# TODO(user): Add fields here
13+
packageName: my-operator

0 commit comments

Comments
 (0)