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 OperatorGroup #480

Merged
merged 33 commits into from
Nov 7, 2018
Merged
Show file tree
Hide file tree
Changes from 29 commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
8d4563e
feat(olm): add OperatorGroup types
Sep 19, 2018
0ec2c72
chore(olm): generated files
Sep 19, 2018
a043600
feat(olm): add CRD definition for OperatorGroup
Sep 21, 2018
2a5a47b
feat(olm): add operator group control loop
Sep 24, 2018
8ab04c2
chore(olm): rename annotateNamespace to syncNamespace
Sep 26, 2018
9265289
feat(olm): make namespace updates trigger annotation updates
Sep 27, 2018
ed88e91
feat(olm): handle required RBAC permissions
Sep 28, 2018
de50de0
feat(olm): copy "dummy" CSVs to target namespaces
Oct 2, 2018
1de9017
fix(olm): change annotations to be allocation safe
Oct 3, 2018
45d9e1e
test(unit): add unit tests for operator groups
Oct 5, 2018
17cfe6f
fix(olm): make status updates on deployments, not CSVs
Oct 8, 2018
a15ba12
test(e2e): add e2e test for operator groups
Oct 12, 2018
c93a433
fix(unit): call Run on operator directly
Oct 12, 2018
2248127
test(e2e): add second e2e for operator groups
Oct 18, 2018
4d6c59e
fix(olm): make RBAC creation resilient
Oct 19, 2018
42dfe77
fix(e2e): ensure created objects are deleted
Oct 19, 2018
522c0b6
refactor(operatorgroup): split apart the larger sync functions
ecordell Oct 19, 2018
fccd2bc
fix(unit): set expected owner refs for deployments
Oct 22, 2018
857676b
fix(unit): fix race condition
Oct 22, 2018
5298dda
fix(e2e): update e2e for refactoring
Oct 22, 2018
59fab56
fix(olm): handle copied CSVs when deletion occurs
Oct 25, 2018
6a00fb9
feat(olm): detect dangling child csvs in olm operator
ecordell Oct 25, 2018
6486f52
fix(olm): adds debug logging for operator groups
Oct 26, 2018
2af56a7
WIP: cvs in operator namespace are being annotated,
ecordell Oct 26, 2018
22a29b3
fix(olm): refactor e2e and check annotations
Oct 26, 2018
ae457b3
fix(olm): set event handler functions correctly
Oct 29, 2018
d7229f1
fix(e2e): slightly improves execution time
Oct 30, 2018
5b7d140
fix(olm): operator group annotations and listers
Nov 1, 2018
ac50ddc
fix(olm): do not check namespace if casting failed
Nov 2, 2018
cd201c5
fix(unit): create OperatorGroups with initial fakes
Nov 6, 2018
337b156
chore(olm): refactor updateNamespaceList
Nov 6, 2018
ab27044
fix(olm): remove duplicated code
Nov 6, 2018
b49c9bc
fix(olm): make operator group copy CSVs more efficiently
Nov 6, 2018
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
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,9 @@ clean-openapi:

codegen-openapi: clean-openapi pkg/package-server/generated/openapi/zz_generated.openapi.go

# our version of hack/update-codegen.sh
codegen: $(CODEGEN)
$(CODEGEN) all $(PKG)/pkg/api/client $(PKG)/pkg/api/apis "operators:v1alpha1"
$(CODEGEN) all $(PKG)/pkg/api/client $(PKG)/pkg/api/apis "operators:v1alpha1,v1alpha2"
$(CODEGEN) all $(PKG)/pkg/package-server/client $(PKG)/pkg/package-server/apis "packagemanifest:v1alpha1"

verify-codegen: codegen
Expand Down
49 changes: 49 additions & 0 deletions deploy/chart/templates/0000_30_14-operatorgroup.crd.yaml
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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Expand Up @@ -195,6 +195,7 @@ const (
CSVReasonReplaced ConditionReason = "Replaced"
CSVReasonNeedCertRotation ConditionReason = "NeedCertRotation"
CSVReasonAPIServiceResourceIssue ConditionReason = "APIServiceResourceIssue"
CSVReasonCopied ConditionReason = "Copied"
)

// Conditions appear in the status as a record of state transitions on the ClusterServiceVersion
Expand Down
3 changes: 3 additions & 0 deletions pkg/api/apis/operators/v1alpha2/doc.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// +k8s:deepcopy-gen=package
// +groupName=operators.coreos.com
package v1alpha2
34 changes: 34 additions & 0 deletions pkg/api/apis/operators/v1alpha2/operatorgroup_types.go
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"`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm still a little concerned that this could get too long. []string seems slightly safer. Perhaps the real answer is to wait for CRDs to support arbitrary subresources and implement a /namespaces subresource (so that we can paginate)

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"`
}
50 changes: 50 additions & 0 deletions pkg/api/apis/operators/v1alpha2/register.go
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 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.

14 changes: 14 additions & 0 deletions pkg/api/client/clientset/versioned/clientset.go

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.

2 changes: 2 additions & 0 deletions pkg/api/client/clientset/versioned/fake/register.go

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

Loading