Skip to content

Commit

Permalink
Update license-verifier (#638)
Browse files Browse the repository at this point in the history
Signed-off-by: 1gtm <1gtm@appscode.com>
  • Loading branch information
1gtm authored Nov 14, 2021
1 parent 9ba8875 commit 3ca8fbf
Show file tree
Hide file tree
Showing 18 changed files with 153 additions and 305 deletions.
9 changes: 5 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,11 @@ require (
k8s.io/component-base v0.21.1
k8s.io/klog/v2 v2.8.0
k8s.io/kubectl v0.21.1
kmodules.xyz/client-go v0.0.0-20211107190155-5bb4090d2728
kmodules.xyz/custom-resources v0.0.0-20211007080833-72bd9e8cae6e
kmodules.xyz/monitoring-agent-api v0.0.0-20210928135619-38ca075a2dbd
kubedb.dev/apimachinery v0.22.1-0.20211108134937-bbd2a36b4e8d
kmodules.xyz/client-go v0.0.0-20211110065417-091bd089a92d
kmodules.xyz/custom-resources v0.0.0-20211025144742-7ab2db03cce8
kmodules.xyz/monitoring-agent-api v0.0.0-20211110102906-ca48f83c44c5
kmodules.xyz/objectstore-api v0.0.0-20211025143832-b9135743b78b // indirect
kubedb.dev/apimachinery v0.22.1-0.20211110124206-1222a1d62803
stash.appscode.dev/apimachinery v0.16.0
)

Expand Down
18 changes: 10 additions & 8 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1175,17 +1175,19 @@ kmodules.xyz/client-go v0.0.0-20210719120358-dd0503cf99cf/go.mod h1:E/vGngai00Ut
kmodules.xyz/client-go v0.0.0-20210831030638-b1d662179991/go.mod h1:0gkPeALtYjB27OHt4rd6+ZmMgoVTHVLtEJQeU23/gtA=
kmodules.xyz/client-go v0.0.0-20210928133955-8df5bb467db6/go.mod h1:0gkPeALtYjB27OHt4rd6+ZmMgoVTHVLtEJQeU23/gtA=
kmodules.xyz/client-go v0.0.0-20211013093146-1fbfd52e78c9/go.mod h1:0gkPeALtYjB27OHt4rd6+ZmMgoVTHVLtEJQeU23/gtA=
kmodules.xyz/client-go v0.0.0-20211103233446-c6983313d40d/go.mod h1:ENUu8pPK19xzBkVpAJHoGCI2QRvb1SqffWRt0K2sV5I=
kmodules.xyz/client-go v0.0.0-20211107190155-5bb4090d2728 h1:wfpdSr2OID1uAD59HtupacI+c3o+UyEdeCL/qrKasdE=
kmodules.xyz/client-go v0.0.0-20211107190155-5bb4090d2728/go.mod h1:ENUu8pPK19xzBkVpAJHoGCI2QRvb1SqffWRt0K2sV5I=
kmodules.xyz/client-go v0.0.0-20211110065417-091bd089a92d h1:1IX5mrAeWAX9r5E2i91UGStS8L91XsW8q+gRta6Po/M=
kmodules.xyz/client-go v0.0.0-20211110065417-091bd089a92d/go.mod h1:ENUu8pPK19xzBkVpAJHoGCI2QRvb1SqffWRt0K2sV5I=
kmodules.xyz/constants v0.0.0-20210218100002-2c304bfda278/go.mod h1:DbiFk1bJ1KEO94t1SlAn7tzc+Zz95rSXgyUKa2nzPmY=
kmodules.xyz/crd-schema-fuzz v0.0.0-20210618002152-fae23aef5fb4/go.mod h1:IIkUctlfoptoci0BOrsUf8ya+MOG5uaeh1PE4uzaIbA=
kmodules.xyz/custom-resources v0.0.0-20211007080833-72bd9e8cae6e h1:0IEUFAJPgwPx3+Zb1BMcHLywKhJtXMk6YCHNsjWJwYQ=
kmodules.xyz/custom-resources v0.0.0-20211007080833-72bd9e8cae6e/go.mod h1:pGabego8q4oi/2sNjhdtFkgVaVw4AyGv14GO6VtAjTw=
kmodules.xyz/monitoring-agent-api v0.0.0-20210928135619-38ca075a2dbd h1:G1HkRXnQx2H63HFRrY+4oWPJg78W2RnzepJqjm8KT/M=
kmodules.xyz/custom-resources v0.0.0-20211025144742-7ab2db03cce8 h1:fukXZ0qnfth9rLuQh1X0L3xhpEGc8x19JO10t8IPQaU=
kmodules.xyz/custom-resources v0.0.0-20211025144742-7ab2db03cce8/go.mod h1:yHLFe4wVYxepTnN00CFUf29xH+jEHDokq6d2fbp9pks=
kmodules.xyz/monitoring-agent-api v0.0.0-20210928135619-38ca075a2dbd/go.mod h1:08pBqfEuy29EjhaMrHB2XFy2iekoFi7AjaXcJS+xAck=
kmodules.xyz/objectstore-api v0.0.0-20210928135706-fdf68f88ea6e h1:2QZBUcUI6r7mLU5/9+Xxd1eDClEIEkZkJlyCU91UoY8=
kmodules.xyz/monitoring-agent-api v0.0.0-20211110102906-ca48f83c44c5 h1:nK6hHkJbcye7o2f5rACCdrId2pDCAYahNtVTcA40wYQ=
kmodules.xyz/monitoring-agent-api v0.0.0-20211110102906-ca48f83c44c5/go.mod h1:pMat/DczEAlpNXI53di7FklmlQ594rzXwK3tdIyht2c=
kmodules.xyz/objectstore-api v0.0.0-20210928135706-fdf68f88ea6e/go.mod h1:Tkcf9uTplnrJ6C8o0zlw2kpgS1SaWAiMO5P2YgLjTo8=
kmodules.xyz/objectstore-api v0.0.0-20211025143832-b9135743b78b h1:OmlGtmyI++rShfOf0VsmmIRulgCmFUOSlAp+g7iOrCs=
kmodules.xyz/objectstore-api v0.0.0-20211025143832-b9135743b78b/go.mod h1:IICnDdPFOEeGXdaPVHOGYfdwD1cyh/p1I/TWMkyNTIE=
kmodules.xyz/offshoot-api v0.0.0-20210829122105-6f4d481b0c61/go.mod h1:3LECbAL3FgbyK80NP3V3Pmiuo/a3hFWg/PR6SPFhTns=
kmodules.xyz/offshoot-api v0.0.0-20211103060642-3e217667cf41 h1:GCDyb1fbgCHUNuFk9MecSFvzMq/WCeGk8pDEtqivziA=
kmodules.xyz/offshoot-api v0.0.0-20211103060642-3e217667cf41/go.mod h1:sJYyxf84ZvbVz4SivxMgSelGRYn19wOLUtObiEncCxk=
Expand All @@ -1196,8 +1198,8 @@ kmodules.xyz/resource-metadata v0.6.4/go.mod h1:KWf68Ado/hgYpb/msYNvhYSLWvS/bJcV
kmodules.xyz/resource-metrics v0.0.3/go.mod h1:6Dv63HDgp83DhA+lZNB7GIQR6PLjNrYW6ghQKioQzII=
kmodules.xyz/resource-metrics v0.0.5/go.mod h1:6Dv63HDgp83DhA+lZNB7GIQR6PLjNrYW6ghQKioQzII=
kmodules.xyz/webhook-runtime v0.0.0-20210928141616-7f73c2ab318a/go.mod h1:MFZFmJk9IXNHwq8JlF/mukwBDbopFQj4swaB2MWHc/U=
kubedb.dev/apimachinery v0.22.1-0.20211108134937-bbd2a36b4e8d h1:UC+YhAEhkdNPOGKWfV6/96HOGt8p8LXCUmHl/u656oc=
kubedb.dev/apimachinery v0.22.1-0.20211108134937-bbd2a36b4e8d/go.mod h1:KAnSBv2JKN17hEm7D3agm4uXeGfnoXVBTnPwci7u5js=
kubedb.dev/apimachinery v0.22.1-0.20211110124206-1222a1d62803 h1:iyoST1LnuIGZBlT4rwLpxy0TLXql4XwcI+bSctb2H/w=
kubedb.dev/apimachinery v0.22.1-0.20211110124206-1222a1d62803/go.mod h1:x8UBaJPIBCD6S58VQ+38+QxFUXCYdvFrmP9FnOuPOaI=
modernc.org/cc v1.0.0/go.mod h1:1Sk4//wdnYJiUIxnW8ddKpaOJCF37yAdqYnkxUpaYxw=
modernc.org/golex v1.0.0/go.mod h1:b/QX9oBD/LhixY6NDh+IdGv17hgB+51fET1i2kPSmvk=
modernc.org/mathutil v1.0.0/go.mod h1:wU0vUrJsVWBZ4P6e7xtFJEhFSNsfRLJ8H458uRjg03k=
Expand Down
7 changes: 0 additions & 7 deletions vendor/kmodules.xyz/client-go/core/v1/kubernetes.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ package v1
import (
"sort"

meta_util "kmodules.xyz/client-go/meta"

jsoniter "github.com/json-iterator/go"
"gomodules.xyz/mergo"
core "k8s.io/api/core/v1"
Expand Down Expand Up @@ -270,11 +268,6 @@ func EnsureEnvVarDeleted(vars []core.EnvVar, name string) []core.EnvVar {
return vars
}

// Deprecated use meta_util.OverwriteKeys()
func UpsertMap(maps, upsert map[string]string) map[string]string {
return meta_util.OverwriteKeys(maps, upsert)
}

func MergeLocalObjectReferences(l1, l2 []core.LocalObjectReference) []core.LocalObjectReference {
result := make([]core.LocalObjectReference, 0, len(l1)+len(l2))
m := make(map[string]core.LocalObjectReference)
Expand Down
16 changes: 11 additions & 5 deletions vendor/kmodules.xyz/client-go/meta/lib.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,16 +117,22 @@ func MergeKeys(out, in map[string]string) map[string]string {
return out
}

func OverwriteKeys(out, in map[string]string) map[string]string {
if len(in) == 0 {
func OverwriteKeys(out map[string]string, ins ...map[string]string) map[string]string {
if len(ins) == 0 {
return out
}
if out == nil {
out = make(map[string]string, len(in))
n := 0
for _, in := range ins {
n += len(in)
}
out = make(map[string]string, n)
}

for k, v := range in {
out[k] = v
for _, in := range ins {
for k, v := range in {
out[k] = v
}
}
return out
}
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -55,69 +55,55 @@ func (e Elasticsearch) OffshootName() string {
return e.Name
}

func (e Elasticsearch) OffshootSelectors(overwrites ...map[string]string) map[string]string {
func (e Elasticsearch) OffshootSelectors(extraSelectors ...map[string]string) map[string]string {
selector := map[string]string{
meta_util.NameLabelKey: e.ResourceFQN(),
meta_util.InstanceLabelKey: e.Name,
meta_util.ManagedByLabelKey: kubedb.GroupName,
}
for _, overwrite := range overwrites {
selector = meta_util.OverwriteKeys(selector, overwrite)
}
return selector
return meta_util.OverwriteKeys(selector, extraSelectors...)
}

func (e Elasticsearch) NodeRoleSpecificLabelKey(roleType ElasticsearchNodeRoleType) string {
return kubedb.GroupName + "/role-" + string(roleType)
}

func (e Elasticsearch) MasterSelectors() map[string]string {
selectors := e.OffshootSelectors()
selectors[e.NodeRoleSpecificLabelKey(ElasticsearchNodeRoleTypeMaster)] = ElasticsearchNodeRoleSet
return selectors
return e.OffshootSelectors(map[string]string{e.NodeRoleSpecificLabelKey(ElasticsearchNodeRoleTypeMaster): ElasticsearchNodeRoleSet})
}

func (e Elasticsearch) DataSelectors() map[string]string {
selectors := e.OffshootSelectors()
selectors[e.NodeRoleSpecificLabelKey(ElasticsearchNodeRoleTypeData)] = ElasticsearchNodeRoleSet
return selectors
return e.OffshootSelectors(map[string]string{e.NodeRoleSpecificLabelKey(ElasticsearchNodeRoleTypeData): ElasticsearchNodeRoleSet})
}

func (e Elasticsearch) IngestSelectors() map[string]string {
selectors := e.OffshootSelectors()
selectors[e.NodeRoleSpecificLabelKey(ElasticsearchNodeRoleTypeIngest)] = ElasticsearchNodeRoleSet
return selectors
return e.OffshootSelectors(map[string]string{e.NodeRoleSpecificLabelKey(ElasticsearchNodeRoleTypeIngest): ElasticsearchNodeRoleSet})
}

func (e Elasticsearch) NodeRoleSpecificSelectors(roleType ElasticsearchNodeRoleType) map[string]string {
selectors := e.OffshootSelectors()
selectors[e.NodeRoleSpecificLabelKey(roleType)] = ElasticsearchNodeRoleSet
return selectors
return e.OffshootSelectors(map[string]string{e.NodeRoleSpecificLabelKey(roleType): ElasticsearchNodeRoleSet})
}

func (e Elasticsearch) OffshootLabels() map[string]string {
return e.offshootLabels(e.OffshootSelectors(), nil)
}

func (e Elasticsearch) PodLabels(overwrites ...map[string]string) map[string]string {
pLabels := e.offshootLabels(e.OffshootSelectors(), e.Spec.PodTemplate.Labels)
for _, overwrite := range overwrites {
pLabels = meta_util.OverwriteKeys(pLabels, overwrite)
}
return pLabels
func (e Elasticsearch) PodLabels(extraLabels ...map[string]string) map[string]string {
return e.offshootLabels(meta_util.OverwriteKeys(e.OffshootSelectors(), extraLabels...), e.Spec.PodTemplate.Labels)
}

func (e Elasticsearch) PodControllerLabels(overwrites ...map[string]string) map[string]string {
pcLabels := e.offshootLabels(e.OffshootSelectors(), e.Spec.PodTemplate.Controller.Labels)
for _, overwrite := range overwrites {
pcLabels = meta_util.OverwriteKeys(pcLabels, overwrite)
}
return pcLabels
func (e Elasticsearch) PodControllerLabels(extraLabels ...map[string]string) map[string]string {
return e.offshootLabels(meta_util.OverwriteKeys(e.OffshootSelectors(), extraLabels...), e.Spec.PodTemplate.Controller.Labels)
}

func (e Elasticsearch) ServiceLabels(alias ServiceAlias, extraLabels ...map[string]string) map[string]string {
svcTemplate := GetServiceTemplate(e.Spec.ServiceTemplates, alias)
return e.offshootLabels(meta_util.OverwriteKeys(e.OffshootSelectors(), extraLabels...), svcTemplate.Labels)
}

func (e Elasticsearch) offshootLabels(selector, overwrite map[string]string) map[string]string {
func (e Elasticsearch) offshootLabels(selector, override map[string]string) map[string]string {
selector[meta_util.ComponentLabelKey] = ComponentDatabase
return meta_util.FilterKeys(kubedb.GroupName, selector, meta_util.OverwriteKeys(e.Labels, overwrite))
return meta_util.FilterKeys(kubedb.GroupName, selector, meta_util.OverwriteKeys(nil, e.Labels, override))
}

func (e Elasticsearch) ResourceFQN() string {
Expand Down Expand Up @@ -378,9 +364,7 @@ func (e Elasticsearch) StatsService() mona.StatsAccessor {
}

func (e Elasticsearch) StatsServiceLabels() map[string]string {
lbl := meta_util.FilterKeys(kubedb.GroupName, e.OffshootSelectors(), e.Labels)
lbl[LabelRole] = RoleStats
return lbl
return e.ServiceLabels(StatsServiceAlias, map[string]string{LabelRole: RoleStats})
}

func (e *Elasticsearch) SetDefaults(esVersion *catalog.ElasticsearchVersion, topology *core_util.Topology) {
Expand Down
Loading

0 comments on commit 3ca8fbf

Please sign in to comment.