mirror of https://github.com/knative/client.git
Fix replicas *int32 type in describe commands (#1312)
* Update to latest dependencies * Fix replicas *int32 type in describe commands
This commit is contained in:
parent
390bf0f9ad
commit
a165c6c64f
8
go.mod
8
go.mod
|
|
@ -21,11 +21,11 @@ require (
|
||||||
k8s.io/cli-runtime v0.19.7
|
k8s.io/cli-runtime v0.19.7
|
||||||
k8s.io/client-go v0.19.7
|
k8s.io/client-go v0.19.7
|
||||||
k8s.io/code-generator v0.19.7
|
k8s.io/code-generator v0.19.7
|
||||||
knative.dev/eventing v0.22.1-0.20210505162953-768b7d116d03
|
knative.dev/eventing v0.22.1-0.20210512205148-1bbc0130b53a
|
||||||
knative.dev/hack v0.0.0-20210428122153-93ad9129c268
|
knative.dev/hack v0.0.0-20210428122153-93ad9129c268
|
||||||
knative.dev/networking v0.0.0-20210428161254-1ad047ce063f
|
knative.dev/networking v0.0.0-20210512050647-ace2d3306f0b
|
||||||
knative.dev/pkg v0.0.0-20210428141353-878c85083565
|
knative.dev/pkg v0.0.0-20210510175900-4564797bf3b7
|
||||||
knative.dev/serving v0.22.1-0.20210505154753-2d4e4a1eff9d
|
knative.dev/serving v0.22.1-0.20210513113048-93847553c9e4
|
||||||
sigs.k8s.io/yaml v1.2.0
|
sigs.k8s.io/yaml v1.2.0
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
23
go.sum
23
go.sum
|
|
@ -1283,23 +1283,20 @@ k8s.io/legacy-cloud-providers v0.19.7/go.mod h1:dsZk4gH9QIwAtHQ8CK0Ps257xlfgoXE3
|
||||||
k8s.io/utils v0.0.0-20200729134348-d5654de09c73/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA=
|
k8s.io/utils v0.0.0-20200729134348-d5654de09c73/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 h1:0T5IaWHO3sJTEmCP6mUlBvMukxPKUQWqiI/YuiBNMiQ=
|
||||||
k8s.io/utils v0.0.0-20210111153108-fddb29f9d009/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA=
|
k8s.io/utils v0.0.0-20210111153108-fddb29f9d009/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA=
|
||||||
knative.dev/caching v0.0.0-20210428140754-1fab472d2faf/go.mod h1:CLQDWuBhkGnC3Pq/3G56qMP14dPt+Y4QmBEe3it44HM=
|
knative.dev/caching v0.0.0-20210512050647-922782660f7c/go.mod h1:d+fIY/LkAZAM6HsRJwmfirNDMCc1+hqGlQctLP1CmzE=
|
||||||
knative.dev/eventing v0.22.1-0.20210505162953-768b7d116d03 h1:+j+URI0eEGWZ+cnC2S02xZ/P2ufT2IhrMmzweuZGkLM=
|
knative.dev/eventing v0.22.1-0.20210512205148-1bbc0130b53a h1:dafIIUwdttDhhoPIvOp4sffzCJ42YCFbZ25DzQgTUaE=
|
||||||
knative.dev/eventing v0.22.1-0.20210505162953-768b7d116d03/go.mod h1:p7FKFj0dYMKI1Ji0GSKdRg2YzLMWVXABm0QHN2RtkSI=
|
knative.dev/eventing v0.22.1-0.20210512205148-1bbc0130b53a/go.mod h1:xehVLff2eqwBxQPxBVmgiHzJadzldQulBxRdYMljRAs=
|
||||||
knative.dev/hack v0.0.0-20210325223819-b6ab329907d3/go.mod h1:PHt8x8yX5Z9pPquBEfIj0X66f8iWkWfR0S/sarACJrI=
|
|
||||||
knative.dev/hack v0.0.0-20210427190353-86f9adc0c8e2/go.mod h1:PHt8x8yX5Z9pPquBEfIj0X66f8iWkWfR0S/sarACJrI=
|
|
||||||
knative.dev/hack v0.0.0-20210428122153-93ad9129c268 h1:lBIj9Epd9UQ55NEaHzAdY/UZbuaegCdGPKVC2+Z68Q0=
|
knative.dev/hack v0.0.0-20210428122153-93ad9129c268 h1:lBIj9Epd9UQ55NEaHzAdY/UZbuaegCdGPKVC2+Z68Q0=
|
||||||
knative.dev/hack v0.0.0-20210428122153-93ad9129c268/go.mod h1:PHt8x8yX5Z9pPquBEfIj0X66f8iWkWfR0S/sarACJrI=
|
knative.dev/hack v0.0.0-20210428122153-93ad9129c268/go.mod h1:PHt8x8yX5Z9pPquBEfIj0X66f8iWkWfR0S/sarACJrI=
|
||||||
knative.dev/hack/schema v0.0.0-20210428122153-93ad9129c268/go.mod h1:ffjwmdcrH5vN3mPhO8RrF2KfNnbHeCE2C60A+2cv3U0=
|
knative.dev/hack/schema v0.0.0-20210428122153-93ad9129c268/go.mod h1:ffjwmdcrH5vN3mPhO8RrF2KfNnbHeCE2C60A+2cv3U0=
|
||||||
knative.dev/networking v0.0.0-20210428161254-1ad047ce063f h1:aobK9UEGzKYcLJMd50BhRLIWMqKQYXq9NuPsOOB3Nk8=
|
knative.dev/networking v0.0.0-20210512050647-ace2d3306f0b h1:Ea6ym1Jfd/Hci1EGj+uPaE3d6SS1s/Br+6fFAWdJCeM=
|
||||||
knative.dev/networking v0.0.0-20210428161254-1ad047ce063f/go.mod h1:6sJKmUcFFSkhloA1mWii/DCqeg9mMHfRraB/ouRzuM0=
|
knative.dev/networking v0.0.0-20210512050647-ace2d3306f0b/go.mod h1:y7RmP2/dHO/DAC1QmpUtgTVF6/Z8whaL+wjgey+HthU=
|
||||||
knative.dev/pkg v0.0.0-20210420053235-1afd04993622/go.mod h1:UtcSLHy2XIz5blWoPTA40F87zk4O7erxkCwv+7Tsmws=
|
|
||||||
knative.dev/pkg v0.0.0-20210428023153-5a308fa62139/go.mod h1:7Xmwv60SD68lc4mpbKvU1J4WJLfZNNDNpHFA87T7/AM=
|
|
||||||
knative.dev/pkg v0.0.0-20210428141353-878c85083565 h1:4I8Pm2IlSJbdJ1R9fC18kOlZlfCZkB59JraRGratgnY=
|
|
||||||
knative.dev/pkg v0.0.0-20210428141353-878c85083565/go.mod h1:fIl4l4OmZodkElyaHoT0LCF5wT+3+P/kinawQ4XlLtE=
|
knative.dev/pkg v0.0.0-20210428141353-878c85083565/go.mod h1:fIl4l4OmZodkElyaHoT0LCF5wT+3+P/kinawQ4XlLtE=
|
||||||
knative.dev/reconciler-test v0.0.0-20210428195854-3db87491edb3/go.mod h1:yZihS1XoBt7oxU6Jq+U2hMKmUvfKFEaj3vMqOMBt/tI=
|
knative.dev/pkg v0.0.0-20210510175900-4564797bf3b7 h1:i4P8emOPrLctmbaPHp5eRIOqz+XTOkit7KgZeS+onKs=
|
||||||
knative.dev/serving v0.22.1-0.20210505154753-2d4e4a1eff9d h1:le2jX6mbc6g0kBtZgDGRyeGWsSVvwZeaLNlzOWqjvsQ=
|
knative.dev/pkg v0.0.0-20210510175900-4564797bf3b7/go.mod h1:fIl4l4OmZodkElyaHoT0LCF5wT+3+P/kinawQ4XlLtE=
|
||||||
knative.dev/serving v0.22.1-0.20210505154753-2d4e4a1eff9d/go.mod h1:eeyZQ8josGr2tus9RG9hkPIB1ITXXjkPojh7RmEazig=
|
knative.dev/reconciler-test v0.0.0-20210506205310-ed3c37806817/go.mod h1:pUozU+xgCWG9eH+4bYBXM0zWPl8lwvan34gCi/ZDP8o=
|
||||||
|
knative.dev/serving v0.22.1-0.20210513113048-93847553c9e4 h1:5n2ztgAWpcBdEt1HVwbrPSMSHHH520xRJn8ZxtALg4E=
|
||||||
|
knative.dev/serving v0.22.1-0.20210513113048-93847553c9e4/go.mod h1:hoGG2F9/qfAL/x0x14hAdciD7YxjdsaDqZ0PRNmj1gs=
|
||||||
modernc.org/cc v1.0.0/go.mod h1:1Sk4//wdnYJiUIxnW8ddKpaOJCF37yAdqYnkxUpaYxw=
|
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/golex v1.0.0/go.mod h1:b/QX9oBD/LhixY6NDh+IdGv17hgB+51fET1i2kPSmvk=
|
||||||
modernc.org/mathutil v1.0.0/go.mod h1:wU0vUrJsVWBZ4P6e7xtFJEhFSNsfRLJ8H458uRjg03k=
|
modernc.org/mathutil v1.0.0/go.mod h1:wU0vUrJsVWBZ4P6e7xtFJEhFSNsfRLJ8H458uRjg03k=
|
||||||
|
|
|
||||||
|
|
@ -206,8 +206,8 @@ func WriteEnvFrom(dw printers.PrefixWriter, revision *servingv1.Revision, printD
|
||||||
func WriteReplicas(dw printers.PrefixWriter, revision *servingv1.Revision) {
|
func WriteReplicas(dw printers.PrefixWriter, revision *servingv1.Revision) {
|
||||||
actualReplicas := revision.Status.ActualReplicas
|
actualReplicas := revision.Status.ActualReplicas
|
||||||
desiredReplicas := revision.Status.DesiredReplicas
|
desiredReplicas := revision.Status.DesiredReplicas
|
||||||
if actualReplicas != 0 || desiredReplicas != 0 {
|
if actualReplicas != nil && desiredReplicas != nil {
|
||||||
dw.WriteAttribute("Replicas", fmt.Sprintf("%d/%d", actualReplicas, desiredReplicas))
|
dw.WriteAttribute("Replicas", fmt.Sprintf("%d/%d", *actualReplicas, *desiredReplicas))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,8 @@ import (
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"knative.dev/pkg/ptr"
|
||||||
|
|
||||||
"gotest.tools/v3/assert"
|
"gotest.tools/v3/assert"
|
||||||
v1 "k8s.io/api/core/v1"
|
v1 "k8s.io/api/core/v1"
|
||||||
"k8s.io/apimachinery/pkg/api/equality"
|
"k8s.io/apimachinery/pkg/api/equality"
|
||||||
|
|
@ -106,7 +108,7 @@ func TestDescribeRevisionYaml(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestDescribeRevisionBasic(t *testing.T) {
|
func TestDescribeRevisionBasic(t *testing.T) {
|
||||||
expectedRevision := createTestRevision("test-rev", 3)
|
expectedRevision := createTestRevision("test-rev", 3, ptr.Int32(1))
|
||||||
|
|
||||||
action, data, err := fakeRevision([]string{"revision", "describe", "test-rev"}, &expectedRevision)
|
action, data, err := fakeRevision([]string{"revision", "describe", "test-rev"}, &expectedRevision)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
@ -120,11 +122,29 @@ func TestDescribeRevisionBasic(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
assert.Assert(t, util.ContainsAll(data, "Image:", "gcr.io/test/image", "++ Ready", "Port:", "8080"))
|
assert.Assert(t, util.ContainsAll(data, "Image:", "gcr.io/test/image", "++ Ready", "Port:", "8080"))
|
||||||
assert.Assert(t, util.ContainsAll(data, "Replicas:", "0/1"))
|
assert.Assert(t, util.ContainsAll(data, "Replicas:", "1/1"))
|
||||||
assert.Assert(t, util.ContainsAll(data, "EnvFrom:", "cm:test1, cm:test2"))
|
assert.Assert(t, util.ContainsAll(data, "EnvFrom:", "cm:test1, cm:test2"))
|
||||||
}
|
}
|
||||||
|
|
||||||
func createTestRevision(revision string, gen int64) servingv1.Revision {
|
func TestDescribeRevisionReplicas(t *testing.T) {
|
||||||
|
expectedRevision := createTestRevision("test-rev", 3, ptr.Int32(1))
|
||||||
|
_, data, err := fakeRevision([]string{"revision", "describe", "test-rev"}, &expectedRevision)
|
||||||
|
assert.NilError(t, err)
|
||||||
|
assert.Assert(t, util.ContainsAll(data, "Replicas:", "1/1"))
|
||||||
|
|
||||||
|
expectedRevision = createTestRevision("test-rev", 3, ptr.Int32(0))
|
||||||
|
_, data, err = fakeRevision([]string{"revision", "describe", "test-rev"}, &expectedRevision)
|
||||||
|
assert.NilError(t, err)
|
||||||
|
assert.Assert(t, util.ContainsAll(data, "Replicas:", "0/0"))
|
||||||
|
|
||||||
|
expectedRevision = createTestRevision("test-rev", 3, nil)
|
||||||
|
_, data, err = fakeRevision([]string{"revision", "describe", "test-rev"}, &expectedRevision)
|
||||||
|
assert.NilError(t, err)
|
||||||
|
assert.Assert(t, util.ContainsNone(data, "Replicas:"))
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
func createTestRevision(revision string, gen int64, replicas *int32) servingv1.Revision {
|
||||||
labels := make(map[string]string)
|
labels := make(map[string]string)
|
||||||
labels[apiserving.ConfigurationGenerationLabelKey] = fmt.Sprintf("%d", gen)
|
labels[apiserving.ConfigurationGenerationLabelKey] = fmt.Sprintf("%d", gen)
|
||||||
|
|
||||||
|
|
@ -162,8 +182,8 @@ func createTestRevision(revision string, gen int64) servingv1.Revision {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Status: servingv1.RevisionStatus{
|
Status: servingv1.RevisionStatus{
|
||||||
ActualReplicas: 0,
|
ActualReplicas: replicas,
|
||||||
DesiredReplicas: 1,
|
DesiredReplicas: replicas,
|
||||||
DeprecatedImageDigest: "gcr.io/test/image@" + imageDigest,
|
DeprecatedImageDigest: "gcr.io/test/image@" + imageDigest,
|
||||||
Status: duckv1.Status{
|
Status: duckv1.Status{
|
||||||
Conditions: goodConditions(),
|
Conditions: goodConditions(),
|
||||||
|
|
|
||||||
|
|
@ -763,8 +763,8 @@ func createTestRevision(revision string, gen int64, conditions duckv1.Conditions
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Status: servingv1.RevisionStatus{
|
Status: servingv1.RevisionStatus{
|
||||||
ActualReplicas: 0,
|
ActualReplicas: ptr.Int32(0),
|
||||||
DesiredReplicas: 1,
|
DesiredReplicas: ptr.Int32(1),
|
||||||
DeprecatedImageDigest: "gcr.io/test/image@" + imageDigest,
|
DeprecatedImageDigest: "gcr.io/test/image@" + imageDigest,
|
||||||
Status: duckv1.Status{
|
Status: duckv1.Status{
|
||||||
Conditions: conditions,
|
Conditions: conditions,
|
||||||
|
|
|
||||||
|
|
@ -59,6 +59,7 @@ type ChannelableStatus struct {
|
||||||
// * Conditions - the latest available observations of a resource's current state.
|
// * Conditions - the latest available observations of a resource's current state.
|
||||||
duckv1.Status `json:",inline"`
|
duckv1.Status `json:",inline"`
|
||||||
// AddressStatus is the part where the Channelable fulfills the Addressable contract.
|
// AddressStatus is the part where the Channelable fulfills the Addressable contract.
|
||||||
|
// +optional
|
||||||
duckv1.AddressStatus `json:",inline"`
|
duckv1.AddressStatus `json:",inline"`
|
||||||
// Subscribers is populated with the statuses of each of the Channelable's subscribers.
|
// Subscribers is populated with the statuses of each of the Channelable's subscribers.
|
||||||
SubscribableStatus `json:",inline"`
|
SubscribableStatus `json:",inline"`
|
||||||
|
|
|
||||||
|
|
@ -90,6 +90,7 @@ type BrokerStatus struct {
|
||||||
|
|
||||||
// Broker is Addressable. It exposes the endpoint as an URI to get events
|
// Broker is Addressable. It exposes the endpoint as an URI to get events
|
||||||
// delivered into the Broker mesh.
|
// delivered into the Broker mesh.
|
||||||
|
// +optional
|
||||||
Address duckv1.Addressable `json:"address,omitempty"`
|
Address duckv1.Addressable `json:"address,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -122,6 +122,11 @@ func (ss *SequenceStatus) PropagateChannelStatuses(channels []*eventingduckv1.Ch
|
||||||
|
|
||||||
}
|
}
|
||||||
for i, c := range channels {
|
for i, c := range channels {
|
||||||
|
// Mark the Sequence address as the Address of the first channel.
|
||||||
|
if i == 0 {
|
||||||
|
ss.setAddress(c.Status.Address)
|
||||||
|
}
|
||||||
|
|
||||||
ss.ChannelStatuses[i] = SequenceChannelStatus{
|
ss.ChannelStatuses[i] = SequenceChannelStatus{
|
||||||
Channel: corev1.ObjectReference{
|
Channel: corev1.ObjectReference{
|
||||||
APIVersion: c.APIVersion,
|
APIVersion: c.APIVersion,
|
||||||
|
|
@ -130,19 +135,15 @@ func (ss *SequenceStatus) PropagateChannelStatuses(channels []*eventingduckv1.Ch
|
||||||
Namespace: c.Namespace,
|
Namespace: c.Namespace,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
// TODO: Once the addressable has a real status to dig through, use that here instead of
|
|
||||||
// addressable, because it might be addressable but not ready.
|
|
||||||
address := c.Status.AddressStatus.Address
|
|
||||||
if address != nil {
|
|
||||||
ss.ChannelStatuses[i].ReadyCondition = apis.Condition{Type: apis.ConditionReady, Status: corev1.ConditionTrue}
|
|
||||||
} else {
|
|
||||||
ss.ChannelStatuses[i].ReadyCondition = apis.Condition{Type: apis.ConditionReady, Status: corev1.ConditionFalse, Reason: "NotAddressable", Message: "Channel is not addressable"}
|
|
||||||
allReady = false
|
|
||||||
}
|
|
||||||
|
|
||||||
// Mark the Sequence address as the Address of the first channel.
|
if ready := c.Status.GetCondition(apis.ConditionReady); ready != nil {
|
||||||
if i == 0 {
|
ss.ChannelStatuses[i].ReadyCondition = *ready
|
||||||
ss.setAddress(address)
|
if !ready.IsTrue() {
|
||||||
|
allReady = false
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
ss.ChannelStatuses[i].ReadyCondition = apis.Condition{Type: apis.ConditionReady, Status: corev1.ConditionUnknown, Reason: "NoReady", Message: "Channel does not have Ready condition"}
|
||||||
|
allReady = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if allReady {
|
if allReady {
|
||||||
|
|
@ -153,22 +154,23 @@ func (ss *SequenceStatus) PropagateChannelStatuses(channels []*eventingduckv1.Ch
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ss *SequenceStatus) MarkChannelsNotReady(reason, messageFormat string, messageA ...interface{}) {
|
func (ss *SequenceStatus) MarkChannelsNotReady(reason, messageFormat string, messageA ...interface{}) {
|
||||||
sCondSet.Manage(ss).MarkFalse(SequenceConditionChannelsReady, reason, messageFormat, messageA...)
|
sCondSet.Manage(ss).MarkUnknown(SequenceConditionChannelsReady, reason, messageFormat, messageA...)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ss *SequenceStatus) MarkSubscriptionsNotReady(reason, messageFormat string, messageA ...interface{}) {
|
func (ss *SequenceStatus) MarkSubscriptionsNotReady(reason, messageFormat string, messageA ...interface{}) {
|
||||||
sCondSet.Manage(ss).MarkFalse(SequenceConditionSubscriptionsReady, reason, messageFormat, messageA...)
|
sCondSet.Manage(ss).MarkUnknown(SequenceConditionSubscriptionsReady, reason, messageFormat, messageA...)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ss *SequenceStatus) MarkAddressableNotReady(reason, messageFormat string, messageA ...interface{}) {
|
func (ss *SequenceStatus) MarkAddressableNotReady(reason, messageFormat string, messageA ...interface{}) {
|
||||||
sCondSet.Manage(ss).MarkFalse(SequenceConditionAddressable, reason, messageFormat, messageA...)
|
sCondSet.Manage(ss).MarkUnknown(SequenceConditionAddressable, reason, messageFormat, messageA...)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ss *SequenceStatus) setAddress(address *duckv1.Addressable) {
|
func (ss *SequenceStatus) setAddress(address *duckv1.Addressable) {
|
||||||
if address == nil || address.URL == nil {
|
if address == nil || address.URL == nil {
|
||||||
sCondSet.Manage(ss).MarkFalse(SequenceConditionAddressable, "emptyAddress", "addressable is nil")
|
ss.Address = duckv1.Addressable{}
|
||||||
|
sCondSet.Manage(ss).MarkUnknown(SequenceConditionAddressable, "emptyAddress", "addressable is nil")
|
||||||
} else {
|
} else {
|
||||||
ss.AddressStatus.Address = &duckv1.Addressable{URL: address.URL}
|
ss.Address = duckv1.Addressable{URL: address.URL}
|
||||||
sCondSet.Manage(ss).MarkTrue(SequenceConditionAddressable)
|
sCondSet.Manage(ss).MarkTrue(SequenceConditionAddressable)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -124,10 +124,11 @@ type SequenceStatus struct {
|
||||||
// Matches the Spec.Steps array in the order.
|
// Matches the Spec.Steps array in the order.
|
||||||
ChannelStatuses []SequenceChannelStatus `json:"channelStatuses"`
|
ChannelStatuses []SequenceChannelStatus `json:"channelStatuses"`
|
||||||
|
|
||||||
// AddressStatus is the starting point to this Sequence. Sending to this
|
// Address is the starting point to this Sequence. Sending to this
|
||||||
// will target the first subscriber.
|
// will target the first subscriber.
|
||||||
// It generally has the form {channel}.{namespace}.svc.{cluster domain name}
|
// It generally has the form {channel}.{namespace}.svc.{cluster domain name}
|
||||||
duckv1.AddressStatus `json:",inline"`
|
// +optional
|
||||||
|
Address duckv1.Addressable `json:"address,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||||
|
|
|
||||||
|
|
@ -364,7 +364,7 @@ func (in *SequenceStatus) DeepCopyInto(out *SequenceStatus) {
|
||||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
in.AddressStatus.DeepCopyInto(&out.AddressStatus)
|
in.Address.DeepCopyInto(&out.Address)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,8 @@ import (
|
||||||
// +genreconciler
|
// +genreconciler
|
||||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||||
|
|
||||||
// Channel represents a generic Channel. It is normally used when we want a Channel, but don't need a specific Channel implementation.
|
// Channel represents a generic Channel. It is normally used when we want a
|
||||||
|
// Channel, but do not need a specific Channel implementation.
|
||||||
type Channel struct {
|
type Channel struct {
|
||||||
metav1.TypeMeta `json:",inline"`
|
metav1.TypeMeta `json:",inline"`
|
||||||
// +optional
|
// +optional
|
||||||
|
|
@ -38,8 +39,8 @@ type Channel struct {
|
||||||
// Spec defines the desired state of the Channel.
|
// Spec defines the desired state of the Channel.
|
||||||
Spec ChannelSpec `json:"spec,omitempty"`
|
Spec ChannelSpec `json:"spec,omitempty"`
|
||||||
|
|
||||||
// Status represents the current state of the Channel. This data may be out of
|
// Status represents the current state of the Channel. This data may be out
|
||||||
// date.
|
// of date.
|
||||||
// +optional
|
// +optional
|
||||||
Status ChannelStatus `json:"status,omitempty"`
|
Status ChannelStatus `json:"status,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
@ -61,12 +62,15 @@ var (
|
||||||
_ duckv1.KRShaped = (*Channel)(nil)
|
_ duckv1.KRShaped = (*Channel)(nil)
|
||||||
)
|
)
|
||||||
|
|
||||||
// ChannelSpec defines which subscribers have expressed interest in receiving events from this Channel.
|
// ChannelSpec defines which subscribers have expressed interest in receiving
|
||||||
// It also defines the ChannelTemplate to use in order to create the CRD Channel backing this Channel.
|
// events from this Channel. It also defines the ChannelTemplate to use in
|
||||||
|
// order to create the CRD Channel backing this Channel.
|
||||||
type ChannelSpec struct {
|
type ChannelSpec struct {
|
||||||
// ChannelTemplate specifies which Channel CRD to use to create the CRD Channel backing this Channel.
|
// ChannelTemplate specifies which Channel CRD to use to create the CRD
|
||||||
// This is immutable after creation. Normally this is set by the Channel defaulter, not directly by the user.
|
// Channel backing this Channel. This is immutable after creation.
|
||||||
ChannelTemplate *ChannelTemplateSpec `json:"channelTemplate"`
|
// Normally this is set by the Channel defaulter, not directly by the user.
|
||||||
|
// +optional
|
||||||
|
ChannelTemplate *ChannelTemplateSpec `json:"channelTemplate,omitempty"`
|
||||||
|
|
||||||
// Channel conforms to ChannelableSpec
|
// Channel conforms to ChannelableSpec
|
||||||
eventingduckv1.ChannelableSpec `json:",inline"`
|
eventingduckv1.ChannelableSpec `json:",inline"`
|
||||||
|
|
@ -78,6 +82,7 @@ type ChannelStatus struct {
|
||||||
eventingduckv1.ChannelableStatus `json:",inline"`
|
eventingduckv1.ChannelableStatus `json:",inline"`
|
||||||
|
|
||||||
// Channel is an KReference to the Channel CRD backing this Channel.
|
// Channel is an KReference to the Channel CRD backing this Channel.
|
||||||
|
// +optional
|
||||||
Channel *duckv1.KReference `json:"channel,omitempty"`
|
Channel *duckv1.KReference `json:"channel,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -91,7 +96,8 @@ type ChannelList struct {
|
||||||
Items []Channel `json:"items"`
|
Items []Channel `json:"items"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetStatus retrieves the status of the Channel. Implements the KRShaped interface.
|
// GetStatus retrieves the status of the Channel. Implements the KRShaped
|
||||||
|
// interface.
|
||||||
func (t *Channel) GetStatus() *duckv1.Status {
|
func (t *Channel) GetStatus() *duckv1.Status {
|
||||||
return &t.Status.Status
|
return &t.Status.Status
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -122,12 +122,15 @@ type SubscriptionStatus struct {
|
||||||
// Subscription.
|
// Subscription.
|
||||||
type SubscriptionStatusPhysicalSubscription struct {
|
type SubscriptionStatusPhysicalSubscription struct {
|
||||||
// SubscriberURI is the fully resolved URI for spec.subscriber.
|
// SubscriberURI is the fully resolved URI for spec.subscriber.
|
||||||
|
// +optional
|
||||||
SubscriberURI *apis.URL `json:"subscriberUri,omitempty"`
|
SubscriberURI *apis.URL `json:"subscriberUri,omitempty"`
|
||||||
|
|
||||||
// ReplyURI is the fully resolved URI for the spec.reply.
|
// ReplyURI is the fully resolved URI for the spec.reply.
|
||||||
|
// +optional
|
||||||
ReplyURI *apis.URL `json:"replyUri,omitempty"`
|
ReplyURI *apis.URL `json:"replyUri,omitempty"`
|
||||||
|
|
||||||
// ReplyURI is the fully resolved URI for the spec.delivery.deadLetterSink.
|
// ReplyURI is the fully resolved URI for the spec.delivery.deadLetterSink.
|
||||||
|
// +optional
|
||||||
DeadLetterSinkURI *apis.URL `json:"deadLetterSinkUri,omitempty"`
|
DeadLetterSinkURI *apis.URL `json:"deadLetterSinkUri,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,26 +21,27 @@ import (
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
|
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||||
|
"k8s.io/apimachinery/pkg/types"
|
||||||
|
"k8s.io/client-go/tools/cache"
|
||||||
|
"knative.dev/pkg/client/injection/ducks/duck/v1/addressable"
|
||||||
|
"knative.dev/pkg/controller"
|
||||||
|
|
||||||
corev1 "k8s.io/api/core/v1"
|
corev1 "k8s.io/api/core/v1"
|
||||||
apierrs "k8s.io/apimachinery/pkg/api/errors"
|
apierrs "k8s.io/apimachinery/pkg/api/errors"
|
||||||
"k8s.io/apimachinery/pkg/api/meta"
|
"k8s.io/apimachinery/pkg/api/meta"
|
||||||
"k8s.io/apimachinery/pkg/types"
|
|
||||||
|
|
||||||
"knative.dev/pkg/apis"
|
"knative.dev/pkg/apis"
|
||||||
pkgapisduck "knative.dev/pkg/apis/duck"
|
pkgapisduck "knative.dev/pkg/apis/duck"
|
||||||
duckv1 "knative.dev/pkg/apis/duck/v1"
|
duckv1 "knative.dev/pkg/apis/duck/v1"
|
||||||
duckv1beta1 "knative.dev/pkg/apis/duck/v1beta1"
|
duckv1beta1 "knative.dev/pkg/apis/duck/v1beta1"
|
||||||
"knative.dev/pkg/controller"
|
|
||||||
"knative.dev/pkg/network"
|
"knative.dev/pkg/network"
|
||||||
"knative.dev/pkg/tracker"
|
"knative.dev/pkg/tracker"
|
||||||
|
|
||||||
"knative.dev/pkg/client/injection/ducks/duck/v1/addressable"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// URIResolver resolves Destinations and ObjectReferences into a URI.
|
// URIResolver resolves Destinations and ObjectReferences into a URI.
|
||||||
type URIResolver struct {
|
type URIResolver struct {
|
||||||
tracker tracker.Interface
|
tracker tracker.Interface
|
||||||
informerFactory pkgapisduck.InformerFactory
|
listerFactory func(schema.GroupVersionResource) (cache.GenericLister, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewURIResolver constructs a new URIResolver with context and a callback
|
// NewURIResolver constructs a new URIResolver with context and a callback
|
||||||
|
|
@ -49,13 +50,19 @@ func NewURIResolver(ctx context.Context, callback func(types.NamespacedName)) *U
|
||||||
ret := &URIResolver{}
|
ret := &URIResolver{}
|
||||||
|
|
||||||
ret.tracker = tracker.New(callback, controller.GetTrackerLease(ctx))
|
ret.tracker = tracker.New(callback, controller.GetTrackerLease(ctx))
|
||||||
ret.informerFactory = &pkgapisduck.CachedInformerFactory{
|
|
||||||
|
informerFactory := &pkgapisduck.CachedInformerFactory{
|
||||||
Delegate: &pkgapisduck.EnqueueInformerFactory{
|
Delegate: &pkgapisduck.EnqueueInformerFactory{
|
||||||
Delegate: addressable.Get(ctx),
|
Delegate: addressable.Get(ctx),
|
||||||
EventHandler: controller.HandleAll(ret.tracker.OnChanged),
|
EventHandler: controller.HandleAll(ret.tracker.OnChanged),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ret.listerFactory = func(gvr schema.GroupVersionResource) (cache.GenericLister, error) {
|
||||||
|
_, l, err := informerFactory.Get(ctx, gvr)
|
||||||
|
return l, err
|
||||||
|
}
|
||||||
|
|
||||||
return ret
|
return ret
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -163,7 +170,7 @@ func (r *URIResolver) URIFromObjectReference(ctx context.Context, ref *corev1.Ob
|
||||||
return url, nil
|
return url, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
_, lister, err := r.informerFactory.Get(ctx, gvr)
|
lister, err := r.listerFactory(gvr)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, apierrs.NewNotFound(gvr.GroupResource(), "Lister")
|
return nil, apierrs.NewNotFound(gvr.GroupResource(), "Lister")
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,6 @@ import (
|
||||||
appsv1 "k8s.io/api/apps/v1"
|
appsv1 "k8s.io/api/apps/v1"
|
||||||
corev1 "k8s.io/api/core/v1"
|
corev1 "k8s.io/api/core/v1"
|
||||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||||
"k8s.io/utils/integer"
|
|
||||||
|
|
||||||
"knative.dev/pkg/apis"
|
"knative.dev/pkg/apis"
|
||||||
autoscalingv1alpha1 "knative.dev/serving/pkg/apis/autoscaling/v1alpha1"
|
autoscalingv1alpha1 "knative.dev/serving/pkg/apis/autoscaling/v1alpha1"
|
||||||
|
|
@ -173,8 +172,15 @@ func (rs *RevisionStatus) PropagateAutoscalerStatus(ps *autoscalingv1alpha1.PodA
|
||||||
// Reflect the PA status in our own.
|
// Reflect the PA status in our own.
|
||||||
cond := ps.GetCondition(autoscalingv1alpha1.PodAutoscalerConditionReady)
|
cond := ps.GetCondition(autoscalingv1alpha1.PodAutoscalerConditionReady)
|
||||||
|
|
||||||
rs.ActualReplicas = integer.Int32Max(ps.GetActualScale(), 0)
|
rs.ActualReplicas = nil
|
||||||
rs.DesiredReplicas = integer.Int32Max(ps.GetDesiredScale(), 0)
|
if ps.ActualScale != nil && *ps.ActualScale >= 0 {
|
||||||
|
rs.ActualReplicas = ps.ActualScale
|
||||||
|
}
|
||||||
|
|
||||||
|
rs.DesiredReplicas = nil
|
||||||
|
if ps.DesiredScale != nil && *ps.DesiredScale >= 0 {
|
||||||
|
rs.DesiredReplicas = ps.DesiredScale
|
||||||
|
}
|
||||||
|
|
||||||
if cond == nil {
|
if cond == nil {
|
||||||
rs.MarkActiveUnknown("Deploying", "")
|
rs.MarkActiveUnknown("Deploying", "")
|
||||||
|
|
|
||||||
|
|
@ -161,10 +161,10 @@ type RevisionStatus struct {
|
||||||
|
|
||||||
// ActualReplicas reflects the amount of ready pods running this revision.
|
// ActualReplicas reflects the amount of ready pods running this revision.
|
||||||
// +optional
|
// +optional
|
||||||
ActualReplicas int32 `json:"actualReplicas,omitempty"`
|
ActualReplicas *int32 `json:"actualReplicas,omitempty"`
|
||||||
// DesiredReplicas reflects the desired amount of pods running this revision.
|
// DesiredReplicas reflects the desired amount of pods running this revision.
|
||||||
// +optional
|
// +optional
|
||||||
DesiredReplicas int32 `json:"desiredReplicas,omitempty"`
|
DesiredReplicas *int32 `json:"desiredReplicas,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// ContainerStatus holds the information of container name and image digest value
|
// ContainerStatus holds the information of container name and image digest value
|
||||||
|
|
|
||||||
|
|
@ -251,6 +251,16 @@ func (in *RevisionStatus) DeepCopyInto(out *RevisionStatus) {
|
||||||
*out = make([]ContainerStatus, len(*in))
|
*out = make([]ContainerStatus, len(*in))
|
||||||
copy(*out, *in)
|
copy(*out, *in)
|
||||||
}
|
}
|
||||||
|
if in.ActualReplicas != nil {
|
||||||
|
in, out := &in.ActualReplicas, &out.ActualReplicas
|
||||||
|
*out = new(int32)
|
||||||
|
**out = **in
|
||||||
|
}
|
||||||
|
if in.DesiredReplicas != nil {
|
||||||
|
in, out := &in.DesiredReplicas, &out.DesiredReplicas
|
||||||
|
*out = new(int32)
|
||||||
|
**out = **in
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -766,7 +766,7 @@ k8s.io/kube-openapi/pkg/util/sets
|
||||||
k8s.io/utils/buffer
|
k8s.io/utils/buffer
|
||||||
k8s.io/utils/integer
|
k8s.io/utils/integer
|
||||||
k8s.io/utils/trace
|
k8s.io/utils/trace
|
||||||
# knative.dev/eventing v0.22.1-0.20210505162953-768b7d116d03
|
# knative.dev/eventing v0.22.1-0.20210512205148-1bbc0130b53a
|
||||||
## explicit
|
## explicit
|
||||||
knative.dev/eventing/pkg/apis/config
|
knative.dev/eventing/pkg/apis/config
|
||||||
knative.dev/eventing/pkg/apis/duck
|
knative.dev/eventing/pkg/apis/duck
|
||||||
|
|
@ -794,12 +794,12 @@ knative.dev/eventing/pkg/client/clientset/versioned/typed/sources/v1beta2/fake
|
||||||
# knative.dev/hack v0.0.0-20210428122153-93ad9129c268
|
# knative.dev/hack v0.0.0-20210428122153-93ad9129c268
|
||||||
## explicit
|
## explicit
|
||||||
knative.dev/hack
|
knative.dev/hack
|
||||||
# knative.dev/networking v0.0.0-20210428161254-1ad047ce063f
|
# knative.dev/networking v0.0.0-20210512050647-ace2d3306f0b
|
||||||
## explicit
|
## explicit
|
||||||
knative.dev/networking/pkg
|
knative.dev/networking/pkg
|
||||||
knative.dev/networking/pkg/apis/networking
|
knative.dev/networking/pkg/apis/networking
|
||||||
knative.dev/networking/pkg/apis/networking/v1alpha1
|
knative.dev/networking/pkg/apis/networking/v1alpha1
|
||||||
# knative.dev/pkg v0.0.0-20210428141353-878c85083565
|
# knative.dev/pkg v0.0.0-20210510175900-4564797bf3b7
|
||||||
## explicit
|
## explicit
|
||||||
knative.dev/pkg/apis
|
knative.dev/pkg/apis
|
||||||
knative.dev/pkg/apis/duck
|
knative.dev/pkg/apis/duck
|
||||||
|
|
@ -842,7 +842,7 @@ knative.dev/pkg/tracing/config
|
||||||
knative.dev/pkg/tracing/propagation
|
knative.dev/pkg/tracing/propagation
|
||||||
knative.dev/pkg/tracing/propagation/tracecontextb3
|
knative.dev/pkg/tracing/propagation/tracecontextb3
|
||||||
knative.dev/pkg/tracker
|
knative.dev/pkg/tracker
|
||||||
# knative.dev/serving v0.22.1-0.20210505154753-2d4e4a1eff9d
|
# knative.dev/serving v0.22.1-0.20210513113048-93847553c9e4
|
||||||
## explicit
|
## explicit
|
||||||
knative.dev/serving/pkg/apis/autoscaling
|
knative.dev/serving/pkg/apis/autoscaling
|
||||||
knative.dev/serving/pkg/apis/autoscaling/v1alpha1
|
knative.dev/serving/pkg/apis/autoscaling/v1alpha1
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue