apache / solr-operator

Official Kubernetes operator for Apache Solr
https://solr.apache.org/operator
Apache License 2.0
243 stars 112 forks source link

Solr Operator Upgrade - `kubectl create/replace VS kubectl apply/apply` #572

Closed anilkhichar closed 10 months ago

anilkhichar commented 1 year ago

kubectl create/replace VS kubectl apply/apply

Can we get real data points specific to solr operator CRDs where using apply can get wrong. Based on my experiment there is no difference in the applied CRD content.

My experiment steps: Step1:

  1. Install v0.5.1 CRD using kubeclt create -f kubeclt get crd -o yaml > *.yaml
  2. Upgrade to v0.6.0 CRD using kubeclt replace -f kubeclt get crd -o yaml > *.yaml
  3. Upgrade to v0.7.0 CRD using kubeclt replace -f kubeclt get crd -o yaml > *.yaml

Step2:

  1. Install v0.5.1 CRD using kubeclt apply -f kubeclt get crd -o yaml > *.yaml
  2. Upgrade to v0.6.0 CRD using kubeclt apply -f kubeclt get crd -o yaml > *.yaml
  3. Upgrade to v0.7.0 CRD using kubeclt apply -f kubeclt get crd -o yaml > *.yaml

Step3, Step4: Also repeated steps from v0.3.0 to v0.7.0 (but same result)

Now the generated outcome YAML files do have exact same content except one last-applied-cofiguration extra element in the apply. And we don't need to worry about it.

kubectl_apply_vs_replace_experiment repalce_vs_apply_diff

Other references: https://github.com/apache/solr-operator/issues/502

HoustonPutman commented 11 months ago

I'm not exactly sure what the goal of this issue is.

The recommended steps when installing the Solr Operator is to use kubectl install and the steps when upgrading the Solr Operator use kubectl replace.

The reason for this is that the last-applied-configuration can be too big for some Kubernetes instances, and those fields are useless for CRDs.