Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add PodDisruptionBudget to router components #346

Merged
merged 11 commits into from
Jul 11, 2023

Conversation

ariefrahmansyah
Copy link
Contributor

@ariefrahmansyah ariefrahmansyah commented Jun 21, 2023

This PR will add PodDisruptionBudget resources to Turing components (router, enricher, and ensembler).

Modifications:

  1. Add PodDisruptionBudget config
  2. Add Create and Delete PodDisruptionBudget on Cluster Controller
  3. Refactor updateKnServices to updateResources so it can accept both KnativeService and PodDisruptionBudget resources
  4. Introduce gotest to Makefile and GitHub actions
    a. In GitHub actions, add make setup to install gotest

@ariefrahmansyah ariefrahmansyah marked this pull request as ready for review June 22, 2023 08:19
@ariefrahmansyah ariefrahmansyah requested review from deadlycoconuts and krithika369 and removed request for deadlycoconuts June 22, 2023 08:19
Copy link
Collaborator

@krithika369 krithika369 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left some questions / comments. The rest LGTM. Thanks, @ariefrahmansyah !

.github/workflows/turing.yaml Show resolved Hide resolved
api/turing/cluster/pdb.go Outdated Show resolved Hide resolved
- apiGroups:
- policy
resources:
- poddisruptionbudgets
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Btw, we'd need to make this change in the chart specs in the helm-charts repo too.

engines/router/Makefile Show resolved Hide resolved
@@ -443,7 +453,7 @@ func (c *OpenapiConfig) GenerateSpecFile() error {
return err
}

err = os.MkdirAll(filepath.Dir(c.MergedSpecFile), 0755)
err = os.MkdirAll(filepath.Dir(c.MergedSpecFile), 0o755)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not specifically about this change, but it would be useful to leave an inline comment about what the file mode does and why it's being set.

type PodDisruptionBudgetConfig struct {
Enabled bool
// Can specify only one of maxUnavailable and minAvailable
MaxUnavailable string
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shall we instead name this as MaxUnavailablePercent and use *int ? Or, if we are sticking with the string type, should we check that the value is of the expected format (like "20%")? Would be nice to add some checks around this as well because otherwise, the earlier we can discover a problem with this config is when we deploy a router, which may be too late.

api/turing/service/router_deployment_service.go Outdated Show resolved Hide resolved
Copy link
Collaborator

@krithika369 krithika369 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks for the changes, @ariefrahmansyah ! Please feel free to merge once the linter errors are addressed.

pdbCfg.WithLabels(pdb.Labels)
pdbCfg.WithSpec(pdbSpec)

pdbObj, err := c.k8sPolicyClient.PodDisruptionBudgets(pdb.Namespace).Apply(ctx, pdbCfg, metav1.ApplyOptions{FieldManager: "application/apply-patch"})
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For Turing, we wouldn't need to "Update" an existing k8s resource - it's always create. In any case, I suppose it's ok to use Apply as it covers both scenarios.

@ariefrahmansyah ariefrahmansyah merged commit f700713 into caraml-dev:main Jul 11, 2023
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants