Skip to content

Commit

Permalink
fix deployments bugs
Browse files Browse the repository at this point in the history
Signed-off-by: Fotis Nikolaidis <nikolaidis.fotis@gmail.com>
  • Loading branch information
fnikolai committed Jul 11, 2023
1 parent 874e02c commit f12c971
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 9 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
- ...


Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,4 @@ WORKDIR $HOME

COPY --from=builder /manager ./

ENTRYPOINT ["./manager"]
ENTRYPOINT ["/home/default/manager"]
2 changes: 1 addition & 1 deletion charts/platform/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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/

Expand Down
3 changes: 2 additions & 1 deletion charts/platform/templates/deployment/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
21 changes: 16 additions & 5 deletions cmd/manager/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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).
Expand All @@ -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",
Expand Down Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion examples/apps/mongodb/templates/master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ metadata:
spec:
inputs:
parameters:
slaves: ""
slaves: "" # masters-0, masters-1, ...
port: "27017"
service:
decorators:
Expand Down

0 comments on commit f12c971

Please sign in to comment.