-
Notifications
You must be signed in to change notification settings - Fork 544
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 OperatorGroup #480
add OperatorGroup #480
Changes from 29 commits
8d4563e
0ec2c72
a043600
2a5a47b
8ab04c2
9265289
ed88e91
de50de0
1de9017
45d9e1e
17cfe6f
a15ba12
c93a433
2248127
4d6c59e
42dfe77
522c0b6
fccd2bc
857676b
5298dda
59fab56
6a00fb9
6486f52
2af56a7
22a29b3
ae457b3
d7229f1
5b7d140
ac50ddc
cd201c5
337b156
ab27044
b49c9bc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
apiVersion: apiextensions.k8s.io/v1beta1 | ||
kind: CustomResourceDefinition | ||
metadata: | ||
name: operatorgroups.operators.coreos.com | ||
spec: | ||
group: operators.coreos.com | ||
version: v1alpha2 | ||
versions: | ||
- name: v1alpha2 | ||
served: true | ||
storage: true | ||
names: | ||
plural: operatorgroups | ||
singular: operatorgroup | ||
kind: OperatorGroup | ||
listKind: OperatorGroupList | ||
scope: Namespaced | ||
subresources: | ||
# status enables the status subresource. | ||
status: {} | ||
validation: | ||
openAPIV3Schema: | ||
properties: | ||
spec: | ||
properties: | ||
selector: | ||
type: object | ||
serviceAccountName: | ||
type: string | ||
required: | ||
- selector | ||
type: object | ||
status: | ||
properties: | ||
lastUpdated: | ||
format: date-time | ||
type: string | ||
namespaces: | ||
items: | ||
type: object | ||
type: array | ||
required: | ||
- namespaces | ||
- lastUpdated | ||
type: object | ||
required: | ||
- metadata | ||
- spec | ||
version: v1alpha2 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
// +k8s:deepcopy-gen=package | ||
// +groupName=operators.coreos.com | ||
package v1alpha2 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package v1alpha2 | ||
|
||
import ( | ||
corev1 "k8s.io/api/core/v1" | ||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
) | ||
|
||
type OperatorGroupSpec struct { | ||
Selector metav1.LabelSelector `json:"selector,omitempty"` | ||
ServiceAccount corev1.ServiceAccount `json:"serviceAccount,omitempty"` | ||
} | ||
|
||
type OperatorGroupStatus struct { | ||
Namespaces []*corev1.Namespace `json:"namespaces"` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm still a little concerned that this could get too long. |
||
LastUpdated metav1.Time `json:"lastUpdated"` | ||
} | ||
|
||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object | ||
// +genclient | ||
type OperatorGroup struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ObjectMeta `json:"metadata"` | ||
|
||
Spec OperatorGroupSpec `json:"spec"` | ||
Status OperatorGroupStatus `json:"status,omitempty"` | ||
} | ||
|
||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object | ||
type OperatorGroupList struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ListMeta `json:"metadata"` | ||
|
||
Items []OperatorGroup `json:"items"` | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
package v1alpha2 | ||
|
||
import ( | ||
"k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/scheme" | ||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
"k8s.io/apimachinery/pkg/runtime" | ||
"k8s.io/apimachinery/pkg/runtime/schema" | ||
k8sscheme "k8s.io/client-go/kubernetes/scheme" | ||
|
||
"github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators" | ||
) | ||
|
||
const ( | ||
GroupName = "operators.coreos.com" | ||
GroupVersion = "v1alpha2" | ||
) | ||
|
||
// SchemeGroupVersion is group version used to register these objects | ||
var SchemeGroupVersion = schema.GroupVersion{Group: operators.GroupName, Version: GroupVersion} | ||
|
||
// Kind takes an unqualified kind and returns back a Group qualified GroupKind | ||
func Kind(kind string) schema.GroupKind { | ||
return SchemeGroupVersion.WithKind(kind).GroupKind() | ||
} | ||
|
||
// Resource takes an unqualified resource and returns a Group qualified GroupResource | ||
func Resource(resource string) schema.GroupResource { | ||
return SchemeGroupVersion.WithResource(resource).GroupResource() | ||
} | ||
|
||
var ( | ||
SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes) | ||
AddToScheme = SchemeBuilder.AddToScheme | ||
serScheme = runtime.NewScheme() | ||
) | ||
|
||
func init() { | ||
k8sscheme.AddToScheme(serScheme) | ||
scheme.AddToScheme(serScheme) | ||
} | ||
|
||
// Adds the list of known types to Scheme. | ||
func addKnownTypes(scheme *runtime.Scheme) error { | ||
scheme.AddKnownTypes(SchemeGroupVersion, | ||
&OperatorGroup{}, | ||
&OperatorGroupList{}, | ||
) | ||
metav1.AddToGroupVersion(scheme, SchemeGroupVersion) | ||
return nil | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should be explicit about accepting a label selector here, see: https://github.com/operator-framework/operator-lifecycle-manager/blob/master/deploy/chart/templates/0000_30_02-clusterserviceversion.crd.yaml#L153-L182