Skip to content

Commit

Permalink
Implement ztunnel controller in Sail Operator
Browse files Browse the repository at this point in the history
This PR implements the ztunnel controller and the associated unit tests
in Sail Operator.

Related to: #500

Signed-off-by: Sridhar Gaddam <[email protected]>
  • Loading branch information
sridhargaddam committed Dec 6, 2024
1 parent 02d1c8a commit 1464eb2
Show file tree
Hide file tree
Showing 8 changed files with 972 additions and 0 deletions.
26 changes: 26 additions & 0 deletions bundle/manifests/sailoperator.clusterserviceversion.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -586,6 +586,32 @@ spec:
- securitycontextconstraints
verbs:
- use
- apiGroups:
- sailoperator.io
resources:
- ztunnels
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
- sailoperator.io
resources:
- ztunnels/finalizers
verbs:
- update
- apiGroups:
- sailoperator.io
resources:
- ztunnels/status
verbs:
- get
- patch
- update
serviceAccountName: sail-operator
deployments:
- label:
Expand Down
14 changes: 14 additions & 0 deletions chart/samples/ambient/istio-sample.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
apiVersion: sailoperator.io/v1alpha1
kind: Istio
metadata:
name: default
spec:
version: v1.24.0
namespace: istio-system
profile: ambient
updateStrategy:
type: InPlace
inactiveRevisionDeletionGracePeriodSeconds: 30
values:
pilot:
trustedZtunnelNamespace: "ztunnel"
8 changes: 8 additions & 0 deletions chart/samples/ambient/istiocni-sample.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
apiVersion: sailoperator.io/v1alpha1
kind: IstioCNI
metadata:
name: default
spec:
version: v1.24.0
profile: ambient
namespace: istio-cni
8 changes: 8 additions & 0 deletions chart/samples/ambient/istioztunnel-sample.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
apiVersion: sailoperator.io/v1alpha1
kind: ZTunnel
metadata:
name: default
spec:
version: v1.24.0
namespace: ztunnel
profile: ambient
26 changes: 26 additions & 0 deletions chart/templates/rbac/role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -209,3 +209,29 @@ rules:
- securitycontextconstraints
verbs:
- use
- apiGroups:
- sailoperator.io
resources:
- ztunnels
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
- sailoperator.io
resources:
- ztunnels/finalizers
verbs:
- update
- apiGroups:
- sailoperator.io
resources:
- ztunnels/status
verbs:
- get
- patch
- update
8 changes: 8 additions & 0 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import (
"github.com/istio-ecosystem/sail-operator/controllers/istiorevision"
"github.com/istio-ecosystem/sail-operator/controllers/istiorevisiontag"
"github.com/istio-ecosystem/sail-operator/controllers/webhook"
"github.com/istio-ecosystem/sail-operator/controllers/ztunnel"
"github.com/istio-ecosystem/sail-operator/pkg/config"
"github.com/istio-ecosystem/sail-operator/pkg/enqueuelogger"
"github.com/istio-ecosystem/sail-operator/pkg/helm"
Expand Down Expand Up @@ -165,6 +166,13 @@ func main() {
os.Exit(1)
}

err = ztunnel.NewReconciler(reconcilerCfg, mgr.GetClient(), mgr.GetScheme(), chartManager).
SetupWithManager(mgr)
if err != nil {
setupLog.Error(err, "unable to create controller", "controller", "ZTunnel")
os.Exit(1)
}

Check warning on line 174 in cmd/main.go

View check run for this annotation

Codecov / codecov/patch

cmd/main.go#L169-L174

Added lines #L169 - L174 were not covered by tests

err = webhook.NewReconciler(mgr.GetClient(), mgr.GetScheme()).
SetupWithManager(mgr)
if err != nil {
Expand Down
Loading

0 comments on commit 1464eb2

Please sign in to comment.