Skip to content

Commit 27f5b09

Browse files
authored
Collapse informer event handlers into the informer collection. (openservicemesh#4953)
This contains changes to the events.PubSubMessage to split the type and kind into the k8s object, and update/delete/added methods. This allows the informer to dynamically infer each message type. Signed-off-by: Sean Teeling <[email protected]>
1 parent e6304c1 commit 27f5b09

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+432
-1376
lines changed

cmd/osm-controller/osm-controller.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ func main() {
257257
}
258258

259259
// Create and start the ADS gRPC service
260-
xdsServer := ads.NewADSServer(meshCatalog, proxyRegistry, cfg.IsDebugServerEnabled(), osmNamespace, cfg, certManager, k8sClient, msgBroker)
260+
xdsServer := ads.NewADSServer(meshCatalog, proxyRegistry, cfg.GetMeshConfig().Spec.Observability.EnableDebugServer, osmNamespace, cfg, certManager, k8sClient, msgBroker)
261261
if err := xdsServer.Start(ctx, cancel, constants.ADSServerPort, adsCert); err != nil {
262262
events.GenericEventRecorder().FatalEvent(err, events.InitializationError, "Error initializing ADS server")
263263
}

pkg/catalog/egress.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ const (
2727

2828
// GetEgressTrafficPolicy returns the Egress traffic policy associated with the given service identity
2929
func (mc *MeshCatalog) GetEgressTrafficPolicy(serviceIdentity identity.ServiceIdentity) (*trafficpolicy.EgressTrafficPolicy, error) {
30-
if !mc.configurator.GetFeatureFlags().EnableEgressPolicy {
30+
if !mc.configurator.GetMeshConfig().Spec.FeatureFlags.EnableEgressPolicy {
3131
return nil, nil
3232
}
3333

pkg/catalog/egress_test.go

+5-1
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,11 @@ func TestGetEgressTrafficPolicy(t *testing.T) {
452452
policyController: mockPolicyController,
453453
}
454454

455-
mockCfg.EXPECT().GetFeatureFlags().Return(configv1alpha2.FeatureFlags{EnableEgressPolicy: true}).Times(1)
455+
mockCfg.EXPECT().GetMeshConfig().Return(configv1alpha2.MeshConfig{
456+
Spec: configv1alpha2.MeshConfigSpec{
457+
FeatureFlags: configv1alpha2.FeatureFlags{EnableEgressPolicy: true},
458+
},
459+
}).Times(1)
456460

457461
actual, err := mc.GetEgressTrafficPolicy(testSourceIdentity)
458462
assert.Equal(tc.expectError, err != nil)

pkg/catalog/endpoint.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ func (mc *MeshCatalog) ListAllowedUpstreamEndpointsForService(downstreamIdentity
1414
return nil
1515
}
1616

17-
if mc.configurator.IsPermissiveTrafficPolicyMode() {
17+
if mc.configurator.GetMeshConfig().Spec.Traffic.EnablePermissiveTrafficPolicyMode {
1818
return outboundEndpoints
1919
}
2020

pkg/catalog/endpoint_test.go

+8-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import (
1313
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
1414
testclient "k8s.io/client-go/kubernetes/fake"
1515

16+
"github.com/openservicemesh/osm/pkg/apis/config/v1alpha2"
1617
"github.com/openservicemesh/osm/pkg/compute"
1718
"github.com/openservicemesh/osm/pkg/configurator"
1819
"github.com/openservicemesh/osm/pkg/constants"
@@ -150,7 +151,13 @@ func TestListAllowedUpstreamEndpointsForService(t *testing.T) {
150151
configurator: mockConfigurator,
151152
}
152153

153-
mockConfigurator.EXPECT().IsPermissiveTrafficPolicyMode().Return(tc.permissiveMode).AnyTimes()
154+
mockConfigurator.EXPECT().GetMeshConfig().Return(v1alpha2.MeshConfig{
155+
Spec: v1alpha2.MeshConfigSpec{
156+
Traffic: v1alpha2.TrafficSpec{
157+
EnablePermissiveTrafficPolicyMode: tc.permissiveMode,
158+
},
159+
},
160+
}).AnyTimes()
154161

155162
for svc, endpoints := range tc.outboundServiceEndpoints {
156163
mockProvider.EXPECT().ListEndpointsForService(svc).Return(endpoints).AnyTimes()

pkg/catalog/helpers_test.go

+8-2
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import (
1313
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
1414
testclient "k8s.io/client-go/kubernetes/fake"
1515

16+
"github.com/openservicemesh/osm/pkg/apis/config/v1alpha2"
1617
tresorFake "github.com/openservicemesh/osm/pkg/certificate/providers/tresor/fake"
1718
kubeFake "github.com/openservicemesh/osm/pkg/compute/kube/fake"
1819
"github.com/openservicemesh/osm/pkg/configurator"
@@ -124,8 +125,13 @@ func newFakeMeshCatalogForRoutes(t *testing.T, testParams testParams) *MeshCatal
124125
mockKubeController.EXPECT().IsMonitoredNamespace(tests.BookbuyerService.Namespace).Return(true).AnyTimes()
125126
mockKubeController.EXPECT().ListMonitoredNamespaces().Return(listExpectedNs, nil).AnyTimes()
126127

127-
mockConfigurator.EXPECT().IsPermissiveTrafficPolicyMode().Return(testParams.permissiveMode).AnyTimes()
128-
mockConfigurator.EXPECT().GetConfigResyncInterval().Return(time.Duration(0)).AnyTimes()
128+
mockConfigurator.EXPECT().GetMeshConfig().Return(v1alpha2.MeshConfig{
129+
Spec: v1alpha2.MeshConfigSpec{
130+
Traffic: v1alpha2.TrafficSpec{
131+
EnablePermissiveTrafficPolicyMode: testParams.permissiveMode,
132+
},
133+
},
134+
}).AnyTimes()
129135

130136
mockMeshSpec.EXPECT().ListTrafficTargets().Return([]*access.TrafficTarget{&tests.TrafficTarget, &tests.BookstoreV2TrafficTarget}).AnyTimes()
131137
mockMeshSpec.EXPECT().ListHTTPTrafficSpecs().Return([]*specs.HTTPRouteGroup{&tests.HTTPRouteGroup}).AnyTimes()

pkg/catalog/inbound_traffic_policies.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ func (mc *MeshCatalog) GetInboundMeshTrafficPolicy(upstreamIdentity identity.Ser
3232
var trafficTargets []*access.TrafficTarget
3333
routeConfigPerPort := make(map[int][]*trafficpolicy.InboundTrafficPolicy)
3434

35-
permissiveMode := mc.configurator.IsPermissiveTrafficPolicyMode()
35+
permissiveMode := mc.configurator.GetMeshConfig().Spec.Traffic.EnablePermissiveTrafficPolicyMode
3636
if !permissiveMode {
3737
// Pre-computing the list of TrafficTarget optimizes to avoid repeated
3838
// cache lookups for each upstream service.

pkg/catalog/inbound_traffic_policies_test.go

+8-1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import (
1515
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
1616
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
1717

18+
"github.com/openservicemesh/osm/pkg/apis/config/v1alpha2"
1819
policyv1alpha1 "github.com/openservicemesh/osm/pkg/apis/policy/v1alpha1"
1920
tresorFake "github.com/openservicemesh/osm/pkg/certificate/providers/tresor/fake"
2021
"github.com/openservicemesh/osm/pkg/constants"
@@ -2170,7 +2171,13 @@ func TestGetInboundMeshTrafficPolicy(t *testing.T) {
21702171
}
21712172

21722173
mockPolicyController.EXPECT().GetUpstreamTrafficSetting(gomock.Any()).Return(tc.upstreamTrafficSetting).AnyTimes()
2173-
mockCfg.EXPECT().IsPermissiveTrafficPolicyMode().Return(tc.permissiveMode)
2174+
mockCfg.EXPECT().GetMeshConfig().Return(v1alpha2.MeshConfig{
2175+
Spec: v1alpha2.MeshConfigSpec{
2176+
Traffic: v1alpha2.TrafficSpec{
2177+
EnablePermissiveTrafficPolicyMode: tc.permissiveMode,
2178+
},
2179+
},
2180+
}).AnyTimes()
21742181
mockMeshSpec.EXPECT().ListTrafficTargets(gomock.Any()).Return(tc.trafficTargets).AnyTimes()
21752182
mockMeshSpec.EXPECT().ListHTTPTrafficSpecs().Return(tc.httpRouteGroups).AnyTimes()
21762183
tc.prepare(mockMeshSpec, tc.trafficSplits)

pkg/catalog/outbound_traffic_policies.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ func (mc *MeshCatalog) GetOutboundMeshTrafficPolicy(downstreamIdentity identity.
5353
clusterConfigForServicePort := &trafficpolicy.MeshClusterConfig{
5454
Name: meshSvc.EnvoyClusterName(),
5555
Service: meshSvc,
56-
EnableEnvoyActiveHealthChecks: mc.configurator.GetFeatureFlags().EnableEnvoyActiveHealthChecks,
56+
EnableEnvoyActiveHealthChecks: mc.configurator.GetMeshConfig().Spec.FeatureFlags.EnableEnvoyActiveHealthChecks,
5757
UpstreamTrafficSetting: mc.policyController.GetUpstreamTrafficSetting(
5858
policy.UpstreamTrafficSettingGetOpt{MeshService: &meshSvc}),
5959
}
@@ -144,7 +144,7 @@ func (mc *MeshCatalog) GetOutboundMeshTrafficPolicy(downstreamIdentity identity.
144144
// ListOutboundServicesForIdentity list the services the given service account is allowed to initiate outbound connections to
145145
// Note: ServiceIdentity must be in the format "name.namespace" [https://github.com/openservicemesh/osm/issues/3188]
146146
func (mc *MeshCatalog) ListOutboundServicesForIdentity(serviceIdentity identity.ServiceIdentity) []service.MeshService {
147-
if mc.configurator.IsPermissiveTrafficPolicyMode() {
147+
if mc.configurator.GetMeshConfig().Spec.Traffic.EnablePermissiveTrafficPolicyMode {
148148
return mc.ListServices()
149149
}
150150

pkg/catalog/outbound_traffic_policies_test.go

+9-3
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import (
1212
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
1313
"k8s.io/apimachinery/pkg/types"
1414

15-
configv1alpha2 "github.com/openservicemesh/osm/pkg/apis/config/v1alpha2"
15+
"github.com/openservicemesh/osm/pkg/apis/config/v1alpha2"
1616
policyv1alpha1 "github.com/openservicemesh/osm/pkg/apis/policy/v1alpha1"
1717
"github.com/openservicemesh/osm/pkg/compute"
1818
"github.com/openservicemesh/osm/pkg/compute/kube"
@@ -594,8 +594,14 @@ func TestGetOutboundMeshTrafficPolicy(t *testing.T) {
594594
}
595595

596596
// Mock calls to k8s client caches
597-
mockCfg.EXPECT().IsPermissiveTrafficPolicyMode().Return(tc.permissiveMode).AnyTimes()
598-
mockCfg.EXPECT().GetFeatureFlags().Return(configv1alpha2.FeatureFlags{}).AnyTimes()
597+
mockCfg.EXPECT().GetMeshConfig().Return(v1alpha2.MeshConfig{
598+
Spec: v1alpha2.MeshConfigSpec{
599+
Traffic: v1alpha2.TrafficSpec{
600+
EnablePermissiveTrafficPolicyMode: tc.permissiveMode,
601+
},
602+
},
603+
}).AnyTimes()
604+
599605
mockProvider.EXPECT().ListServices().Return(allMeshServices).AnyTimes()
600606
mockMeshSpec.EXPECT().ListTrafficTargets().Return(trafficTargets).AnyTimes()
601607
// Mock conditional traffic split for service

pkg/catalog/retry.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import (
99
// getRetryPolicy returns the RetryPolicySpec for the given downstream identity and upstream service
1010
// TODO: Add support for wildcard destinations
1111
func (mc *MeshCatalog) getRetryPolicy(downstreamIdentity identity.ServiceIdentity, upstreamSvc service.MeshService) *v1alpha1.RetryPolicySpec {
12-
if !mc.configurator.GetFeatureFlags().EnableRetryPolicy {
12+
if !mc.configurator.GetMeshConfig().Spec.FeatureFlags.EnableRetryPolicy {
1313
log.Trace().Msgf("Retry policy flag not enabled")
1414
return nil
1515
}

pkg/catalog/retry_test.go

+7-1
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,13 @@ func TestGetRetryPolicy(t *testing.T) {
231231
t.Run(tc.name, func(t *testing.T) {
232232
assert := tassert.New(t)
233233

234-
mockCfg.EXPECT().GetFeatureFlags().Return(v1alpha2.FeatureFlags{EnableRetryPolicy: tc.retryPolicyFlag}).Times(1)
234+
mockCfg.EXPECT().GetMeshConfig().Return(
235+
v1alpha2.MeshConfig{
236+
Spec: v1alpha2.MeshConfigSpec{
237+
FeatureFlags: v1alpha2.FeatureFlags{EnableRetryPolicy: tc.retryPolicyFlag},
238+
},
239+
},
240+
).AnyTimes()
235241
mockPolicyController.EXPECT().ListRetryPolicies(gomock.Any()).Return(tc.retryCRDs).Times(1)
236242

237243
res := mc.getRetryPolicy(retrySrc, tc.destSvc)

pkg/catalog/traffictarget.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ func (mc *MeshCatalog) ListOutboundServiceIdentities(downstream identity.Service
2929
func (mc *MeshCatalog) ListInboundTrafficTargetsWithRoutes(upstream identity.ServiceIdentity) ([]trafficpolicy.TrafficTargetWithRoutes, error) {
3030
var trafficTargets []trafficpolicy.TrafficTargetWithRoutes
3131

32-
if mc.configurator.IsPermissiveTrafficPolicyMode() {
32+
if mc.configurator.GetMeshConfig().Spec.Traffic.EnablePermissiveTrafficPolicyMode {
3333
return nil, nil
3434
}
3535

pkg/catalog/traffictarget_test.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -849,8 +849,7 @@ func TestListInboundTrafficTargetsWithRoutes(t *testing.T) {
849849
meshSpec: mockMeshSpec,
850850
configurator: mockCfg,
851851
}
852-
853-
mockCfg.EXPECT().IsPermissiveTrafficPolicyMode().Return(false).AnyTimes()
852+
mockCfg.EXPECT().GetMeshConfig().AnyTimes()
854853

855854
// Mock TrafficTargets returned by MeshSpec, should return all TrafficTargets relevant for this test
856855
mockMeshSpec.EXPECT().ListTrafficTargets().Return(tc.trafficTargets).AnyTimes()

pkg/certificate/providers/certmanager/certificate_manager_test.go

+2-4
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import (
44
"crypto/rand"
55
"crypto/x509"
66
"testing"
7-
"time"
87

98
tassert "github.com/stretchr/testify/assert"
109

@@ -33,8 +32,7 @@ var (
3332
)
3433

3534
const (
36-
validity = 1 * time.Hour
37-
keySize = 2048
35+
keySize = 2048
3836
)
3937

4038
func TestCertificateFromCertificateRequest(t *testing.T) {
@@ -53,7 +51,7 @@ func TestCertificateFromCertificateRequest(t *testing.T) {
5351
rootKey, err := certificate.DecodePEMPrivateKey(rootKeyPEM)
5452
assert.Nil(err)
5553

56-
mockConfigurator.EXPECT().GetServiceCertValidityPeriod().Return(validity).AnyTimes()
54+
mockConfigurator.EXPECT().GetMeshConfig().AnyTimes()
5755

5856
cm, err := New(
5957
fakeClient,

pkg/certificate/providers/config.go

+17-4
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import (
2424
"github.com/openservicemesh/osm/pkg/constants"
2525
"github.com/openservicemesh/osm/pkg/k8s/informers"
2626
"github.com/openservicemesh/osm/pkg/messaging"
27+
"github.com/openservicemesh/osm/pkg/utils"
2728
)
2829

2930
const (
@@ -54,7 +55,7 @@ func NewCertificateManager(ctx context.Context, kubeClient kubernetes.Interface,
5455
MRCProviderGenerator: MRCProviderGenerator{
5556
kubeClient: kubeClient,
5657
kubeConfig: kubeConfig,
57-
KeyBitSize: cfg.GetCertKeyBitSize(),
58+
KeyBitSize: utils.GetCertKeyBitSize(cfg.GetMeshConfig()),
5859
caExtractorFunc: getCA,
5960
},
6061
mrc: &v1alpha2.MeshRootCertificate{
@@ -76,7 +77,13 @@ func NewCertificateManager(ctx context.Context, kubeClient kubernetes.Interface,
7677
mrcClient.MRCProviderGenerator.DefaultVaultToken = vaultOption.VaultToken
7778
}
7879

79-
return certificate.NewManager(ctx, mrcClient, cfg.GetServiceCertValidityPeriod, cfg.GetIngressGatewayCertValidityPeriod, checkInterval)
80+
return certificate.NewManager(
81+
ctx,
82+
mrcClient,
83+
func() time.Duration { return utils.GetServiceCertValidityPeriod(cfg.GetMeshConfig()) },
84+
func() time.Duration { return utils.GetIngressGatewayCertValidityPeriod(cfg.GetMeshConfig()) },
85+
checkInterval,
86+
)
8087
}
8188

8289
// NewCertificateManagerFromMRC returns a new certificate manager.
@@ -90,7 +97,7 @@ func NewCertificateManagerFromMRC(ctx context.Context, kubeClient kubernetes.Int
9097
MRCProviderGenerator: MRCProviderGenerator{
9198
kubeClient: kubeClient,
9299
kubeConfig: kubeConfig,
93-
KeyBitSize: cfg.GetCertKeyBitSize(),
100+
KeyBitSize: utils.GetCertKeyBitSize(cfg.GetMeshConfig()),
94101
caExtractorFunc: getCA,
95102
},
96103
informerCollection: ic,
@@ -100,7 +107,13 @@ func NewCertificateManagerFromMRC(ctx context.Context, kubeClient kubernetes.Int
100107
mrcClient.MRCProviderGenerator.DefaultVaultToken = vaultOption.VaultToken
101108
}
102109

103-
return certificate.NewManager(ctx, mrcClient, cfg.GetServiceCertValidityPeriod, cfg.GetIngressGatewayCertValidityPeriod, checkInterval)
110+
return certificate.NewManager(
111+
ctx,
112+
mrcClient,
113+
func() time.Duration { return utils.GetServiceCertValidityPeriod(cfg.GetMeshConfig()) },
114+
func() time.Duration { return utils.GetIngressGatewayCertValidityPeriod(cfg.GetMeshConfig()) },
115+
checkInterval,
116+
)
104117
}
105118

106119
// GetCertIssuerForMRC returns a certificate.Issuer generated from the provided MRC.

pkg/certificate/providers/config_test.go

+2-7
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,8 @@ import (
3030
func TestGetCertificateManager(t *testing.T) {
3131
mockCtrl := gomock.NewController(t)
3232
mockConfigurator := configurator.NewMockConfigurator(mockCtrl)
33+
mockConfigurator.EXPECT().GetMeshConfig().AnyTimes()
3334

34-
mockConfigurator.EXPECT().IsDebugServerEnabled().Return(false).AnyTimes()
35-
mockConfigurator.EXPECT().GetCertKeyBitSize().Return(2048).AnyTimes()
36-
mockConfigurator.EXPECT().GetServiceCertValidityPeriod().Return(1 * time.Hour).AnyTimes()
3735
type testCase struct {
3836
name string
3937
expectError bool
@@ -163,10 +161,7 @@ func TestGetCertificateManager(t *testing.T) {
163161
func TestGetCertificateManagerFromMRC(t *testing.T) {
164162
mockCtrl := gomock.NewController(t)
165163
mockConfigurator := configurator.NewMockConfigurator(mockCtrl)
166-
167-
mockConfigurator.EXPECT().IsDebugServerEnabled().Return(false).AnyTimes()
168-
mockConfigurator.EXPECT().GetCertKeyBitSize().Return(2048).AnyTimes()
169-
mockConfigurator.EXPECT().GetServiceCertValidityPeriod().Return(1 * time.Hour).AnyTimes()
164+
mockConfigurator.EXPECT().GetMeshConfig().AnyTimes()
170165

171166
type testCase struct {
172167
name string

pkg/configurator/client.go

+13-1
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,20 @@ func (c *Client) metricsHandler() cache.ResourceEventHandlerFuncs {
8484
// Ensure metrics reflect however the rest of the control plane
8585
// handles when the MeshConfig doesn't exist. If this happens not to
8686
// be the "real" MeshConfig, handleMetrics() will simply ignore it.
87-
config.Spec.FeatureFlags = c.GetFeatureFlags()
87+
config.Spec.FeatureFlags = c.GetMeshConfig().Spec.FeatureFlags
8888
handleMetrics(config)
8989
},
9090
}
9191
}
92+
93+
// The functions in this file implement the configurator.Configurator interface
94+
95+
// GetMeshConfig returns the MeshConfig resource corresponding to the control plane
96+
func (c *Client) GetMeshConfig() configv1alpha2.MeshConfig {
97+
return c.getMeshConfig()
98+
}
99+
100+
// GetOSMNamespace returns the namespace in which the OSM controller pod resides.
101+
func (c *Client) GetOSMNamespace() string {
102+
return c.osmNamespace
103+
}

pkg/configurator/client_test.go

+12-2
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ import (
44
"testing"
55

66
"github.com/stretchr/testify/assert"
7+
tassert "github.com/stretchr/testify/assert"
78
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
89

10+
configv1alpha2 "github.com/openservicemesh/osm/pkg/apis/config/v1alpha2"
911
fakeConfig "github.com/openservicemesh/osm/pkg/gen/client/config/clientset/versioned/fake"
1012
"github.com/openservicemesh/osm/pkg/k8s/informers"
1113
"github.com/openservicemesh/osm/pkg/metricsstore"
12-
13-
configv1alpha2 "github.com/openservicemesh/osm/pkg/apis/config/v1alpha2"
1414
)
1515

1616
const (
@@ -99,3 +99,13 @@ func TestMetricsHandler(t *testing.T) {
9999
a.True(metricsstore.DefaultMetricsStore.Contains(`osm_feature_flag_enabled{feature_flag="enableRetryPolicy"} 0` + "\n"))
100100
a.True(metricsstore.DefaultMetricsStore.Contains(`osm_feature_flag_enabled{feature_flag="enableSnapshotCacheMode"} 0` + "\n"))
101101
}
102+
103+
func TestGetMeshConfigCacheKey(t *testing.T) {
104+
c := Client{
105+
meshConfigName: "configName",
106+
osmNamespace: "namespaceName",
107+
}
108+
expected := "namespaceName/configName"
109+
actual := c.getMeshConfigCacheKey()
110+
tassert.Equal(t, expected, actual)
111+
}

0 commit comments

Comments
 (0)