Skip to content

Commit

Permalink
fix: debug is optional
Browse files Browse the repository at this point in the history
Signed-off-by: Mark Sagi-Kazar <mark.sagikazar@gmail.com>
  • Loading branch information
sagikazarmark authored and bitsf committed Apr 21, 2022
1 parent 75575ac commit 2afa9df
Showing 1 changed file with 17 additions and 9 deletions.
26 changes: 17 additions & 9 deletions controllers/goharbor/registry/deployments.go
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,22 @@ func (r *Reconciler) GetDeployment(ctx context.Context, registry *goharborv1.Reg
Scheme: registry.Spec.HTTP.TLS.GetScheme(),
}

containerPorts := []corev1.ContainerPort{
{
ContainerPort: apiPort,
Name: harbormetav1.RegistryAPIPortName,
Protocol: corev1.ProtocolTCP,
},
}

if registry.Spec.HTTP.Debug != nil {
containerPorts = append(containerPorts, corev1.ContainerPort{
ContainerPort: registry.Spec.HTTP.Debug.Port,
Name: harbormetav1.RegistryMetricsPortName,
Protocol: corev1.ProtocolTCP,
})
}

deploy := &appsv1.Deployment{
ObjectMeta: metav1.ObjectMeta{
Name: name,
Expand Down Expand Up @@ -292,15 +308,7 @@ func (r *Reconciler) GetDeployment(ctx context.Context, registry *goharborv1.Reg
Containers: []corev1.Container{{
Name: controllers.Registry.String(),
Image: image,
Ports: []corev1.ContainerPort{{
ContainerPort: apiPort,
Name: harbormetav1.RegistryAPIPortName,
Protocol: corev1.ProtocolTCP,
}, {
ContainerPort: registry.Spec.HTTP.Debug.Port,
Name: harbormetav1.RegistryMetricsPortName,
Protocol: corev1.ProtocolTCP,
}},
Ports: containerPorts,
LivenessProbe: &corev1.Probe{
ProbeHandler: corev1.ProbeHandler{
HTTPGet: httpGET,
Expand Down

0 comments on commit 2afa9df

Please sign in to comment.