Merge pull request #71854 from apelisse/fix-dryrun-detection

apply: fix detection of non-dry-run enabled servers
pull/564/head
Kubernetes Prow Robot 2018-12-07 16:52:12 -08:00 committed by GitHub
commit 9a9497d7af
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 6 deletions

View File

@ -344,6 +344,13 @@ func (o *ApplyOptions) Run() error {
return err return err
} }
// If server-dry-run is requested but the type doesn't support it, fail right away.
if o.ServerDryRun {
if err := dryRunVerifier.HasSupport(info.Mapping.GroupVersionKind); err != nil {
return err
}
}
if info.Namespaced() { if info.Namespaced() {
visitedNamespaces.Insert(info.Namespace) visitedNamespaces.Insert(info.Namespace)
} }
@ -367,12 +374,6 @@ func (o *ApplyOptions) Run() error {
if !errors.IsNotFound(err) { if !errors.IsNotFound(err) {
return cmdutil.AddSourceToErr(fmt.Sprintf("retrieving current configuration of:\n%s\nfrom server for:", info.String()), info.Source, err) return cmdutil.AddSourceToErr(fmt.Sprintf("retrieving current configuration of:\n%s\nfrom server for:", info.String()), info.Source, err)
} }
// If server-dry-run is requested but the type doesn't support it, fail right away.
if o.ServerDryRun {
if err := dryRunVerifier.HasSupport(info.Mapping.GroupVersionKind); err != nil {
return err
}
}
// Create the resource if it doesn't exist // Create the resource if it doesn't exist
// First, update the annotation used by kubectl apply // First, update the annotation used by kubectl apply