Skip to content

Commit

Permalink
fix(agent): missing registry secret
Browse files Browse the repository at this point in the history
Ref: Longhorn-5467

Signed-off-by: Chin-Ya Huang <chin-ya.huang@suse.com>
  • Loading branch information
c3y1huang authored and innobead committed Mar 2, 2023
1 parent 3b32c66 commit c16cc5f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions cmd/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ func init() {
managerCmd.PersistentFlags().StringVar(&sbm.ImageName, "image-name", os.Getenv("SUPPORT_BUNDLE_IMAGE"), "The support bundle image")
managerCmd.PersistentFlags().StringVar(&sbm.ImagePullPolicy, "image-pull-policy", os.Getenv("SUPPORT_BUNDLE_IMAGE_PULL_POLICY"), "Pull policy of the support bundle image")
managerCmd.PersistentFlags().StringVar(&sbm.NodeSelector, "node-selector", os.Getenv("SUPPORT_BUNDLE_NODE_SELECTOR"), "NodeSelector of agent DaemonSet. e.g., key1=value1,key2=value2")
managerCmd.PersistentFlags().StringVar(&sbm.RegistrySecret, "registry-secret", os.Getenv("SUPPORT_BUNDLE_REGISTRY_SECRET"), "The registry secret for image pull")
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")
}
8 changes: 8 additions & 0 deletions pkg/manager/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,14 @@ func (a *AgentDaemonSet) Create(image string, managerURL string) error {
},
}

if a.sbm.RegistrySecret != "" {
daemonSet.Spec.Template.Spec.ImagePullSecrets = []corev1.LocalObjectReference{
{
Name: a.sbm.RegistrySecret,
},
}
}

_, err = a.sbm.k8s.CreateDaemonSets(a.sbm.PodNamespace, daemonSet)
return err
}
Expand Down
1 change: 1 addition & 0 deletions pkg/manager/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ type SupportBundleManager struct {
KubeConfig string
PodNamespace string
NodeSelector string
RegistrySecret string

ExcludeResources []schema.GroupResource
ExcludeResourceList []string
Expand Down

0 comments on commit c16cc5f

Please sign in to comment.