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

observe: support CRDs #650

Merged
merged 2 commits into from
Nov 30, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 5 additions & 5 deletions pkg/cli/observe/observe.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ var (
touch inventory
cut -f 1-1 -d ' ' inventory

$ oc observe nodes -a '{ .status.addresses[0].address }' \
$ oc observe nodes --template '{ .status.addresses[0].address }' \
--names ./known_nodes.sh \
--delete ./remove_from_inventory.sh \
-- ./add_to_inventory.sh
Expand All @@ -130,10 +130,10 @@ var (
oc observe services

# Observe changes to services, including the clusterIP and invoke a script for each
oc observe services -a '{ .spec.clusterIP }' -- register_dns.sh
oc observe services --template '{ .spec.clusterIP }' -- register_dns.sh

# Observe changes to services filtered by a label selector
oc observe namespaces -l regist-dns=true -a '{ .spec.clusterIP }' -- register_dns.sh
oc observe namespaces -l regist-dns=true --template '{ .spec.clusterIP }' -- register_dns.sh
`)
)

Expand Down Expand Up @@ -295,7 +295,7 @@ func (o *ObserveOptions) Complete(f kcmdutil.Factory, cmd *cobra.Command, args [
o.mapping = mapping
o.includeNamespace = mapping.Scope.Name() == meta.RESTScopeNamespace.Name()

o.client, err = f.ClientForMapping(mapping)
o.client, err = f.UnstructuredClientForMapping(mapping)
if err != nil {
return err
}
Expand Down Expand Up @@ -692,7 +692,7 @@ func (o *ObserveOptions) next(deltaType cache.DeltaType, obj runtime.Object, out
cmd.Env = append(cmd.Env, fmt.Sprintf("%s=%s", o.objectEnvVar, string(output)))
}
if len(o.typeEnvVar) > 0 {
cmd.Env = append(cmd.Env, fmt.Sprintf("%s=%s", o.typeEnvVar, string(outType)))
cmd.Env = append(cmd.Env, fmt.Sprintf("%s=%s", o.typeEnvVar, outType))
}
err := measureCommandDuration(execDurations, cmd.Run, outType)
out.Flush()
Expand Down