mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-06 11:42:14 +00:00
Introduce kubectl describe --show-events
Introduce DescriberSettings for Describer display options Introduce --show-events flag and DescriberSettings in Describer methods Introduce unit-tests Regenerated kubectl describe docs Add events flag tests to test-cmd.sh Signed-off-by: dhodovsk@redhat.com Signed-off-by: jchaloup@redhat.com
This commit is contained in:
@@ -368,9 +368,21 @@ runTests() {
|
||||
kube::test::get_object_jsonpath_assert 'pods/valid-pod' "{$id_field}" 'valid-pod'
|
||||
# Describe command should print detailed information
|
||||
kube::test::describe_object_assert pods 'valid-pod' "Name:" "Image:" "Node:" "Labels:" "Status:" "Controllers"
|
||||
# Describe command should print events information by default
|
||||
kube::test::describe_object_events_assert pods 'valid-pod'
|
||||
# Describe command should not print events information when show-events=false
|
||||
kube::test::describe_object_events_assert pods 'valid-pod' false
|
||||
# Describe command should print events information when show-events=true
|
||||
kube::test::describe_object_events_assert pods 'valid-pod' true
|
||||
# Describe command (resource only) should print detailed information
|
||||
kube::test::describe_resource_assert pods "Name:" "Image:" "Node:" "Labels:" "Status:" "Controllers"
|
||||
|
||||
# Describe command should print events information by default
|
||||
kube::test::describe_resource_events_assert pods
|
||||
# Describe command should not print events information when show-events=false
|
||||
kube::test::describe_resource_events_assert pods false
|
||||
# Describe command should print events information when show-events=true
|
||||
kube::test::describe_resource_events_assert pods true
|
||||
### Validate Export ###
|
||||
kube::test::get_object_assert 'pods/valid-pod' "{{.metadata.namespace}} {{.metadata.name}}" '<no value> valid-pod' "--export=true"
|
||||
|
||||
@@ -1220,8 +1232,20 @@ __EOF__
|
||||
kube::test::get_object_assert services "{{range.items}}{{$id_field}}:{{end}}" 'kubernetes:redis-master:'
|
||||
# Describe command should print detailed information
|
||||
kube::test::describe_object_assert services 'redis-master' "Name:" "Labels:" "Selector:" "IP:" "Port:" "Endpoints:" "Session Affinity:"
|
||||
# Describe command should print events information by default
|
||||
kube::test::describe_object_events_assert services 'redis-master'
|
||||
# Describe command should not print events information when show-events=false
|
||||
kube::test::describe_object_events_assert services 'redis-master' false
|
||||
# Describe command should print events information when show-events=true
|
||||
kube::test::describe_object_events_assert services 'redis-master' true
|
||||
# Describe command (resource only) should print detailed information
|
||||
kube::test::describe_resource_assert services "Name:" "Labels:" "Selector:" "IP:" "Port:" "Endpoints:" "Session Affinity:"
|
||||
# Describe command should print events information by default
|
||||
kube::test::describe_resource_events_assert services
|
||||
# Describe command should not print events information when show-events=false
|
||||
kube::test::describe_resource_events_assert services false
|
||||
# Describe command should print events information when show-events=true
|
||||
kube::test::describe_resource_events_assert services true
|
||||
|
||||
### Dump current redis-master service
|
||||
output_service=$(kubectl get service redis-master -o json --output-version=v1 "${kube_flags[@]}")
|
||||
@@ -1327,8 +1351,20 @@ __EOF__
|
||||
kube::test::get_object_assert rc "{{range.items}}{{$id_field}}:{{end}}" 'frontend:'
|
||||
# Describe command should print detailed information
|
||||
kube::test::describe_object_assert rc 'frontend' "Name:" "Image(s):" "Labels:" "Selector:" "Replicas:" "Pods Status:"
|
||||
# Describe command should print events information by default
|
||||
kube::test::describe_object_events_assert rc 'frontend'
|
||||
# Describe command should not print events information when show-events=false
|
||||
kube::test::describe_object_events_assert rc 'frontend' false
|
||||
# Describe command should print events information when show-events=true
|
||||
kube::test::describe_object_events_assert rc 'frontend' true
|
||||
# Describe command (resource only) should print detailed information
|
||||
kube::test::describe_resource_assert rc "Name:" "Name:" "Image(s):" "Labels:" "Selector:" "Replicas:" "Pods Status:"
|
||||
# Describe command should print events information by default
|
||||
kube::test::describe_resource_events_assert rc
|
||||
# Describe command should not print events information when show-events=false
|
||||
kube::test::describe_resource_events_assert rc false
|
||||
# Describe command should print events information when show-events=true
|
||||
kube::test::describe_resource_events_assert rc true
|
||||
|
||||
### Scale replication controller frontend with current-replicas and replicas
|
||||
# Pre-condition: 3 replicas
|
||||
@@ -1582,8 +1618,20 @@ __EOF__
|
||||
kube::test::get_object_assert rs "{{range.items}}{{$id_field}}:{{end}}" 'frontend:'
|
||||
# Describe command should print detailed information
|
||||
kube::test::describe_object_assert rs 'frontend' "Name:" "Image(s):" "Labels:" "Selector:" "Replicas:" "Pods Status:"
|
||||
# Describe command should print events information by default
|
||||
kube::test::describe_object_events_assert rs 'frontend'
|
||||
# Describe command should not print events information when show-events=false
|
||||
kube::test::describe_object_events_assert rs 'frontend' false
|
||||
# Describe command should print events information when show-events=true
|
||||
kube::test::describe_object_events_assert rs 'frontend' true
|
||||
# Describe command (resource only) should print detailed information
|
||||
kube::test::describe_resource_assert rs "Name:" "Name:" "Image(s):" "Labels:" "Selector:" "Replicas:" "Pods Status:"
|
||||
# Describe command should print events information by default
|
||||
kube::test::describe_resource_events_assert rs
|
||||
# Describe command should not print events information when show-events=false
|
||||
kube::test::describe_resource_events_assert rs false
|
||||
# Describe command should print events information when show-events=true
|
||||
kube::test::describe_resource_events_assert rs true
|
||||
|
||||
### Scale replica set frontend with current-replicas and replicas
|
||||
# Pre-condition: 3 replicas
|
||||
@@ -1877,8 +1925,20 @@ __EOF__
|
||||
kube::test::get_object_assert nodes "{{range.items}}{{$id_field}}:{{end}}" '127.0.0.1:'
|
||||
|
||||
kube::test::describe_object_assert nodes "127.0.0.1" "Name:" "Labels:" "CreationTimestamp:" "Conditions:" "Addresses:" "Capacity:" "Pods:"
|
||||
# Describe command should print events information by default
|
||||
kube::test::describe_object_events_assert nodes "127.0.0.1"
|
||||
# Describe command should not print events information when show-events=false
|
||||
kube::test::describe_object_events_assert nodes "127.0.0.1" false
|
||||
# Describe command should print events information when show-events=true
|
||||
kube::test::describe_object_events_assert nodes "127.0.0.1" true
|
||||
# Describe command (resource only) should print detailed information
|
||||
kube::test::describe_resource_assert nodes "Name:" "Labels:" "CreationTimestamp:" "Conditions:" "Addresses:" "Capacity:" "Pods:"
|
||||
# Describe command should print events information by default
|
||||
kube::test::describe_resource_events_assert nodes
|
||||
# Describe command should not print events information when show-events=false
|
||||
kube::test::describe_resource_events_assert nodes false
|
||||
# Describe command should print events information when show-events=true
|
||||
kube::test::describe_resource_events_assert nodes true
|
||||
|
||||
### kubectl patch update can mark node unschedulable
|
||||
# Pre-condition: node is schedulable
|
||||
|
Reference in New Issue
Block a user