-
Notifications
You must be signed in to change notification settings - Fork 288
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
kubernetesapply: add support for discovery_strategy='selectors-only' (#…
…4881) You can specify this in the tiltfile as k8s_resource(..., discovery_strategy='selectors-only') and tilt will create kdisco objects with namespace-only watches (no UIDs). Fixes #4867
- Loading branch information
Showing
12 changed files
with
149 additions
and
9 deletions.
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
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,32 @@ | ||
package k8s | ||
|
||
import ( | ||
"fmt" | ||
|
||
"go.starlark.net/starlark" | ||
|
||
"github.com/tilt-dev/tilt/internal/tiltfile/value" | ||
"github.com/tilt-dev/tilt/pkg/apis/core/v1alpha1" | ||
) | ||
|
||
// Deserializing discovery strategy from starlark values. | ||
type DiscoveryStrategy v1alpha1.KubernetesDiscoveryStrategy | ||
|
||
func (ds *DiscoveryStrategy) Unpack(v starlark.Value) error { | ||
s, ok := value.AsString(v) | ||
if !ok { | ||
return fmt.Errorf("Must be a string. Got: %s", v.Type()) | ||
} | ||
|
||
kdStrategy := v1alpha1.KubernetesDiscoveryStrategy(s) | ||
if !(kdStrategy == "" || | ||
kdStrategy == v1alpha1.KubernetesDiscoveryStrategyDefault || | ||
kdStrategy == v1alpha1.KubernetesDiscoveryStrategySelectorsOnly) { | ||
return fmt.Errorf("Invalid. Must be one of: %q, %q", | ||
v1alpha1.KubernetesDiscoveryStrategyDefault, | ||
v1alpha1.KubernetesDiscoveryStrategySelectorsOnly) | ||
} | ||
|
||
*ds = DiscoveryStrategy(kdStrategy) | ||
return nil | ||
} |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.