Skip to content

Commit 7c4801f

Browse files
1gtmtamalsahaEmruz Hossain
authored
[cherry-pick] Verify license info from stash operator (#119) (#121)
/cherry-pick Signed-off-by: Tamal Saha <tamal@appscode.com> Co-authored-by: Emruz Hossain <emruz@appscode.com> Co-authored-by: Tamal Saha <tamal@appscode.com> Co-authored-by: Emruz Hossain <emruz@appscode.com>
1 parent 76980c4 commit 7c4801f

File tree

367 files changed

+58737
-1111
lines changed

Some content is hidden

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

367 files changed

+58737
-1111
lines changed

charts/stash-mysql/templates/mysql-backup-function.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ spec:
3737
- --retention-dry-run=${RETENTION_DRY_RUN:=false}
3838
# output & metric information
3939
- --output-dir=${outputDir:=}
40+
- --license-apiservice=${LICENSE_APISERVICE:=}
4041
volumeMounts:
4142
- name: ${secretVolume}
4243
mountPath: /etc/repository/secret

charts/stash-mysql/templates/mysql-restore-function.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ spec:
2828
- --snapshot=${RESTORE_SNAPSHOTS:=}
2929
# output & metric information
3030
- --output-dir=${outputDir:=}
31+
- --license-apiservice=${LICENSE_APISERVICE:=}
3132
volumeMounts:
3233
- name: ${secretVolume}
3334
mountPath: /etc/repository/secret

go.mod

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,23 +5,25 @@ go 1.12
55
require (
66
github.com/appscode/go v0.0.0-20200323182826-54e98e09185a
77
github.com/codeskyblue/go-sh v0.0.0-20190412065543-76bd3d59ff27
8-
github.com/go-openapi/spec v0.19.3
8+
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
9+
github.com/go-openapi/spec v0.19.7
910
github.com/gogo/protobuf v1.3.1
1011
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b
1112
github.com/google/gofuzz v1.1.0
1213
github.com/spf13/cobra v0.0.5
1314
github.com/yudai/gojsondiff v1.0.0
15+
go.bytebuilders.dev/license-verifier/kubernetes v0.3.0
1416
k8s.io/api v0.18.3
1517
k8s.io/apiextensions-apiserver v0.18.3
16-
k8s.io/apimachinery v0.18.3
18+
k8s.io/apimachinery v0.18.8
1719
k8s.io/client-go v12.0.0+incompatible
1820
k8s.io/kube-openapi v0.0.0-20200410145947-61e04a5be9a6
19-
kmodules.xyz/client-go v0.0.0-20200905112811-2e29b973ee0c
21+
kmodules.xyz/client-go v0.0.0-20200915091229-7df16c29f4e8
2022
kmodules.xyz/crd-schema-fuzz v0.0.0-20200521005638-2433a187de95
2123
kmodules.xyz/custom-resources v0.0.0-20200604135349-9e9f5c4fdba9
2224
kmodules.xyz/offshoot-api v0.0.0-20200521035628-e135bf07b226
2325
sigs.k8s.io/yaml v1.2.0
24-
stash.appscode.dev/apimachinery v0.10.1-0.20200914045248-546ceea96940
26+
stash.appscode.dev/apimachinery v0.10.1-0.20200916073701-0189ba363808
2527
)
2628

2729
replace bitbucket.org/ww/goautoneg => gomodules.xyz/goautoneg v0.0.0-20120707110453-a547fc61f48d
@@ -62,7 +64,7 @@ replace github.com/googleapis/gnostic => github.com/googleapis/gnostic v0.3.1
6264

6365
replace github.com/imdario/mergo => github.com/imdario/mergo v0.3.5
6466

65-
replace github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring => github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring v0.0.0-20200911141619-675d303ee0b8
67+
replace github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring => github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring v0.42.0
6668

6769
replace github.com/prometheus/client_golang => github.com/prometheus/client_golang v1.7.1
6870

@@ -86,6 +88,6 @@ replace k8s.io/client-go => k8s.io/client-go v0.18.3
8688

8789
replace k8s.io/component-base => k8s.io/component-base v0.18.3
8890

89-
replace k8s.io/kube-openapi => k8s.io/kube-openapi v0.0.0-20200410145947-61e04a5be9a6 // release-1.18
91+
replace k8s.io/kube-openapi => k8s.io/kube-openapi v0.0.0-20200410145947-61e04a5be9a6
9092

9193
replace k8s.io/kubernetes => github.com/kmodules/kubernetes v1.19.0-alpha.0.0.20200521033432-49d3646051ad

go.sum

Lines changed: 86 additions & 17 deletions
Large diffs are not rendered by default.

hack/gencrd/main.go

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,17 @@ func generateSwaggerJson() {
4848
Title: "Stash",
4949
Version: "v0",
5050
Contact: &spec.ContactInfo{
51-
Name: "AppsCode Inc.",
52-
URL: "https://appscode.com",
53-
Email: "hello@appscode.com",
51+
ContactInfoProps: spec.ContactInfoProps{
52+
Name: "AppsCode Inc.",
53+
URL: "https://appscode.com",
54+
Email: "hello@appscode.com",
55+
},
5456
},
5557
License: &spec.License{
56-
Name: "Apache 2.0",
57-
URL: "https://www.apache.org/licenses/LICENSE-2.0.html",
58+
LicenseProps: spec.LicenseProps{
59+
Name: "Apache 2.0",
60+
URL: "https://www.apache.org/licenses/LICENSE-2.0.html",
61+
},
5862
},
5963
},
6064
OpenAPIDefinitions: []common.GetOpenAPIDefinitions{

pkg/backup.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import (
2828

2929
"github.com/appscode/go/flags"
3030
"github.com/spf13/cobra"
31+
license "go.bytebuilders.dev/license-verifier/kubernetes"
3132
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
3233
"k8s.io/client-go/kubernetes"
3334
"k8s.io/client-go/tools/clientcmd"
@@ -67,6 +68,10 @@ func NewCmdBackup() *cobra.Command {
6768
if err != nil {
6869
return err
6970
}
71+
err = license.CheckLicenseEndpoint(config, licenseApiService, SupportedProducts)
72+
if err != nil {
73+
return err
74+
}
7075
opt.kubeClient, err = kubernetes.NewForConfig(config)
7176
if err != nil {
7277
return err

pkg/restore.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import (
2626

2727
"github.com/appscode/go/flags"
2828
"github.com/spf13/cobra"
29+
license "go.bytebuilders.dev/license-verifier/kubernetes"
2930
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
3031
"k8s.io/client-go/kubernetes"
3132
"k8s.io/client-go/tools/clientcmd"
@@ -63,6 +64,10 @@ func NewCmdRestore() *cobra.Command {
6364
if err != nil {
6465
return err
6566
}
67+
err = license.CheckLicenseEndpoint(config, licenseApiService, SupportedProducts)
68+
if err != nil {
69+
return err
70+
}
6671
opt.kubeClient, err = kubernetes.NewForConfig(config)
6772
if err != nil {
6873
return err

pkg/root.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,12 @@ import (
2727
clientsetscheme "k8s.io/client-go/kubernetes/scheme"
2828
"kmodules.xyz/client-go/logs"
2929
"kmodules.xyz/client-go/tools/cli"
30-
"kmodules.xyz/client-go/tools/pushgateway"
3130
)
3231

32+
var SupportedProducts = []string{"stash-enterprise"}
33+
34+
var licenseApiService string
35+
3336
func NewRootCmd() *cobra.Command {
3437
var rootCmd = &cobra.Command{
3538
Use: "stash-mysql",
@@ -45,7 +48,7 @@ func NewRootCmd() *cobra.Command {
4548
}
4649
rootCmd.PersistentFlags().AddGoFlagSet(flag.CommandLine)
4750
logs.ParseFlags()
48-
rootCmd.PersistentFlags().StringVar(&pushgateway.ServiceName, "service-name", "stash-operator", "Stash service name.")
51+
rootCmd.PersistentFlags().StringVar(&licenseApiService, "license-apiservice", "", "Name of ApiService used to expose License endpoint")
4952
rootCmd.PersistentFlags().BoolVar(&cli.EnableAnalytics, "enable-analytics", cli.EnableAnalytics, "Send analytical events to Google Analytics")
5053

5154
rootCmd.AddCommand(v.NewCmdVersion())

vendor/github.com/BurntSushi/toml/.gitignore

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/BurntSushi/toml/.travis.yml

Lines changed: 15 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)