diff --git a/go.mod b/go.mod index 4f926dcc1e..f2bc3a572e 100644 --- a/go.mod +++ b/go.mod @@ -85,7 +85,6 @@ require ( github.com/felixge/httpsnoop v1.0.3 // indirect github.com/fsnotify/fsnotify v1.6.0 // indirect github.com/fvbommel/sortorder v1.0.1 // indirect - github.com/ghodss/yaml v1.0.0 // indirect github.com/go-air/gini v1.0.4 // indirect github.com/go-errors/errors v1.4.2 // indirect github.com/go-git/gcfg v1.5.0 // indirect diff --git a/manifests/0000_50_olm_07-olm-operator.deployment.ibm-cloud-managed.yaml b/manifests/0000_50_olm_07-olm-operator.deployment.ibm-cloud-managed.yaml index 5631a5ed8a..bfd60e504d 100644 --- a/manifests/0000_50_olm_07-olm-operator.deployment.ibm-cloud-managed.yaml +++ b/manifests/0000_50_olm_07-olm-operator.deployment.ibm-cloud-managed.yaml @@ -10,7 +10,7 @@ metadata: capability.openshift.io/name: "OperatorLifecycleManager" spec: strategy: - type: RollingUpdate + type: Recreate replicas: 1 selector: matchLabels: diff --git a/manifests/0000_50_olm_07-olm-operator.deployment.yaml b/manifests/0000_50_olm_07-olm-operator.deployment.yaml index 211d0049d4..7808c0f1c7 100644 --- a/manifests/0000_50_olm_07-olm-operator.deployment.yaml +++ b/manifests/0000_50_olm_07-olm-operator.deployment.yaml @@ -10,7 +10,7 @@ metadata: capability.openshift.io/name: "OperatorLifecycleManager" spec: strategy: - type: RollingUpdate + type: Recreate replicas: 1 selector: matchLabels: diff --git a/manifests/0000_50_olm_08-catalog-operator.deployment.ibm-cloud-managed.yaml b/manifests/0000_50_olm_08-catalog-operator.deployment.ibm-cloud-managed.yaml index bbcdd2658c..066c8f30a9 100644 --- a/manifests/0000_50_olm_08-catalog-operator.deployment.ibm-cloud-managed.yaml +++ b/manifests/0000_50_olm_08-catalog-operator.deployment.ibm-cloud-managed.yaml @@ -10,7 +10,7 @@ metadata: capability.openshift.io/name: "OperatorLifecycleManager" spec: strategy: - type: RollingUpdate + type: Recreate replicas: 1 selector: matchLabels: diff --git a/manifests/0000_50_olm_08-catalog-operator.deployment.yaml b/manifests/0000_50_olm_08-catalog-operator.deployment.yaml index 9d9cd5e457..ca4f9401da 100644 --- a/manifests/0000_50_olm_08-catalog-operator.deployment.yaml +++ b/manifests/0000_50_olm_08-catalog-operator.deployment.yaml @@ -10,7 +10,7 @@ metadata: capability.openshift.io/name: "OperatorLifecycleManager" spec: strategy: - type: RollingUpdate + type: Recreate replicas: 1 selector: matchLabels: diff --git a/microshift-manifests/0000_50_olm_07-olm-operator.deployment.ibm-cloud-managed.yaml b/microshift-manifests/0000_50_olm_07-olm-operator.deployment.ibm-cloud-managed.yaml index 5631a5ed8a..bfd60e504d 100644 --- a/microshift-manifests/0000_50_olm_07-olm-operator.deployment.ibm-cloud-managed.yaml +++ b/microshift-manifests/0000_50_olm_07-olm-operator.deployment.ibm-cloud-managed.yaml @@ -10,7 +10,7 @@ metadata: capability.openshift.io/name: "OperatorLifecycleManager" spec: strategy: - type: RollingUpdate + type: Recreate replicas: 1 selector: matchLabels: diff --git a/microshift-manifests/0000_50_olm_07-olm-operator.deployment.yaml b/microshift-manifests/0000_50_olm_07-olm-operator.deployment.yaml index 038134126d..a67f0a89b7 100644 --- a/microshift-manifests/0000_50_olm_07-olm-operator.deployment.yaml +++ b/microshift-manifests/0000_50_olm_07-olm-operator.deployment.yaml @@ -10,7 +10,7 @@ metadata: capability.openshift.io/name: "OperatorLifecycleManager" spec: strategy: - type: RollingUpdate + type: Recreate replicas: 1 selector: matchLabels: diff --git a/microshift-manifests/0000_50_olm_08-catalog-operator.deployment.ibm-cloud-managed.yaml b/microshift-manifests/0000_50_olm_08-catalog-operator.deployment.ibm-cloud-managed.yaml index bbcdd2658c..066c8f30a9 100644 --- a/microshift-manifests/0000_50_olm_08-catalog-operator.deployment.ibm-cloud-managed.yaml +++ b/microshift-manifests/0000_50_olm_08-catalog-operator.deployment.ibm-cloud-managed.yaml @@ -10,7 +10,7 @@ metadata: capability.openshift.io/name: "OperatorLifecycleManager" spec: strategy: - type: RollingUpdate + type: Recreate replicas: 1 selector: matchLabels: diff --git a/microshift-manifests/0000_50_olm_08-catalog-operator.deployment.yaml b/microshift-manifests/0000_50_olm_08-catalog-operator.deployment.yaml index 9d9cd5e457..ca4f9401da 100644 --- a/microshift-manifests/0000_50_olm_08-catalog-operator.deployment.yaml +++ b/microshift-manifests/0000_50_olm_08-catalog-operator.deployment.yaml @@ -10,7 +10,7 @@ metadata: capability.openshift.io/name: "OperatorLifecycleManager" spec: strategy: - type: RollingUpdate + type: Recreate replicas: 1 selector: matchLabels: diff --git a/staging/operator-lifecycle-manager/deploy/chart/templates/0000_50_olm_07-olm-operator.deployment.yaml b/staging/operator-lifecycle-manager/deploy/chart/templates/0000_50_olm_07-olm-operator.deployment.yaml index 76f7ca1ee0..f2c7bd8ab2 100644 --- a/staging/operator-lifecycle-manager/deploy/chart/templates/0000_50_olm_07-olm-operator.deployment.yaml +++ b/staging/operator-lifecycle-manager/deploy/chart/templates/0000_50_olm_07-olm-operator.deployment.yaml @@ -7,7 +7,7 @@ metadata: app: olm-operator spec: strategy: - type: RollingUpdate + type: Recreate replicas: {{ .Values.olm.replicaCount }} selector: matchLabels: diff --git a/staging/operator-lifecycle-manager/deploy/chart/templates/0000_50_olm_08-catalog-operator.deployment.yaml b/staging/operator-lifecycle-manager/deploy/chart/templates/0000_50_olm_08-catalog-operator.deployment.yaml index 2b2d4534d3..eea8046cea 100644 --- a/staging/operator-lifecycle-manager/deploy/chart/templates/0000_50_olm_08-catalog-operator.deployment.yaml +++ b/staging/operator-lifecycle-manager/deploy/chart/templates/0000_50_olm_08-catalog-operator.deployment.yaml @@ -7,7 +7,7 @@ metadata: app: catalog-operator spec: strategy: - type: RollingUpdate + type: Recreate replicas: {{ .Values.catalog.replicaCount }} selector: matchLabels: diff --git a/staging/operator-lifecycle-manager/pkg/controller/operators/catalog/operator.go b/staging/operator-lifecycle-manager/pkg/controller/operators/catalog/operator.go index 7394fb1241..2b0e3d592e 100644 --- a/staging/operator-lifecycle-manager/pkg/controller/operators/catalog/operator.go +++ b/staging/operator-lifecycle-manager/pkg/controller/operators/catalog/operator.go @@ -581,11 +581,20 @@ func NewOperator(ctx context.Context, kubeconfigPath string, clock utilclock.Clo sharedIndexInformers = append(sharedIndexInformers, buPodInformer.Informer()) // Wire ConfigMaps - configMapInformer := informers.NewSharedInformerFactoryWithOptions(op.opClient.KubernetesInterface(), resyncPeriod(), informers.WithTweakListOptions(func(options *metav1.ListOptions) { - options.LabelSelector = install.OLMManagedLabelKey - })).Core().V1().ConfigMaps() + configMapInformer := k8sInformerFactory.Core().V1().ConfigMaps() op.lister.CoreV1().RegisterConfigMapLister(metav1.NamespaceAll, configMapInformer.Lister()) sharedIndexInformers = append(sharedIndexInformers, configMapInformer.Informer()) + configmapsgvk := corev1.SchemeGroupVersion.WithResource("configmaps") + if err := labelObjects(configmapsgvk, configMapInformer.Informer(), labeller.ObjectLabeler[*corev1.ConfigMap, *corev1applyconfigurations.ConfigMapApplyConfiguration]( + ctx, op.logger, labeller.Filter(configmapsgvk), + configMapInformer.Lister().List, + corev1applyconfigurations.ConfigMap, + func(namespace string, ctx context.Context, cfg *corev1applyconfigurations.ConfigMapApplyConfiguration, opts metav1.ApplyOptions) (*corev1.ConfigMap, error) { + return op.opClient.KubernetesInterface().CoreV1().ConfigMaps(namespace).Apply(ctx, cfg, opts) + }, + )); err != nil { + return nil, err + } // Wire Jobs jobInformer := k8sInformerFactory.Batch().V1().Jobs() diff --git a/staging/operator-lifecycle-manager/pkg/controller/operators/catalog/subscription/reconciler.go b/staging/operator-lifecycle-manager/pkg/controller/operators/catalog/subscription/reconciler.go index 982e6164d9..374e49fb77 100644 --- a/staging/operator-lifecycle-manager/pkg/controller/operators/catalog/subscription/reconciler.go +++ b/staging/operator-lifecycle-manager/pkg/controller/operators/catalog/subscription/reconciler.go @@ -128,10 +128,9 @@ func (c *catalogHealthReconciler) updateDeprecatedStatus(ctx context.Context, su if c.sourceProvider == nil { return false, nil } - - source, ok := c.sourceProvider.Sources(sub.Namespace)[cache.SourceKey{ + source, ok := c.sourceProvider.Sources(sub.Spec.CatalogSourceNamespace)[cache.SourceKey{ Name: sub.Spec.CatalogSource, - Namespace: sub.Namespace, + Namespace: sub.Spec.CatalogSourceNamespace, }] if !ok { return false, nil diff --git a/staging/operator-lifecycle-manager/pkg/controller/operators/labeller/filters.go b/staging/operator-lifecycle-manager/pkg/controller/operators/labeller/filters.go index 11e04a24d8..2167d34544 100644 --- a/staging/operator-lifecycle-manager/pkg/controller/operators/labeller/filters.go +++ b/staging/operator-lifecycle-manager/pkg/controller/operators/labeller/filters.go @@ -59,7 +59,8 @@ func ServiceAccountFilter(isServiceAccountReferenced func(namespace, name string } var filters = map[schema.GroupVersionResource]func(metav1.Object) bool{ - corev1.SchemeGroupVersion.WithResource("services"): HasOLMOwnerRef, + corev1.SchemeGroupVersion.WithResource("configmaps"): HasOLMOwnerRef, + corev1.SchemeGroupVersion.WithResource("services"): HasOLMOwnerRef, corev1.SchemeGroupVersion.WithResource("pods"): func(object metav1.Object) bool { _, ok := object.GetLabels()[reconciler.CatalogSourceLabelKey] return ok diff --git a/staging/operator-lifecycle-manager/pkg/controller/registry/reconciler/configmap.go b/staging/operator-lifecycle-manager/pkg/controller/registry/reconciler/configmap.go index 2fdb4775b6..654484125e 100644 --- a/staging/operator-lifecycle-manager/pkg/controller/registry/reconciler/configmap.go +++ b/staging/operator-lifecycle-manager/pkg/controller/registry/reconciler/configmap.go @@ -290,9 +290,11 @@ func (c *ConfigMapRegistryReconciler) EnsureRegistryServer(logger *logrus.Entry, if source.Spec.SourceType == v1alpha1.SourceTypeConfigmap || source.Spec.SourceType == v1alpha1.SourceTypeInternal { // fetch configmap first, exit early if we can't find it - configMap, err := c.Lister.CoreV1().ConfigMapLister().ConfigMaps(source.GetNamespace()).Get(source.Spec.ConfigMap) + // we use the live client here instead of a lister since our listers are scoped to objects with the olm.managed label, + // and this configmap is a user-provided input to the catalog source and will not have that label + configMap, err := c.OpClient.KubernetesInterface().CoreV1().ConfigMaps(source.GetNamespace()).Get(context.TODO(), source.Spec.ConfigMap, metav1.GetOptions{}) if err != nil { - return fmt.Errorf("unable to get configmap %s/%s from cache", source.GetNamespace(), source.Spec.ConfigMap) + return fmt.Errorf("unable to find configmap %s/%s: %w", source.GetNamespace(), source.Spec.ConfigMap, err) } if source.ConfigMapChanges(configMap) { @@ -459,9 +461,11 @@ func (c *ConfigMapRegistryReconciler) CheckRegistryServer(logger *logrus.Entry, } if source.Spec.SourceType == v1alpha1.SourceTypeConfigmap || source.Spec.SourceType == v1alpha1.SourceTypeInternal { - configMap, err := c.Lister.CoreV1().ConfigMapLister().ConfigMaps(source.GetNamespace()).Get(source.Spec.ConfigMap) + // we use the live client here instead of a lister since our listers are scoped to objects with the olm.managed label, + // and this configmap is a user-provided input to the catalog source and will not have that label + configMap, err := c.OpClient.KubernetesInterface().CoreV1().ConfigMaps(source.GetNamespace()).Get(context.TODO(), source.Spec.ConfigMap, metav1.GetOptions{}) if err != nil { - return false, fmt.Errorf("unable to get configmap %s/%s from cache", source.GetNamespace(), source.Spec.ConfigMap) + return false, fmt.Errorf("unable to find configmap %s/%s: %w", source.GetNamespace(), source.Spec.ConfigMap, err) } if source.ConfigMapChanges(configMap) { diff --git a/staging/operator-lifecycle-manager/pkg/controller/registry/reconciler/configmap_test.go b/staging/operator-lifecycle-manager/pkg/controller/registry/reconciler/configmap_test.go index 04f7644594..7e6b1dcd76 100644 --- a/staging/operator-lifecycle-manager/pkg/controller/registry/reconciler/configmap_test.go +++ b/staging/operator-lifecycle-manager/pkg/controller/registry/reconciler/configmap_test.go @@ -299,13 +299,17 @@ func TestConfigMapRegistryReconciler(t *testing.T) { in: in{ cluster: cluster{}, catsrc: &v1alpha1.CatalogSource{ + ObjectMeta: metav1.ObjectMeta{ + Namespace: "test-ns", + }, Spec: v1alpha1.CatalogSourceSpec{ SourceType: v1alpha1.SourceTypeConfigmap, + ConfigMap: "test-cm", }, }, }, out: out{ - err: fmt.Errorf("unable to get configmap / from cache"), + err: fmt.Errorf(`unable to find configmap test-ns/test-cm: configmaps "test-cm" not found`), }, }, { @@ -463,7 +467,11 @@ func TestConfigMapRegistryReconciler(t *testing.T) { err := rec.EnsureRegistryServer(logrus.NewEntry(logrus.New()), tt.in.catsrc) - require.Equal(t, tt.out.err, err) + if tt.out.err != nil { + require.EqualError(t, err, tt.out.err.Error()) + } else { + require.NoError(t, err) + } require.Equal(t, tt.out.status, tt.in.catsrc.Status.RegistryServiceStatus) if tt.out.err != nil { diff --git a/staging/operator-lifecycle-manager/test/e2e/subscription_e2e_test.go b/staging/operator-lifecycle-manager/test/e2e/subscription_e2e_test.go index 9259345221..795c07f305 100644 --- a/staging/operator-lifecycle-manager/test/e2e/subscription_e2e_test.go +++ b/staging/operator-lifecycle-manager/test/e2e/subscription_e2e_test.go @@ -159,13 +159,21 @@ var _ = Describe("Subscription", func() { It("creation if not installed", func() { defer func() { + if env := os.Getenv("SKIP_CLEANUP"); env != "" { + fmt.Printf("Skipping cleanup of subscriptions in namespace %s\n", generatedNamespace.GetName()) + return + } require.NoError(GinkgoT(), crc.OperatorsV1alpha1().Subscriptions(generatedNamespace.GetName()).DeleteCollection(context.Background(), metav1.DeleteOptions{}, metav1.ListOptions{})) }() + + By("creating a catalog") require.NoError(GinkgoT(), initCatalog(GinkgoT(), generatedNamespace.GetName(), c, crc)) + By(fmt.Sprintf("creating a subscription: %s/%s", generatedNamespace.GetName(), testSubscriptionName)) cleanup, _ := createSubscription(GinkgoT(), crc, generatedNamespace.GetName(), testSubscriptionName, testPackageName, betaChannel, operatorsv1alpha1.ApprovalAutomatic) defer cleanup() + By("waiting for the subscription to have a current CSV and be at latest") var currentCSV string Eventually(func() bool { fetched, err := crc.OperatorsV1alpha1().Subscriptions(generatedNamespace.GetName()).Get(context.Background(), testSubscriptionName, metav1.GetOptions{}) @@ -3121,6 +3129,7 @@ func initCatalog(t GinkgoTInterface, namespace string, c operatorclient.ClientIn } return err } + t.Logf("created configmap %s/%s", dummyCatalogConfigMap.Namespace, dummyCatalogConfigMap.Name) dummyCatalogSource.SetNamespace(namespace) if _, err := crc.OperatorsV1alpha1().CatalogSources(namespace).Create(context.Background(), &dummyCatalogSource, metav1.CreateOptions{}); err != nil { @@ -3129,6 +3138,7 @@ func initCatalog(t GinkgoTInterface, namespace string, c operatorclient.ClientIn } return err } + t.Logf("created catalog source %s/%s", dummyCatalogSource.Namespace, dummyCatalogSource.Name) fetched, err := fetchCatalogSourceOnStatus(crc, dummyCatalogSource.GetName(), dummyCatalogSource.GetNamespace(), catalogSourceRegistryPodSynced()) require.NoError(t, err) @@ -3312,6 +3322,7 @@ func createSubscription(t GinkgoTInterface, crc versioned.Interface, namespace, subscription, err := crc.OperatorsV1alpha1().Subscriptions(namespace).Create(context.Background(), subscription, metav1.CreateOptions{}) Expect(err).ToNot(HaveOccurred()) + t.Logf("created subscription %s/%s", subscription.Namespace, subscription.Name) return buildSubscriptionCleanupFunc(crc, subscription), subscription } diff --git a/staging/operator-lifecycle-manager/test/e2e/util.go b/staging/operator-lifecycle-manager/test/e2e/util.go index cec2b08c53..fa7e3480e5 100644 --- a/staging/operator-lifecycle-manager/test/e2e/util.go +++ b/staging/operator-lifecycle-manager/test/e2e/util.go @@ -1073,11 +1073,13 @@ func SetupGeneratedTestNamespaceWithOperatorGroup(name string, og operatorsv1.Op return ctx.Ctx().E2EClient().Create(context.Background(), &ns) }).Should(Succeed()) + ctx.Ctx().Logf("created the %s testing namespace", ns.GetName()) + Eventually(func() error { return ctx.Ctx().E2EClient().Create(context.Background(), &og) }).Should(Succeed()) - ctx.Ctx().Logf("created the %s testing namespace", ns.GetName()) + ctx.Ctx().Logf("created the %s/%s operator group", og.Namespace, og.Name) return ns } diff --git a/staging/operator-registry/Makefile b/staging/operator-registry/Makefile index 71c10f086d..7b0b6474d0 100644 --- a/staging/operator-registry/Makefile +++ b/staging/operator-registry/Makefile @@ -148,10 +148,12 @@ $(LOCALBIN): ## Tool Binaries GORELEASER ?= $(LOCALBIN)/goreleaser GINKGO ?= $(LOCALBIN)/ginkgo +PROTOC_VERSION ?= $(LOCALBIN)/protoc-gen-go-grpc ## Tool Versions GORELEASER_VERSION ?= v1.8.3 GINKGO_VERSION ?= v2.1.3 +PROTOC_VERSION ?= v1.3.0 .PHONY: goreleaser goreleaser: $(GORELEASER) ## Download goreleaser locally if necessary. @@ -162,3 +164,8 @@ $(GORELEASER): $(LOCALBIN) ginkgo: $(GINKGO) ## Download ginkgo locally if necessary. $(GINKGO): $(LOCALBIN) GOBIN=$(LOCALBIN) go install $(GO_INSTALL_OPTS) github.com/onsi/ginkgo/v2/ginkgo@$(GINKGO_VERSION) + +.PHONY: protoc-gen-go-grpc +protoc-gen-go-grpc: $(protoc-gen-go-grpc) ## Download protoc-gen-go-grpc locally if necessary. +$(protoc-gen-go-grpc): $(LOCALBIN) + GOBIN=$(LOCALBIN) go install $(GO_INSTALL_OPTS) google.golang.org/grpc/cmd/protoc-gen-go-grpc@$(PROTOC_VERSION) diff --git a/staging/operator-registry/alpha/declcfg/write.go b/staging/operator-registry/alpha/declcfg/write.go index 049d96b22f..9856c2e1ee 100644 --- a/staging/operator-registry/alpha/declcfg/write.go +++ b/staging/operator-registry/alpha/declcfg/write.go @@ -106,6 +106,26 @@ func (writer *MermaidWriter) WriteChannels(cfg DeclarativeConfig, out io.Writer) minEdgePackage := writer.getMinEdgePackage(&cfg) + depByPackage := sets.Set[string]{} + depByChannel := sets.Set[string]{} + depByBundle := sets.Set[string]{} + + for _, d := range cfg.Deprecations { + for _, e := range d.Entries { + switch e.Reference.Schema { + case SchemaPackage: + depByPackage.Insert(d.Package) + case SchemaChannel: + depByChannel.Insert(e.Reference.Name) + case SchemaBundle: + depByBundle.Insert(e.Reference.Name) + } + } + } + + var deprecatedPackage string + deprecatedChannels := []string{} + for _, c := range cfg.Channels { filteredChannel := writer.filterChannel(&c, versionMap, minVersion, minEdgePackage) if filteredChannel != nil { @@ -119,10 +139,23 @@ func (writer *MermaidWriter) WriteChannels(cfg DeclarativeConfig, out io.Writer) pkgBuilder.WriteString(fmt.Sprintf(" %%%% channel %q\n", filteredChannel.Name)) pkgBuilder.WriteString(fmt.Sprintf(" subgraph %s[%q]\n", channelID, filteredChannel.Name)) + if depByPackage.Has(filteredChannel.Package) { + deprecatedPackage = filteredChannel.Package + } + + if depByChannel.Has(filteredChannel.Name) { + deprecatedChannels = append(deprecatedChannels, channelID) + } + for _, ce := range filteredChannel.Entries { if versionMap[ce.Name].GE(minVersion) { + bundleDeprecation := "" + if depByBundle.Has(ce.Name) { + bundleDeprecation = ":::deprecated" + } + entryId := fmt.Sprintf("%s-%s", channelID, ce.Name) - pkgBuilder.WriteString(fmt.Sprintf(" %s[%q]\n", entryId, ce.Name)) + pkgBuilder.WriteString(fmt.Sprintf(" %s[%q]%s\n", entryId, ce.Name, bundleDeprecation)) if len(ce.Replaces) > 0 { replacesId := fmt.Sprintf("%s-%s", channelID, ce.Replaces) @@ -154,6 +187,7 @@ func (writer *MermaidWriter) WriteChannels(cfg DeclarativeConfig, out io.Writer) } out.Write([]byte("graph LR\n")) + out.Write([]byte(fmt.Sprintf(" classDef deprecated fill:#E8960F\n"))) pkgNames := []string{} for pname := range pkgs { pkgNames = append(pkgNames, pname) @@ -168,6 +202,16 @@ func (writer *MermaidWriter) WriteChannels(cfg DeclarativeConfig, out io.Writer) out.Write([]byte(" end\n")) } + if deprecatedPackage != "" { + out.Write([]byte(fmt.Sprintf("style %s fill:#989695\n", deprecatedPackage))) + } + + if len(deprecatedChannels) > 0 { + for _, deprecatedChannel := range deprecatedChannels { + out.Write([]byte(fmt.Sprintf("style %s fill:#DCD0FF\n", deprecatedChannel))) + } + } + return nil } diff --git a/staging/operator-registry/alpha/declcfg/write_test.go b/staging/operator-registry/alpha/declcfg/write_test.go index 03cca3e2f9..9e98e4c545 100644 --- a/staging/operator-registry/alpha/declcfg/write_test.go +++ b/staging/operator-registry/alpha/declcfg/write_test.go @@ -526,11 +526,12 @@ func TestWriteMermaidChannels(t *testing.T) { startEdge: "", packageFilter: "", expected: `graph LR + classDef deprecated fill:#E8960F %% package "anakin" subgraph "anakin" %% channel "dark" subgraph anakin-dark["dark"] - anakin-dark-anakin.v0.0.1["anakin.v0.0.1"] + anakin-dark-anakin.v0.0.1["anakin.v0.0.1"]:::deprecated anakin-dark-anakin.v0.1.0["anakin.v0.1.0"] anakin-dark-anakin.v0.0.1["anakin.v0.0.1"]-- replace --> anakin-dark-anakin.v0.1.0["anakin.v0.1.0"] anakin-dark-anakin.v0.1.1["anakin.v0.1.1"] @@ -539,7 +540,7 @@ func TestWriteMermaidChannels(t *testing.T) { end %% channel "light" subgraph anakin-light["light"] - anakin-light-anakin.v0.0.1["anakin.v0.0.1"] + anakin-light-anakin.v0.0.1["anakin.v0.0.1"]:::deprecated anakin-light-anakin.v0.1.0["anakin.v0.1.0"] anakin-light-anakin.v0.0.1["anakin.v0.0.1"]-- replace --> anakin-light-anakin.v0.1.0["anakin.v0.1.0"] end @@ -553,6 +554,8 @@ func TestWriteMermaidChannels(t *testing.T) { boba-fett-mando-boba-fett.v1.0.0["boba-fett.v1.0.0"]-- replace --> boba-fett-mando-boba-fett.v2.0.0["boba-fett.v2.0.0"] end end +style anakin fill:#989695 +style anakin-light fill:#DCD0FF `, }, { @@ -561,6 +564,7 @@ func TestWriteMermaidChannels(t *testing.T) { startEdge: "anakin.v0.1.0", packageFilter: "", expected: `graph LR + classDef deprecated fill:#E8960F %% package "anakin" subgraph "anakin" %% channel "dark" @@ -574,6 +578,8 @@ func TestWriteMermaidChannels(t *testing.T) { anakin-light-anakin.v0.1.0["anakin.v0.1.0"] end end +style anakin fill:#989695 +style anakin-light fill:#DCD0FF `, }, { @@ -582,6 +588,7 @@ func TestWriteMermaidChannels(t *testing.T) { startEdge: "", packageFilter: "boba-fett", expected: `graph LR + classDef deprecated fill:#E8960F %% package "boba-fett" subgraph "boba-fett" %% channel "mando" diff --git a/staging/operator-registry/go.mod b/staging/operator-registry/go.mod index 736d7979d5..71c0c24ee1 100644 --- a/staging/operator-registry/go.mod +++ b/staging/operator-registry/go.mod @@ -9,7 +9,6 @@ require ( github.com/containers/image/v5 v5.28.0 github.com/docker/cli v23.0.5+incompatible github.com/docker/distribution v2.8.2+incompatible - github.com/ghodss/yaml v1.0.0 github.com/golang-migrate/migrate/v4 v4.16.1 github.com/golang/mock v1.6.0 github.com/google/go-cmp v0.6.0 @@ -23,7 +22,7 @@ require ( github.com/onsi/gomega v1.27.10 github.com/opencontainers/go-digest v1.0.0 github.com/opencontainers/image-spec v1.1.0-rc4 - github.com/operator-framework/api v0.19.0 + github.com/operator-framework/api v0.20.0 github.com/otiai10/copy v1.2.0 github.com/phayes/freeport v0.0.0-20180830031419-95f893ade6f2 github.com/pkg/errors v0.9.1 diff --git a/staging/operator-registry/go.sum b/staging/operator-registry/go.sum index 558b869ef1..fce3193ae3 100644 --- a/staging/operator-registry/go.sum +++ b/staging/operator-registry/go.sum @@ -165,7 +165,6 @@ github.com/garyburd/redigo v0.0.0-20150301180006-535138d7bcd7/go.mod h1:NR3MbYis github.com/garyburd/redigo v1.6.0 h1:0VruCpn7yAIIu7pWVClQC8wxCJEcG3nyzpMSHKi1PQc= github.com/garyburd/redigo v1.6.0/go.mod h1:NR3MbYisc3/PwhQ00EMzDiPmrwpPxAn5GI05/YaO1SY= github.com/ghodss/yaml v0.0.0-20150909031657-73d445a93680/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= -github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/gliderlabs/ssh v0.2.2/go.mod h1:U7qILu1NlMHj9FlMhZLlkCdDnU1DBEAqr0aevW3Awn0= github.com/go-git/gcfg v1.5.0 h1:Q5ViNfGF8zFgyJWPqYwA7qGFoMTEiBmdlkcfRmpIMa4= @@ -449,8 +448,8 @@ github.com/opencontainers/runc v1.1.9 h1:XR0VIHTGce5eWPkaPesqTBrhW2yAcaraWfsEalN github.com/opencontainers/runc v1.1.9/go.mod h1:CbUumNnWCuTGFukNXahoo/RFBZvDAgRh/smNYNOhA50= github.com/opencontainers/runtime-spec v1.1.0 h1:HHUyrt9mwHUjtasSbXSMvs4cyFxh+Bll4AjJ9odEGpg= github.com/opencontainers/runtime-spec v1.1.0/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0= -github.com/operator-framework/api v0.19.0 h1:QU1CTJU+CufoeneA5rsNlP/uP96s8vDHWUYDFZTauzA= -github.com/operator-framework/api v0.19.0/go.mod h1:SCCslqke6AVOJ5JM+NqNE1CHuAgJLScsL66pnPaSMXs= +github.com/operator-framework/api v0.20.0 h1:A2YCRhr+6s0k3pRJacnwjh1Ue8BqjIGuQ2jvPg9XCB4= +github.com/operator-framework/api v0.20.0/go.mod h1:rXPOhrQ6mMeXqCmpDgt1ALoar9ZlHL+Iy5qut9R99a4= github.com/otiai10/copy v1.2.0 h1:HvG945u96iNadPoG2/Ja2+AUJeW5YuFQMixq9yirC+k= github.com/otiai10/copy v1.2.0/go.mod h1:rrF5dJ5F0t/EWSYODDu4j9/vEeYHMkc8jt0zJChqQWw= github.com/otiai10/curr v0.0.0-20150429015615-9b4961190c95/go.mod h1:9qAhocn7zKJG+0mI8eUu6xqkFDYS2kb2saOteoSB3cE= diff --git a/staging/operator-registry/pkg/configmap/configmap_writer.go b/staging/operator-registry/pkg/configmap/configmap_writer.go index 580aeaeb05..dd8931cc9e 100644 --- a/staging/operator-registry/pkg/configmap/configmap_writer.go +++ b/staging/operator-registry/pkg/configmap/configmap_writer.go @@ -6,12 +6,12 @@ import ( "os" "regexp" - "github.com/ghodss/yaml" "github.com/sirupsen/logrus" batchv1 "k8s.io/api/batch/v1" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/client-go/kubernetes" + "sigs.k8s.io/yaml" "github.com/operator-framework/operator-registry/pkg/client" "github.com/operator-framework/operator-registry/pkg/lib/bundle" diff --git a/staging/operator-registry/pkg/lib/bundle/validate.go b/staging/operator-registry/pkg/lib/bundle/validate.go index a11025c285..66e29dffc0 100644 --- a/staging/operator-registry/pkg/lib/bundle/validate.go +++ b/staging/operator-registry/pkg/lib/bundle/validate.go @@ -8,7 +8,6 @@ import ( "path/filepath" "strings" - y "github.com/ghodss/yaml" log "github.com/sirupsen/logrus" apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" apiextensionsv1beta1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1" @@ -18,6 +17,7 @@ import ( "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/util/validation/field" k8syaml "k8s.io/apimachinery/pkg/util/yaml" + y "sigs.k8s.io/yaml" "github.com/operator-framework/api/pkg/manifests" v1 "github.com/operator-framework/api/pkg/operators/v1alpha1" diff --git a/staging/operator-registry/pkg/lib/indexer/indexer_test.go b/staging/operator-registry/pkg/lib/indexer/indexer_test.go index 9ced69e37f..f2fce1d328 100644 --- a/staging/operator-registry/pkg/lib/indexer/indexer_test.go +++ b/staging/operator-registry/pkg/lib/indexer/indexer_test.go @@ -6,7 +6,7 @@ import ( "sort" "testing" - "github.com/ghodss/yaml" + "sigs.k8s.io/yaml" pregistry "github.com/operator-framework/operator-registry/pkg/registry" "github.com/operator-framework/operator-registry/pkg/sqlite" diff --git a/staging/operator-registry/pkg/sqlite/configmap.go b/staging/operator-registry/pkg/sqlite/configmap.go index 0f727e1d45..44e2302cc4 100644 --- a/staging/operator-registry/pkg/sqlite/configmap.go +++ b/staging/operator-registry/pkg/sqlite/configmap.go @@ -5,13 +5,13 @@ import ( "fmt" "strings" - "github.com/ghodss/yaml" "github.com/sirupsen/logrus" v1 "k8s.io/api/core/v1" "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "k8s.io/apimachinery/pkg/runtime" utilerrors "k8s.io/apimachinery/pkg/util/errors" + "sigs.k8s.io/yaml" "github.com/operator-framework/operator-registry/pkg/registry" ) diff --git a/vendor/github.com/ghodss/yaml/.gitignore b/vendor/github.com/ghodss/yaml/.gitignore deleted file mode 100644 index e256a31e00..0000000000 --- a/vendor/github.com/ghodss/yaml/.gitignore +++ /dev/null @@ -1,20 +0,0 @@ -# OSX leaves these everywhere on SMB shares -._* - -# Eclipse files -.classpath -.project -.settings/** - -# Emacs save files -*~ - -# Vim-related files -[._]*.s[a-w][a-z] -[._]s[a-w][a-z] -*.un~ -Session.vim -.netrwhist - -# Go test binaries -*.test diff --git a/vendor/github.com/ghodss/yaml/.travis.yml b/vendor/github.com/ghodss/yaml/.travis.yml deleted file mode 100644 index 0e9d6edc01..0000000000 --- a/vendor/github.com/ghodss/yaml/.travis.yml +++ /dev/null @@ -1,7 +0,0 @@ -language: go -go: - - 1.3 - - 1.4 -script: - - go test - - go build diff --git a/vendor/github.com/ghodss/yaml/LICENSE b/vendor/github.com/ghodss/yaml/LICENSE deleted file mode 100644 index 7805d36de7..0000000000 --- a/vendor/github.com/ghodss/yaml/LICENSE +++ /dev/null @@ -1,50 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2014 Sam Ghods - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - - -Copyright (c) 2012 The Go Authors. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - * Neither the name of Google Inc. nor the names of its -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/vendor/github.com/ghodss/yaml/README.md b/vendor/github.com/ghodss/yaml/README.md deleted file mode 100644 index 0200f75b4d..0000000000 --- a/vendor/github.com/ghodss/yaml/README.md +++ /dev/null @@ -1,121 +0,0 @@ -# YAML marshaling and unmarshaling support for Go - -[![Build Status](https://travis-ci.org/ghodss/yaml.svg)](https://travis-ci.org/ghodss/yaml) - -## Introduction - -A wrapper around [go-yaml](https://github.com/go-yaml/yaml) designed to enable a better way of handling YAML when marshaling to and from structs. - -In short, this library first converts YAML to JSON using go-yaml and then uses `json.Marshal` and `json.Unmarshal` to convert to or from the struct. This means that it effectively reuses the JSON struct tags as well as the custom JSON methods `MarshalJSON` and `UnmarshalJSON` unlike go-yaml. For a detailed overview of the rationale behind this method, [see this blog post](http://ghodss.com/2014/the-right-way-to-handle-yaml-in-golang/). - -## Compatibility - -This package uses [go-yaml](https://github.com/go-yaml/yaml) and therefore supports [everything go-yaml supports](https://github.com/go-yaml/yaml#compatibility). - -## Caveats - -**Caveat #1:** When using `yaml.Marshal` and `yaml.Unmarshal`, binary data should NOT be preceded with the `!!binary` YAML tag. If you do, go-yaml will convert the binary data from base64 to native binary data, which is not compatible with JSON. You can still use binary in your YAML files though - just store them without the `!!binary` tag and decode the base64 in your code (e.g. in the custom JSON methods `MarshalJSON` and `UnmarshalJSON`). This also has the benefit that your YAML and your JSON binary data will be decoded exactly the same way. As an example: - -``` -BAD: - exampleKey: !!binary gIGC - -GOOD: - exampleKey: gIGC -... and decode the base64 data in your code. -``` - -**Caveat #2:** When using `YAMLToJSON` directly, maps with keys that are maps will result in an error since this is not supported by JSON. This error will occur in `Unmarshal` as well since you can't unmarshal map keys anyways since struct fields can't be keys. - -## Installation and usage - -To install, run: - -``` -$ go get github.com/ghodss/yaml -``` - -And import using: - -``` -import "github.com/ghodss/yaml" -``` - -Usage is very similar to the JSON library: - -```go -package main - -import ( - "fmt" - - "github.com/ghodss/yaml" -) - -type Person struct { - Name string `json:"name"` // Affects YAML field names too. - Age int `json:"age"` -} - -func main() { - // Marshal a Person struct to YAML. - p := Person{"John", 30} - y, err := yaml.Marshal(p) - if err != nil { - fmt.Printf("err: %v\n", err) - return - } - fmt.Println(string(y)) - /* Output: - age: 30 - name: John - */ - - // Unmarshal the YAML back into a Person struct. - var p2 Person - err = yaml.Unmarshal(y, &p2) - if err != nil { - fmt.Printf("err: %v\n", err) - return - } - fmt.Println(p2) - /* Output: - {John 30} - */ -} -``` - -`yaml.YAMLToJSON` and `yaml.JSONToYAML` methods are also available: - -```go -package main - -import ( - "fmt" - - "github.com/ghodss/yaml" -) - -func main() { - j := []byte(`{"name": "John", "age": 30}`) - y, err := yaml.JSONToYAML(j) - if err != nil { - fmt.Printf("err: %v\n", err) - return - } - fmt.Println(string(y)) - /* Output: - name: John - age: 30 - */ - j2, err := yaml.YAMLToJSON(y) - if err != nil { - fmt.Printf("err: %v\n", err) - return - } - fmt.Println(string(j2)) - /* Output: - {"age":30,"name":"John"} - */ -} -``` diff --git a/vendor/github.com/ghodss/yaml/fields.go b/vendor/github.com/ghodss/yaml/fields.go deleted file mode 100644 index 5860074026..0000000000 --- a/vendor/github.com/ghodss/yaml/fields.go +++ /dev/null @@ -1,501 +0,0 @@ -// Copyright 2013 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. -package yaml - -import ( - "bytes" - "encoding" - "encoding/json" - "reflect" - "sort" - "strings" - "sync" - "unicode" - "unicode/utf8" -) - -// indirect walks down v allocating pointers as needed, -// until it gets to a non-pointer. -// if it encounters an Unmarshaler, indirect stops and returns that. -// if decodingNull is true, indirect stops at the last pointer so it can be set to nil. -func indirect(v reflect.Value, decodingNull bool) (json.Unmarshaler, encoding.TextUnmarshaler, reflect.Value) { - // If v is a named type and is addressable, - // start with its address, so that if the type has pointer methods, - // we find them. - if v.Kind() != reflect.Ptr && v.Type().Name() != "" && v.CanAddr() { - v = v.Addr() - } - for { - // Load value from interface, but only if the result will be - // usefully addressable. - if v.Kind() == reflect.Interface && !v.IsNil() { - e := v.Elem() - if e.Kind() == reflect.Ptr && !e.IsNil() && (!decodingNull || e.Elem().Kind() == reflect.Ptr) { - v = e - continue - } - } - - if v.Kind() != reflect.Ptr { - break - } - - if v.Elem().Kind() != reflect.Ptr && decodingNull && v.CanSet() { - break - } - if v.IsNil() { - if v.CanSet() { - v.Set(reflect.New(v.Type().Elem())) - } else { - v = reflect.New(v.Type().Elem()) - } - } - if v.Type().NumMethod() > 0 { - if u, ok := v.Interface().(json.Unmarshaler); ok { - return u, nil, reflect.Value{} - } - if u, ok := v.Interface().(encoding.TextUnmarshaler); ok { - return nil, u, reflect.Value{} - } - } - v = v.Elem() - } - return nil, nil, v -} - -// A field represents a single field found in a struct. -type field struct { - name string - nameBytes []byte // []byte(name) - equalFold func(s, t []byte) bool // bytes.EqualFold or equivalent - - tag bool - index []int - typ reflect.Type - omitEmpty bool - quoted bool -} - -func fillField(f field) field { - f.nameBytes = []byte(f.name) - f.equalFold = foldFunc(f.nameBytes) - return f -} - -// byName sorts field by name, breaking ties with depth, -// then breaking ties with "name came from json tag", then -// breaking ties with index sequence. -type byName []field - -func (x byName) Len() int { return len(x) } - -func (x byName) Swap(i, j int) { x[i], x[j] = x[j], x[i] } - -func (x byName) Less(i, j int) bool { - if x[i].name != x[j].name { - return x[i].name < x[j].name - } - if len(x[i].index) != len(x[j].index) { - return len(x[i].index) < len(x[j].index) - } - if x[i].tag != x[j].tag { - return x[i].tag - } - return byIndex(x).Less(i, j) -} - -// byIndex sorts field by index sequence. -type byIndex []field - -func (x byIndex) Len() int { return len(x) } - -func (x byIndex) Swap(i, j int) { x[i], x[j] = x[j], x[i] } - -func (x byIndex) Less(i, j int) bool { - for k, xik := range x[i].index { - if k >= len(x[j].index) { - return false - } - if xik != x[j].index[k] { - return xik < x[j].index[k] - } - } - return len(x[i].index) < len(x[j].index) -} - -// typeFields returns a list of fields that JSON should recognize for the given type. -// The algorithm is breadth-first search over the set of structs to include - the top struct -// and then any reachable anonymous structs. -func typeFields(t reflect.Type) []field { - // Anonymous fields to explore at the current level and the next. - current := []field{} - next := []field{{typ: t}} - - // Count of queued names for current level and the next. - count := map[reflect.Type]int{} - nextCount := map[reflect.Type]int{} - - // Types already visited at an earlier level. - visited := map[reflect.Type]bool{} - - // Fields found. - var fields []field - - for len(next) > 0 { - current, next = next, current[:0] - count, nextCount = nextCount, map[reflect.Type]int{} - - for _, f := range current { - if visited[f.typ] { - continue - } - visited[f.typ] = true - - // Scan f.typ for fields to include. - for i := 0; i < f.typ.NumField(); i++ { - sf := f.typ.Field(i) - if sf.PkgPath != "" { // unexported - continue - } - tag := sf.Tag.Get("json") - if tag == "-" { - continue - } - name, opts := parseTag(tag) - if !isValidTag(name) { - name = "" - } - index := make([]int, len(f.index)+1) - copy(index, f.index) - index[len(f.index)] = i - - ft := sf.Type - if ft.Name() == "" && ft.Kind() == reflect.Ptr { - // Follow pointer. - ft = ft.Elem() - } - - // Record found field and index sequence. - if name != "" || !sf.Anonymous || ft.Kind() != reflect.Struct { - tagged := name != "" - if name == "" { - name = sf.Name - } - fields = append(fields, fillField(field{ - name: name, - tag: tagged, - index: index, - typ: ft, - omitEmpty: opts.Contains("omitempty"), - quoted: opts.Contains("string"), - })) - if count[f.typ] > 1 { - // If there were multiple instances, add a second, - // so that the annihilation code will see a duplicate. - // It only cares about the distinction between 1 or 2, - // so don't bother generating any more copies. - fields = append(fields, fields[len(fields)-1]) - } - continue - } - - // Record new anonymous struct to explore in next round. - nextCount[ft]++ - if nextCount[ft] == 1 { - next = append(next, fillField(field{name: ft.Name(), index: index, typ: ft})) - } - } - } - } - - sort.Sort(byName(fields)) - - // Delete all fields that are hidden by the Go rules for embedded fields, - // except that fields with JSON tags are promoted. - - // The fields are sorted in primary order of name, secondary order - // of field index length. Loop over names; for each name, delete - // hidden fields by choosing the one dominant field that survives. - out := fields[:0] - for advance, i := 0, 0; i < len(fields); i += advance { - // One iteration per name. - // Find the sequence of fields with the name of this first field. - fi := fields[i] - name := fi.name - for advance = 1; i+advance < len(fields); advance++ { - fj := fields[i+advance] - if fj.name != name { - break - } - } - if advance == 1 { // Only one field with this name - out = append(out, fi) - continue - } - dominant, ok := dominantField(fields[i : i+advance]) - if ok { - out = append(out, dominant) - } - } - - fields = out - sort.Sort(byIndex(fields)) - - return fields -} - -// dominantField looks through the fields, all of which are known to -// have the same name, to find the single field that dominates the -// others using Go's embedding rules, modified by the presence of -// JSON tags. If there are multiple top-level fields, the boolean -// will be false: This condition is an error in Go and we skip all -// the fields. -func dominantField(fields []field) (field, bool) { - // The fields are sorted in increasing index-length order. The winner - // must therefore be one with the shortest index length. Drop all - // longer entries, which is easy: just truncate the slice. - length := len(fields[0].index) - tagged := -1 // Index of first tagged field. - for i, f := range fields { - if len(f.index) > length { - fields = fields[:i] - break - } - if f.tag { - if tagged >= 0 { - // Multiple tagged fields at the same level: conflict. - // Return no field. - return field{}, false - } - tagged = i - } - } - if tagged >= 0 { - return fields[tagged], true - } - // All remaining fields have the same length. If there's more than one, - // we have a conflict (two fields named "X" at the same level) and we - // return no field. - if len(fields) > 1 { - return field{}, false - } - return fields[0], true -} - -var fieldCache struct { - sync.RWMutex - m map[reflect.Type][]field -} - -// cachedTypeFields is like typeFields but uses a cache to avoid repeated work. -func cachedTypeFields(t reflect.Type) []field { - fieldCache.RLock() - f := fieldCache.m[t] - fieldCache.RUnlock() - if f != nil { - return f - } - - // Compute fields without lock. - // Might duplicate effort but won't hold other computations back. - f = typeFields(t) - if f == nil { - f = []field{} - } - - fieldCache.Lock() - if fieldCache.m == nil { - fieldCache.m = map[reflect.Type][]field{} - } - fieldCache.m[t] = f - fieldCache.Unlock() - return f -} - -func isValidTag(s string) bool { - if s == "" { - return false - } - for _, c := range s { - switch { - case strings.ContainsRune("!#$%&()*+-./:<=>?@[]^_{|}~ ", c): - // Backslash and quote chars are reserved, but - // otherwise any punctuation chars are allowed - // in a tag name. - default: - if !unicode.IsLetter(c) && !unicode.IsDigit(c) { - return false - } - } - } - return true -} - -const ( - caseMask = ^byte(0x20) // Mask to ignore case in ASCII. - kelvin = '\u212a' - smallLongEss = '\u017f' -) - -// foldFunc returns one of four different case folding equivalence -// functions, from most general (and slow) to fastest: -// -// 1) bytes.EqualFold, if the key s contains any non-ASCII UTF-8 -// 2) equalFoldRight, if s contains special folding ASCII ('k', 'K', 's', 'S') -// 3) asciiEqualFold, no special, but includes non-letters (including _) -// 4) simpleLetterEqualFold, no specials, no non-letters. -// -// The letters S and K are special because they map to 3 runes, not just 2: -// * S maps to s and to U+017F 'ſ' Latin small letter long s -// * k maps to K and to U+212A 'K' Kelvin sign -// See http://play.golang.org/p/tTxjOc0OGo -// -// The returned function is specialized for matching against s and -// should only be given s. It's not curried for performance reasons. -func foldFunc(s []byte) func(s, t []byte) bool { - nonLetter := false - special := false // special letter - for _, b := range s { - if b >= utf8.RuneSelf { - return bytes.EqualFold - } - upper := b & caseMask - if upper < 'A' || upper > 'Z' { - nonLetter = true - } else if upper == 'K' || upper == 'S' { - // See above for why these letters are special. - special = true - } - } - if special { - return equalFoldRight - } - if nonLetter { - return asciiEqualFold - } - return simpleLetterEqualFold -} - -// equalFoldRight is a specialization of bytes.EqualFold when s is -// known to be all ASCII (including punctuation), but contains an 's', -// 'S', 'k', or 'K', requiring a Unicode fold on the bytes in t. -// See comments on foldFunc. -func equalFoldRight(s, t []byte) bool { - for _, sb := range s { - if len(t) == 0 { - return false - } - tb := t[0] - if tb < utf8.RuneSelf { - if sb != tb { - sbUpper := sb & caseMask - if 'A' <= sbUpper && sbUpper <= 'Z' { - if sbUpper != tb&caseMask { - return false - } - } else { - return false - } - } - t = t[1:] - continue - } - // sb is ASCII and t is not. t must be either kelvin - // sign or long s; sb must be s, S, k, or K. - tr, size := utf8.DecodeRune(t) - switch sb { - case 's', 'S': - if tr != smallLongEss { - return false - } - case 'k', 'K': - if tr != kelvin { - return false - } - default: - return false - } - t = t[size:] - - } - if len(t) > 0 { - return false - } - return true -} - -// asciiEqualFold is a specialization of bytes.EqualFold for use when -// s is all ASCII (but may contain non-letters) and contains no -// special-folding letters. -// See comments on foldFunc. -func asciiEqualFold(s, t []byte) bool { - if len(s) != len(t) { - return false - } - for i, sb := range s { - tb := t[i] - if sb == tb { - continue - } - if ('a' <= sb && sb <= 'z') || ('A' <= sb && sb <= 'Z') { - if sb&caseMask != tb&caseMask { - return false - } - } else { - return false - } - } - return true -} - -// simpleLetterEqualFold is a specialization of bytes.EqualFold for -// use when s is all ASCII letters (no underscores, etc) and also -// doesn't contain 'k', 'K', 's', or 'S'. -// See comments on foldFunc. -func simpleLetterEqualFold(s, t []byte) bool { - if len(s) != len(t) { - return false - } - for i, b := range s { - if b&caseMask != t[i]&caseMask { - return false - } - } - return true -} - -// tagOptions is the string following a comma in a struct field's "json" -// tag, or the empty string. It does not include the leading comma. -type tagOptions string - -// parseTag splits a struct field's json tag into its name and -// comma-separated options. -func parseTag(tag string) (string, tagOptions) { - if idx := strings.Index(tag, ","); idx != -1 { - return tag[:idx], tagOptions(tag[idx+1:]) - } - return tag, tagOptions("") -} - -// Contains reports whether a comma-separated list of options -// contains a particular substr flag. substr must be surrounded by a -// string boundary or commas. -func (o tagOptions) Contains(optionName string) bool { - if len(o) == 0 { - return false - } - s := string(o) - for s != "" { - var next string - i := strings.Index(s, ",") - if i >= 0 { - s, next = s[:i], s[i+1:] - } - if s == optionName { - return true - } - s = next - } - return false -} diff --git a/vendor/github.com/ghodss/yaml/yaml.go b/vendor/github.com/ghodss/yaml/yaml.go deleted file mode 100644 index 4fb4054a8b..0000000000 --- a/vendor/github.com/ghodss/yaml/yaml.go +++ /dev/null @@ -1,277 +0,0 @@ -package yaml - -import ( - "bytes" - "encoding/json" - "fmt" - "reflect" - "strconv" - - "gopkg.in/yaml.v2" -) - -// Marshals the object into JSON then converts JSON to YAML and returns the -// YAML. -func Marshal(o interface{}) ([]byte, error) { - j, err := json.Marshal(o) - if err != nil { - return nil, fmt.Errorf("error marshaling into JSON: %v", err) - } - - y, err := JSONToYAML(j) - if err != nil { - return nil, fmt.Errorf("error converting JSON to YAML: %v", err) - } - - return y, nil -} - -// Converts YAML to JSON then uses JSON to unmarshal into an object. -func Unmarshal(y []byte, o interface{}) error { - vo := reflect.ValueOf(o) - j, err := yamlToJSON(y, &vo) - if err != nil { - return fmt.Errorf("error converting YAML to JSON: %v", err) - } - - err = json.Unmarshal(j, o) - if err != nil { - return fmt.Errorf("error unmarshaling JSON: %v", err) - } - - return nil -} - -// Convert JSON to YAML. -func JSONToYAML(j []byte) ([]byte, error) { - // Convert the JSON to an object. - var jsonObj interface{} - // We are using yaml.Unmarshal here (instead of json.Unmarshal) because the - // Go JSON library doesn't try to pick the right number type (int, float, - // etc.) when unmarshalling to interface{}, it just picks float64 - // universally. go-yaml does go through the effort of picking the right - // number type, so we can preserve number type throughout this process. - err := yaml.Unmarshal(j, &jsonObj) - if err != nil { - return nil, err - } - - // Marshal this object into YAML. - return yaml.Marshal(jsonObj) -} - -// Convert YAML to JSON. Since JSON is a subset of YAML, passing JSON through -// this method should be a no-op. -// -// Things YAML can do that are not supported by JSON: -// * In YAML you can have binary and null keys in your maps. These are invalid -// in JSON. (int and float keys are converted to strings.) -// * Binary data in YAML with the !!binary tag is not supported. If you want to -// use binary data with this library, encode the data as base64 as usual but do -// not use the !!binary tag in your YAML. This will ensure the original base64 -// encoded data makes it all the way through to the JSON. -func YAMLToJSON(y []byte) ([]byte, error) { - return yamlToJSON(y, nil) -} - -func yamlToJSON(y []byte, jsonTarget *reflect.Value) ([]byte, error) { - // Convert the YAML to an object. - var yamlObj interface{} - err := yaml.Unmarshal(y, &yamlObj) - if err != nil { - return nil, err - } - - // YAML objects are not completely compatible with JSON objects (e.g. you - // can have non-string keys in YAML). So, convert the YAML-compatible object - // to a JSON-compatible object, failing with an error if irrecoverable - // incompatibilties happen along the way. - jsonObj, err := convertToJSONableObject(yamlObj, jsonTarget) - if err != nil { - return nil, err - } - - // Convert this object to JSON and return the data. - return json.Marshal(jsonObj) -} - -func convertToJSONableObject(yamlObj interface{}, jsonTarget *reflect.Value) (interface{}, error) { - var err error - - // Resolve jsonTarget to a concrete value (i.e. not a pointer or an - // interface). We pass decodingNull as false because we're not actually - // decoding into the value, we're just checking if the ultimate target is a - // string. - if jsonTarget != nil { - ju, tu, pv := indirect(*jsonTarget, false) - // We have a JSON or Text Umarshaler at this level, so we can't be trying - // to decode into a string. - if ju != nil || tu != nil { - jsonTarget = nil - } else { - jsonTarget = &pv - } - } - - // If yamlObj is a number or a boolean, check if jsonTarget is a string - - // if so, coerce. Else return normal. - // If yamlObj is a map or array, find the field that each key is - // unmarshaling to, and when you recurse pass the reflect.Value for that - // field back into this function. - switch typedYAMLObj := yamlObj.(type) { - case map[interface{}]interface{}: - // JSON does not support arbitrary keys in a map, so we must convert - // these keys to strings. - // - // From my reading of go-yaml v2 (specifically the resolve function), - // keys can only have the types string, int, int64, float64, binary - // (unsupported), or null (unsupported). - strMap := make(map[string]interface{}) - for k, v := range typedYAMLObj { - // Resolve the key to a string first. - var keyString string - switch typedKey := k.(type) { - case string: - keyString = typedKey - case int: - keyString = strconv.Itoa(typedKey) - case int64: - // go-yaml will only return an int64 as a key if the system - // architecture is 32-bit and the key's value is between 32-bit - // and 64-bit. Otherwise the key type will simply be int. - keyString = strconv.FormatInt(typedKey, 10) - case float64: - // Stolen from go-yaml to use the same conversion to string as - // the go-yaml library uses to convert float to string when - // Marshaling. - s := strconv.FormatFloat(typedKey, 'g', -1, 32) - switch s { - case "+Inf": - s = ".inf" - case "-Inf": - s = "-.inf" - case "NaN": - s = ".nan" - } - keyString = s - case bool: - if typedKey { - keyString = "true" - } else { - keyString = "false" - } - default: - return nil, fmt.Errorf("Unsupported map key of type: %s, key: %+#v, value: %+#v", - reflect.TypeOf(k), k, v) - } - - // jsonTarget should be a struct or a map. If it's a struct, find - // the field it's going to map to and pass its reflect.Value. If - // it's a map, find the element type of the map and pass the - // reflect.Value created from that type. If it's neither, just pass - // nil - JSON conversion will error for us if it's a real issue. - if jsonTarget != nil { - t := *jsonTarget - if t.Kind() == reflect.Struct { - keyBytes := []byte(keyString) - // Find the field that the JSON library would use. - var f *field - fields := cachedTypeFields(t.Type()) - for i := range fields { - ff := &fields[i] - if bytes.Equal(ff.nameBytes, keyBytes) { - f = ff - break - } - // Do case-insensitive comparison. - if f == nil && ff.equalFold(ff.nameBytes, keyBytes) { - f = ff - } - } - if f != nil { - // Find the reflect.Value of the most preferential - // struct field. - jtf := t.Field(f.index[0]) - strMap[keyString], err = convertToJSONableObject(v, &jtf) - if err != nil { - return nil, err - } - continue - } - } else if t.Kind() == reflect.Map { - // Create a zero value of the map's element type to use as - // the JSON target. - jtv := reflect.Zero(t.Type().Elem()) - strMap[keyString], err = convertToJSONableObject(v, &jtv) - if err != nil { - return nil, err - } - continue - } - } - strMap[keyString], err = convertToJSONableObject(v, nil) - if err != nil { - return nil, err - } - } - return strMap, nil - case []interface{}: - // We need to recurse into arrays in case there are any - // map[interface{}]interface{}'s inside and to convert any - // numbers to strings. - - // If jsonTarget is a slice (which it really should be), find the - // thing it's going to map to. If it's not a slice, just pass nil - // - JSON conversion will error for us if it's a real issue. - var jsonSliceElemValue *reflect.Value - if jsonTarget != nil { - t := *jsonTarget - if t.Kind() == reflect.Slice { - // By default slices point to nil, but we need a reflect.Value - // pointing to a value of the slice type, so we create one here. - ev := reflect.Indirect(reflect.New(t.Type().Elem())) - jsonSliceElemValue = &ev - } - } - - // Make and use a new array. - arr := make([]interface{}, len(typedYAMLObj)) - for i, v := range typedYAMLObj { - arr[i], err = convertToJSONableObject(v, jsonSliceElemValue) - if err != nil { - return nil, err - } - } - return arr, nil - default: - // If the target type is a string and the YAML type is a number, - // convert the YAML type to a string. - if jsonTarget != nil && (*jsonTarget).Kind() == reflect.String { - // Based on my reading of go-yaml, it may return int, int64, - // float64, or uint64. - var s string - switch typedVal := typedYAMLObj.(type) { - case int: - s = strconv.FormatInt(int64(typedVal), 10) - case int64: - s = strconv.FormatInt(typedVal, 10) - case float64: - s = strconv.FormatFloat(typedVal, 'g', -1, 32) - case uint64: - s = strconv.FormatUint(typedVal, 10) - case bool: - if typedVal { - s = "true" - } else { - s = "false" - } - } - if len(s) > 0 { - yamlObj = interface{}(s) - } - } - return yamlObj, nil - } - - return nil, nil -} diff --git a/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/controller/operators/catalog/operator.go b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/controller/operators/catalog/operator.go index 7394fb1241..2b0e3d592e 100644 --- a/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/controller/operators/catalog/operator.go +++ b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/controller/operators/catalog/operator.go @@ -581,11 +581,20 @@ func NewOperator(ctx context.Context, kubeconfigPath string, clock utilclock.Clo sharedIndexInformers = append(sharedIndexInformers, buPodInformer.Informer()) // Wire ConfigMaps - configMapInformer := informers.NewSharedInformerFactoryWithOptions(op.opClient.KubernetesInterface(), resyncPeriod(), informers.WithTweakListOptions(func(options *metav1.ListOptions) { - options.LabelSelector = install.OLMManagedLabelKey - })).Core().V1().ConfigMaps() + configMapInformer := k8sInformerFactory.Core().V1().ConfigMaps() op.lister.CoreV1().RegisterConfigMapLister(metav1.NamespaceAll, configMapInformer.Lister()) sharedIndexInformers = append(sharedIndexInformers, configMapInformer.Informer()) + configmapsgvk := corev1.SchemeGroupVersion.WithResource("configmaps") + if err := labelObjects(configmapsgvk, configMapInformer.Informer(), labeller.ObjectLabeler[*corev1.ConfigMap, *corev1applyconfigurations.ConfigMapApplyConfiguration]( + ctx, op.logger, labeller.Filter(configmapsgvk), + configMapInformer.Lister().List, + corev1applyconfigurations.ConfigMap, + func(namespace string, ctx context.Context, cfg *corev1applyconfigurations.ConfigMapApplyConfiguration, opts metav1.ApplyOptions) (*corev1.ConfigMap, error) { + return op.opClient.KubernetesInterface().CoreV1().ConfigMaps(namespace).Apply(ctx, cfg, opts) + }, + )); err != nil { + return nil, err + } // Wire Jobs jobInformer := k8sInformerFactory.Batch().V1().Jobs() diff --git a/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/controller/operators/catalog/subscription/reconciler.go b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/controller/operators/catalog/subscription/reconciler.go index 982e6164d9..374e49fb77 100644 --- a/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/controller/operators/catalog/subscription/reconciler.go +++ b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/controller/operators/catalog/subscription/reconciler.go @@ -128,10 +128,9 @@ func (c *catalogHealthReconciler) updateDeprecatedStatus(ctx context.Context, su if c.sourceProvider == nil { return false, nil } - - source, ok := c.sourceProvider.Sources(sub.Namespace)[cache.SourceKey{ + source, ok := c.sourceProvider.Sources(sub.Spec.CatalogSourceNamespace)[cache.SourceKey{ Name: sub.Spec.CatalogSource, - Namespace: sub.Namespace, + Namespace: sub.Spec.CatalogSourceNamespace, }] if !ok { return false, nil diff --git a/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/controller/operators/labeller/filters.go b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/controller/operators/labeller/filters.go index 11e04a24d8..2167d34544 100644 --- a/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/controller/operators/labeller/filters.go +++ b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/controller/operators/labeller/filters.go @@ -59,7 +59,8 @@ func ServiceAccountFilter(isServiceAccountReferenced func(namespace, name string } var filters = map[schema.GroupVersionResource]func(metav1.Object) bool{ - corev1.SchemeGroupVersion.WithResource("services"): HasOLMOwnerRef, + corev1.SchemeGroupVersion.WithResource("configmaps"): HasOLMOwnerRef, + corev1.SchemeGroupVersion.WithResource("services"): HasOLMOwnerRef, corev1.SchemeGroupVersion.WithResource("pods"): func(object metav1.Object) bool { _, ok := object.GetLabels()[reconciler.CatalogSourceLabelKey] return ok diff --git a/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/controller/registry/reconciler/configmap.go b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/controller/registry/reconciler/configmap.go index 2fdb4775b6..654484125e 100644 --- a/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/controller/registry/reconciler/configmap.go +++ b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/controller/registry/reconciler/configmap.go @@ -290,9 +290,11 @@ func (c *ConfigMapRegistryReconciler) EnsureRegistryServer(logger *logrus.Entry, if source.Spec.SourceType == v1alpha1.SourceTypeConfigmap || source.Spec.SourceType == v1alpha1.SourceTypeInternal { // fetch configmap first, exit early if we can't find it - configMap, err := c.Lister.CoreV1().ConfigMapLister().ConfigMaps(source.GetNamespace()).Get(source.Spec.ConfigMap) + // we use the live client here instead of a lister since our listers are scoped to objects with the olm.managed label, + // and this configmap is a user-provided input to the catalog source and will not have that label + configMap, err := c.OpClient.KubernetesInterface().CoreV1().ConfigMaps(source.GetNamespace()).Get(context.TODO(), source.Spec.ConfigMap, metav1.GetOptions{}) if err != nil { - return fmt.Errorf("unable to get configmap %s/%s from cache", source.GetNamespace(), source.Spec.ConfigMap) + return fmt.Errorf("unable to find configmap %s/%s: %w", source.GetNamespace(), source.Spec.ConfigMap, err) } if source.ConfigMapChanges(configMap) { @@ -459,9 +461,11 @@ func (c *ConfigMapRegistryReconciler) CheckRegistryServer(logger *logrus.Entry, } if source.Spec.SourceType == v1alpha1.SourceTypeConfigmap || source.Spec.SourceType == v1alpha1.SourceTypeInternal { - configMap, err := c.Lister.CoreV1().ConfigMapLister().ConfigMaps(source.GetNamespace()).Get(source.Spec.ConfigMap) + // we use the live client here instead of a lister since our listers are scoped to objects with the olm.managed label, + // and this configmap is a user-provided input to the catalog source and will not have that label + configMap, err := c.OpClient.KubernetesInterface().CoreV1().ConfigMaps(source.GetNamespace()).Get(context.TODO(), source.Spec.ConfigMap, metav1.GetOptions{}) if err != nil { - return false, fmt.Errorf("unable to get configmap %s/%s from cache", source.GetNamespace(), source.Spec.ConfigMap) + return false, fmt.Errorf("unable to find configmap %s/%s: %w", source.GetNamespace(), source.Spec.ConfigMap, err) } if source.ConfigMapChanges(configMap) { diff --git a/vendor/github.com/operator-framework/operator-registry/alpha/declcfg/write.go b/vendor/github.com/operator-framework/operator-registry/alpha/declcfg/write.go index 049d96b22f..9856c2e1ee 100644 --- a/vendor/github.com/operator-framework/operator-registry/alpha/declcfg/write.go +++ b/vendor/github.com/operator-framework/operator-registry/alpha/declcfg/write.go @@ -106,6 +106,26 @@ func (writer *MermaidWriter) WriteChannels(cfg DeclarativeConfig, out io.Writer) minEdgePackage := writer.getMinEdgePackage(&cfg) + depByPackage := sets.Set[string]{} + depByChannel := sets.Set[string]{} + depByBundle := sets.Set[string]{} + + for _, d := range cfg.Deprecations { + for _, e := range d.Entries { + switch e.Reference.Schema { + case SchemaPackage: + depByPackage.Insert(d.Package) + case SchemaChannel: + depByChannel.Insert(e.Reference.Name) + case SchemaBundle: + depByBundle.Insert(e.Reference.Name) + } + } + } + + var deprecatedPackage string + deprecatedChannels := []string{} + for _, c := range cfg.Channels { filteredChannel := writer.filterChannel(&c, versionMap, minVersion, minEdgePackage) if filteredChannel != nil { @@ -119,10 +139,23 @@ func (writer *MermaidWriter) WriteChannels(cfg DeclarativeConfig, out io.Writer) pkgBuilder.WriteString(fmt.Sprintf(" %%%% channel %q\n", filteredChannel.Name)) pkgBuilder.WriteString(fmt.Sprintf(" subgraph %s[%q]\n", channelID, filteredChannel.Name)) + if depByPackage.Has(filteredChannel.Package) { + deprecatedPackage = filteredChannel.Package + } + + if depByChannel.Has(filteredChannel.Name) { + deprecatedChannels = append(deprecatedChannels, channelID) + } + for _, ce := range filteredChannel.Entries { if versionMap[ce.Name].GE(minVersion) { + bundleDeprecation := "" + if depByBundle.Has(ce.Name) { + bundleDeprecation = ":::deprecated" + } + entryId := fmt.Sprintf("%s-%s", channelID, ce.Name) - pkgBuilder.WriteString(fmt.Sprintf(" %s[%q]\n", entryId, ce.Name)) + pkgBuilder.WriteString(fmt.Sprintf(" %s[%q]%s\n", entryId, ce.Name, bundleDeprecation)) if len(ce.Replaces) > 0 { replacesId := fmt.Sprintf("%s-%s", channelID, ce.Replaces) @@ -154,6 +187,7 @@ func (writer *MermaidWriter) WriteChannels(cfg DeclarativeConfig, out io.Writer) } out.Write([]byte("graph LR\n")) + out.Write([]byte(fmt.Sprintf(" classDef deprecated fill:#E8960F\n"))) pkgNames := []string{} for pname := range pkgs { pkgNames = append(pkgNames, pname) @@ -168,6 +202,16 @@ func (writer *MermaidWriter) WriteChannels(cfg DeclarativeConfig, out io.Writer) out.Write([]byte(" end\n")) } + if deprecatedPackage != "" { + out.Write([]byte(fmt.Sprintf("style %s fill:#989695\n", deprecatedPackage))) + } + + if len(deprecatedChannels) > 0 { + for _, deprecatedChannel := range deprecatedChannels { + out.Write([]byte(fmt.Sprintf("style %s fill:#DCD0FF\n", deprecatedChannel))) + } + } + return nil } diff --git a/vendor/github.com/operator-framework/operator-registry/pkg/configmap/configmap_writer.go b/vendor/github.com/operator-framework/operator-registry/pkg/configmap/configmap_writer.go index 580aeaeb05..dd8931cc9e 100644 --- a/vendor/github.com/operator-framework/operator-registry/pkg/configmap/configmap_writer.go +++ b/vendor/github.com/operator-framework/operator-registry/pkg/configmap/configmap_writer.go @@ -6,12 +6,12 @@ import ( "os" "regexp" - "github.com/ghodss/yaml" "github.com/sirupsen/logrus" batchv1 "k8s.io/api/batch/v1" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/client-go/kubernetes" + "sigs.k8s.io/yaml" "github.com/operator-framework/operator-registry/pkg/client" "github.com/operator-framework/operator-registry/pkg/lib/bundle" diff --git a/vendor/github.com/operator-framework/operator-registry/pkg/lib/bundle/validate.go b/vendor/github.com/operator-framework/operator-registry/pkg/lib/bundle/validate.go index a11025c285..66e29dffc0 100644 --- a/vendor/github.com/operator-framework/operator-registry/pkg/lib/bundle/validate.go +++ b/vendor/github.com/operator-framework/operator-registry/pkg/lib/bundle/validate.go @@ -8,7 +8,6 @@ import ( "path/filepath" "strings" - y "github.com/ghodss/yaml" log "github.com/sirupsen/logrus" apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" apiextensionsv1beta1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1" @@ -18,6 +17,7 @@ import ( "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/util/validation/field" k8syaml "k8s.io/apimachinery/pkg/util/yaml" + y "sigs.k8s.io/yaml" "github.com/operator-framework/api/pkg/manifests" v1 "github.com/operator-framework/api/pkg/operators/v1alpha1" diff --git a/vendor/github.com/operator-framework/operator-registry/pkg/sqlite/configmap.go b/vendor/github.com/operator-framework/operator-registry/pkg/sqlite/configmap.go index 0f727e1d45..44e2302cc4 100644 --- a/vendor/github.com/operator-framework/operator-registry/pkg/sqlite/configmap.go +++ b/vendor/github.com/operator-framework/operator-registry/pkg/sqlite/configmap.go @@ -5,13 +5,13 @@ import ( "fmt" "strings" - "github.com/ghodss/yaml" "github.com/sirupsen/logrus" v1 "k8s.io/api/core/v1" "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "k8s.io/apimachinery/pkg/runtime" utilerrors "k8s.io/apimachinery/pkg/util/errors" + "sigs.k8s.io/yaml" "github.com/operator-framework/operator-registry/pkg/registry" ) diff --git a/vendor/modules.txt b/vendor/modules.txt index 4763e0c656..499d2fffc4 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -310,9 +310,6 @@ github.com/fsnotify/fsnotify # github.com/fvbommel/sortorder v1.0.1 ## explicit; go 1.13 github.com/fvbommel/sortorder -# github.com/ghodss/yaml v1.0.0 -## explicit -github.com/ghodss/yaml # github.com/go-air/gini v1.0.4 ## explicit; go 1.16 github.com/go-air/gini