Skip to content

Commit

Permalink
remove webConsolePlugin from ToolchainClusterConfig (phase 2) (#420)
Browse files Browse the repository at this point in the history
Pendo has been decommisioned, we don't need this plugin anymore

---------

Signed-off-by: Xavier Coulon <xcoulon@redhat.com>
Co-authored-by: Alexey Kazakov <alkazako@redhat.com>
Co-authored-by: Rajiv Senthilnathan <rajivnathan@gmail.com>
  • Loading branch information
3 people authored Aug 1, 2024
1 parent afce891 commit 2f18a82
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 86 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/codeready-toolchain/toolchain-common
go 1.20

require (
github.com/codeready-toolchain/api v0.0.0-20240717145630-bb67a632867a
github.com/codeready-toolchain/api v0.0.0-20240801160201-ed4387f19137
github.com/go-logr/logr v1.2.3
github.com/golang-jwt/jwt/v5 v5.2.0
github.com/lestrrat-go/jwx v1.2.29
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,8 @@ github.com/cncf/xds/go v0.0.0-20210312221358-fbca930ec8ed/go.mod h1:eXthEFrGJvWH
github.com/cockroachdb/datadriven v0.0.0-20200714090401-bf6692d28da5/go.mod h1:h6jFvWxBdQXxjopDMZyH2UVceIRfR84bdzbkoKrsWNo=
github.com/cockroachdb/errors v1.2.4/go.mod h1:rQD95gz6FARkaKkQXUksEje/d9a6wBJoCr5oaCLELYA=
github.com/cockroachdb/logtags v0.0.0-20190617123548-eb05cc24525f/go.mod h1:i/u985jwjWRlyHXQbwatDASoW0RMlZ/3i9yJHE2xLkI=
github.com/codeready-toolchain/api v0.0.0-20240717145630-bb67a632867a h1:La7GOCysmkU+4vnN8lDzXFJwJiA1LWZ9YkX/yQXYnpw=
github.com/codeready-toolchain/api v0.0.0-20240717145630-bb67a632867a/go.mod h1:ie9p4LenCCS0LsnbWp6/xwpFDdCWYE0KWzUO6Sk1g0E=
github.com/codeready-toolchain/api v0.0.0-20240801160201-ed4387f19137 h1:axAZH/Ku+QHu2eQjlx/a7dctWRgj0T3K4gfnq1fzKFo=
github.com/codeready-toolchain/api v0.0.0-20240801160201-ed4387f19137/go.mod h1:ie9p4LenCCS0LsnbWp6/xwpFDdCWYE0KWzUO6Sk1g0E=
github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk=
github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE=
github.com/coreos/etcd v3.3.13+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE=
Expand Down
20 changes: 0 additions & 20 deletions pkg/configuration/memberoperatorconfig/configuration.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,6 @@ func (c *Configuration) Webhook() WebhookConfig {
}
}

func (c *Configuration) WebConsolePlugin() WebConsolePluginConfig {
return WebConsolePluginConfig{c.cfg.WebConsolePlugin}
}

type AuthConfig struct {
auth toolchainv1alpha1.AuthConfig
}
Expand Down Expand Up @@ -252,19 +248,3 @@ func (a WebhookConfig) VMSSHKey() string {
vmAccessKey := commonconfig.GetString(a.w.Secret.VirtualMachineAccessKey, "")
return a.webhookSecret(vmAccessKey)
}

type WebConsolePluginConfig struct {
w toolchainv1alpha1.WebConsolePlugin
}

func (a WebConsolePluginConfig) Deploy() bool {
return commonconfig.GetBool(a.w.Deploy, false)
}

func (a WebConsolePluginConfig) PendoKey() string {
return commonconfig.GetString(a.w.PendoKey, "")
}

func (a WebConsolePluginConfig) PendoHost() string {
return commonconfig.GetString(a.w.PendoHost, "cdn.pendo.io")
}
27 changes: 0 additions & 27 deletions pkg/configuration/memberoperatorconfig/configuration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -273,30 +273,3 @@ func TestWebhook(t *testing.T) {
assert.Equal(t, "ssh-rsa abc-123", memberOperatorCfg.Webhook().VMSSHKey())
})
}

func TestWebConsolePlugin(t *testing.T) {
t.Run("default", func(t *testing.T) {
cfg := commonconfig.NewMemberOperatorConfigWithReset(t)
memberOperatorCfg := Configuration{cfg: &cfg.Spec}

assert.False(t, memberOperatorCfg.WebConsolePlugin().Deploy())
})
t.Run("non-default", func(t *testing.T) {
cfg := commonconfig.NewMemberOperatorConfigWithReset(t, testconfig.WebConsolePlugin().Deploy(true))
memberOperatorCfg := Configuration{cfg: &cfg.Spec}

assert.True(t, memberOperatorCfg.WebConsolePlugin().Deploy())
})
t.Run("with PendoKey set", func(t *testing.T) {
cfg := commonconfig.NewMemberOperatorConfigWithReset(t, testconfig.WebConsolePlugin().PendoKey("XXXX"))
memberOperatorCfg := Configuration{cfg: &cfg.Spec}

assert.Equal(t, "XXXX", memberOperatorCfg.WebConsolePlugin().PendoKey())
})
t.Run("with PendoHost set", func(t *testing.T) {
cfg := commonconfig.NewMemberOperatorConfigWithReset(t, testconfig.WebConsolePlugin().PendoHost("abc.pendo.io"))
memberOperatorCfg := Configuration{cfg: &cfg.Spec}

assert.Equal(t, "abc.pendo.io", memberOperatorCfg.WebConsolePlugin().PendoHost())
})
}
36 changes: 0 additions & 36 deletions pkg/test/config/memberoperatorconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -277,42 +277,6 @@ func (o WebhookOption) VMSSHKey(value string) WebhookOption {
return o
}

type WebConsolePluginOption struct {
*MemberOperatorConfigOptionImpl
}

func WebConsolePlugin() *WebConsolePluginOption {
o := &WebConsolePluginOption{
&MemberOperatorConfigOptionImpl{},
}
o.addFunction(func(config *toolchainv1alpha1.MemberOperatorConfig) {
config.Spec.WebConsolePlugin = toolchainv1alpha1.WebConsolePlugin{}
})

return o
}

func (o WebConsolePluginOption) Deploy(value bool) WebConsolePluginOption {
o.addFunction(func(config *toolchainv1alpha1.MemberOperatorConfig) {
config.Spec.WebConsolePlugin.Deploy = &value
})
return o
}

func (o WebConsolePluginOption) PendoKey(value string) WebConsolePluginOption {
o.addFunction(func(config *toolchainv1alpha1.MemberOperatorConfig) {
config.Spec.WebConsolePlugin.PendoKey = &value
})
return o
}

func (o WebConsolePluginOption) PendoHost(value string) WebConsolePluginOption {
o.addFunction(func(config *toolchainv1alpha1.MemberOperatorConfig) {
config.Spec.WebConsolePlugin.PendoHost = &value
})
return o
}

func NewMemberOperatorConfigObj(options ...MemberOperatorConfigOption) *toolchainv1alpha1.MemberOperatorConfig {
memberOperatorConfig := &toolchainv1alpha1.MemberOperatorConfig{
ObjectMeta: metav1.ObjectMeta{
Expand Down

0 comments on commit 2f18a82

Please sign in to comment.