Skip to content

Commit

Permalink
feat: fetch metadata from env and remove useless code
Browse files Browse the repository at this point in the history
  • Loading branch information
Yu-Jack committed Nov 16, 2023
1 parent 2d2e246 commit bb02d7d
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 9 deletions.
2 changes: 2 additions & 0 deletions cmd/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,6 @@ func init() {
managerCmd.PersistentFlags().StringVar(&sbm.SpecifyCollector, "specify-collector", os.Getenv("SUPPORT_BUNDLE_COLLECTOR"), "Execute specify collector script. e.g., longhorn")
managerCmd.PersistentFlags().StringSliceVar(&sbm.ExcludeResourceList, "exclude-resources", getEnvStringSlice("SUPPORT_BUNDLE_EXCLUDE_RESOURCES"), "List of resources to exclude. e.g., settings.harvesterhci.io,secrets")
managerCmd.PersistentFlags().StringSliceVar(&sbm.BundleCollectors, "extra-collectors", getEnvStringSlice("SUPPORT_BUNDLE_EXTRA_COLLECTORS"), "Get extra resource for the specific components e.g., harvester")
managerCmd.PersistentFlags().StringVar(&sbm.Description, "description", os.Getenv("SUPPORT_BUNDLE_DESCRIPTION"), "The support bundle description")
managerCmd.PersistentFlags().StringVar(&sbm.IssueURL, "issue-url", os.Getenv("SUPPORT_BUNDLE_ISSUE_URL"), "The support bundle issue url")
}
11 changes: 3 additions & 8 deletions pkg/manager/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,19 +43,14 @@ func (c *Cluster) GenerateClusterBundle(bundleDir string) (string, error) {
return "", errors.Wrap(err, "cannot get kubernetes version")
}

sb, err := c.sbm.state.GetSupportBundle(c.sbm.PodNamespace, c.sbm.BundleName)
if err != nil {
return "", errors.Wrap(err, "cannot get support bundle")
}

bundleMeta := &BundleMeta{
BundleName: sb.Name,
BundleName: c.sbm.BundleName,
BundleVersion: BundleVersion,
KubernetesVersion: kubeVersion.GitVersion,
ProjectNamespaceUUID: string(namespace.UID),
BundleCreatedAt: utils.Now(),
IssueURL: sb.Spec.IssueURL,
IssueDescription: sb.Spec.Description,
IssueURL: c.sbm.IssueURL,
IssueDescription: c.sbm.Description,
}

bundleName := fmt.Sprintf("supportbundle_%s_%s.zip",
Expand Down
2 changes: 2 additions & 0 deletions pkg/manager/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ type SupportBundleManager struct {
NodeSelector string
TaintToleration string
RegistrySecret string
IssueURL string
Description string

ExcludeResources []schema.GroupResource
ExcludeResourceList []string
Expand Down
1 change: 0 additions & 1 deletion pkg/manager/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,5 @@ type BundleMeta struct {
}

type StateStoreInterface interface {
GetSupportBundle(namespace, supportbundle string) (*types.SupportBundle, error)
GetState(namespace, supportbundle string) (types.SupportBundleState, error)
}

0 comments on commit bb02d7d

Please sign in to comment.