Skip to content

Commit

Permalink
fix fqdn
Browse files Browse the repository at this point in the history
  • Loading branch information
ruanxin committed Nov 15, 2024
1 parent 52a4a7e commit e8980db
Show file tree
Hide file tree
Showing 9 changed files with 24 additions and 22 deletions.
6 changes: 1 addition & 5 deletions .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -181,11 +181,7 @@ issues:
- err113 # Dynamic error creation in unit and integration test utils is ok
- path: tests/e2e/
linters: [ gci ] # Disable gci due to the test utilities dot import.
- path: tests/integration/watcher/certificate_suite_test.go
linters: [ gci ] # Disable gci due to the test utilities dot import.
- path: tests/integration/declarative/declarative_test.go
linters: [ gci ] # Disable gci due to the test utilities dot import.
- path: tests/integration/controller/(.*)/(.*)_test.go
- path: tests/integration/
linters: [ gci ] # Disable gci due to the test utilities dot import.
- linters:
- importas
Expand Down
4 changes: 2 additions & 2 deletions docs/contributor/04-local-test-setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ This setup is deployed with the following security features enabled:
The output should look like the following:

```shell
{"repositories":["component-descriptors/kyma-project.io/template-operator"]}
{"repositories":["component-descriptors/kyma-project.io/module/template-operator"]}
```

7. Open the generated `template.yaml` file and change the following line:
Expand Down Expand Up @@ -240,7 +240,7 @@ status:
operation: kyma is ready
modules:
- channel: regular
fqdn: kyma-project.io/template-operator
fqdn: kyma-project.io/module/template-operator
manifest:
apiVersion: operator.kyma-project.io/v1beta2
kind: Manifest
Expand Down
2 changes: 1 addition & 1 deletion pkg/testutils/builder/manifest.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ func NewManifestBuilder() ManifestBuilder {
manifest: &v1beta2.Manifest{
TypeMeta: apimetav1.TypeMeta{
APIVersion: v1beta2.GroupVersion.String(),
Kind: "Manifest",
Kind: string(shared.ManifestKind),
},
ObjectMeta: apimetav1.ObjectMeta{
Name: random.Name(),
Expand Down
4 changes: 2 additions & 2 deletions pkg/testutils/manifest.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ var (

func NewTestManifest(prefix string) *v1beta2.Manifest {
return builder.NewManifestBuilder().WithName(fmt.Sprintf("%s-%s", prefix,
random.Name())).WithNamespace(apimetav1.NamespaceDefault).WithLabel(shared.KymaName,
random.Name())).WithNamespace(ControlPlaneNamespace).WithLabel(shared.KymaName,
string(uuid.NewUUID())).Build()
}

Expand Down Expand Up @@ -648,7 +648,7 @@ func GetManifestWithName(ctx context.Context, clnt client.Client, manifestName s
manifest := &v1beta2.Manifest{}
err := clnt.Get(
ctx, client.ObjectKey{
Namespace: apimetav1.NamespaceDefault,
Namespace: ControlPlaneNamespace,
Name: manifestName,
}, manifest,
)
Expand Down
3 changes: 3 additions & 0 deletions pkg/testutils/ocm.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package testutils

const DefaultFQDN = "kyma-project.io/module/template-operator"
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,9 @@ import (
. "github.com/kyma-project/lifecycle-manager/pkg/testutils"
)

var ErrNoMandatoryManifest = errors.New("manifest for mandatory Module not found")

const (
mandatoryChannel = "dummychannel"
mandatoryModule = "mandatory-module"
)

var _ = Describe("Mandatory Module Deletion", Ordered, func() {
Expand All @@ -39,14 +38,14 @@ var _ = Describe("Mandatory Module Deletion", Ordered, func() {
Should(Succeed())
Eventually(MandatoryManifestExistsWithLabelAndAnnotation).
WithContext(ctx).
WithArguments(kcpClient, shared.FQDN, "kyma-project.io/template-operator").
WithArguments(kcpClient, shared.FQDN, DefaultFQDN).
Should(Succeed())
By("And mandatory finalizer is added to the mandatory ModuleTemplate", func() {
Eventually(mandatoryModuleTemplateFinalizerExists).
WithContext(ctx).
WithArguments(kcpClient, client.ObjectKey{
Namespace: ControlPlaneNamespace,
Name: "mandatory-module",
Name: mandatoryModule,
}).
Should(Succeed())
})
Expand All @@ -62,14 +61,14 @@ var _ = Describe("Mandatory Module Deletion", Ordered, func() {
It("Then mandatory Manifest is deleted", func() {
Eventually(MandatoryManifestExistsWithLabelAndAnnotation).
WithContext(ctx).
WithArguments(kcpClient, shared.FQDN, "kyma-project.io/template-operator").
WithArguments(kcpClient, shared.FQDN, DefaultFQDN).
Should(Not(Succeed()))
By("And finalizer is removed from mandatory ModuleTemplate", func() {
Eventually(mandatoryModuleTemplateFinalizerExists).
WithContext(ctx).
WithArguments(kcpClient, client.ObjectKey{
Namespace: ControlPlaneNamespace,
Name: "mandatory-module",
Name: mandatoryModule,
}).
Should(Not(Succeed()))
})
Expand All @@ -80,12 +79,12 @@ var _ = Describe("Mandatory Module Deletion", Ordered, func() {
func registerControlPlaneLifecycleForKyma(kyma *v1beta2.Kyma) {
template := builder.NewModuleTemplateBuilder().
WithNamespace(ControlPlaneNamespace).
WithName("mandatory-module").
WithLabelModuleName("mandatory-module").
WithName(mandatoryModule).
WithLabelModuleName(mandatoryModule).
WithChannel(mandatoryChannel).
WithMandatory(true).
WithOCM(compdescv2.SchemaVersion).Build()
mandatoryManifest := NewTestManifest("mandatory-module")
mandatoryManifest := NewTestManifest(mandatoryModule)
mandatoryManifest.Labels[shared.IsMandatoryModule] = "true"

BeforeAll(func() {
Expand All @@ -102,7 +101,7 @@ func registerControlPlaneLifecycleForKyma(kyma *v1beta2.Kyma) {
WithArguments(kyma, reconciler, shared.StateReady).Should(Succeed())

installName := filepath.Join("main-dir", "installs")
mandatoryManifest.Annotations = map[string]string{shared.FQDN: "kyma-project.io/template-operator"}
mandatoryManifest.Annotations = map[string]string{shared.FQDN: DefaultFQDN}
validImageSpec, err := CreateOCIImageSpecFromFile(installName, server.Listener.Addr().String(),
manifestFilePath,
false)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import (

"github.com/google/go-containerregistry/pkg/registry"
"go.uber.org/zap/zapcore"
apicorev1 "k8s.io/api/core/v1"
apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
k8sclientscheme "k8s.io/client-go/kubernetes/scheme"
ctrl "sigs.k8s.io/controller-runtime"
Expand Down Expand Up @@ -95,6 +96,7 @@ var _ = BeforeSuite(func() {

Expect(api.AddToScheme(k8sclientscheme.Scheme)).NotTo(HaveOccurred())
Expect(apiextensionsv1.AddToScheme(k8sclientscheme.Scheme)).NotTo(HaveOccurred())
Expect(apicorev1.AddToScheme(k8sclientscheme.Scheme)).NotTo(HaveOccurred())

// +kubebuilder:scaffold:scheme

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ var _ = Describe("Mandatory Module Installation", Ordered, func() {
It("And Manifest CR for the Mandatory Module should be created with correct Owner Reference", func() {
Eventually(checkMandatoryManifestForKyma).
WithContext(ctx).
WithArguments(kyma, "kyma-project.io/template-operator").
WithArguments(kyma, DefaultFQDN).
Should(Succeed())
})
})
Expand All @@ -71,7 +71,7 @@ var _ = Describe("Skipping Mandatory Module Installation", Ordered, func() {
It("When Kyma has 'skip-reconciliation' label, then no Mandatory Module Manifest should be created", func() {
Eventually(checkMandatoryManifestForKyma).
WithContext(ctx).
WithArguments(kyma, "kyma-project.io/template-operator").
WithArguments(kyma, DefaultFQDN).
Should(Equal(ErrNoMandatoryManifest))
})
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
"time"

"go.uber.org/zap/zapcore"
apicorev1 "k8s.io/api/core/v1"
apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
k8sclientscheme "k8s.io/client-go/kubernetes/scheme"
ctrl "sigs.k8s.io/controller-runtime"
Expand Down Expand Up @@ -86,6 +87,7 @@ var _ = BeforeSuite(func() {

Expect(api.AddToScheme(k8sclientscheme.Scheme)).NotTo(HaveOccurred())
Expect(apiextensionsv1.AddToScheme(k8sclientscheme.Scheme)).NotTo(HaveOccurred())
Expect(apicorev1.AddToScheme(k8sclientscheme.Scheme)).NotTo(HaveOccurred())

// +kubebuilder:scaffold:scheme

Expand Down

0 comments on commit e8980db

Please sign in to comment.