MCPcopy Index your code
hub / github.com/devspace-sh/devspace / EnsurePullSecrets

Method EnsurePullSecrets

pkg/devspace/pullsecrets/init.go:73–117  ·  view source on GitHub ↗

EnsurePullSecrets creates the image pull secrets

(ctx devspacecontext.Context, dockerClient docker.Client, pullSecrets []string)

Source from the content-addressed store, hash-verified

71
72// EnsurePullSecrets creates the image pull secrets
73func (r *client) EnsurePullSecrets(ctx devspacecontext.Context, dockerClient docker.Client, pullSecrets []string) (err error) {
74 defer func() {
75 if err != nil {
76 // execute on error pull secrets hooks
77 pluginErr := hook.ExecuteHooks(ctx, map[string]interface{}{
78 "PULL_SECRETS": pullSecrets,
79 "error": err,
80 }, "error:createPullSecrets")
81 if pluginErr != nil {
82 return
83 }
84 }
85 }()
86
87 // execute before pull secrets hooks
88 pluginErr := hook.ExecuteHooks(ctx, map[string]interface{}{
89 "PULL_SECRETS": pullSecrets,
90 }, "before:createPullSecrets")
91 if pluginErr != nil {
92 return pluginErr
93 }
94
95 // create pull secrets
96 for _, pullSecretConf := range ctx.Config().Config().PullSecrets {
97 if len(pullSecrets) > 0 && !stringutil.Contains(pullSecrets, pullSecretConf.Name) {
98 continue
99 }
100
101 ctx := ctx.WithLogger(ctx.Log().WithPrefix("pullsecret:" + pullSecretConf.Name + " "))
102 err = r.ensurePullSecret(ctx, dockerClient, ctx.KubeClient().Namespace(), pullSecretConf)
103 if err != nil {
104 return err
105 }
106 }
107
108 // execute after pull secrets hooks
109 pluginErr = hook.ExecuteHooks(ctx, map[string]interface{}{
110 "PULL_SECRETS": pullSecrets,
111 }, "after:createPullSecrets")
112 if pluginErr != nil {
113 return pluginErr
114 }
115
116 return nil
117}
118
119func (r *client) addPullSecretsToServiceAccount(ctx devspacecontext.Context, namespace, pullSecretName string, serviceAccount string) error {
120 if serviceAccount == "" {

Callers

nothing calls this directly

Calls 9

ensurePullSecretMethod · 0.95
ExecuteHooksFunction · 0.92
ContainsFunction · 0.92
ConfigMethod · 0.65
WithLoggerMethod · 0.65
WithPrefixMethod · 0.65
LogMethod · 0.65
NamespaceMethod · 0.65
KubeClientMethod · 0.65

Tested by

no test coverage detected