Skip to content

Commit

Permalink
Cleanup dead code (istio#24053)
Browse files Browse the repository at this point in the history
* Initial removal

* conformance

* agent

* More dead code

* Kill nodeagent

* Clean up dead security controllers

* protocol

* lint

* controlz

* Conversion

* more

* fmt

* Fix bad merge
  • Loading branch information
howardjohn authored Jun 1, 2020
1 parent dc107a1 commit 709dcf4
Show file tree
Hide file tree
Showing 155 changed files with 13 additions and 11,325 deletions.
18 changes: 0 additions & 18 deletions galley/pkg/config/analysis/analyzers/util/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,27 +15,9 @@
package util

import (
"istio.io/api/mesh/v1alpha1"

"istio.io/istio/galley/pkg/config/analysis"
"istio.io/istio/pkg/config/resource"
"istio.io/istio/pkg/config/schema/collections"
)

// MeshConfig returns the mesh configuration object associated with the context
// Analyzers that call this should include metadata.IstioMeshV1Alpha1MeshConfig as an input in their Metadata
func MeshConfig(ctx analysis.Context) *v1alpha1.MeshConfig {
// Only one MeshConfig should exist in practice, but getting it this way avoids needing
// to plumb through the name or enforce/expose a constant.
var mc *v1alpha1.MeshConfig
ctx.ForEach(collections.IstioMeshV1Alpha1MeshConfig.Name(), func(r *resource.Instance) bool {
mc = r.Message.(*v1alpha1.MeshConfig)
return true
})

return mc
}

// IsSystemNamespace returns true for system namespaces
func IsSystemNamespace(ns resource.Namespace) bool {
return ns == "kube-system" || ns == "kube-public"
Expand Down
3 changes: 0 additions & 3 deletions galley/pkg/config/collection/instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@ import (
"istio.io/istio/pkg/config/schema/collection"
)

// ChangeNotifierFn is called when a collection instance changes.
type ChangeNotifierFn func()

// Instance is collection of resources, indexed by name.
type Instance struct {
mu sync.RWMutex // TODO: This lock will most likely cause contention. We should investigate whether removing it would help.
Expand Down
3 changes: 0 additions & 3 deletions galley/pkg/config/processing/snapshotter/snapshotter.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,6 @@ type Snapshotter struct {

var _ event.Processor = &Snapshotter{}

// HandlerFn handles generated snapshots
type HandlerFn func(*coll.Set)

type accumulator struct {
reqSyncCount int32
syncCount int32
Expand Down
44 changes: 0 additions & 44 deletions galley/pkg/config/util/pb/proto.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,58 +15,14 @@
package pb

import (
"fmt"
"strings"

"github.com/ghodss/yaml"
"github.com/gogo/protobuf/jsonpb"
"github.com/gogo/protobuf/proto"
multierror "github.com/hashicorp/go-multierror"
yaml2 "gopkg.in/yaml.v2"

"istio.io/istio/pkg/config/schema/collection"
"istio.io/istio/pkg/util/gogoprotomarshal"
)

// UnmarshalFromJSON converts a canonical JSON to a proto message
func UnmarshalFromJSON(s collection.Schema, js string) (proto.Message, error) {
pb, err := s.Resource().NewProtoInstance()
if err != nil {
return nil, err
}
if err = gogoprotomarshal.ApplyJSON(js, pb); err != nil {
return nil, err
}
return pb, nil
}

// UnmarshalFromYAML converts a canonical YAML to a proto message
func UnmarshalFromYAML(s collection.Schema, yml string) (proto.Message, error) {
pb, err := s.Resource().NewProtoInstance()
if err != nil {
return nil, err
}
if err = gogoprotomarshal.ApplyYAML(yml, pb); err != nil {
return nil, err
}
return pb, nil
}

// UnmarshalFromJSONMap converts from a generic map to a proto message using canonical JSON encoding
// JSON encoding is specified here: https://developers.google.com/protocol-buffers/docs/proto3#json
func UnmarshalFromJSONMap(s collection.Schema, data interface{}) (proto.Message, error) {
// Marshal to YAML bytes
str, err := yaml.Marshal(data)
if err != nil {
return nil, err
}
out, err := UnmarshalFromYAML(s, string(str))
if err != nil {
return nil, multierror.Prefix(err, fmt.Sprintf("YAML decoding error: %v", string(str)))
}
return out, nil
}

// UnmarshalData data into the proto.
func UnmarshalData(pb proto.Message, data interface{}) error {
js, err := toJSON(data)
Expand Down
15 changes: 0 additions & 15 deletions galley/pkg/envvar/envvars.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,18 +47,3 @@ var (
// EnableIncrementalMCP is an option to enable incremental mcp
EnableIncrementalMCP = env.RegisterBoolVar("ENABLE_INCREMENTAL_MCP", false, "")
)

// RegisteredEnvVarNames returns the names of registered environment variables.
func RegisteredEnvVarNames() []string {
return []string{
// AuthFailure RateLimiter
AuthzFailureLogFreq.Name,
AuthzFailureLogBurstSize.Name,
// SourceServer RateLimiter
SourceServerStreamBurstSize.Name,
SourceServerStreamFreq.Name,
// MCP Source RateLimiter
MCPSourceReqBurstSize.Name,
MCPSourceReqFreq.Name,
}
}
51 changes: 0 additions & 51 deletions galley/pkg/meshconfig/inmemory.go

This file was deleted.

15 changes: 3 additions & 12 deletions galley/pkg/server/components/processing.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ import (

mcp "istio.io/api/mcp/v1alpha1"

"istio.io/pkg/ctrlz/fw"
"istio.io/pkg/log"
"istio.io/pkg/version"

Expand All @@ -48,7 +47,6 @@ import (
"istio.io/istio/pkg/config/schema"
"istio.io/istio/pkg/config/schema/collection"
"istio.io/istio/pkg/config/schema/snapshots"
configz "istio.io/istio/pkg/mcp/configz/server"
"istio.io/istio/pkg/mcp/creds"
"istio.io/istio/pkg/mcp/monitoring"
mcprate "istio.io/istio/pkg/mcp/rate"
Expand All @@ -64,8 +62,7 @@ const versionMetadataKey = "config.source.version"
type Processing struct {
args *settings.Args

mcpCache *snapshot.Cache
configzTopic fw.Topic
mcpCache *snapshot.Cache

k kube.Interfaces

Expand All @@ -84,9 +81,8 @@ type Processing struct {
func NewProcessing(a *settings.Args) *Processing {
mcpCache := snapshot.New(groups.IndexFunction)
return &Processing{
args: a,
mcpCache: mcpCache,
configzTopic: configz.CreateTopic(mcpCache),
args: a,
mcpCache: mcpCache,
}
}

Expand Down Expand Up @@ -258,11 +254,6 @@ func (p *Processing) Start() (err error) {
return nil
}

// ConfigZTopic returns the ConfigZTopic for the processor.
func (p *Processing) ConfigZTopic() fw.Topic {
return p.configzTopic
}

func (p *Processing) getServerGrpcOptions() []grpc.ServerOption {
var grpcOptions []grpc.ServerOption
grpcOptions = append(grpcOptions,
Expand Down
Loading

0 comments on commit 709dcf4

Please sign in to comment.