Skip to content

Commit c14a1fd

Browse files
committed
feat(csv): add installmodes to CSV spec
1 parent 73bc1d5 commit c14a1fd

File tree

9 files changed

+66
-15
lines changed

9 files changed

+66
-15
lines changed

deploy/chart/templates/0000_30_02-clusterserviceversion.crd.yaml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -613,6 +613,27 @@ spec:
613613
required:
614614
- deployments
615615
properties:
616+
installModes:
617+
type: array
618+
description: List of supported install modes for the operator
619+
items:
620+
type: object
621+
description: A tuple representing a mode of installation and whether the operator supports it
622+
required:
623+
- type
624+
- supported
625+
properties:
626+
type:
627+
type: string
628+
description: A type of install mode
629+
enum:
630+
- OwnNamespace
631+
- SingleNamespace
632+
- MultiNamespace
633+
- AllNamespaces
634+
supported:
635+
type: boolean
636+
description: Represents if the install mode type is supported
616637
deployments:
617638
type: array
618639
description: List of deployments to create

deploy/chart/templates/0000_30_13-operatorgroup.crd.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,10 @@ spec:
5959
values:
6060
type: array
6161
description: set of values for the expression
62+
targetNamespaces:
63+
type: array
64+
items:
65+
type: string
6266
serviceAccountName:
6367
type: string
6468
required:

go.mod

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ require (
4848
github.com/xiang90/probing v0.0.0-20160813154853-07dd2e8dfe18 // indirect
4949
golang.org/x/oauth2 v0.0.0-20181105165119-ca4130e427c7 // indirect
5050
golang.org/x/tools v0.0.0-20181207222222-4c874b978acb // indirect
51-
google.golang.org/grpc v1.16.0
5251
gopkg.in/natefinch/lumberjack.v2 v2.0.0-20170531160350-a96e63847dc3 // indirect
5352
k8s.io/api v0.0.0-20181203235848-2dd39edadc55
5453
k8s.io/apiextensions-apiserver v0.0.0-20181204003618-e419c5771cdc
@@ -60,5 +59,5 @@ require (
6059
k8s.io/klog v0.0.0-20181102134211-b9b56d5dfc92 // indirect
6160
k8s.io/kube-aggregator v0.0.0-20181204002017-122bac39d429
6261
k8s.io/kube-openapi v0.0.0-20181031203759-72693cb1fadd
63-
k8s.io/kubernetes v1.11.6-beta.0.0.20181212102158-c4240ecfddd7
62+
k8s.io/kubernetes v1.11.7-beta.0.0.20181219023948-b875d52ea96d
6463
)

go.sum

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,6 @@ golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
195195
golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2 h1:+DCIGbF/swA92ohVg0//6X2IVY3KZs6p9mix0ziNYJM=
196196
golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
197197
golang.org/x/tools v0.0.0-20180828015842-6cd1fcedba52/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
198-
golang.org/x/tools v0.0.0-20181011152555-a398e557df60 h1:PDHN4Zqpfzyio+3C8FTXO2gSMFZa0f8tFifs+K4tdoQ=
199198
golang.org/x/tools v0.0.0-20181011152555-a398e557df60/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
200199
golang.org/x/tools v0.0.0-20181207222222-4c874b978acb h1:YIXCxYolAiiPmVSqA4gVUVcHo8Mi1ivU7ANnK9a63JY=
201200
golang.org/x/tools v0.0.0-20181207222222-4c874b978acb/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
@@ -219,11 +218,9 @@ gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWD
219218
gopkg.in/yaml.v2 v2.2.1 h1:mUhvW9EsL+naU5Q3cakzfE91YhliOondGd6ZrsDBHQE=
220219
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
221220
honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
222-
k8s.io/api v0.0.0-20180904230853-4e7be11eab3f h1:DLRkv8Ps4Sdx8Srj+UtGisj4whV7v/HezlHx6QqiZqE=
223221
k8s.io/api v0.0.0-20180904230853-4e7be11eab3f/go.mod h1:iuAfoD4hCxJ8Onx9kaTIt30j7jUFS00AXQi6QMi99vA=
224222
k8s.io/api v0.0.0-20181203235848-2dd39edadc55 h1:FmAMYGd999iHkN+swot+oART9AumJiAvH0idpIZ3Ozo=
225223
k8s.io/api v0.0.0-20181203235848-2dd39edadc55/go.mod h1:iuAfoD4hCxJ8Onx9kaTIt30j7jUFS00AXQi6QMi99vA=
226-
k8s.io/apiextensions-apiserver v0.0.0-20180905004947-16750353bf97 h1:s4lWWs6JN5kWVzk5bztddkr5kgO/cGIbqTDP+QttUeQ=
227224
k8s.io/apiextensions-apiserver v0.0.0-20180905004947-16750353bf97/go.mod h1:IxkesAMoaCRoLrPJdZNZUQp9NfZnzqaVzLhb2VEQzXE=
228225
k8s.io/apiextensions-apiserver v0.0.0-20181204003618-e419c5771cdc h1:IOukeE9HtTwpLslbujLDfRpfFU6tsjq28yO0fjnl/hk=
229226
k8s.io/apiextensions-apiserver v0.0.0-20181204003618-e419c5771cdc/go.mod h1:IxkesAMoaCRoLrPJdZNZUQp9NfZnzqaVzLhb2VEQzXE=
@@ -233,7 +230,7 @@ k8s.io/apimachinery v0.0.0-20181203235515-3d8ee2261517/go.mod h1:ccL7Eh7zubPUSh9
233230
k8s.io/apiserver v0.0.0-20181026151315-13cfe3978170 h1:CqI85nZvPaV+7JFono0nAOGOx2brocqefcOhDPVhHKI=
234231
k8s.io/apiserver v0.0.0-20181026151315-13cfe3978170/go.mod h1:6bqaTSOSJavUIXUtfaR9Os9JtTCm8ZqH2SUl2S60C4w=
235232
k8s.io/client-go v0.0.0-20180718001006-59698c7d9724/go.mod h1:7vJpHMYJwNQCWgzmNV+VYUl1zCObLyodBc8nIyt8L5s=
236-
k8s.io/client-go v8.0.0+incompatible h1:2pUaSg2x6iEHr8cia6zmWhoCXG1EDG9TCx9s//Aq7HY=
233+
k8s.io/client-go v8.0.0+incompatible h1:tTI4hRmb1DRMl4fG6Vclfdi6nTM82oIrTT7HfitmxC4=
237234
k8s.io/client-go v8.0.0+incompatible/go.mod h1:7vJpHMYJwNQCWgzmNV+VYUl1zCObLyodBc8nIyt8L5s=
238235
k8s.io/code-generator v0.0.0-20181203235156-f8cba74510f3 h1:f/Aa24HPnPEDWia884BCF94E1b29KYjOTVTHcBzvT2Q=
239236
k8s.io/code-generator v0.0.0-20181203235156-f8cba74510f3/go.mod h1:MYiN+ZJZ9HkETbgVZdWw2AsuAi9PZ4V80cwfuf2axe8=
@@ -245,5 +242,5 @@ k8s.io/kube-aggregator v0.0.0-20181204002017-122bac39d429 h1:wIDPKpRuwEfyt+ImBaP
245242
k8s.io/kube-aggregator v0.0.0-20181204002017-122bac39d429/go.mod h1:8sbzT4QQKDEmSCIbfqjV0sd97GpUT7A4W626sBiYJmU=
246243
k8s.io/kube-openapi v0.0.0-20181031203759-72693cb1fadd h1:ggv/Vfza0i5xuhUZyYyxcc25AmQvHY8Zi1C2m8WgBvA=
247244
k8s.io/kube-openapi v0.0.0-20181031203759-72693cb1fadd/go.mod h1:BXM9ceUBTj2QnfH2MK1odQs778ajze1RxcmP6S8RVVc=
248-
k8s.io/kubernetes v1.11.6-beta.0.0.20181212102158-c4240ecfddd7 h1:o48C0Emh8uKTGznb+GRliG2C7PnKwB+yWdddTG7CNbw=
249-
k8s.io/kubernetes v1.11.6-beta.0.0.20181212102158-c4240ecfddd7/go.mod h1:ocZa8+6APFNC2tX1DZASIbocyYT5jHzqFVsY5aoB7Jk=
245+
k8s.io/kubernetes v1.11.7-beta.0.0.20181219023948-b875d52ea96d h1:+bCdU1zyST7byJ6W1kZvrHZ2TgUUQsd2+DWlUN23ZTk=
246+
k8s.io/kubernetes v1.11.7-beta.0.0.20181219023948-b875d52ea96d/go.mod h1:ocZa8+6APFNC2tX1DZASIbocyYT5jHzqFVsY5aoB7Jk=

pkg/api/apis/operators/v1alpha1/clusterserviceversion_types.go

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,22 @@ const (
1717
ClusterServiceVersionKind = "ClusterServiceVersion"
1818
)
1919

20+
// InstallModeType is a supported type of install mode for CSV installation
21+
type InstallModeType string
22+
23+
const (
24+
InstallModeTypeOwnNamespace InstallModeType = "OwnNamespace"
25+
InstallModeTypeSingleNamespace InstallModeType = "SingleNamespace"
26+
InstallModeTypeMultiNamespace InstallModeType = "MultiNamespace"
27+
InstallModeTypeAllNamespaces InstallModeType = "AllNamespaces"
28+
)
29+
30+
// InstallMode associates an InstallModeType with a flag representing if the CSV supports it
31+
type InstallMode struct {
32+
Type InstallModeType `json:"type"`
33+
Supported bool `json:"supported"`
34+
}
35+
2036
// NamedInstallStrategy represents the block of an ClusterServiceVersion resource
2137
// where the install strategy is specified.
2238
type NamedInstallStrategy struct {
@@ -120,6 +136,9 @@ type ClusterServiceVersionSpec struct {
120136
Links []AppLink `json:"links,omitempty"`
121137
Icon []Icon `json:"icon,omitempty"`
122138

139+
// InstallModes
140+
InstallModes []InstallMode `json:"installModes,omitempty"`
141+
123142
// The name of a CSV this one replaces. Should match the `metadata.Name` field of the old CSV.
124143
// +optional
125144
Replaces string `json:"replaces,omitempty"`
@@ -448,4 +467,3 @@ func (csv ClusterServiceVersion) GetOwnedAPIServiceDescriptions() []APIServiceDe
448467

449468
return descs
450469
}
451-

pkg/api/apis/operators/v1alpha2/operatorgroup_types.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,16 @@ import (
66
)
77

88
type OperatorGroupSpec struct {
9-
Selector metav1.LabelSelector `json:"selector,omitempty"`
9+
// Selector selects the OperatorGroup's target namespaces.
10+
// +optional
11+
Selector metav1.LabelSelector `json:"selector,omitempty"`
12+
13+
// TargetNamespaces is an explicit set of namespaces to target.
14+
// If it is set, Selector is ignored.
15+
// +optional
16+
TargetNamespaces []string `json:"targetNamespaces,omitempty"`
17+
18+
// ServiceAccount to bind OperatorGroup roles to.
1019
ServiceAccount corev1.ServiceAccount `json:"serviceAccount,omitempty"`
1120
}
1221

pkg/controller/operators/olm/operatorgroup.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,10 @@ func (a *Operator) updateNamespaceList(op *v1alpha2.OperatorGroup) ([]string, er
401401
}
402402

403403
namespaceList := []string{}
404-
if selector.Empty() || selector == nil {
404+
if op.Spec.TargetNamespaces != nil && len(op.Spec.TargetNamespaces) > 0 {
405+
// TODO: Ensure namespaceList is a set
406+
namespaceList = append(namespaceList, op.Spec.TargetNamespaces...)
407+
} else if selector.Empty() || selector == nil {
405408
namespaceList = append(namespaceList, corev1.NamespaceAll)
406409
} else {
407410
matchedNamespaces, err := a.lister.CoreV1().NamespaceLister().List(selector)

vendor/k8s.io/client-go/pkg/version/base.go

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/modules.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,9 +124,9 @@ github.com/modern-go/concurrent
124124
# github.com/modern-go/reflect2 v1.0.1
125125
github.com/modern-go/reflect2
126126
# github.com/operator-framework/operator-registry v1.0.1
127-
github.com/operator-framework/operator-registry/pkg/api
128127
github.com/operator-framework/operator-registry/pkg/client
129128
github.com/operator-framework/operator-registry/pkg/registry
129+
github.com/operator-framework/operator-registry/pkg/api
130130
# github.com/pborman/uuid v1.2.0
131131
github.com/pborman/uuid
132132
# github.com/peterbourgon/diskv v2.0.1+incompatible
@@ -656,7 +656,7 @@ k8s.io/kube-openapi/pkg/generators/rules
656656
k8s.io/kube-openapi/pkg/builder
657657
k8s.io/kube-openapi/pkg/handler
658658
k8s.io/kube-openapi/pkg/util/sets
659-
# k8s.io/kubernetes v1.11.6-beta.0.0.20181212102158-c4240ecfddd7
659+
# k8s.io/kubernetes v1.11.7-beta.0.0.20181219023948-b875d52ea96d
660660
k8s.io/kubernetes/plugin/pkg/auth/authorizer/rbac
661661
k8s.io/kubernetes/pkg/apis/rbac/v1
662662
k8s.io/kubernetes/pkg/registry/rbac/validation

0 commit comments

Comments
 (0)