-
Notifications
You must be signed in to change notification settings - Fork 544
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #480 from jpeeler/add-operator-group
add OperatorGroup
- Loading branch information
Showing
31 changed files
with
2,035 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
// +k8s:deepcopy-gen=package | ||
// +groupName=operators.coreos.com | ||
package v1alpha2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"` | ||
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"` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} |
134 changes: 134 additions & 0 deletions
134
pkg/api/apis/operators/v1alpha2/zz_generated.deepcopy.go
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
7 changes: 7 additions & 0 deletions
7
pkg/api/client/clientset/versioned/fake/clientset_generated.go
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.