diff --git a/cmd/manager.go b/cmd/manager.go index fcc71f0ad..dd9b281b7 100644 --- a/cmd/manager.go +++ b/cmd/manager.go @@ -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") } diff --git a/pkg/manager/agent.go b/pkg/manager/agent.go index 67d1d68c0..3c99f0470 100644 --- a/pkg/manager/agent.go +++ b/pkg/manager/agent.go @@ -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 } diff --git a/pkg/manager/manager.go b/pkg/manager/manager.go index df656a3b8..f2d1aabd4 100644 --- a/pkg/manager/manager.go +++ b/pkg/manager/manager.go @@ -36,6 +36,7 @@ type SupportBundleManager struct { KubeConfig string PodNamespace string NodeSelector string + RegistrySecret string ExcludeResources []schema.GroupResource ExcludeResourceList []string