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

kapp will show complete yaml which is generated after applying rebase rules and others changes #524

Merged
merged 20 commits into from
Jul 5, 2022

Conversation

kumaritanushree
Copy link
Contributor

@kumaritanushree kumaritanushree commented Jun 3, 2022

Fix for issue : #488

Output in different use cases will look like :

Creating a new app:

$./carvel-kapp/kapp deploy -a app1 -f test-488-yml-output/kapp-dry-run.yml  --diff-changes-yaml
Target cluster 'https://127.0.0.1:33907' (nodes: minikube)

---
# create: configmap/simple-cm (v1) namespace: default
apiVersion: v1
data:
  hello_msg: good-morning-blr
kind: ConfigMap
metadata:
  annotation:
    kapp.k14s.io/exists: ""
  labels:
    kapp.k14s.io/app: "1656585353984253000"
    kapp.k14s.io/association: v1.2a776d2dcf640bae095c987623b4a235
  name: simple-cm
  namespace: default

---
# create: deployment/simple-app1 (apps/v1) namespace: default
apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    kapp.k14s.io/app: "1656585353984253000"
    kapp.k14s.io/association: v1.2604464f207bf1e113ba69715d597ce6
  name: simple-app1
  namespace: default
spec:
  replicas: 2
  selector:
    matchLabels:
      kapp.k14s.io/app: "1656585353984253000"
      simple-app: ""
  template:
    metadata:
      labels:
        kapp.k14s.io/app: "1656585353984253000"
        kapp.k14s.io/association: v1.2604464f207bf1e113ba69715d597ce6
        simple-app: ""
    spec:
      containers:
      - env:
        - name: HELLO_MSG
          value: stranger
        image: nginx:1.21.6
        name: simple-app
status:
  conditions:
  - lastTransitionTime: "2022-05-12T03:35:07Z"
    lastUpdateTime: "2022-05-12T03:35:07Z"
    message: Deployment has minimum availability.
    reason: MinimumReplicasAvailable
    status: "True"
    type: Available

---
# create: secret/mysecret (v1) namespace: default
apiVersion: v1
data:
  password: <-- value not shown (#1)
  username: <-- value not shown (#2)
kind: Secret
metadata:
  labels:
    kapp.k14s.io/app: "1656585353984253000"
    kapp.k14s.io/association: v1.000230f224f6e1124fe556ed5f0f691f
  name: mysecret
  namespace: default

Update secret, deployment and delete ConfigMap and re-deploy app:

---
# update: deployment/simple-app1 (apps/v1) namespace: default
apiVersion: apps/v1
kind: Deployment
metadata:
  annotations:
    deployment.kubernetes.io/revision: "1"
  creationTimestamp: "2022-06-20T19:36:16Z"
  generation: 2
  labels:
    kapp.k14s.io/app: "1656585353984253000"
    kapp.k14s.io/association: v1.2604464f207bf1e113ba69715d597ce6
  name: simple-app1
  namespace: default
  resourceVersion: "289922"
  uid: 63bb6913-036d-4237-969d-85d51bb898a3
spec:
  replicas: 1
  selector:
    matchLabels:
      kapp.k14s.io/app: "1656585353984253000"
      simple-app: ""
  template:
    metadata:
      labels:
        kapp.k14s.io/app: "1656585353984253000"
        kapp.k14s.io/association: v1.2604464f207bf1e113ba69715d597ce6
        simple-app: ""
    spec:
      containers:
      - env:
        - name: HELLO_MSG
          value: stranger
        image: nginx:1.21.6
        name: simple-app
status:
  availableReplicas: 2
  conditions:
  - lastTransitionTime: "2022-06-20T19:36:18Z"
    lastUpdateTime: "2022-06-20T19:36:18Z"
    message: Deployment has minimum availability.
    reason: MinimumReplicasAvailable
    status: "True"
    type: Available
  - lastTransitionTime: "2022-06-20T19:36:16Z"
    lastUpdateTime: "2022-06-20T19:36:18Z"
    message: ReplicaSet "simple-app1-5b8bc88d7b" has successfully progressed.
    reason: NewReplicaSetAvailable
    status: "True"
    type: Progressing
  observedGeneration: 2
  readyReplicas: 2
  replicas: 2
  updatedReplicas: 2

---
# update: secret/mysecret (v1) namespace: default
apiVersion: v1
data:
  password: <-- value not shown (#1)
  username: <-- value not shown (#2)
kind: Secret
metadata:
  creationTimestamp: "2022-06-20T19:36:16Z"
  labels:
    kapp.k14s.io/app: "1656585353984253000"
    kapp.k14s.io/association: v1.000230f224f6e1124fe556ed5f0f691f
  name: mysecret
  namespace: default
  resourceVersion: "289883"
  uid: 675c44e3-7c93-4236-b900-b56a12f169b4

---
# delete: configmap/simple-cm (v1) namespace: default

Resource with exists annotation

---
# exists: namespace/ns-sample (v1) cluster 

---
# create: configmap/configmap-sample (v1) namespace: ns-sample
apiVersion: v1
data:
  player_initial_lives: "33"
kind: ConfigMap
metadata:
  labels:
    kapp.k14s.io/app: "1655295085164557000"
    kapp.k14s.io/association: v1.216aa44a56073ff0ff55bfae60148595
  name: configmap-sample
  namespace: ns-sample

Succeeded

Note: kapp will print nothing in case of operation = noop

Deleting app:

./carvel-kapp/kapp delete -a app --diff-changes-yaml
Target cluster 'https://127.0.0.1:64899' (nodes: minikube)

---
# delete: deployment/simple-app1 (apps/v1) namespace: default

---
# delete: configmap/simple-cm (v1) namespace: default


Changes

Namespace  Name                          Kind        Age  Op      Op st.  Wait to  Rs  Ri  
default    simple-app1                   Deployment  3h   delete  -       delete   ok  -  
^          simple-app1-7f77fd9697        ReplicaSet  3h   -       -       delete   ok  -  
^          simple-app1-7f77fd9697-hdvg2  Pod         3h   -       -       delete   ok  -  
^          simple-cm                     ConfigMap   3h   delete  -       delete   ok  -  

Op:      0 create, 2 delete, 0 update, 2 noop, 0 exists
Wait to: 0 reconcile, 4 delete, 0 noop

@kumaritanushree kumaritanushree changed the title kapp will show show complete yaml which is generated after apply rebase rules and others changes kapp will show complete yaml which is generated after apply rebase rules and others changes Jun 3, 2022
@kumaritanushree kumaritanushree changed the title kapp will show complete yaml which is generated after apply rebase rules and others changes kapp will show complete yaml which is generated after applying rebase rules and others changes Jun 3, 2022
@100mik
Copy link
Contributor

100mik commented Jun 9, 2022

@kumaritanushree I think it will be super helpful if you put down the final output here 🤔

@kumaritanushree
Copy link
Contributor Author

@100mik Thank you for reminding, I updated the output in description. Thanks

pkg/kapp/clusterapply/change_set_view.go Outdated Show resolved Hide resolved
pkg/kapp/cmd/app/apply_flags.go Outdated Show resolved Hide resolved
pkg/kapp/cmd/app/deploy.go Outdated Show resolved Hide resolved
test/e2e/apply_run_test.go Outdated Show resolved Hide resolved
test/e2e/apply_run_test.go Outdated Show resolved Hide resolved
pkg/kapp/cmd/app/apply_flags.go Outdated Show resolved Hide resolved
pkg/kapp/clusterapply/change_set_view.go Outdated Show resolved Hide resolved
pkg/kapp/clusterapply/change_set_view.go Outdated Show resolved Hide resolved
pkg/kapp/clusterapply/change_set_view.go Outdated Show resolved Hide resolved
test/e2e/apply_run_test.go Outdated Show resolved Hide resolved
pkg/kapp/clusterapply/change_set_view.go Outdated Show resolved Hide resolved
pkg/kapp/clusterapply/change_set_view.go Outdated Show resolved Hide resolved
pkg/kapp/clusterapply/change_set_view.go Outdated Show resolved Hide resolved
pkg/kapp/cmd/app/apply_flags.go Outdated Show resolved Hide resolved
test/e2e/apply_run_test.go Outdated Show resolved Hide resolved
test/e2e/apply_run_test.go Outdated Show resolved Hide resolved
test/e2e/apply_run_test.go Outdated Show resolved Hide resolved
test/e2e/apply_run_test.go Outdated Show resolved Hide resolved
test/e2e/apply_run_test.go Outdated Show resolved Hide resolved
test/e2e/apply_run_test.go Outdated Show resolved Hide resolved
pkg/kapp/clusterapply/change_set_view.go Show resolved Hide resolved
pkg/kapp/clusterapply/change_set_view.go Outdated Show resolved Hide resolved
pkg/kapp/cmd/tools/diff_flags.go Outdated Show resolved Hide resolved
pkg/kapp/clusterapply/change_set_view.go Outdated Show resolved Hide resolved
pkg/kapp/clusterapply/change_set_view.go Outdated Show resolved Hide resolved
pkg/kapp/clusterapply/change_set_view.go Outdated Show resolved Hide resolved
pkg/kapp/clusterapply/change_set_view.go Outdated Show resolved Hide resolved
pkg/kapp/clusterapply/change_set_view.go Outdated Show resolved Hide resolved
pkg/kapp/clusterapply/change_set_view.go Outdated Show resolved Hide resolved
pkg/kapp/cmd/tools/diff_flags.go Outdated Show resolved Hide resolved
test/e2e/diff_change_yaml_test.go Outdated Show resolved Hide resolved
pkg/kapp/clusterapply/change_set_view.go Outdated Show resolved Hide resolved
pkg/kapp/cmd/tools/diff_flags.go Outdated Show resolved Hide resolved
pkg/kapp/cmd/app/deploy.go Outdated Show resolved Hide resolved
pkg/kapp/clusterapply/change_set_view.go Show resolved Hide resolved
test/e2e/diff_change_yaml_test.go Show resolved Hide resolved
pkg/kapp/clusterapply/change_set_view.go Outdated Show resolved Hide resolved
pkg/kapp/clusterapply/change_set_view.go Outdated Show resolved Hide resolved
pkg/kapp/clusterapply/change_set_view.go Outdated Show resolved Hide resolved
pkg/kapp/clusterapply/change_set_view.go Outdated Show resolved Hide resolved
pkg/kapp/clusterapply/change_set_view.go Outdated Show resolved Hide resolved
pkg/kapp/clusterapply/change_set_view.go Outdated Show resolved Hide resolved
Copy link
Member

@praveenrewar praveenrewar left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link
Contributor

@sethiyash sethiyash left a comment

Choose a reason for hiding this comment

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

Looks Good.

@cppforlife cppforlife merged commit cc64572 into develop Jul 5, 2022
@kumaritanushree kumaritanushree linked an issue Jul 7, 2022 that may be closed by this pull request
@praveenrewar praveenrewar deleted the task/488-showComplete-yaml branch March 28, 2024 10:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ability to show complete yaml with dry-run
7 participants