Skip to content

Commit aec0f1d

Browse files
Merge pull request #695 from openshift-bot/synchronize-upstream
NO-ISSUE: Synchronize From Upstream Repositories
2 parents 12a2e2f + ac771e7 commit aec0f1d

File tree

38 files changed

+616
-70
lines changed

38 files changed

+616
-70
lines changed

go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ require (
1313
github.com/mikefarah/yq/v3 v3.0.0-20201202084205-8846255d1c37
1414
github.com/onsi/ginkgo/v2 v2.15.0
1515
github.com/openshift/api v3.9.0+incompatible
16-
github.com/operator-framework/api v0.21.0
16+
github.com/operator-framework/api v0.22.0
1717
github.com/operator-framework/operator-lifecycle-manager v0.0.0-00010101000000-000000000000
1818
github.com/operator-framework/operator-registry v1.35.0
1919
github.com/sirupsen/logrus v1.9.3
@@ -165,7 +165,7 @@ require (
165165
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
166166
github.com/onsi/gomega v1.31.1 // indirect
167167
github.com/opencontainers/go-digest v1.0.0 // indirect
168-
github.com/opencontainers/image-spec v1.1.0-rc5 // indirect
168+
github.com/opencontainers/image-spec v1.1.0-rc6 // indirect
169169
github.com/opencontainers/runc v1.1.12 // indirect
170170
github.com/opencontainers/runtime-spec v1.1.0 // indirect
171171
github.com/openshift/client-go v0.0.0-20220525160904-9e1acff93e4a // indirect

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -727,8 +727,8 @@ github.com/onsi/gomega v1.31.1 h1:KYppCUK+bUgAZwHOu7EXVBKyQA6ILvOESHkn/tgoqvo=
727727
github.com/onsi/gomega v1.31.1/go.mod h1:y40C95dwAD1Nz36SsEnxvfFe8FFfNxzI5eJ0EYGyAy0=
728728
github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U=
729729
github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM=
730-
github.com/opencontainers/image-spec v1.1.0-rc5 h1:Ygwkfw9bpDvs+c9E34SdgGOj41dX/cbdlwvlWt0pnFI=
731-
github.com/opencontainers/image-spec v1.1.0-rc5/go.mod h1:X4pATf0uXsnn3g5aiGIsVnJBR4mxhKzfwmvK/B2NTm8=
730+
github.com/opencontainers/image-spec v1.1.0-rc6 h1:XDqvyKsJEbRtATzkgItUqBA7QHk58yxX1Ov9HERHNqU=
731+
github.com/opencontainers/image-spec v1.1.0-rc6/go.mod h1:W4s4sFTMaBeK1BQLXbG4AdM2szdn85PY75RI83NrTrM=
732732
github.com/opencontainers/runc v1.1.12 h1:BOIssBaW1La0/qbNZHXOOa71dZfZEQOzW7dqQf3phss=
733733
github.com/opencontainers/runc v1.1.12/go.mod h1:S+lQwSfncpBha7XTy/5lBwWgm5+y5Ma/O44Ekby9FK8=
734734
github.com/opencontainers/runtime-spec v1.1.0 h1:HHUyrt9mwHUjtasSbXSMvs4cyFxh+Bll4AjJ9odEGpg=

manifests/0000_50_olm_99-operatorstatus.yaml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@ status:
1111
versions:
1212
- name: operator
1313
version: "0.0.1-snapshot"
14+
relatedObjects:
15+
- group: operators.coreos.com
16+
name: packageserver
17+
namespace: openshift-operator-lifecycle-manager
18+
resource: clusterserviceversions
1419
---
1520
apiVersion: config.openshift.io/v1
1621
kind: ClusterOperator
@@ -25,6 +30,10 @@ status:
2530
versions:
2631
- name: operator
2732
version: "0.0.1-snapshot"
33+
relatedObjects:
34+
- group: ""
35+
name: openshift-operator-lifecycle-manager
36+
resource: namespaces
2837
---
2938
apiVersion: config.openshift.io/v1
3039
kind: ClusterOperator
@@ -39,3 +48,11 @@ status:
3948
versions:
4049
- name: operator
4150
version: "0.0.1-snapshot"
51+
relatedObjects:
52+
- group: ""
53+
name: openshift-operator-lifecycle-manager
54+
resource: namespaces
55+
- group: operators.coreos.com
56+
name: packageserver
57+
namespace: openshift-operator-lifecycle-manager
58+
resource: clusterserviceversions

microshift-manifests/0000_50_olm_99-operatorstatus.yaml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@ status:
1111
versions:
1212
- name: operator
1313
version: "0.0.1-snapshot"
14+
relatedObjects:
15+
- group: operators.coreos.com
16+
name: packageserver
17+
namespace: openshift-operator-lifecycle-manager
18+
resource: clusterserviceversions
1419
---
1520
apiVersion: config.openshift.io/v1
1621
kind: ClusterOperator
@@ -25,6 +30,10 @@ status:
2530
versions:
2631
- name: operator
2732
version: "0.0.1-snapshot"
33+
relatedObjects:
34+
- group: ""
35+
name: openshift-operator-lifecycle-manager
36+
resource: namespaces
2837
---
2938
apiVersion: config.openshift.io/v1
3039
kind: ClusterOperator
@@ -39,3 +48,11 @@ status:
3948
versions:
4049
- name: operator
4150
version: "0.0.1-snapshot"
51+
relatedObjects:
52+
- group: ""
53+
name: openshift-operator-lifecycle-manager
54+
resource: namespaces
55+
- group: operators.coreos.com
56+
name: packageserver
57+
namespace: openshift-operator-lifecycle-manager
58+
resource: clusterserviceversions

staging/operator-lifecycle-manager/CONTRIBUTING.md

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,6 @@ This is a rough outline of what a contributor's workflow looks like:
3131
- Identify or create an issue.
3232
- Create a topic branch from where to base the contribution. This is usually the master branch.
3333
- Make commits of logical units.
34-
- Make sure commit messages are in the proper format ([see below][commit-messages]).
35-
- Ensure all relevant commit messages contain a valid sign-off message ([see below][commit-messages]).
3634
- Push changes in a topic branch to a personal fork of the repository.
3735
- Submit a pull request to the operator-framework/operator-lifecycle-manager repository.
3836
- Wait and respond to feedback from the maintainers listed in the OWNERS file.
@@ -62,11 +60,9 @@ In addition to the linked style documentation, OLM formats Golang packages using
6260

6361
Please follow this style to make the OLM project easier to review, maintain and develop.
6462

65-
### Commit Messages and Sign-off ([DCO][DCO])
63+
### Developer Certificate of Origin ([DCO][DCO])
6664

67-
A [sign-off][sign-off] is a line towards the end of a commit message that certifies the commit author(s).
68-
69-
For more information on the structuring of commit messages, read the information in the [DCO][dco] application that the OLM projects uses.
65+
By contributing to this project you agree to the Developer Certificate of Origin (DCO). This document was created by the Linux Kernl community and is a simple statement that you, as a contributor, have the legal right to make the contribution. See the [DCO][dco] file for details.
7066

7167
## Documentation
7268

@@ -84,4 +80,3 @@ The OLM documentation mainly lives in the [operator-framework/olm-docs][olm-docs
8480
[sign-off]: <https://git-scm.com/docs/git-commit#Documentation/git-commit.txt---signoff>
8581
[goimports]: <https://pkg.go.dev/golang.org/x/tools/cmd/goimports>
8682
[gofmt]: <https://pkg.go.dev/cmd/gofmt>
87-
[commit-messages]: <https://github.com/operator-framework/operator-lifecycle-manager/blob/master/CONTRIBUTING.md#commit-messages-and-sign-off-dco>

staging/operator-lifecycle-manager/deploy/chart/crds/0000_50_olm_00-subscriptions.crd.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -524,6 +524,11 @@ spec:
524524
topologyKey:
525525
description: This pod should be co-located (affinity) or not co-located (anti-affinity) with the pods matching the labelSelector in the specified namespaces, where co-located is defined as running on a node whose value of the label with key topologyKey matches that of any node on which any of the selected pods is running. Empty topologyKey is not allowed.
526526
type: string
527+
annotations:
528+
description: Annotations is an unstructured key value map stored with each Deployment, Pod, APIService in the Operator. Typically, annotations may be set by external tools to store and retrieve arbitrary metadata. Use this field to pre-define annotations that OLM should add to each of the Subscription's deployments, pods, and apiservices.
529+
type: object
530+
additionalProperties:
531+
type: string
527532
env:
528533
description: Env is a list of environment variables to set in the container. Cannot be updated.
529534
type: array

staging/operator-lifecycle-manager/deploy/chart/templates/0000_50_olm_99-operatorstatus.yaml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ status:
77
versions:
88
- name: operator
99
version: "0.0.1-snapshot"
10+
relatedObjects:
11+
- group: operators.coreos.com
12+
name: packageserver
13+
namespace: openshift-operator-lifecycle-manager
14+
resource: clusterserviceversions
1015
---
1116
apiVersion: config.openshift.io/v1
1217
kind: ClusterOperator
@@ -16,6 +21,10 @@ status:
1621
versions:
1722
- name: operator
1823
version: "0.0.1-snapshot"
24+
relatedObjects:
25+
- group: ""
26+
name: openshift-operator-lifecycle-manager
27+
resource: namespaces
1928
{{- if .Values.writePackageServerStatusName }}
2029
---
2130
apiVersion: config.openshift.io/v1
@@ -26,5 +35,13 @@ status:
2635
versions:
2736
- name: operator
2837
version: "0.0.1-snapshot"
38+
relatedObjects:
39+
- group: ""
40+
name: openshift-operator-lifecycle-manager
41+
resource: namespaces
42+
- group: operators.coreos.com
43+
name: packageserver
44+
namespace: openshift-operator-lifecycle-manager
45+
resource: clusterserviceversions
2946
{{- end }}
3047
{{- end }}

staging/operator-lifecycle-manager/go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ require (
2424
github.com/onsi/gomega v1.29.0
2525
github.com/openshift/api v3.9.0+incompatible
2626
github.com/openshift/client-go v0.0.0-20220525160904-9e1acff93e4a
27-
github.com/operator-framework/api v0.21.0
27+
github.com/operator-framework/api v0.22.0
2828
github.com/operator-framework/operator-registry v1.35.0
2929
github.com/otiai10/copy v1.14.0
3030
github.com/pkg/errors v0.9.1

staging/operator-lifecycle-manager/go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -672,8 +672,8 @@ github.com/openshift/api v0.0.0-20221021112143-4226c2167e40 h1:PxjGCA72RtsdHWToZ
672672
github.com/openshift/api v0.0.0-20221021112143-4226c2167e40/go.mod h1:aQ6LDasvHMvHZXqLHnX2GRmnfTWCF/iIwz8EMTTIE9A=
673673
github.com/openshift/client-go v0.0.0-20221019143426-16aed247da5c h1:CV76yFOTXmq9VciBR3Bve5ZWzSxdft7gaMVB3kS0rwg=
674674
github.com/openshift/client-go v0.0.0-20221019143426-16aed247da5c/go.mod h1:lFMO8mLHXWFzSdYvGNo8ivF9SfF6zInA8ZGw4phRnUE=
675-
github.com/operator-framework/api v0.21.0 h1:89LhqGTLskxpPR4siEaorkF9PY3KLI51S5mFxP6q1G8=
676-
github.com/operator-framework/api v0.21.0/go.mod h1:3tsDLxXChMY1KgxO5v1CZQogHNQCIMy14YXkXqA5lT4=
675+
github.com/operator-framework/api v0.22.0 h1:UZSn+iaQih4rCReezOnWTTJkMyawwV5iLnIItaOzytY=
676+
github.com/operator-framework/api v0.22.0/go.mod h1:p/7YDbr+n4fmESfZ47yLAV1SvkfE6NU2aX8KhcfI0GA=
677677
github.com/operator-framework/operator-registry v1.35.0 h1:BvytqLwhgb0QiAkEODEKXq3vc2vWiHQq0IlofvFA+OI=
678678
github.com/operator-framework/operator-registry v1.35.0/go.mod h1:foC+NO1V9JuDIOk3pjjlrPE0KVkq09m8oDVRz/a/nFA=
679679
github.com/otiai10/copy v1.14.0 h1:dCI/t1iTdYGtkvCuBG2BgR6KZa83PTclw4U5n2wAllU=

staging/operator-lifecycle-manager/pkg/controller/install/apiservice.go

Lines changed: 32 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
log "github.com/sirupsen/logrus"
99
apierrors "k8s.io/apimachinery/pkg/api/errors"
1010
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
11+
"k8s.io/apimachinery/pkg/labels"
1112
apiregistrationv1 "k8s.io/kube-aggregator/pkg/apis/apiregistration/v1"
1213

1314
"github.com/operator-framework/api/pkg/operators/v1alpha1"
@@ -40,6 +41,16 @@ func (i *StrategyDeploymentInstaller) createOrUpdateAPIService(caPEM []byte, des
4041
},
4142
}
4243
apiService.SetName(apiServiceName)
44+
45+
ownerSubscription, err := i.findOwnerSubscription()
46+
if err != nil {
47+
return err
48+
} else if ownerSubscription == nil {
49+
// This is not an error. For example, the PackageServer CSV in OLM is created without a Subscription.
50+
logger.Debugf("failed to get the owner subscription csv=%s", i.owner.GetName())
51+
} else if ownerSubscription.Spec.Config != nil {
52+
apiService.SetAnnotations(ownerSubscription.Spec.Config.Annotations)
53+
}
4354
} else {
4455
apiService = apiService.DeepCopy()
4556
csv, ok := i.owner.(*v1alpha1.ClusterServiceVersion)
@@ -101,10 +112,10 @@ func IsAPIServiceAdoptable(opLister operatorlister.OperatorLister, target *v1alp
101112
return
102113
}
103114

104-
labels := apiService.GetLabels()
105-
ownerKind := labels[ownerutil.OwnerKind]
106-
ownerName := labels[ownerutil.OwnerKey]
107-
ownerNamespace := labels[ownerutil.OwnerNamespaceKey]
115+
apiServiceLabels := apiService.GetLabels()
116+
ownerKind := apiServiceLabels[ownerutil.OwnerKind]
117+
ownerName := apiServiceLabels[ownerutil.OwnerKey]
118+
ownerNamespace := apiServiceLabels[ownerutil.OwnerNamespaceKey]
108119

109120
if ownerKind == "" || ownerNamespace == "" || ownerName == "" {
110121
return
@@ -285,3 +296,20 @@ func legacyAPIServiceNameToServiceName(apiServiceName string) string {
285296
// Replace all '.'s with "-"s to convert to a DNS-1035 label
286297
return strings.Replace(apiServiceName, ".", "-", -1)
287298
}
299+
300+
func (i *StrategyDeploymentInstaller) findOwnerSubscription() (*v1alpha1.Subscription, error) {
301+
list, listErr := i.strategyClient.GetOpLister().OperatorsV1alpha1().SubscriptionLister().Subscriptions(i.owner.GetNamespace()).List(labels.Everything())
302+
if listErr != nil {
303+
err := fmt.Errorf("failed to list subscription namespace=%s - %v", i.owner.GetNamespace(), listErr)
304+
return nil, err
305+
}
306+
307+
for idx := range list {
308+
sub := list[idx]
309+
if sub.Status.InstalledCSV == i.owner.GetName() {
310+
return sub, nil
311+
}
312+
}
313+
314+
return nil, nil
315+
}

0 commit comments

Comments
 (0)