Skip to content

Commit

Permalink
fixup: empty imagePullSecrets
Browse files Browse the repository at this point in the history
Signed-off-by: Todd Baert <[email protected]>
  • Loading branch information
toddbaert committed Jun 4, 2024
1 parent 5e4124c commit ddb39d8
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 9 deletions.
11 changes: 8 additions & 3 deletions common/flagdproxy/flagdproxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,13 @@ func (f *FlagdProxyHandler) newFlagdProxyManifest(ownerReference *metav1.OwnerRe
if f.config.DebugLogging {
args = append(args, "--debug")
}
imagePullSecrets := []corev1.LocalObjectReference{}
if f.config.ImagePullSecret != "" {
imagePullSecrets = append(imagePullSecrets, corev1.LocalObjectReference{
Name: f.config.ImagePullSecret,
})
}

return &appsV1.Deployment{
ObjectMeta: metav1.ObjectMeta{
Name: FlagdProxyDeploymentName,
Expand Down Expand Up @@ -174,9 +181,7 @@ func (f *FlagdProxyHandler) newFlagdProxyManifest(ownerReference *metav1.OwnerRe
},
Spec: corev1.PodSpec{
ServiceAccountName: FlagdProxyServiceAccountName,
ImagePullSecrets: []corev1.LocalObjectReference{
{Name: f.config.ImagePullSecret},
},
ImagePullSecrets: imagePullSecrets,
Containers: []corev1.Container{
{
Image: fmt.Sprintf("%s:%s", f.config.Image, f.config.Tag),
Expand Down
6 changes: 5 additions & 1 deletion config/crd/bases/core.openfeature.dev_flagds.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,9 @@ spec:
Default: /flagd.evaluation.v1.Service
type: string
hosts:
description: Hosts list of hosts to be added to the ingress
description: |-
Hosts list of hosts to be added to the ingress.
Empty string corresponds to rule with no host.
items:
type: string
type: array
Expand Down Expand Up @@ -109,6 +111,8 @@ spec:
type: string
type: object
type: array
required:
- hosts
type: object
replicas:
default: 1
Expand Down
13 changes: 8 additions & 5 deletions controllers/core/flagd/resources/deployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,12 @@ func (r *FlagdDeployment) GetResource(ctx context.Context, flagd *api.Flagd) (cl
}

featureFlagSource := &api.FeatureFlagSource{}
imagePullSecrets := []corev1.LocalObjectReference{}
if r.FlagdConfig.ImagePullSecret != "" {
imagePullSecrets = append(imagePullSecrets, corev1.LocalObjectReference{
Name: r.FlagdConfig.ImagePullSecret,
})
}

if err := r.Client.Get(ctx, client.ObjectKey{
Namespace: flagd.Namespace,
Expand All @@ -94,12 +100,9 @@ func (r *FlagdDeployment) GetResource(ctx context.Context, flagd *api.Flagd) (cl
return nil, errors.New("no flagd container has been injected into deployment")
}

deployment.Spec.Template.Spec.ImagePullSecrets = imagePullSecrets

// override settings for the injected container for flagd standalone deployment mode
deployment.Spec.Template.Spec.ImagePullSecrets = []corev1.LocalObjectReference{
{
Name: r.FlagdConfig.ImagePullSecret,
},
}
deployment.Spec.Template.Spec.Containers[0].Image = fmt.Sprintf("%s:%s", r.FlagdConfig.Image, r.FlagdConfig.Tag)

deployment.Spec.Template.Spec.Containers[0].Ports = []corev1.ContainerPort{
Expand Down

0 comments on commit ddb39d8

Please sign in to comment.