Skip to content
This repository has been archived by the owner on Jun 29, 2022. It is now read-only.

Commit

Permalink
pkg/components: remove Register(), Get() and other related functions
Browse files Browse the repository at this point in the history
They are not used anymore, so can be removed.

Refs #992.

Signed-off-by: Mateusz Gozdek <mateusz@kinvolk.io>
  • Loading branch information
invidian committed Dec 2, 2020
1 parent a32721e commit 4a3ca24
Show file tree
Hide file tree
Showing 22 changed files with 0 additions and 121 deletions.
5 changes: 0 additions & 5 deletions pkg/components/aws-ebs-csi-driver/component.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,6 @@ enableDefaultStorageClass: {{ .EnableDefaultStorageClass }}
`
)

//nolint:gochecknoinits
func init() {
components.Register(Name, NewConfig())
}

type component struct {
EnableDefaultStorageClass bool `hcl:"enable_default_storage_class,optional"`
}
Expand Down
4 changes: 0 additions & 4 deletions pkg/components/cert-manager/component.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,6 @@ const (
Name = "cert-manager"
)

func init() {
components.Register(Name, NewConfig())
}

type component struct {
Email string `hcl:"email,attr"`
Namespace string `hcl:"namespace,optional"`
Expand Down
4 changes: 0 additions & 4 deletions pkg/components/cluster-autoscaler/component.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,6 @@ serviceMonitor:
`
)

func init() {
components.Register(Name, NewConfig())
}

type component struct {
// required parameters
Provider string `hcl:"provider,optional"`
Expand Down
31 changes: 0 additions & 31 deletions pkg/components/components.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,44 +15,13 @@
package components

import (
"fmt"
"path/filepath"

"github.com/kinvolk/lokomotive/pkg/assets"
"github.com/kinvolk/lokomotive/pkg/helm"
"helm.sh/helm/v3/pkg/chart"
)

// components is the map of registered components
var components map[string]Component

func init() {
components = make(map[string]Component)
}

func Register(name string, obj Component) {
if _, exists := components[name]; exists {
panic(fmt.Sprintf("component with name %q registered already", name))
}
components[name] = obj
}

func ListNames() []string {
var componentList []string
for name := range components {
componentList = append(componentList, name)
}
return componentList
}

func Get(name string) (Component, error) {
component, exists := components[name]
if !exists {
return nil, fmt.Errorf("no component with name %q found", name)
}
return component, nil
}

// Chart is a convenience function which returns a pointer to a chart.Chart representing the
// component named name.
func Chart(name string) (*chart.Chart, error) {
Expand Down
4 changes: 0 additions & 4 deletions pkg/components/contour/component.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,6 @@ const (
serviceTypeLoadBalancer = "LoadBalancer"
)

func init() {
components.Register(Name, NewConfig())
}

// This annotation is added to Envoy service.
type component struct {
EnableMonitoring bool `hcl:"enable_monitoring,optional"`
Expand Down
4 changes: 0 additions & 4 deletions pkg/components/dex/component.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,6 @@ const (
Name = "dex"
)

func init() { //nolint:gochecknoinits
components.Register(Name, NewConfig())
}

type org struct {
Name string `hcl:"name,attr" json:"name"`
Teams []string `hcl:"teams,attr" json:"teams"`
Expand Down
4 changes: 0 additions & 4 deletions pkg/components/external-dns/component.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,6 @@ metrics:
`
)

func init() {
components.Register(Name, NewConfig())
}

// AwsConfig provides configuration for AWS Route53 DNS.
type AwsConfig struct {
ZoneID string `hcl:"zone_id"`
Expand Down
4 changes: 0 additions & 4 deletions pkg/components/flatcar-linux-update-operator/component.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,6 @@ const (
Name = "flatcar-linux-update-operator"
)

func init() {
components.Register(Name, NewConfig())
}

// NewConfig returns new Flatcar Linux Update Operator component configuration with default values set.
//
//nolint:golint
Expand Down
4 changes: 0 additions & 4 deletions pkg/components/gangway/component.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,6 @@ const (
Name = "gangway"
)

func init() { //nolint:gochecknoinits
components.Register(Name, NewConfig())
}

type component struct {
ClusterName string `hcl:"cluster_name,attr"`
IngressHost string `hcl:"ingress_host,attr"`
Expand Down
4 changes: 0 additions & 4 deletions pkg/components/httpbin/component.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,6 @@ const (
Name = "httpbin"
)

func init() { //nolint:gochecknoinits
components.Register(Name, NewConfig())
}

type component struct {
IngressHost string `hcl:"ingress_host,attr"`
CertManagerClusterIssuer string `hcl:"certmanager_cluster_issuer,optional"`
Expand Down
5 changes: 0 additions & 5 deletions pkg/components/inspektor-gadget/component.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,6 @@ const (
Name = "inspektor-gadget"
)

//nolint:gochecknoinits
func init() {
components.Register(Name, NewConfig())
}

type component struct {
Namespace string `hcl:"namespace,optional"`
EnableTraceloop bool `hcl:"enable_traceloop,optional"`
Expand Down
5 changes: 0 additions & 5 deletions pkg/components/istio-operator/component.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,6 @@ const (
namespace = "istio-operator"
)

//nolint:gochecknoinits
func init() {
components.Register(Name, NewConfig())
}

type component struct {
Profile string `hcl:"profile,optional"`
EnableMonitoring bool `hcl:"enable_monitoring,optional"`
Expand Down
5 changes: 0 additions & 5 deletions pkg/components/linkerd/component.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,6 @@ const (
certCommonName = "identity.linkerd.cluster.local"
)

//nolint:gochecknoinits
func init() {
components.Register(Name, NewConfig())
}

type component struct {
ControllerReplicas int `hcl:"controller_replicas,optional"`
EnableMonitoring bool `hcl:"enable_monitoring,optional"`
Expand Down
4 changes: 0 additions & 4 deletions pkg/components/metallb/component.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,6 @@ const (
Name = "metallb"
)

func init() {
components.Register(Name, NewConfig())
}

type component struct {
AddressPools map[string][]string `hcl:"address_pools"`
ControllerNodeSelectors map[string]string `hcl:"controller_node_selectors,optional"`
Expand Down
4 changes: 0 additions & 4 deletions pkg/components/metrics-server/component.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,6 @@ args:
- --kubelet-preferred-address-types=InternalIP
`

func init() {
components.Register(Name, NewConfig())
}

type component struct {
Namespace string `hcl:"namespace,optional"`
}
Expand Down
4 changes: 0 additions & 4 deletions pkg/components/openebs-operator/component.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,6 @@ const (
Name = "openebs-operator"
)

func init() {
components.Register(Name, NewConfig())
}

type component struct {
NDMSelectorLabel string `hcl:"ndm_selector_label,optional"`
NDMSelectorValue string `hcl:"ndm_selector_value,optional"`
Expand Down
4 changes: 0 additions & 4 deletions pkg/components/openebs-storage-class/component.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,6 @@ const (
poolName = "openebs-storage-pool"
)

func init() {
components.Register(Name, NewConfig())
}

type Storageclass struct {
Name string `hcl:"name,label"`
ReplicaCount int `hcl:"replica_count,optional"`
Expand Down
4 changes: 0 additions & 4 deletions pkg/components/prometheus-operator/component.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,6 @@ const (
Name = "prometheus-operator"
)

func init() {
components.Register(Name, NewConfig())
}

// Monitor holds information about which Kubernetes components should be monitored with the default Prometheus instance.
type Monitor struct {
Etcd bool `hcl:"etcd,optional"`
Expand Down
4 changes: 0 additions & 4 deletions pkg/components/rook-ceph/component.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,6 @@ const (
Name = "rook-ceph"
)

func init() {
components.Register(Name, NewConfig())
}

type component struct {
Namespace string `hcl:"namespace,optional"`
MonitorCount int `hcl:"monitor_count,optional"`
Expand Down
4 changes: 0 additions & 4 deletions pkg/components/rook/component.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,6 @@ const (
Name = "rook"
)

func init() {
components.Register(Name, NewConfig())
}

type component struct {
Namespace string `hcl:"namespace,optional"`
NodeSelector util.NodeSelector `hcl:"node_selector,optional"`
Expand Down
5 changes: 0 additions & 5 deletions pkg/components/velero/component.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,6 @@ const (
Name = "velero"
)

// init registers velero component to components list, so it shows up as available to install
func init() {
components.Register(Name, NewConfig())
}

// component represents component configuration data
type component struct {
// Namespace where velero resources should be installed. Defaults to 'velero'.
Expand Down
5 changes: 0 additions & 5 deletions pkg/components/web-ui/component.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,6 @@ const (
Name = "web-ui"
)

//nolint:gochecknoinits
func init() {
components.Register(Name, NewConfig())
}

type oidc struct {
ClientID string `hcl:"client_id"`
ClientSecret string `hcl:"client_secret"`
Expand Down

0 comments on commit 4a3ca24

Please sign in to comment.