question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

CreateOrReplace not fully equivalent with `apply`

See original GitHub issue

Describe the bug

Client Version: 5.12.1 K8s version: 1.19

Function createOrReplace is not equivalent to kubectl apply is instead behaves more like kubectl create (as expressed in the code comments )

Despite being an old comment this is what we’re experiencing (https://github.com/kubernetes/kubernetes/issues/25238#issuecomment-306549174)

what is currently happening is that we have

  • Deployment with no replica set
  • HPA with min replicas 1

when using manually kubectl apply it behaves as expected, doing the proper rolling update (25%, max unavailable 0)

when using the client it behaves like a create(or replace) operation forcing the deployment object to update to replicas 1 (default by k8s) and updating the replica set back to 1 this immediately terminates all remaining pods breaking what would else be a smooth deployment.

This completely invalidates the use of fabric8 client for applying manifests in a safe way.

Other refs: https://github.com/kubernetes/kubernetes/issues/25238#issuecomment-406415297 https://www.linkedin.com/pulse/kubectl-createreplace-vs-apply-which-one-use-samrat-sen/

Fabric8 Kubernetes Client version

5.12.1@latest

Steps to reproduce

  1. Use client apply twice a manifest with 1.1 HPA 10 min replicas (10 just allows to easily observe the behaviour) 1.2 Deployment with no replicas specified, rolling update (max surge 25%, max unavailable 0)

Expected behavior

Second apply should show a smooth transition of the pods to the new ones.

Runtime

Kubernetes (vanilla)

Kubernetes API Server version

other (please specify in additional context)

Environment

Amazon

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:8
  • Comments:10 (8 by maintainers)

github_iconTop GitHub Comments

2reactions
shawkinscommented, Mar 14, 2022

@sunix @rohanKanojia it would probably be good to still have an issue for a higher-level apply or serverSideApply method. That will be easier for users to find.

1reaction
manusacommented, Sep 1, 2022

is this fixed with #3937 ?

No, see https://github.com/fabric8io/kubernetes-client/issues/3896#issuecomment-1066739461.

It would be nice to have a DSL method to perform the Server Side Apply logic, instead of manually configuring the patch.

Read more comments on GitHub >

github_iconTop Results From Across the Web

what is the equivalent of CREATE VIEW IF NOT EXISTS in ...
1 Answer 1 ... You could use CREATE OR REPLACE : CREATE OR REPLACE VIEW is similar, but if a view of the...
Read more >
Documentation: 15: 43.10. Trigger Functions - PostgreSQL
A trigger function is created with the CREATE FUNCTION command, declaring it as a function with no arguments and a return type of...
Read more >
Data definition language (DDL) statements in ... - Google Cloud
CREATE [ OR REPLACE ] [ TEMP | TEMPORARY ] TABLE [ IF NOT EXISTS ] table_name ... column_schema : Similar to a...
Read more >
CREATE VIEW | ClickHouse Docs
CREATE [OR REPLACE ] VIEW [IF NOT EXISTS] [db.] ... This query is fully equivalent to using the subquery: ... [table] , you...
Read more >
9 Using PL/SQL Packages
To learn how to write C call specs, see Oracle Database Application Developer's ... You need not define the package bodies fully until...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found