Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug 1701422: use port 443 for registry service #259

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion pkg/operator/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ func NewController(kubeconfig *restclient.Config) (*Controller, error) {

p := parameters.Globals{}

p.Service.Name = imageregistryv1.ImageRegistryName

p.Deployment.Namespace = namespace
p.Deployment.Labels = map[string]string{"docker-registry": "default"}

Expand All @@ -75,7 +77,6 @@ func NewController(kubeconfig *restclient.Config) (*Controller, error) {
p.Healthz.Route = "/healthz"
p.Healthz.TimeoutSeconds = 5

p.Service.Name = imageregistryv1.ImageRegistryName
p.ImageConfig.Name = "cluster"
p.CAConfig.Name = imageregistryv1.ImageRegistryCertificatesName

Expand Down
4 changes: 3 additions & 1 deletion pkg/resource/imageconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,8 @@ func (gic *generatorImageConfig) getRouteHostnames() ([]string, error) {
return externalHostnames, nil
}

// getServiceHostname returns the host name for the internal registry service.
// This value is propagated to the OpenShift cluster via the image.config.openshift.io/cluster object.
func getServiceHostname(serviceLister kcorelisters.ServiceNamespaceLister, serviceName string) (string, error) {
svc, err := serviceLister.Get(serviceName)
if errors.IsNotFound(err) {
Expand All @@ -188,6 +190,6 @@ func getServiceHostname(serviceLister kcorelisters.ServiceNamespaceLister, servi
if svc == nil || err != nil {
return "", err
}
svcHostname := fmt.Sprintf("%s.%s.svc:%d", svc.Name, svc.Namespace, svc.Spec.Ports[0].Port)
svcHostname := fmt.Sprintf("%s.%s.svc", svc.Name, svc.Namespace)
return svcHostname, nil
}
17 changes: 10 additions & 7 deletions pkg/resource/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,20 @@ type generatorService struct {
namespace string
labels map[string]string
port int
targetPort int
secretName string
}

func newGeneratorService(lister corelisters.ServiceNamespaceLister, client coreset.CoreV1Interface, params *parameters.Globals, cr *imageregistryv1.Config) *generatorService {
return &generatorService{
lister: lister,
client: client,
name: params.Service.Name,
namespace: params.Deployment.Namespace,
labels: params.Deployment.Labels,
port: params.Container.Port,
lister: lister,
client: client,
name: params.Service.Name,
namespace: params.Deployment.Namespace,
labels: params.Deployment.Labels,
// Bug 1701422: Hard-code service to use HTTPS port
port: 443,
targetPort: params.Container.Port,
secretName: imageregistryv1.ImageRegistryName + "-tls",
}
}
Expand Down Expand Up @@ -73,7 +76,7 @@ func (gs *generatorService) expected() *corev1.Service {
Name: fmt.Sprintf("%d-tcp", gs.port),
Port: int32(gs.port),
Protocol: "TCP",
TargetPort: intstr.FromInt(gs.port),
TargetPort: intstr.FromInt(gs.targetPort),
},
},
},
Expand Down
11 changes: 10 additions & 1 deletion test/framework/imageregistry.go
Original file line number Diff line number Diff line change
Expand Up @@ -271,9 +271,18 @@ func ensureInternalRegistryHostnameIsSet(logger Logger, client *Clientset) error
} else if err != nil {
return false, err
}
if cfg == nil || cfg.Status.InternalRegistryHostname != "image-registry.openshift-image-registry.svc:5000" {
if cfg == nil {
return false, nil
}
if len(cfg.Status.InternalRegistryHostname) == 0 {
return false, nil
}
// Bug 1701422: drop port number since we are using HTTPS default port on service
if cfg.Status.InternalRegistryHostname != "image-registry.openshift-image-registry.svc" {
return false, fmt.Errorf("expected internal registry hostname %s; got %s",
"image-registry.openshift-image-registry.svc",
cfg.Status.InternalRegistryHostname)
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fail fast if the internal registry host name doesn't match what we expect.

return true, nil
})
if err != nil {
Expand Down