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

K8S version upgrade v0.29.x and related changes #2681

Merged
merged 11 commits into from
Feb 28, 2024

Conversation

mabhi
Copy link
Contributor

@mabhi mabhi commented Feb 20, 2024

Change Overview

The following PR is the revert of previous reverted PR: #2676 .
This PR includes :

  • Restore changes on k8s upgrade version v0.29.x
  • A change wherein validation webhook being created is added explicitly to the controller manager.
    Without the second change there was always a chance that the mutating/validating webhook request never reached the controller
  • New validation methods added to service validation webhook requests.

Pull request type

Please check the type of change your PR introduces:

  • 🚧 Work in Progress
  • 🌈 Refactoring (no functional changes, no api changes)
  • 🐹 Trivial/Minor
  • 🐛 Bugfix
  • 🌻 Feature
  • 🗺️ Documentation
  • 🤖 Test

Issues

  • fixes #issue-number

Test Plan

  • 💪 Manual
  • ⚡ Unit test
  • 💚 E2E

Install kanister controller using private image in repo with local changes (TAG=v0.0.6)
helm upgrade --install kanister ./helm/kanister-operator --create-namespace -n kanister --set image.repository=mabhi2ic/controller --set image.tag=${TAG}

Check the correct version of the controller image with the changes

(⎈|kind-local:default)➜  kanister git:(revert-k8s-upgrade-v0-29-x) ✗ k describe -n kanister po kanister-kanister-operator-7c8bf8766-kd8lp

Name:             kanister-kanister-operator-7c8bf8766-kd8lp
Namespace:        kanister
....
Status:           Running
IP:               10.244.0.16
......
Containers:
  kanister-kanister-operator:
    Container ID:   containerd://f21dab87ebdd6515c5b2261e5db81aaf533fbccb5312ea4e58d05ae68debfacb
    Image:          mabhi2ic/controller:v0.0.6
     .....
    Mounts:
      /var/run/secrets/kubernetes.io/serviceaccount from kube-api-access-xlc5l (ro)
      /var/run/webhook/serving-cert from webhook-certs (rw)
Conditions:
  Type              Status
  Initialized       True 
  Ready             True 
  ContainersReady   True 
  PodScheduled      True 
Volumes:
  webhook-certs:
    Type:        Secret (a volume populated by a Secret)
    SecretName:  kanister-webhook-certs
    Optional:    false

Testing by issuing a valid blueprint

(⎈|kind-local:default)➜  kanister git:(revert-k8s-upgrade-v0-29-x) k get po -n kanister   
NAME                                          READY   STATUS    RESTARTS   AGE
kanister-kanister-operator-7df894bb95-gmlmr   1/1     Running   0          29s
(⎈|kind-local:default)➜  kanister git:(revert-k8s-upgrade-v0-29-x) k create -f ./examples/mysql/mysql-blueprint.yaml -n kanister
blueprint.cr.kanister.io/mysql-blueprint created

Container logs for the above -

-------------------------------------------------------------------------
Passed the 'validation of phase restoreFromBlobStore in action restore' check.. ✅
Passed the 'validation of phase dumpToObjectStore in action backup' check.. ✅
Passed the 'validation of phase deleteFromBlobStore in action delete' check.. ✅
{"level":"info","ts":"2024-02-20T18:40:10Z","logger":"admission","msg":"Validating blueprint","object":{"name":"mysql-blueprint","namespace":"kanister"},"namespace":"kanister","name":"mysql-blueprint","resource":{"group":"cr.kanister.io","version":"v1alpha1","resource":"blueprints"},"user":"kubernetes-admin","requestID":"5d22fff4-4ec5-4719-b24e-b1212935f35b"}
{"File":"pkg/controller/controller.go","Function":"github.com/kanisterio/kanister/pkg/controller.(*Controller).onAddBlueprint","Line":231,"cluster_name":"94c9c8a4-f51d-46eb-a15c-019e6d6beabc","hostname":"kanister-kanister-operator-7df894bb95-gmlmr","level":"info","msg":"Added blueprint mysql-blueprint","time":"2024-02-20T18:40:10.553588555Z"}

Testing issuing an invalid blueprint

(⎈|kind-local:default)➜  kanister git:(revert-k8s-upgrade-v0-29-x) k create -f ./examples/mysql/mysql-blueprint.yaml -n kanister
Error from server (Forbidden): error when creating "./examples/mysql/mysql-blueprint.yaml": admission webhook "blueprints.cr.kanister.io" denied the request: Invalid blueprint, Failed to validate action backup: Requested function {KubeTaskInvalid} has not been registered

Container logs for the above -

----------------------------------------------------------------------------  
Failed the 'validation of action backup' check.. ❌
{"level":"info","ts":"2024-02-20T18:41:29Z","logger":"admission","msg":"Validating blueprint","object":{"name":"mysql-blueprint","namespace":"kanister"},"namespace":"kanister","name":"mysql-blueprint","resource":{"group":"cr.kanister.io","version":"v1alpha1","resource":"blueprints"},"user":"kubernetes-admin","requestID":"109071e5-cafc-43d2-b8c1-408bb6fa1384"}
{"BlueprintName":"mysql-blueprint","File":"pkg/controller/controller.go","Function":"github.com/kanisterio/kanister/pkg/controller.(*Controller).onDeleteBlueprint","Line":300,"cluster_name":"94c9c8a4-f51d-46eb-a15c-019e6d6beabc","hostname":"kanister-kanister-operator-7df894bb95-gmlmr","level":"info","msg":"Deleted Blueprint ","time":"2024-02-20T18:44:02.815380997Z"}
{"level":"info","ts":"2024-02-20T18:44:13Z","logger":"admission","msg":"Validating blueprint","object":{"name":"mysql-blueprint","namespace":"kanister"},"namespace":"kanister","name":"mysql-blueprint","resource":{"group":"cr.kanister.io","version":"v1alpha1","resource":"blueprints"},"user":"kubernetes-admin","requestID":"c6413c18-a770-486b-89fa-10df3574dd13"}

@mabhi mabhi changed the title Revert k8s upgrade v0 29 x Revert: Revert k8s upgrade v0.29,x Feb 20, 2024
@mabhi mabhi changed the title Revert: Revert k8s upgrade v0.29,x Revert: Revert k8s upgrade v0.29.x Feb 20, 2024
@mabhi mabhi marked this pull request as ready for review February 21, 2024 04:12
@mabhi mabhi force-pushed the revert-k8s-upgrade-v0-29-x branch 2 times, most recently from 52e7e2d to 05504a0 Compare February 23, 2024 05:00
cmd/reposervercontroller/main.go Outdated Show resolved Hide resolved
pkg/resource/resource.go Outdated Show resolved Hide resolved
pkg/utils/utils.go Outdated Show resolved Hide resolved
pkg/handler/handler.go Outdated Show resolved Hide resolved
pkg/handler/handler.go Outdated Show resolved Hide resolved
pkg/handler/handler.go Outdated Show resolved Hide resolved
pkg/validatingwebhook/blueprint_handler.go Outdated Show resolved Hide resolved
@mabhi mabhi requested a review from pavannd1 February 26, 2024 05:11
cmd/reposervercontroller/main.go Outdated Show resolved Hide resolved
pkg/utils/utils.go Outdated Show resolved Hide resolved
cmd/reposervercontroller/main.go Outdated Show resolved Hide resolved
docker/postgres-kanister-tools/Dockerfile Outdated Show resolved Hide resolved
examples/postgres-RDS/Dockerfile Outdated Show resolved Hide resolved
pkg/blockstorage/vmware/vmware.go Outdated Show resolved Hide resolved
@mabhi mabhi changed the title Revert: Revert k8s upgrade v0.29.x K8S version upgrade v0.29.x and related changes Feb 26, 2024
Copy link
Contributor

@PrasadG193 PrasadG193 left a comment

Choose a reason for hiding this comment

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

LGTM

@mabhi mabhi added the kueue label Feb 28, 2024
Signed-off-by: Abhijit Mukherjee <abhijit.mukherjee@infracloud.io>
Signed-off-by: Abhijit Mukherjee <abhijit.mukherjee@infracloud.io>
Signed-off-by: Abhijit Mukherjee <abhijit.mukherjee@infracloud.io>
Signed-off-by: Abhijit Mukherjee <abhijit.mukherjee@infracloud.io>
Signed-off-by: Abhijit Mukherjee <abhijit.mukherjee@infracloud.io>
Signed-off-by: Abhijit Mukherjee <abhijit.mukherjee@infracloud.io>
Signed-off-by: Abhijit Mukherjee <abhijit.mukherjee@infracloud.io>
Signed-off-by: Abhijit Mukherjee <abhijit.mukherjee@infracloud.io>
Signed-off-by: Abhijit Mukherjee <abhijit.mukherjee@infracloud.io>
@mergify mergify bot merged commit 647d6e6 into master Feb 28, 2024
14 checks passed
@mergify mergify bot deleted the revert-k8s-upgrade-v0-29-x branch February 28, 2024 19:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

4 participants