Skip to content

Commit

Permalink
Join helm charts (#17)
Browse files Browse the repository at this point in the history
* Join helm charts

* use dockerregistry name

* rename secret

* remove dependency

* remove globals from values.yaml

* adjust flags

* fix tests

* FIX TEST
  • Loading branch information
halamix2 authored May 8, 2024
1 parent c15febd commit 734346c
Show file tree
Hide file tree
Showing 26 changed files with 255 additions and 308 deletions.
5 changes: 3 additions & 2 deletions components/operator/controllers/controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ package controllers

import (
"context"
"github.com/kyma-project/docker-registry/components/operator/internal/registry"
"time"

"github.com/kyma-project/docker-registry/components/operator/internal/registry"

"github.com/kyma-project/docker-registry/components/operator/api/v1alpha1"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
Expand All @@ -17,7 +18,7 @@ var _ = Describe("DockerRegistry controller", func() {
const (
namespaceName = "kyma-system"
crName = "cr-test"
deploymentName = "internal-docker-registry"
deploymentName = "dockerregistry"
registrySecret = registry.SecretName
)

Expand Down
6 changes: 3 additions & 3 deletions components/operator/internal/chart/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,12 @@ func (fb *flagsBuilder) WithRegistryCredentials(username, password string) *flag
}

func (fb *flagsBuilder) WithRegistryHttpSecret(httpSecret string) *flagsBuilder {
fb.flags["docker-registry.rollme"] = "dontrollplease"
fb.flags["docker-registry.registryHTTPSecret"] = httpSecret
fb.flags["rollme"] = "dontrollplease"
fb.flags["registryHTTPSecret"] = httpSecret
return fb
}

func (fb *flagsBuilder) WithNodePort(nodePort int64) *flagsBuilder {
fb.flags["global.registryNodePort"] = nodePort
fb.flags["registryNodePort"] = nodePort
return fb
}
10 changes: 3 additions & 7 deletions components/operator/internal/chart/flags_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,13 @@ func Test_flagsBuilder_Build(t *testing.T) {
},
},
},
"docker-registry": map[string]interface{}{
"registryHTTPSecret": "testHttpSecret",
"rollme": "dontrollplease",
},
"registryHTTPSecret": "testHttpSecret",
"rollme": "dontrollplease",
"dockerRegistry": map[string]interface{}{
"password": "testPassword",
"username": "testUsername",
},
"global": map[string]interface{}{
"registryNodePort": int64(1234),
},
"registryNodePort": int64(1234),
}

flags := NewFlagsBuilder().
Expand Down
2 changes: 1 addition & 1 deletion components/operator/internal/chart/pvc.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
)

const (
dockerRegistryPVCName = "internal-docker-registry"
dockerRegistryPVCName = "dockerregistry"
pvcKind = "PersistentVolumeClaim"
pvcVersion = "v1"
pvcGroup = ""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const (

type Config struct {
BaseNamespace string `envconfig:"default=kyma-system"`
BaseDefaultSecretName string `envconfig:"default=internal-dockerregistry-config"`
BaseDefaultSecretName string `envconfig:"default=dockerregistry-config"`
ExcludedNamespaces []string `envconfig:"default=kyma-system"`
ConfigMapRequeueDuration time.Duration `envconfig:"default=1m"`
SecretRequeueDuration time.Duration `envconfig:"default=1m"`
Expand Down
2 changes: 1 addition & 1 deletion components/operator/internal/registry/node_port.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const (
)

const (
dockerRegistryService = "internal-docker-registry"
dockerRegistryService = "dockerregistry"
dockerRegistryPortName = "http-registry"

allNamespaces = ""
Expand Down
4 changes: 2 additions & 2 deletions components/operator/internal/registry/secret.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ import (
)

const (
SecretName = "internal-dockerregistry-config"
SecretName = "dockerregistry-config"
LabelConfigKey = "dockerregistry.kyma-project.io/config"
LabelConfigVal = "credentials"
IsInternalKey = "isInternal"
DeploymentName = "internal-docker-registry"
DeploymentName = "dockerregistry"
HttpEnvKey = "REGISTRY_HTTP_SECRET"
)

Expand Down
4 changes: 1 addition & 3 deletions components/operator/internal/state/registry_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@ func Test_sFnRegistryConfiguration(t *testing.T) {
log: zap.NewNop().Sugar(),
}
expectedFlags := map[string]interface{}{
"global": map[string]interface{}{
"registryNodePort": int64(32_137),
},
"registryNodePort": int64(32_137),
}

next, result, err := sFnRegistryConfiguration(context.Background(), r, s)
Expand Down
5 changes: 2 additions & 3 deletions config/docker-registry/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
apiVersion: v1
description: Kyma component 'docker registry'
name: docker-registry
version: 1.0.0
version: 1.9.1
appVersion: 2.7.1
home: https://kyma-project.io
icon: https://github.com/kyma-project/kyma/blob/main/logo.png?raw=true
dependencies:
- name: docker-registry
File renamed without changes.
21 changes: 0 additions & 21 deletions config/docker-registry/charts/docker-registry/.helmignore

This file was deleted.

14 changes: 0 additions & 14 deletions config/docker-registry/charts/docker-registry/Chart.yaml

This file was deleted.

This file was deleted.

171 changes: 0 additions & 171 deletions config/docker-registry/charts/docker-registry/values.yaml

This file was deleted.

27 changes: 26 additions & 1 deletion config/docker-registry/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -1,3 +1,28 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "docker-registry.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
{{- end -}}

{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
*/}}
{{- define "docker-registry.fullname" -}}
{{- if .Values.fullnameOverride -}}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- $name := default .Chart.Name .Values.nameOverride -}}
{{- if contains $name .Release.Name -}}
{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{- end -}}
{{- end -}}

{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
Expand Down Expand Up @@ -34,7 +59,7 @@ Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
*/}}
{{- define "registry-fullname" -}}
{{- "internal-docker-registry" -}}
{{- "dockerregistry" -}}
{{- end -}}


Expand Down
Loading

0 comments on commit 734346c

Please sign in to comment.