enable all other resources
This commit is contained in:
@@ -56,6 +56,7 @@ func NewConnectionReconciler(client client.Client, refResolver *zitadelv1alpha1.
|
||||
//+kubebuilder:rbac:groups=zitadel.github.com,resources=connections,verbs=get;list;watch;create;update;patch;delete
|
||||
//+kubebuilder:rbac:groups=zitadel.github.com,resources=connections/status,verbs=get;update;patch
|
||||
//+kubebuilder:rbac:groups=zitadel.github.com,resources=connections/finalizers,verbs=update
|
||||
// +kubebuilder:rbac:groups="",resources=secrets,verbs=list;watch;create;patch
|
||||
|
||||
// Reconcile is part of the main kubernetes reconciliation loop which aims to
|
||||
// move the current state of the cluster closer to the desired state.
|
||||
|
||||
@@ -1,84 +0,0 @@
|
||||
/*
|
||||
Copyright 2024.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package controller
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
. "github.com/onsi/ginkgo/v2"
|
||||
. "github.com/onsi/gomega"
|
||||
"k8s.io/apimachinery/pkg/api/errors"
|
||||
"k8s.io/apimachinery/pkg/types"
|
||||
"sigs.k8s.io/controller-runtime/pkg/reconcile"
|
||||
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
|
||||
zitadelv1alpha1 "github.com/HaimKortovich/zitadel-k8s-operator/api/v1alpha1"
|
||||
)
|
||||
|
||||
var _ = Describe("ZitadelInstance Controller", func() {
|
||||
Context("When reconciling a resource", func() {
|
||||
const resourceName = "test-resource"
|
||||
|
||||
ctx := context.Background()
|
||||
|
||||
typeNamespacedName := types.NamespacedName{
|
||||
Name: resourceName,
|
||||
Namespace: "default", // TODO(user):Modify as needed
|
||||
}
|
||||
zitadelinstance := &zitadelv1alpha1.ZitadelInstance{}
|
||||
|
||||
BeforeEach(func() {
|
||||
By("creating the custom resource for the Kind ZitadelInstance")
|
||||
err := k8sClient.Get(ctx, typeNamespacedName, zitadelinstance)
|
||||
if err != nil && errors.IsNotFound(err) {
|
||||
resource := &zitadelv1alpha1.ZitadelInstance{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: resourceName,
|
||||
Namespace: "default",
|
||||
},
|
||||
// TODO(user): Specify other spec details if needed.
|
||||
}
|
||||
Expect(k8sClient.Create(ctx, resource)).To(Succeed())
|
||||
}
|
||||
})
|
||||
|
||||
AfterEach(func() {
|
||||
// TODO(user): Cleanup logic after each test, like removing the resource instance.
|
||||
resource := &zitadelv1alpha1.ZitadelInstance{}
|
||||
err := k8sClient.Get(ctx, typeNamespacedName, resource)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
By("Cleanup the specific resource instance ZitadelInstance")
|
||||
Expect(k8sClient.Delete(ctx, resource)).To(Succeed())
|
||||
})
|
||||
It("should successfully reconcile the resource", func() {
|
||||
By("Reconciling the created resource")
|
||||
controllerReconciler := &ZitadelInstanceReconciler{
|
||||
Client: k8sClient,
|
||||
Scheme: k8sClient.Scheme(),
|
||||
}
|
||||
|
||||
_, err := controllerReconciler.Reconcile(ctx, reconcile.Request{
|
||||
NamespacedName: typeNamespacedName,
|
||||
})
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
// TODO(user): Add more specific assertions depending on your controller's reconciliation logic.
|
||||
// Example: If you expect a certain status condition after reconciliation, verify it here.
|
||||
})
|
||||
})
|
||||
})
|
||||
@@ -6,10 +6,10 @@ import (
|
||||
"slices"
|
||||
"time"
|
||||
|
||||
zitadelv1alpha1 "github.com/HaimKortovich/zitadel-k8s-operator/api/v1alpha1"
|
||||
"github.com/HaimKortovich/zitadel-k8s-operator/pkg/builder"
|
||||
condition "github.com/HaimKortovich/zitadel-k8s-operator/pkg/condition"
|
||||
"github.com/HaimKortovich/zitadel-k8s-operator/pkg/controller/core"
|
||||
zitadelv1alpha1 "github.com/HaimKortovich/zitadel-resources-operator/api/v1alpha1"
|
||||
"github.com/HaimKortovich/zitadel-resources-operator/pkg/builder"
|
||||
condition "github.com/HaimKortovich/zitadel-resources-operator/pkg/condition"
|
||||
"github.com/HaimKortovich/zitadel-resources-operator/pkg/controller/core"
|
||||
clientv2 "github.com/zitadel/zitadel-go/v3/pkg/client"
|
||||
"github.com/zitadel/zitadel-go/v3/pkg/client/zitadel/filter/v2"
|
||||
"github.com/zitadel/zitadel-go/v3/pkg/client/zitadel/internal_permission/v2"
|
||||
@@ -1,8 +1,8 @@
|
||||
package controller
|
||||
|
||||
import (
|
||||
zitadelv1alpha1 "github.com/HaimKortovich/zitadel-k8s-operator/api/v1alpha1"
|
||||
"github.com/HaimKortovich/zitadel-k8s-operator/pkg/controller/core"
|
||||
zitadelv1alpha1 "github.com/HaimKortovich/zitadel-resources-operator/api/v1alpha1"
|
||||
"github.com/HaimKortovich/zitadel-resources-operator/pkg/controller/core"
|
||||
|
||||
"context"
|
||||
"fmt"
|
||||
@@ -21,10 +21,10 @@ import (
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
zitadelv1alpha1 "github.com/HaimKortovich/zitadel-k8s-operator/api/v1alpha1"
|
||||
"github.com/HaimKortovich/zitadel-k8s-operator/pkg/builder"
|
||||
condition "github.com/HaimKortovich/zitadel-k8s-operator/pkg/condition"
|
||||
"github.com/HaimKortovich/zitadel-k8s-operator/pkg/controller/core"
|
||||
zitadelv1alpha1 "github.com/HaimKortovich/zitadel-resources-operator/api/v1alpha1"
|
||||
"github.com/HaimKortovich/zitadel-resources-operator/pkg/builder"
|
||||
condition "github.com/HaimKortovich/zitadel-resources-operator/pkg/condition"
|
||||
"github.com/HaimKortovich/zitadel-resources-operator/pkg/controller/core"
|
||||
clientv2 "github.com/zitadel/zitadel-go/v3/pkg/client"
|
||||
"github.com/zitadel/zitadel-go/v3/pkg/client/zitadel/application/v2"
|
||||
"github.com/zitadel/zitadel-go/v3/pkg/client/zitadel/filter/v2"
|
||||
@@ -191,7 +191,7 @@ func (wr *wrappedOIDCAppReconciler) Reconcile(ctx context.Context, ztdClient *cl
|
||||
}
|
||||
|
||||
secretData := map[string][]byte{"clientSecret": []byte(resp.GetApiConfiguration().ClientSecret), "appId": []byte(resp.ApplicationId), "clientId": []byte(resp.GetApiConfiguration().ClientId)}
|
||||
secret, err := wr.Builder.BuildSecret(builder.SecretOpts{Immutable: false, Zitadel: nil, Key: key, Data: secretData}, wr.OIDCApp)
|
||||
secret, err := wr.Builder.BuildSecret(builder.SecretOpts{Immutable: false, Key: key, Data: secretData}, wr.OIDCApp)
|
||||
if err != nil {
|
||||
return fmt.Errorf("error building Secret: %v", err)
|
||||
}
|
||||
@@ -3,8 +3,8 @@ package controller
|
||||
import (
|
||||
"strings"
|
||||
|
||||
zitadelv1alpha1 "github.com/HaimKortovich/zitadel-k8s-operator/api/v1alpha1"
|
||||
"github.com/HaimKortovich/zitadel-k8s-operator/pkg/controller/core"
|
||||
zitadelv1alpha1 "github.com/HaimKortovich/zitadel-resources-operator/api/v1alpha1"
|
||||
"github.com/HaimKortovich/zitadel-resources-operator/pkg/controller/core"
|
||||
|
||||
"context"
|
||||
"fmt"
|
||||
@@ -21,9 +21,9 @@ import (
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
zitadelv1alpha1 "github.com/HaimKortovich/zitadel-k8s-operator/api/v1alpha1"
|
||||
condition "github.com/HaimKortovich/zitadel-k8s-operator/pkg/condition"
|
||||
"github.com/HaimKortovich/zitadel-k8s-operator/pkg/controller/core"
|
||||
zitadelv1alpha1 "github.com/HaimKortovich/zitadel-resources-operator/api/v1alpha1"
|
||||
condition "github.com/HaimKortovich/zitadel-resources-operator/pkg/condition"
|
||||
"github.com/HaimKortovich/zitadel-resources-operator/pkg/controller/core"
|
||||
clientv2 "github.com/zitadel/zitadel-go/v3/pkg/client"
|
||||
"github.com/zitadel/zitadel-go/v3/pkg/client/zitadel/object/v2"
|
||||
"github.com/zitadel/zitadel-go/v3/pkg/client/zitadel/org/v2"
|
||||
@@ -1,8 +1,8 @@
|
||||
package controller
|
||||
|
||||
import (
|
||||
zitadelv1alpha1 "github.com/HaimKortovich/zitadel-k8s-operator/api/v1alpha1"
|
||||
"github.com/HaimKortovich/zitadel-k8s-operator/pkg/controller/core"
|
||||
zitadelv1alpha1 "github.com/HaimKortovich/zitadel-resources-operator/api/v1alpha1"
|
||||
"github.com/HaimKortovich/zitadel-resources-operator/pkg/controller/core"
|
||||
|
||||
"context"
|
||||
"fmt"
|
||||
@@ -23,9 +23,9 @@ import (
|
||||
"sort"
|
||||
"time"
|
||||
|
||||
zitadelv1alpha1 "github.com/HaimKortovich/zitadel-k8s-operator/api/v1alpha1"
|
||||
condition "github.com/HaimKortovich/zitadel-k8s-operator/pkg/condition"
|
||||
"github.com/HaimKortovich/zitadel-k8s-operator/pkg/controller/core"
|
||||
zitadelv1alpha1 "github.com/HaimKortovich/zitadel-resources-operator/api/v1alpha1"
|
||||
condition "github.com/HaimKortovich/zitadel-resources-operator/pkg/condition"
|
||||
"github.com/HaimKortovich/zitadel-resources-operator/pkg/controller/core"
|
||||
|
||||
clientv2 "github.com/zitadel/zitadel-go/v3/pkg/client"
|
||||
"github.com/zitadel/zitadel-go/v3/pkg/client/zitadel/filter/v2"
|
||||
@@ -1,8 +1,8 @@
|
||||
package controller
|
||||
|
||||
import (
|
||||
zitadelv1alpha1 "github.com/HaimKortovich/zitadel-k8s-operator/api/v1alpha1"
|
||||
"github.com/HaimKortovich/zitadel-k8s-operator/pkg/controller/core"
|
||||
zitadelv1alpha1 "github.com/HaimKortovich/zitadel-resources-operator/api/v1alpha1"
|
||||
"github.com/HaimKortovich/zitadel-resources-operator/pkg/controller/core"
|
||||
|
||||
"context"
|
||||
"fmt"
|
||||
Reference in New Issue
Block a user