mirror of https://github.com/knative/client.git
upgrade to latest dependencies (#1397)
bumping knative.dev/pkg d9b7180...889b567: > 889b567 Update community files (# 2199) > 842df75 Update community files (# 2196) > fa8095f Use default Kubeconfig loading rules (# 2197) bumping knative.dev/eventing 003a8a2...ea859aa: > ea859aa Improve security-related config in yaml files (# 5611) > d3e8af1 upgrade to latest dependencies (# 5606) > d9b4354 Update community files (# 5602) > dcbb9af Fix the link to the Working Group page. (# 5610) > a005619 Add health endpoint to event_display server (# 5608) > 7251c1b if no kubeconfig use inclusterconfig test (# 5603) bumping knative.dev/networking 7390d8c...03e4c43: > 03e4c43 upgrade to latest dependencies (# 470) > e3c72d2 Fix the Go iterator capture issue (# 467) > 74db2e5 Update community files (# 469) bumping knative.dev/serving 11abffd...7b9f1e9: > 7b9f1e9 Update net-certmanager nightly (# 11720) > 8d116e0 Update net-kourier nightly (# 11719) > 0703daa Update community files (# 11718) > ecc107f upgrade to latest dependencies (# 11713) > 19ddc78 Update net-istio nightly (# 11716) > 3296961 Update net-contour nightly (# 11715) > e1b42ce Update net-kourier nightly (# 11714) > 5a51323 Add v1beta1 version of DomainMapping crd (# 11682) > 6447982 Add support for emptydir rw access and e2e testing (# 11705) > d068a6d Add `app.kubernetes.io` labels (# 11655) > d2c28a0 Bump to Go 1.16 (# 11698) > c78a665 drop duplicate test (# 11711) > 3efd3d6 Update net-certmanager nightly (# 11707) > b2b3abb Update community files (# 11701) > 55a6139 Update net-kourier nightly (# 11704) > 3921d41 Update net-contour nightly (# 11703) Signed-off-by: Knative Automation <automation@knative.team>
This commit is contained in:
parent
a252d9b38d
commit
248baa6226
8
go.mod
8
go.mod
|
|
@ -18,11 +18,11 @@ require (
|
|||
k8s.io/cli-runtime v0.20.7
|
||||
k8s.io/client-go v0.20.7
|
||||
k8s.io/code-generator v0.20.7
|
||||
knative.dev/eventing v0.24.1-0.20210720191312-003a8a2d4ef5
|
||||
knative.dev/eventing v0.24.1-0.20210726215949-ea859aadcfe4
|
||||
knative.dev/hack v0.0.0-20210622141627-e28525d8d260
|
||||
knative.dev/networking v0.0.0-20210719003653-7390d8cf09e3
|
||||
knative.dev/pkg v0.0.0-20210715175632-d9b7180af6f2
|
||||
knative.dev/serving v0.24.1-0.20210721125539-11abffdc6f0d
|
||||
knative.dev/networking v0.0.0-20210723170945-03e4c4360c07
|
||||
knative.dev/pkg v0.0.0-20210726021015-889b5670e173
|
||||
knative.dev/serving v0.24.1-0.20210726155516-7b9f1e9d49e5
|
||||
sigs.k8s.io/yaml v1.2.0
|
||||
)
|
||||
|
||||
|
|
|
|||
29
go.sum
29
go.sum
|
|
@ -849,7 +849,6 @@ github.com/prometheus/statsd_exporter v0.20.0 h1:M0hQphnq2WyWKS5CefQL8PqWwBOBPhi
|
|||
github.com/prometheus/statsd_exporter v0.20.0/go.mod h1:YL3FWCG8JBBtaUSxAg4Gz2ZYu22bS84XM89ZQXXTWmQ=
|
||||
github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU=
|
||||
github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4=
|
||||
github.com/remyoudompheng/bigfft v0.0.0-20170806203942-52369c62f446/go.mod h1:uYEyJGbgTkfkS4+E/PavXkNJcbFIpEtjt2B0KDQ5+9M=
|
||||
github.com/rickb777/date v1.13.0 h1:+8AmwLuY1d/rldzdqvqTEg7107bZ8clW37x4nsdG3Hs=
|
||||
github.com/rickb777/date v1.13.0/go.mod h1:GZf3LoGnxPWjX+/1TXOuzHefZFDovTyNLHDMd3qH70k=
|
||||
github.com/rickb777/plural v1.2.1 h1:UitRAgR70+yHFt26Tmj/F9dU9aV6UfjGXSbO1DcC9/U=
|
||||
|
|
@ -1051,7 +1050,6 @@ golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL
|
|||
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
||||
golang.org/x/exp v0.0.0-20190125153040-c74c464bbbf2/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
||||
golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
||||
golang.org/x/exp v0.0.0-20190312203227-4b39c73a6495/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8=
|
||||
golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8=
|
||||
golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek=
|
||||
golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY=
|
||||
|
|
@ -1367,7 +1365,6 @@ gonum.org/v1/gonum v0.0.0-20181121035319-3f7ecaa7e8ca/go.mod h1:Y+Yx5eoAFn32cQvJ
|
|||
gonum.org/v1/gonum v0.0.0-20190331200053-3d26580ed485/go.mod h1:2ltnJ7xHfj0zHS40VVPYEAAMTa3ZGguvHGBSJeRWqE0=
|
||||
gonum.org/v1/netlib v0.0.0-20181029234149-ec6d1f5cefe6/go.mod h1:wa6Ws7BG/ESfp6dHfk7C6KdzKA7wR7u/rKwOGE66zvw=
|
||||
gonum.org/v1/netlib v0.0.0-20190313105609-8cb42192e0e0/go.mod h1:wa6Ws7BG/ESfp6dHfk7C6KdzKA7wR7u/rKwOGE66zvw=
|
||||
gonum.org/v1/netlib v0.0.0-20190331212654-76723241ea4e/go.mod h1:kS+toOQn6AQKjmKJ7gzohV1XkqsFehRA2FbsbkopSuQ=
|
||||
google.golang.org/api v0.0.0-20160322025152-9bf6e6e569ff/go.mod h1:4mhQ8q/RsB7i+udVvVy5NUi08OU8ZlA0gRVgrF7VFY0=
|
||||
google.golang.org/api v0.3.1/go.mod h1:6wY9I6uQWHQ8EM57III9mq/AjF+i8G65rmVagqKMtkk=
|
||||
google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE=
|
||||
|
|
@ -1629,27 +1626,23 @@ k8s.io/utils v0.0.0-20200729134348-d5654de09c73/go.mod h1:jPW/WVKK9YHAvNhRxK0md/
|
|||
k8s.io/utils v0.0.0-20201110183641-67b214c5f920/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA=
|
||||
k8s.io/utils v0.0.0-20210111153108-fddb29f9d009 h1:0T5IaWHO3sJTEmCP6mUlBvMukxPKUQWqiI/YuiBNMiQ=
|
||||
k8s.io/utils v0.0.0-20210111153108-fddb29f9d009/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA=
|
||||
knative.dev/caching v0.0.0-20210715062632-201766006aee/go.mod h1:eXLaNJZlrpZRCDqx+KnS1GqS3uED4+fEUDKZkmh5QWU=
|
||||
knative.dev/eventing v0.24.1-0.20210720191312-003a8a2d4ef5 h1:12mJt7L8s+qzlR+Gb14mKioELrK7A+GOFGL4jCvng6Y=
|
||||
knative.dev/eventing v0.24.1-0.20210720191312-003a8a2d4ef5/go.mod h1:RhRbB4NJUWNSAsktOPy5buIuzDWfZik3wVEG533PrQA=
|
||||
knative.dev/caching v0.0.0-20210723125444-b6b4e59cc43e/go.mod h1:QlC2pO60b3fYo3V50YkEqJ6cJ+lfCs6f4qljJ2LvOhQ=
|
||||
knative.dev/eventing v0.24.1-0.20210726215949-ea859aadcfe4 h1:OOzFDk5fmiFNaYMQfbYlyxA4y0V3KKdSYSYNhKjTZWU=
|
||||
knative.dev/eventing v0.24.1-0.20210726215949-ea859aadcfe4/go.mod h1:9/2aEJibKsXKIxppJuITR2xf9qLuxHeoRV14kDotnp8=
|
||||
knative.dev/hack v0.0.0-20210622141627-e28525d8d260 h1:f2eMtOubAOc/Q7JlvFPDKXiPlJVK+VpX2Cot8hRzCgQ=
|
||||
knative.dev/hack v0.0.0-20210622141627-e28525d8d260/go.mod h1:PHt8x8yX5Z9pPquBEfIj0X66f8iWkWfR0S/sarACJrI=
|
||||
knative.dev/hack/schema v0.0.0-20210622141627-e28525d8d260/go.mod h1:ffjwmdcrH5vN3mPhO8RrF2KfNnbHeCE2C60A+2cv3U0=
|
||||
knative.dev/networking v0.0.0-20210715062632-8925a5091ec7/go.mod h1:o2bPzMLFYvArfopSBqOrrS+SvoVRuTx/id0UCccK4xs=
|
||||
knative.dev/networking v0.0.0-20210719003653-7390d8cf09e3 h1:qmgmG+AD/sxyhLr2iu6g+vcksSFtHTjq+UkhbpVNa9A=
|
||||
knative.dev/networking v0.0.0-20210719003653-7390d8cf09e3/go.mod h1:JS1XZNYQ8hAdf+ySlQJr9F8KcdThKDYFdH2klpaumiY=
|
||||
knative.dev/networking v0.0.0-20210721164339-e3c72d213a1a/go.mod h1:JS1XZNYQ8hAdf+ySlQJr9F8KcdThKDYFdH2klpaumiY=
|
||||
knative.dev/networking v0.0.0-20210723170945-03e4c4360c07 h1:pkZKYCfxbHkzz/mMFedGfaL/hMzRxfO3AAZ3QAhTEDk=
|
||||
knative.dev/networking v0.0.0-20210723170945-03e4c4360c07/go.mod h1:Q0ou6/Zb4/MYXwaK5x5dyL1Y0YOvpp9Bz7RHZC3dCBU=
|
||||
knative.dev/pkg v0.0.0-20210713175550-7d1b0f19ef71/go.mod h1:d06VsGUT2grnlhA8GcUjsoePok8P859AYcIqWISMGtY=
|
||||
knative.dev/pkg v0.0.0-20210714200831-7764284cfa9a/go.mod h1:NYZRIPU+Pv39VfbZV1BtMIe4kCavNle1udsPrvOLm+Y=
|
||||
knative.dev/pkg v0.0.0-20210715175632-d9b7180af6f2 h1:dmyRXdB2IZkY8c3R58GVnbIfBLeRYvwSNTWqth+W/Pg=
|
||||
knative.dev/pkg v0.0.0-20210715175632-d9b7180af6f2/go.mod h1:NYZRIPU+Pv39VfbZV1BtMIe4kCavNle1udsPrvOLm+Y=
|
||||
knative.dev/pkg v0.0.0-20210722223844-842df75f5c02/go.mod h1:NYZRIPU+Pv39VfbZV1BtMIe4kCavNle1udsPrvOLm+Y=
|
||||
knative.dev/pkg v0.0.0-20210726021015-889b5670e173 h1:IMxLC9lMWpobbFIu5MU7nENayFs2bVrKLGb4Ge/a4co=
|
||||
knative.dev/pkg v0.0.0-20210726021015-889b5670e173/go.mod h1:NYZRIPU+Pv39VfbZV1BtMIe4kCavNle1udsPrvOLm+Y=
|
||||
knative.dev/reconciler-test v0.0.0-20210714231231-91e5b206e1d5/go.mod h1:Zp2WHfJuh6+rOpOAq78My82drT4Bxjm/K4etmKcA7ko=
|
||||
knative.dev/serving v0.24.1-0.20210721125539-11abffdc6f0d h1:NtS72w/3MGDnIFHl3lsOE5ITr5eH0u2XH80qOtNOTmo=
|
||||
knative.dev/serving v0.24.1-0.20210721125539-11abffdc6f0d/go.mod h1:TxQDJl/M6xR09eCjGgu63RPbJmy62vDaOiJBwcfzWis=
|
||||
modernc.org/cc v1.0.0/go.mod h1:1Sk4//wdnYJiUIxnW8ddKpaOJCF37yAdqYnkxUpaYxw=
|
||||
modernc.org/golex v1.0.0/go.mod h1:b/QX9oBD/LhixY6NDh+IdGv17hgB+51fET1i2kPSmvk=
|
||||
modernc.org/mathutil v1.0.0/go.mod h1:wU0vUrJsVWBZ4P6e7xtFJEhFSNsfRLJ8H458uRjg03k=
|
||||
modernc.org/strutil v1.0.0/go.mod h1:lstksw84oURvj9y3tn8lGvRxyRC1S2+g5uuIzNfIOBs=
|
||||
modernc.org/xc v1.0.0/go.mod h1:mRNCo0bvLjGhHO9WsyuKVU4q0ceiDDDoEeWDJHrNx8I=
|
||||
knative.dev/serving v0.24.1-0.20210726155516-7b9f1e9d49e5 h1:tRxxE71/JAuEsPM1bSZgjL4QJsJCTvuhae3kUoMLa/k=
|
||||
knative.dev/serving v0.24.1-0.20210726155516-7b9f1e9d49e5/go.mod h1:Gl5B3ZiPtmzv/yqZhBlnxPdayhTjwrUQwAOhqYyotKE=
|
||||
pgregory.net/rapid v0.3.3/go.mod h1:UYpPVyjFHzYBGHIxLFoupi8vwk6rXNzRY9OMvVxFIOU=
|
||||
rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8=
|
||||
rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0=
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@ limitations under the License.
|
|||
package environment
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"flag"
|
||||
"fmt"
|
||||
"math"
|
||||
|
|
@ -59,27 +58,12 @@ func (c *ClientConfig) GetRESTConfig() (*rest.Config, error) {
|
|||
return nil, fmt.Errorf("provided QPS value %f must be >0 and <3.4+e38", c.QPS)
|
||||
}
|
||||
|
||||
// If we have an explicit indication of where the kubernetes config lives, read that.
|
||||
if c.Kubeconfig != "" {
|
||||
return c.configFromPath(c.Kubeconfig)
|
||||
}
|
||||
|
||||
// If not, try the in-cluster config.
|
||||
if rc, err := rest.InClusterConfig(); err == nil {
|
||||
return c.applyOverrides(rc), nil
|
||||
}
|
||||
|
||||
// If no in-cluster config, try the default location in the user's home directory.
|
||||
if c, err := c.configFromPath(clientcmd.RecommendedHomeFile); err == nil {
|
||||
return c, nil
|
||||
}
|
||||
|
||||
return nil, errors.New("could not create a valid kubeconfig")
|
||||
}
|
||||
|
||||
func (c *ClientConfig) configFromPath(path string) (*rest.Config, error) {
|
||||
loadingRules := clientcmd.NewDefaultClientConfigLoadingRules()
|
||||
overrides := &clientcmd.ConfigOverrides{}
|
||||
|
||||
if c.Kubeconfig != "" {
|
||||
loadingRules.ExplicitPath = c.Kubeconfig
|
||||
}
|
||||
if c.Cluster != "" {
|
||||
overrides.Context = clientcmdapi.Context{Cluster: c.Cluster}
|
||||
} else if c.ServerURL != "" {
|
||||
|
|
@ -87,19 +71,16 @@ func (c *ClientConfig) configFromPath(path string) (*rest.Config, error) {
|
|||
}
|
||||
|
||||
config, err := clientcmd.NewNonInteractiveDeferredLoadingClientConfig(
|
||||
&clientcmd.ClientConfigLoadingRules{ExplicitPath: path},
|
||||
loadingRules,
|
||||
overrides,
|
||||
).ClientConfig()
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return nil, fmt.Errorf("failed to create client config: %w", err)
|
||||
}
|
||||
|
||||
return c.applyOverrides(config), nil
|
||||
}
|
||||
config.QPS = float32(c.QPS)
|
||||
config.Burst = c.Burst
|
||||
|
||||
func (c *ClientConfig) applyOverrides(restCfg *rest.Config) *rest.Config {
|
||||
restCfg.QPS = float32(c.QPS)
|
||||
restCfg.Burst = c.Burst
|
||||
return restCfg
|
||||
return config, nil
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,13 +41,18 @@ func NewSpoofingClient(ctx context.Context, client kubernetes.Interface, logf lo
|
|||
|
||||
// BuildClientConfig builds the client config specified by the config path and the cluster name
|
||||
func BuildClientConfig(kubeConfigPath string, clusterName string) (*rest.Config, error) {
|
||||
loadingRules := clientcmd.NewDefaultClientConfigLoadingRules()
|
||||
overrides := clientcmd.ConfigOverrides{}
|
||||
|
||||
if kubeConfigPath != "" {
|
||||
loadingRules.ExplicitPath = kubeConfigPath
|
||||
}
|
||||
// Override the cluster name if provided.
|
||||
if clusterName != "" {
|
||||
overrides.Context.Cluster = clusterName
|
||||
}
|
||||
return clientcmd.NewNonInteractiveDeferredLoadingClientConfig(
|
||||
&clientcmd.ClientConfigLoadingRules{ExplicitPath: kubeConfigPath},
|
||||
loadingRules,
|
||||
&overrides).ClientConfig()
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -82,8 +82,8 @@ var (
|
|||
)
|
||||
|
||||
// ValidateVolumes validates the Volumes of a PodSpec.
|
||||
func ValidateVolumes(ctx context.Context, vs []corev1.Volume, mountedVolumes sets.String) (sets.String, *apis.FieldError) {
|
||||
volumes := make(sets.String, len(vs))
|
||||
func ValidateVolumes(ctx context.Context, vs []corev1.Volume, mountedVolumes sets.String) (map[string]corev1.Volume, *apis.FieldError) {
|
||||
volumes := make(map[string]corev1.Volume, len(vs))
|
||||
var errs *apis.FieldError
|
||||
features := config.FromContextOrDefaults(ctx).Features
|
||||
for i, volume := range vs {
|
||||
|
|
@ -91,7 +91,7 @@ func ValidateVolumes(ctx context.Context, vs []corev1.Volume, mountedVolumes set
|
|||
errs = errs.Also((&apis.FieldError{Message: fmt.Sprintf("EmptyDir volume support is off, "+
|
||||
"but found EmptyDir volume %s", volume.Name)}).ViaIndex(i))
|
||||
}
|
||||
if volumes.Has(volume.Name) {
|
||||
if _, ok := volumes[volume.Name]; ok {
|
||||
errs = errs.Also((&apis.FieldError{
|
||||
Message: fmt.Sprintf("duplicate volume name %q", volume.Name),
|
||||
Paths: []string{"name"},
|
||||
|
|
@ -104,7 +104,7 @@ func ValidateVolumes(ctx context.Context, vs []corev1.Volume, mountedVolumes set
|
|||
}).ViaIndex(i))
|
||||
}
|
||||
errs = errs.Also(validateVolume(ctx, volume).ViaIndex(i))
|
||||
volumes.Insert(volume.Name)
|
||||
volumes[volume.Name] = volume
|
||||
}
|
||||
return volumes, errs
|
||||
}
|
||||
|
|
@ -338,7 +338,7 @@ func ValidatePodSpec(ctx context.Context, ps corev1.PodSpec) *apis.FieldError {
|
|||
return errs
|
||||
}
|
||||
|
||||
func validateContainers(ctx context.Context, containers []corev1.Container, volumes sets.String) (errs *apis.FieldError) {
|
||||
func validateContainers(ctx context.Context, containers []corev1.Container, volumes map[string]corev1.Volume) (errs *apis.FieldError) {
|
||||
features := config.FromContextOrDefaults(ctx).Features
|
||||
if features.MultiContainer != config.Enabled {
|
||||
return errs.Also(&apis.FieldError{Message: fmt.Sprintf("multi-container is off, "+
|
||||
|
|
@ -386,7 +386,7 @@ func validateContainersPorts(containers []corev1.Container) *apis.FieldError {
|
|||
}
|
||||
|
||||
// validateSidecarContainer validate fields for non serving containers
|
||||
func validateSidecarContainer(ctx context.Context, container corev1.Container, volumes sets.String) (errs *apis.FieldError) {
|
||||
func validateSidecarContainer(ctx context.Context, container corev1.Container, volumes map[string]corev1.Volume) (errs *apis.FieldError) {
|
||||
if container.LivenessProbe != nil {
|
||||
errs = errs.Also(apis.CheckDisallowedFields(*container.LivenessProbe,
|
||||
*ProbeMask(&corev1.Probe{})).ViaField("livenessProbe"))
|
||||
|
|
@ -399,7 +399,7 @@ func validateSidecarContainer(ctx context.Context, container corev1.Container, v
|
|||
}
|
||||
|
||||
// ValidateContainer validate fields for serving containers
|
||||
func ValidateContainer(ctx context.Context, container corev1.Container, volumes sets.String) (errs *apis.FieldError) {
|
||||
func ValidateContainer(ctx context.Context, container corev1.Container, volumes map[string]corev1.Volume) (errs *apis.FieldError) {
|
||||
// Single container cannot have multiple ports
|
||||
errs = errs.Also(portValidation(container.Ports).ViaField("ports"))
|
||||
// Liveness Probes
|
||||
|
|
@ -420,7 +420,7 @@ func portValidation(containerPorts []corev1.ContainerPort) *apis.FieldError {
|
|||
return nil
|
||||
}
|
||||
|
||||
func validate(ctx context.Context, container corev1.Container, volumes sets.String) *apis.FieldError {
|
||||
func validate(ctx context.Context, container corev1.Container, volumes map[string]corev1.Volume) *apis.FieldError {
|
||||
if equality.Semantic.DeepEqual(container, corev1.Container{}) {
|
||||
return apis.ErrMissingField(apis.CurrentField)
|
||||
}
|
||||
|
|
@ -505,7 +505,7 @@ func validateSecurityContext(ctx context.Context, sc *corev1.SecurityContext) *a
|
|||
return errs
|
||||
}
|
||||
|
||||
func validateVolumeMounts(mounts []corev1.VolumeMount, volumes sets.String) *apis.FieldError {
|
||||
func validateVolumeMounts(mounts []corev1.VolumeMount, volumes map[string]corev1.Volume) *apis.FieldError {
|
||||
var errs *apis.FieldError
|
||||
// Check that volume mounts match names in "volumes", that "volumes" has 100%
|
||||
// coverage, and the field restrictions.
|
||||
|
|
@ -515,7 +515,7 @@ func validateVolumeMounts(mounts []corev1.VolumeMount, volumes sets.String) *api
|
|||
vm := mounts[i]
|
||||
errs = errs.Also(apis.CheckDisallowedFields(vm, *VolumeMountMask(&vm)).ViaIndex(i))
|
||||
// This effectively checks that Name is non-empty because Volume name must be non-empty.
|
||||
if !volumes.Has(vm.Name) {
|
||||
if _, ok := volumes[vm.Name]; !ok {
|
||||
errs = errs.Also((&apis.FieldError{
|
||||
Message: "volumeMount has no matching volume",
|
||||
Paths: []string{"name"},
|
||||
|
|
@ -538,10 +538,9 @@ func validateVolumeMounts(mounts []corev1.VolumeMount, volumes sets.String) *api
|
|||
}
|
||||
seenMountPath.Insert(filepath.Clean(vm.MountPath))
|
||||
|
||||
if !vm.ReadOnly {
|
||||
if volumes[vm.Name].EmptyDir == nil && !vm.ReadOnly {
|
||||
errs = errs.Also(apis.ErrMissingField("readOnly").ViaIndex(i))
|
||||
}
|
||||
|
||||
}
|
||||
return errs
|
||||
}
|
||||
|
|
|
|||
|
|
@ -135,9 +135,17 @@ func (rs *RevisionSpec) applyDefault(ctx context.Context, container *corev1.Cont
|
|||
rs.PodSpec.EnableServiceLinks = cfg.Defaults.EnableServiceLinks
|
||||
}
|
||||
|
||||
vNames := make(sets.String)
|
||||
for _, v := range rs.PodSpec.Volumes {
|
||||
if v.EmptyDir != nil {
|
||||
vNames.Insert(v.Name)
|
||||
}
|
||||
}
|
||||
vms := container.VolumeMounts
|
||||
for i := range vms {
|
||||
vms[i].ReadOnly = true
|
||||
if !vNames.Has(vms[i].Name) {
|
||||
vms[i].ReadOnly = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,9 @@
|
|||
# Knative Serving API v1beta1
|
||||
|
||||
This is the implementation of the Knative Serving API, which is specified in
|
||||
[`docs/spec/spec.md`](/docs/spec/spec.md) and verified via
|
||||
[the conformance tests](/test/conformance).
|
||||
|
||||
**Updates to this implementation should include a corresponding change to
|
||||
[the spec](/docs/spec/spec.md) and [the conformance tests](/test/conformance).**
|
||||
([#780](https://github.com/knative/serving/issues/780))
|
||||
|
|
@ -0,0 +1,51 @@
|
|||
/*
|
||||
Copyright 2021 The Knative Authors
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package v1beta1
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"knative.dev/pkg/apis"
|
||||
)
|
||||
|
||||
const (
|
||||
// ConditionTypeConvertible is a Warning condition that is set on
|
||||
// resources when they cannot be converted to warn of a forthcoming
|
||||
// breakage.
|
||||
ConditionTypeConvertible apis.ConditionType = "Convertible"
|
||||
)
|
||||
|
||||
// CannotConvertError is returned when a field cannot be converted.
|
||||
type CannotConvertError struct {
|
||||
Message string
|
||||
Field string
|
||||
}
|
||||
|
||||
var _ error = (*CannotConvertError)(nil)
|
||||
|
||||
// Error implements error
|
||||
func (cce *CannotConvertError) Error() string {
|
||||
return cce.Message
|
||||
}
|
||||
|
||||
// ConvertErrorf creates a CannotConvertError from the field name and format string.
|
||||
func ConvertErrorf(field, msg string, args ...interface{}) error {
|
||||
return &CannotConvertError{
|
||||
Message: fmt.Sprintf(msg, args...),
|
||||
Field: field,
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
/*
|
||||
Copyright 2021 The Knative Authors
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// +k8s:deepcopy-gen=package
|
||||
// +groupName=serving.knative.dev
|
||||
|
||||
// Package v1beta1 contains the v1beta1 versions of the serving apis.
|
||||
// Api versions allow the api contract for a resource to be changed while keeping
|
||||
// backward compatibility by support multiple concurrent versions
|
||||
// of the same resource
|
||||
package v1beta1
|
||||
36
vendor/knative.dev/serving/pkg/apis/serving/v1beta1/domainmapping_defaults.go
vendored
Normal file
36
vendor/knative.dev/serving/pkg/apis/serving/v1beta1/domainmapping_defaults.go
vendored
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
/*
|
||||
Copyright 2021 The Knative Authors
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package v1beta1
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"knative.dev/pkg/apis"
|
||||
"knative.dev/serving/pkg/apis/serving"
|
||||
)
|
||||
|
||||
// SetDefaults implements apis.Defaultable.
|
||||
func (dm *DomainMapping) SetDefaults(ctx context.Context) {
|
||||
ctx = apis.WithinParent(ctx, dm.ObjectMeta)
|
||||
dm.Spec.Ref.SetDefaults(apis.WithinSpec(ctx))
|
||||
|
||||
if apis.IsInUpdate(ctx) {
|
||||
serving.SetUserInfo(ctx, apis.GetBaseline(ctx).(*DomainMapping).Spec, dm.Spec, dm)
|
||||
} else {
|
||||
serving.SetUserInfo(ctx, nil, dm.Spec, dm)
|
||||
}
|
||||
}
|
||||
180
vendor/knative.dev/serving/pkg/apis/serving/v1beta1/domainmapping_lifecycle.go
vendored
Normal file
180
vendor/knative.dev/serving/pkg/apis/serving/v1beta1/domainmapping_lifecycle.go
vendored
Normal file
|
|
@ -0,0 +1,180 @@
|
|||
/*
|
||||
Copyright 2021 The Knative Authors
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package v1beta1
|
||||
|
||||
import (
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
netv1alpha1 "knative.dev/networking/pkg/apis/networking/v1alpha1"
|
||||
"knative.dev/pkg/apis"
|
||||
)
|
||||
|
||||
var domainMappingCondSet = apis.NewLivingConditionSet(
|
||||
DomainMappingConditionDomainClaimed,
|
||||
DomainMappingConditionReferenceResolved,
|
||||
DomainMappingConditionIngressReady,
|
||||
DomainMappingConditionCertificateProvisioned,
|
||||
)
|
||||
|
||||
// GetConditionSet retrieves the condition set for this resource. Implements the KRShaped interface.
|
||||
func (*DomainMapping) GetConditionSet() apis.ConditionSet {
|
||||
return domainMappingCondSet
|
||||
}
|
||||
|
||||
// GetGroupVersionKind returns the GroupVersionKind.
|
||||
func (dm *DomainMapping) GetGroupVersionKind() schema.GroupVersionKind {
|
||||
return SchemeGroupVersion.WithKind("DomainMapping")
|
||||
}
|
||||
|
||||
// IsReady returns true if the DomainMapping is ready.
|
||||
func (dms *DomainMappingStatus) IsReady() bool {
|
||||
return domainMappingCondSet.Manage(dms).IsHappy()
|
||||
}
|
||||
|
||||
// IsReady returns true if the Status condition DomainMappingConditionReady
|
||||
// is true and the latest spec has been observed.
|
||||
func (dm *DomainMapping) IsReady() bool {
|
||||
dms := dm.Status
|
||||
return dms.ObservedGeneration == dm.Generation &&
|
||||
dms.GetCondition(DomainMappingConditionReady).IsTrue()
|
||||
}
|
||||
|
||||
// InitializeConditions sets the initial values to the conditions.
|
||||
func (dms *DomainMappingStatus) InitializeConditions() {
|
||||
domainMappingCondSet.Manage(dms).InitializeConditions()
|
||||
}
|
||||
|
||||
const (
|
||||
// AutoTLSNotEnabledMessage is the message which is set on the
|
||||
// DomainMappingConditionCertificateProvisioned condition when it is set to True
|
||||
// because AutoTLS was not enabled.
|
||||
AutoTLSNotEnabledMessage = "autoTLS is not enabled"
|
||||
// TLSCertificateProvidedExternally indicates that a TLS secret won't be created or managed
|
||||
// instead a reference to an existing TLS secret should have been provided in the DomainMapping spec
|
||||
TLSCertificateProvidedExternally = "TLS certificate was provided externally"
|
||||
)
|
||||
|
||||
// MarkTLSNotEnabled sets DomainMappingConditionCertificateProvisioned to true when
|
||||
// certificate provisioning was skipped because TLS was not enabled.
|
||||
func (dms *DomainMappingStatus) MarkTLSNotEnabled(msg string) {
|
||||
domainMappingCondSet.Manage(dms).MarkTrueWithReason(DomainMappingConditionCertificateProvisioned,
|
||||
"TLSNotEnabled", msg)
|
||||
}
|
||||
|
||||
func (dms *DomainMappingStatus) MarkCertificateNotRequired(msg string) {
|
||||
domainMappingCondSet.Manage(dms).MarkTrueWithReason(DomainMappingConditionCertificateProvisioned,
|
||||
"CertificateExternallyProvided", msg)
|
||||
}
|
||||
|
||||
// MarkCertificateReady marks the DomainMappingConditionCertificateProvisioned
|
||||
// condition to indicate that the Certificate is ready.
|
||||
func (dms *DomainMappingStatus) MarkCertificateReady(name string) {
|
||||
domainMappingCondSet.Manage(dms).MarkTrue(DomainMappingConditionCertificateProvisioned)
|
||||
}
|
||||
|
||||
// MarkCertificateNotReady marks the DomainMappingConditionCertificateProvisioned
|
||||
// condition to indicate that the Certificate is not ready.
|
||||
func (dms *DomainMappingStatus) MarkCertificateNotReady(name string) {
|
||||
domainMappingCondSet.Manage(dms).MarkUnknown(DomainMappingConditionCertificateProvisioned,
|
||||
"CertificateNotReady",
|
||||
"Certificate %s is not ready.", name)
|
||||
}
|
||||
|
||||
// MarkCertificateNotOwned changes the DomainMappingConditionCertificateProvisioned
|
||||
// status to be false with the reason being that there is an existing
|
||||
// certificate with the name we wanted to use.
|
||||
func (dms *DomainMappingStatus) MarkCertificateNotOwned(name string) {
|
||||
domainMappingCondSet.Manage(dms).MarkFalse(DomainMappingConditionCertificateProvisioned,
|
||||
"CertificateNotOwned",
|
||||
"There is an existing certificate %s that we don't own.", name)
|
||||
}
|
||||
|
||||
// MarkCertificateProvisionFailed marks the
|
||||
// DomainMappingConditionCertificateProvisioned condition to indicate that the
|
||||
// Certificate provisioning failed.
|
||||
func (dms *DomainMappingStatus) MarkCertificateProvisionFailed(name string) {
|
||||
domainMappingCondSet.Manage(dms).MarkFalse(DomainMappingConditionCertificateProvisioned,
|
||||
"CertificateProvisionFailed",
|
||||
"Certificate %s failed to be provisioned.", name)
|
||||
}
|
||||
|
||||
// MarkHTTPDowngrade sets DomainMappingConditionCertificateProvisioned to true when plain
|
||||
// HTTP is enabled even when Certificate is not ready.
|
||||
func (dms *DomainMappingStatus) MarkHTTPDowngrade(name string) {
|
||||
domainMappingCondSet.Manage(dms).MarkTrueWithReason(DomainMappingConditionCertificateProvisioned,
|
||||
"HTTPDowngrade",
|
||||
"Certificate %s is not ready downgrade HTTP.", name)
|
||||
}
|
||||
|
||||
// MarkIngressNotConfigured changes the IngressReady condition to be unknown to reflect
|
||||
// that the Ingress does not yet have a Status.
|
||||
func (dms *DomainMappingStatus) MarkIngressNotConfigured() {
|
||||
domainMappingCondSet.Manage(dms).MarkUnknown(DomainMappingConditionIngressReady,
|
||||
"IngressNotConfigured", "Ingress has not yet been reconciled.")
|
||||
}
|
||||
|
||||
// MarkDomainClaimed updates the DomainMappingConditionDomainClaimed condition
|
||||
// to indicate that the domain was successfully claimed.
|
||||
func (dms *DomainMappingStatus) MarkDomainClaimed() {
|
||||
domainMappingCondSet.Manage(dms).MarkTrue(DomainMappingConditionDomainClaimed)
|
||||
}
|
||||
|
||||
// MarkDomainClaimNotOwned updates the DomainMappingConditionDomainClaimed
|
||||
// condition to indicate that the domain is already in use by another
|
||||
// DomainMapping.
|
||||
func (dms *DomainMappingStatus) MarkDomainClaimNotOwned() {
|
||||
domainMappingCondSet.Manage(dms).MarkFalse(DomainMappingConditionDomainClaimed, "DomainAlreadyClaimed",
|
||||
"The domain name is already in use by another DomainMapping")
|
||||
}
|
||||
|
||||
// MarkDomainClaimFailed updates the DomainMappingConditionDomainClaimed
|
||||
// condition to indicate that creating the ClusterDomainClaim failed.
|
||||
func (dms *DomainMappingStatus) MarkDomainClaimFailed(reason string) {
|
||||
domainMappingCondSet.Manage(dms).MarkFalse(DomainMappingConditionDomainClaimed, "DomainClaimFailed", reason)
|
||||
}
|
||||
|
||||
// MarkReferenceResolved sets the DomainMappingConditionReferenceResolved
|
||||
// condition to true.
|
||||
func (dms *DomainMappingStatus) MarkReferenceResolved() {
|
||||
domainMappingCondSet.Manage(dms).MarkTrue(DomainMappingConditionReferenceResolved)
|
||||
}
|
||||
|
||||
// MarkReferenceNotResolved sets the DomainMappingConditionReferenceResolved
|
||||
// condition to false.
|
||||
func (dms *DomainMappingStatus) MarkReferenceNotResolved(reason string) {
|
||||
domainMappingCondSet.Manage(dms).MarkFalse(DomainMappingConditionReferenceResolved, "ResolveFailed", reason)
|
||||
}
|
||||
|
||||
// PropagateIngressStatus updates the DomainMappingConditionIngressReady
|
||||
// condition according to the underlying Ingress's status.
|
||||
func (dms *DomainMappingStatus) PropagateIngressStatus(cs netv1alpha1.IngressStatus) {
|
||||
cc := cs.GetCondition(netv1alpha1.IngressConditionReady)
|
||||
if cc == nil {
|
||||
dms.MarkIngressNotConfigured()
|
||||
return
|
||||
}
|
||||
|
||||
m := domainMappingCondSet.Manage(dms)
|
||||
switch cc.Status {
|
||||
case corev1.ConditionTrue:
|
||||
m.MarkTrue(DomainMappingConditionIngressReady)
|
||||
case corev1.ConditionFalse:
|
||||
m.MarkFalse(DomainMappingConditionIngressReady, cc.Reason, cc.Message)
|
||||
case corev1.ConditionUnknown:
|
||||
m.MarkUnknown(DomainMappingConditionIngressReady, cc.Reason, cc.Message)
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,135 @@
|
|||
/*
|
||||
Copyright 2021 The Knative Authors
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package v1beta1
|
||||
|
||||
import (
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
|
||||
"knative.dev/pkg/apis"
|
||||
duckv1 "knative.dev/pkg/apis/duck/v1"
|
||||
)
|
||||
|
||||
// +genclient
|
||||
// +genreconciler
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
|
||||
// DomainMapping is a mapping from a custom hostname to an Addressable.
|
||||
type DomainMapping struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
// Standard object's metadata.
|
||||
// More info: https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#metadata
|
||||
// +optional
|
||||
metav1.ObjectMeta `json:"metadata,omitempty"`
|
||||
|
||||
// Spec is the desired state of the DomainMapping.
|
||||
// More info: https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#spec-and-status
|
||||
// +optional
|
||||
Spec DomainMappingSpec `json:"spec,omitempty"`
|
||||
|
||||
// Status is the current state of the DomainMapping.
|
||||
// More info: https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#spec-and-status
|
||||
// +optional
|
||||
Status DomainMappingStatus `json:"status,omitempty"`
|
||||
}
|
||||
|
||||
// Verify that DomainMapping adheres to the appropriate interfaces.
|
||||
var (
|
||||
// Check that DomainMapping may be validated and defaulted.
|
||||
_ apis.Validatable = (*DomainMapping)(nil)
|
||||
_ apis.Defaultable = (*DomainMapping)(nil)
|
||||
|
||||
// Check that the type conforms to the duck Knative Resource shape.
|
||||
_ duckv1.KRShaped = (*DomainMapping)(nil)
|
||||
)
|
||||
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
|
||||
// DomainMappingList is a collection of DomainMapping objects.
|
||||
type DomainMappingList struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
// Standard object metadata.
|
||||
// More info: https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#metadata
|
||||
// +optional
|
||||
metav1.ListMeta `json:"metadata,omitempty"`
|
||||
|
||||
// Items is the list of DomainMapping objects.
|
||||
Items []DomainMapping `json:"items"`
|
||||
}
|
||||
|
||||
// SecretTLS wrapper for TLS SecretName.
|
||||
type SecretTLS struct {
|
||||
// SecretName is the name of the existing secret used to terminate TLS traffic.
|
||||
SecretName string `json:"secretName"`
|
||||
}
|
||||
|
||||
// DomainMappingSpec describes the DomainMapping the user wishes to exist.
|
||||
type DomainMappingSpec struct {
|
||||
// Ref specifies the target of the Domain Mapping.
|
||||
//
|
||||
// The object identified by the Ref must be an Addressable with a URL of the
|
||||
// form `{name}.{namespace}.{domain}` where `{domain}` is the cluster domain,
|
||||
// and `{name}` and `{namespace}` are the name and namespace of a Kubernetes
|
||||
// Service.
|
||||
//
|
||||
// This contract is satisfied by Knative types such as Knative Services and
|
||||
// Knative Routes, and by Kubernetes Services.
|
||||
Ref duckv1.KReference `json:"ref"`
|
||||
|
||||
// TLS allows the DomainMapping to terminate TLS traffic with an existing secret.
|
||||
// +optional
|
||||
TLS *SecretTLS `json:"tls,omitempty"`
|
||||
}
|
||||
|
||||
// DomainMappingStatus describes the current state of the DomainMapping.
|
||||
type DomainMappingStatus struct {
|
||||
duckv1.Status `json:",inline"`
|
||||
|
||||
// URL is the URL of this DomainMapping.
|
||||
// +optional
|
||||
URL *apis.URL `json:"url,omitempty"`
|
||||
|
||||
// Address holds the information needed for a DomainMapping to be the target of an event.
|
||||
// +optional
|
||||
Address *duckv1.Addressable `json:"address,omitempty"`
|
||||
}
|
||||
|
||||
const (
|
||||
// DomainMappingConditionReady is set when the DomainMapping is configured
|
||||
// and the Ingress is ready.
|
||||
DomainMappingConditionReady = apis.ConditionReady
|
||||
|
||||
// DomainMappingConditionReferenceResolved reflects whether the Ref
|
||||
// has been successfully resolved to an existing object.
|
||||
DomainMappingConditionReferenceResolved apis.ConditionType = "ReferenceResolved"
|
||||
|
||||
// DomainMappingConditionIngressReady reflects the readiness of the
|
||||
// underlying Ingress resource.
|
||||
DomainMappingConditionIngressReady apis.ConditionType = "IngressReady"
|
||||
|
||||
// DomainMappingConditionDomainClaimed reflects that the ClusterDomainClaim
|
||||
// for this DomainMapping exists, and is owned by this DomainMapping.
|
||||
DomainMappingConditionDomainClaimed apis.ConditionType = "DomainClaimed"
|
||||
|
||||
// DomainMappingConditionCertificateProvisioned is set to False when the
|
||||
// Knative Certificates fail to be provisioned for the DomainMapping.
|
||||
DomainMappingConditionCertificateProvisioned apis.ConditionType = "CertificateProvisioned"
|
||||
)
|
||||
|
||||
// GetStatus retrieves the status of the DomainMapping. Implements the KRShaped interface.
|
||||
func (dm *DomainMapping) GetStatus() *duckv1.Status {
|
||||
return &dm.Status.Status
|
||||
}
|
||||
73
vendor/knative.dev/serving/pkg/apis/serving/v1beta1/domainmapping_validation.go
vendored
Normal file
73
vendor/knative.dev/serving/pkg/apis/serving/v1beta1/domainmapping_validation.go
vendored
Normal file
|
|
@ -0,0 +1,73 @@
|
|||
/*
|
||||
Copyright 2021 The Knative Authors
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package v1beta1
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"k8s.io/apimachinery/pkg/util/validation"
|
||||
"k8s.io/apimachinery/pkg/util/validation/field"
|
||||
"knative.dev/pkg/apis"
|
||||
"knative.dev/pkg/network"
|
||||
"knative.dev/serving/pkg/apis/serving"
|
||||
)
|
||||
|
||||
// Validate makes sure that DomainMapping is properly configured.
|
||||
func (dm *DomainMapping) Validate(ctx context.Context) *apis.FieldError {
|
||||
errs := dm.validateMetadata(ctx).ViaField("metadata")
|
||||
|
||||
ctx = apis.WithinParent(ctx, dm.ObjectMeta)
|
||||
errs = errs.Also(dm.Spec.Validate(apis.WithinSpec(ctx)).ViaField("spec"))
|
||||
|
||||
return errs
|
||||
}
|
||||
|
||||
// validateMetadata validates the metadata section of a DomainMapping.
|
||||
func (dm *DomainMapping) validateMetadata(ctx context.Context) (errs *apis.FieldError) {
|
||||
if dm.GenerateName != "" {
|
||||
errs = errs.Also(apis.ErrDisallowedFields("generateName"))
|
||||
}
|
||||
|
||||
err := validation.IsFullyQualifiedDomainName(field.NewPath("name"), dm.Name)
|
||||
if err != nil {
|
||||
errs = errs.Also(apis.ErrGeneric(fmt.Sprintf(
|
||||
"invalid name %q: %s", dm.Name, err.ToAggregate()), "name"))
|
||||
}
|
||||
|
||||
clusterLocalDomain := network.GetClusterDomainName()
|
||||
if strings.HasSuffix(dm.Name, "."+clusterLocalDomain) {
|
||||
errs = errs.Also(apis.ErrGeneric(
|
||||
fmt.Sprintf("invalid name %q: must not be a subdomain of cluster local domain %q", dm.Name, clusterLocalDomain), "name"))
|
||||
}
|
||||
|
||||
if apis.IsInUpdate(ctx) {
|
||||
original := apis.GetBaseline(ctx).(*DomainMapping)
|
||||
errs = errs.Also(
|
||||
apis.ValidateCreatorAndModifier(original.Spec, dm.Spec,
|
||||
original.GetAnnotations(), dm.GetAnnotations(), serving.GroupName).ViaField("annotations"),
|
||||
)
|
||||
}
|
||||
|
||||
return errs
|
||||
}
|
||||
|
||||
// Validate makes sure the DomainMappingSpec is properly configured.
|
||||
func (spec *DomainMappingSpec) Validate(ctx context.Context) *apis.FieldError {
|
||||
return spec.Ref.Validate(ctx).ViaField("ref")
|
||||
}
|
||||
|
|
@ -0,0 +1,55 @@
|
|||
/*
|
||||
Copyright 2021 The Knative Authors
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package v1beta1
|
||||
|
||||
import (
|
||||
"knative.dev/serving/pkg/apis/serving"
|
||||
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
)
|
||||
|
||||
// SchemeGroupVersion is group version used to register these objects
|
||||
var SchemeGroupVersion = schema.GroupVersion{Group: serving.GroupName, Version: "v1beta1"}
|
||||
|
||||
// Kind takes an unqualified kind and returns back a Group qualified GroupKind
|
||||
func Kind(kind string) schema.GroupKind {
|
||||
return SchemeGroupVersion.WithKind(kind).GroupKind()
|
||||
}
|
||||
|
||||
// Resource takes an unqualified resource and returns a Group qualified GroupResource
|
||||
func Resource(resource string) schema.GroupResource {
|
||||
return SchemeGroupVersion.WithResource(resource).GroupResource()
|
||||
}
|
||||
|
||||
var (
|
||||
// SchemeBuilder registers the addKnownTypes function.
|
||||
SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes)
|
||||
// AddToScheme applies all the stored functions to the scheme.
|
||||
AddToScheme = SchemeBuilder.AddToScheme
|
||||
)
|
||||
|
||||
// Adds the list of known types to Scheme.
|
||||
func addKnownTypes(scheme *runtime.Scheme) error {
|
||||
scheme.AddKnownTypes(SchemeGroupVersion,
|
||||
&DomainMapping{},
|
||||
&DomainMappingList{},
|
||||
)
|
||||
metav1.AddToGroupVersion(scheme, SchemeGroupVersion)
|
||||
return nil
|
||||
}
|
||||
169
vendor/knative.dev/serving/pkg/apis/serving/v1beta1/zz_generated.deepcopy.go
vendored
Normal file
169
vendor/knative.dev/serving/pkg/apis/serving/v1beta1/zz_generated.deepcopy.go
vendored
Normal file
|
|
@ -0,0 +1,169 @@
|
|||
// +build !ignore_autogenerated
|
||||
|
||||
/*
|
||||
Copyright 2021 The Knative Authors
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// Code generated by deepcopy-gen. DO NOT EDIT.
|
||||
|
||||
package v1beta1
|
||||
|
||||
import (
|
||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||
apis "knative.dev/pkg/apis"
|
||||
v1 "knative.dev/pkg/apis/duck/v1"
|
||||
)
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *CannotConvertError) DeepCopyInto(out *CannotConvertError) {
|
||||
*out = *in
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CannotConvertError.
|
||||
func (in *CannotConvertError) DeepCopy() *CannotConvertError {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(CannotConvertError)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *DomainMapping) DeepCopyInto(out *DomainMapping) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
||||
in.Spec.DeepCopyInto(&out.Spec)
|
||||
in.Status.DeepCopyInto(&out.Status)
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DomainMapping.
|
||||
func (in *DomainMapping) DeepCopy() *DomainMapping {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(DomainMapping)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *DomainMapping) DeepCopyObject() runtime.Object {
|
||||
if c := in.DeepCopy(); c != nil {
|
||||
return c
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *DomainMappingList) DeepCopyInto(out *DomainMappingList) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ListMeta.DeepCopyInto(&out.ListMeta)
|
||||
if in.Items != nil {
|
||||
in, out := &in.Items, &out.Items
|
||||
*out = make([]DomainMapping, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DomainMappingList.
|
||||
func (in *DomainMappingList) DeepCopy() *DomainMappingList {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(DomainMappingList)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *DomainMappingList) DeepCopyObject() runtime.Object {
|
||||
if c := in.DeepCopy(); c != nil {
|
||||
return c
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *DomainMappingSpec) DeepCopyInto(out *DomainMappingSpec) {
|
||||
*out = *in
|
||||
out.Ref = in.Ref
|
||||
if in.TLS != nil {
|
||||
in, out := &in.TLS, &out.TLS
|
||||
*out = new(SecretTLS)
|
||||
**out = **in
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DomainMappingSpec.
|
||||
func (in *DomainMappingSpec) DeepCopy() *DomainMappingSpec {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(DomainMappingSpec)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *DomainMappingStatus) DeepCopyInto(out *DomainMappingStatus) {
|
||||
*out = *in
|
||||
in.Status.DeepCopyInto(&out.Status)
|
||||
if in.URL != nil {
|
||||
in, out := &in.URL, &out.URL
|
||||
*out = new(apis.URL)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
if in.Address != nil {
|
||||
in, out := &in.Address, &out.Address
|
||||
*out = new(v1.Addressable)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DomainMappingStatus.
|
||||
func (in *DomainMappingStatus) DeepCopy() *DomainMappingStatus {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(DomainMappingStatus)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *SecretTLS) DeepCopyInto(out *SecretTLS) {
|
||||
*out = *in
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SecretTLS.
|
||||
func (in *SecretTLS) DeepCopy() *SecretTLS {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(SecretTLS)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
|
@ -27,6 +27,7 @@ import (
|
|||
autoscalingv1alpha1 "knative.dev/serving/pkg/apis/autoscaling/v1alpha1"
|
||||
servingv1 "knative.dev/serving/pkg/apis/serving/v1"
|
||||
servingv1alpha1 "knative.dev/serving/pkg/apis/serving/v1alpha1"
|
||||
servingv1beta1 "knative.dev/serving/pkg/apis/serving/v1beta1"
|
||||
)
|
||||
|
||||
var Scheme = runtime.NewScheme()
|
||||
|
|
@ -35,6 +36,7 @@ var ParameterCodec = runtime.NewParameterCodec(Scheme)
|
|||
var localSchemeBuilder = runtime.SchemeBuilder{
|
||||
autoscalingv1alpha1.AddToScheme,
|
||||
servingv1.AddToScheme,
|
||||
servingv1beta1.AddToScheme,
|
||||
servingv1alpha1.AddToScheme,
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -685,7 +685,7 @@ k8s.io/utils/buffer
|
|||
k8s.io/utils/integer
|
||||
k8s.io/utils/pointer
|
||||
k8s.io/utils/trace
|
||||
# knative.dev/eventing v0.24.1-0.20210720191312-003a8a2d4ef5
|
||||
# knative.dev/eventing v0.24.1-0.20210726215949-ea859aadcfe4
|
||||
## explicit
|
||||
knative.dev/eventing/pkg/apis/config
|
||||
knative.dev/eventing/pkg/apis/duck
|
||||
|
|
@ -714,12 +714,12 @@ knative.dev/eventing/pkg/client/clientset/versioned/typed/sources/v1beta2/fake
|
|||
# knative.dev/hack v0.0.0-20210622141627-e28525d8d260
|
||||
## explicit
|
||||
knative.dev/hack
|
||||
# knative.dev/networking v0.0.0-20210719003653-7390d8cf09e3
|
||||
# knative.dev/networking v0.0.0-20210723170945-03e4c4360c07
|
||||
## explicit
|
||||
knative.dev/networking/pkg
|
||||
knative.dev/networking/pkg/apis/networking
|
||||
knative.dev/networking/pkg/apis/networking/v1alpha1
|
||||
# knative.dev/pkg v0.0.0-20210715175632-d9b7180af6f2
|
||||
# knative.dev/pkg v0.0.0-20210726021015-889b5670e173
|
||||
## explicit
|
||||
knative.dev/pkg/apis
|
||||
knative.dev/pkg/apis/duck
|
||||
|
|
@ -765,7 +765,7 @@ knative.dev/pkg/tracing/propagation
|
|||
knative.dev/pkg/tracing/propagation/tracecontextb3
|
||||
knative.dev/pkg/tracker
|
||||
knative.dev/pkg/unstructured
|
||||
# knative.dev/serving v0.24.1-0.20210721125539-11abffdc6f0d
|
||||
# knative.dev/serving v0.24.1-0.20210726155516-7b9f1e9d49e5
|
||||
## explicit
|
||||
knative.dev/serving/pkg/apis/autoscaling
|
||||
knative.dev/serving/pkg/apis/autoscaling/v1alpha1
|
||||
|
|
@ -773,6 +773,7 @@ knative.dev/serving/pkg/apis/config
|
|||
knative.dev/serving/pkg/apis/serving
|
||||
knative.dev/serving/pkg/apis/serving/v1
|
||||
knative.dev/serving/pkg/apis/serving/v1alpha1
|
||||
knative.dev/serving/pkg/apis/serving/v1beta1
|
||||
knative.dev/serving/pkg/autoscaler/config
|
||||
knative.dev/serving/pkg/autoscaler/config/autoscalerconfig
|
||||
knative.dev/serving/pkg/client/clientset/versioned/scheme
|
||||
|
|
|
|||
Loading…
Reference in New Issue