-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Delete and redeploy object upon error 'field is immutable' #940
Merged
Merged
Changes from 9 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
9229993
Delete and redeploy object upon error 'field is immutable'
939e6cf
Delete and redeploy object upon error 'field is immutable'
8747bf9
fixed merge conflict
ba13055
Add integration test for skaffold dev
354de8e
Rebased
01a154d
Remove cleanup from skaffold dev test
1cb427b
Apply objects one by one so that one redeploy won't force delete all …
b80c9f3
merged master, fixed merge conflict in cli.go
1c4780f
Add --force flag when deploying with kubectl
eb06f39
Address code review comments
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
FROM golang:1.10.1-alpine3.7 as builder | ||
COPY foo /foo | ||
CMD sleep 600 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
apiVersion: batch/v1 | ||
kind: Job | ||
metadata: | ||
name: test-dev-job | ||
spec: | ||
template: | ||
spec: | ||
containers: | ||
- name: test-dev-job | ||
image: gcr.io/k8s-skaffold/test-dev-job | ||
restartPolicy: OnFailure |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
apiVersion: skaffold/v1alpha4 | ||
kind: Config | ||
build: | ||
artifacts: | ||
- imageName: gcr.io/k8s-skaffold/test-dev-job | ||
deploy: | ||
kubectl: | ||
manifests: | ||
- k8s-* | ||
profiles: | ||
- name: gcb | ||
build: | ||
googleCloudBuild: | ||
projectId: k8s-skaffold |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,7 +19,9 @@ package kubectl | |
import ( | ||
"context" | ||
"encoding/json" | ||
"fmt" | ||
"os/exec" | ||
"strconv" | ||
|
||
"github.com/GoogleContainerTools/skaffold/pkg/skaffold/util" | ||
"github.com/sirupsen/logrus" | ||
|
@@ -46,6 +48,18 @@ func (v ClientVersion) String() string { | |
return v.Major + "." + v.Minor | ||
} | ||
|
||
// CheckVersion warns the user if their kubectl version is < 1.12.0 | ||
func (c *CLI) CheckVersion() error { | ||
m, err := strconv.Atoi(c.Version().Minor) | ||
if err != nil { | ||
return fmt.Errorf("couldn't get kubectl minor version: %v", err) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: |
||
} | ||
if m < 12 { | ||
return fmt.Errorf("kubectl version 1.12.0 or greater is recommended for use with skaffold") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: |
||
} | ||
return nil | ||
} | ||
|
||
// Version returns the client version of kubectl. | ||
func (c *CLI) Version() ClientVersion { | ||
c.versionOnce.Do(func() { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
might be worth documenting the known issues for earlier kubectl versions for users
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for sure, would this be the right spot for that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah, sorry missed your reply on this. FWIW this is a fine place to do it :)