diff --git a/CHANGELOG.md b/CHANGELOG.md index d57742ae6..1a4718c51 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,11 +8,13 @@ ### New Features & Functionality - Add autocompletion for uninstall command. - Add validation for missing callable. +- Add flag for disabling chaos controller. - ... ## Bug Fixes - Remove VirtualObjects and Templates from the list of CRDs whose finalizers can be forcibly deleted (they have no finalizers). - Fix issues with partial and conditional deployments (Ingress, chaos, ..) +- Fix platform chart to disable kubernetes dashboard according to the chart values. - ... diff --git a/Dockerfile b/Dockerfile index 5e41c4ffa..b5fedfc3d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -52,4 +52,4 @@ WORKDIR $HOME COPY --from=builder /manager ./ -ENTRYPOINT ["./manager"] +ENTRYPOINT ["/home/default/manager"] diff --git a/charts/platform/Chart.yaml b/charts/platform/Chart.yaml index f135e7568..6631a1591 100755 --- a/charts/platform/Chart.yaml +++ b/charts/platform/Chart.yaml @@ -41,7 +41,7 @@ dependencies: repository: https://charts.chaos-mesh.org - name: kubernetes-dashboard # web-based Kubernetes user interface - condition: dashboard.enabled + condition: kubernetes-dashboard.enabled version: 5.7.0 repository: https://kubernetes.github.io/dashboard/ diff --git a/charts/platform/templates/deployment/deployment.yaml b/charts/platform/templates/deployment/deployment.yaml index 7b80b447b..a764a3649 100644 --- a/charts/platform/templates/deployment/deployment.yaml +++ b/charts/platform/templates/deployment/deployment.yaml @@ -47,7 +47,8 @@ spec: - /bin/sh # Run shell - -c # Read from string - | # Multi-line str - ~/manager -cert-dir=/tmp/k8s-webhook-server/serving-certs + /home/default/manager -cert-dir=/tmp/k8s-webhook-server/serving-certs \ + --enable-chaos={{index .Values "chaos-mesh" "enabled"}} livenessProbe: httpGet: diff --git a/cmd/manager/main.go b/cmd/manager/main.go index db6758cc1..de683c97e 100644 --- a/cmd/manager/main.go +++ b/cmd/manager/main.go @@ -33,6 +33,8 @@ import ( "k8s.io/apimachinery/pkg/runtime" utilruntime "k8s.io/apimachinery/pkg/util/runtime" clientgoscheme "k8s.io/client-go/kubernetes/scheme" + "sigs.k8s.io/controller-runtime/pkg/webhook" + // Import all Kubernetes client auth plugins (e.g. Azure, GCP, OIDC, etc.) // to ensure that exec-entrypoint and run can make use of them. _ "k8s.io/client-go/plugin/pkg/client/auth" @@ -65,12 +67,16 @@ func main() { enableLeaderElection bool probeAddr string + enableChaos bool + // logger verbose int ) flag.StringVar(&certDir, "cert-dir", "/tmp/k8s-webhook-server/serving-certs/", "Points to the directory with webhook certificates.") + flag.BoolVar(&enableChaos, "enable-chaos", true, "Enable Chaos controllers.") + // flag.StringVar(&namespace, "namespace", "default", "Restricts the manager's cache to watch objects in this namespace ") // If set to "0" the metrics serving is disabled (otherwise, :8080). @@ -97,10 +103,13 @@ func main() { mgr, err := ctrl.NewManager(ctrl.GetConfigOrDie(), ctrl.Options{ Scheme: scheme, + WebhookServer: webhook.NewServer(webhook.Options{ + // Port: o.Port, + Host: "0.0.0.0", + CertDir: certDir, + }), // DeleteNamespace: namespace, // MetricsBindAddress: metricsAddr, - Host: "0.0.0.0", - CertDir: certDir, HealthProbeBindAddress: probeAddr, // LeaderElection: enableLeaderElection, // LeaderElectionID: "233dac68.frisbee.dev", @@ -130,10 +139,12 @@ func main() { os.Exit(1) } - if err := chaos.NewController(mgr, setupLog); err != nil { - utilruntime.HandleError(errors.Wrapf(err, "cannot create Chaos controller")) + if enableChaos { + if err := chaos.NewController(mgr, setupLog); err != nil { + utilruntime.HandleError(errors.Wrapf(err, "cannot create Chaos controller")) - os.Exit(1) + os.Exit(1) + } } if err := cascade.NewController(mgr, setupLog); err != nil { diff --git a/examples/apps/mongodb/templates/master.yml b/examples/apps/mongodb/templates/master.yml index 66218bce0..758c9317e 100644 --- a/examples/apps/mongodb/templates/master.yml +++ b/examples/apps/mongodb/templates/master.yml @@ -6,7 +6,7 @@ metadata: spec: inputs: parameters: - slaves: "" + slaves: "" # masters-0, masters-1, ... port: "27017" service: decorators: