mirror of
https://github.com/fluxcd/flagger.git
synced 2026-04-15 06:57:34 +00:00
Rename CRD group and kind name to canaries.steerer.app
This commit is contained in:
@@ -39,14 +39,14 @@ that exposes a port named http or https. These services are used as destinations
|
||||
|
||||

|
||||
|
||||
Gated rollout stages:
|
||||
Gated canary promotion stages:
|
||||
|
||||
* scan for deployments marked for rollout
|
||||
* scan for canary deployments
|
||||
* check Istio virtual service routes are mapped to primary and canary ClusterIP services
|
||||
* check primary and canary deployments status
|
||||
* halt rollout if a rolling update is underway
|
||||
* halt rollout if pods are unhealthy
|
||||
* increase canary traffic weight percentage from 0% to 10%
|
||||
* increase canary traffic weight percentage from 0% to 5% (step weight)
|
||||
* check canary HTTP request success rate and latency
|
||||
* halt rollout if any metric is under the specified threshold
|
||||
* increment the failed checks counter
|
||||
@@ -54,7 +54,7 @@ Gated rollout stages:
|
||||
* route all traffic to primary
|
||||
* scale to zero the canary deployment and mark it as failed
|
||||
* wait for the canary deployment to be updated (revision bump) and start over
|
||||
* increase canary traffic weight by 10% (step weight) till it reaches 100% (max weight)
|
||||
* increase canary traffic weight by 5% (step weight) till it reaches 50% (max weight)
|
||||
* halt rollout while canary request success rate is under the threshold
|
||||
* halt rollout while canary request duration P99 is over the threshold
|
||||
* halt rollout if the primary or canary deployment becomes unhealthy
|
||||
@@ -68,7 +68,7 @@ Gated rollout stages:
|
||||
* mark rollout as finished
|
||||
* wait for the canary deployment to be updated (revision bump) and start over
|
||||
|
||||
You can change the canary analysis _max weight_ and the _step weight_ percentage in the rollout custom resource.
|
||||
You can change the canary analysis _max weight_ and the _step weight_ percentage in the Steerer's custom resource.
|
||||
|
||||
Assuming the primary deployment is named _podinfo_ and the canary one _podinfo-canary_, Steerer will require
|
||||
a virtual service configured with weight-based routing:
|
||||
@@ -112,11 +112,11 @@ spec:
|
||||
targetPort: 9898
|
||||
```
|
||||
|
||||
Based on the two deployments, services and virtual service, a rollout can be defined using Steerer's custom resource:
|
||||
Based on the two deployments, services and virtual service, a canary promotion can be defined using Steerer's custom resource:
|
||||
|
||||
```yaml
|
||||
apiVersion: apps.weave.works/v1beta1
|
||||
kind: Rollout
|
||||
apiVersion: steerer.app/v1beta1
|
||||
kind: Canary
|
||||
metadata:
|
||||
name: podinfo
|
||||
namespace: test
|
||||
@@ -136,10 +136,10 @@ spec:
|
||||
threshold: 10
|
||||
# max traffic percentage routed to canary
|
||||
# percentage (0-100)
|
||||
maxWeight: 100
|
||||
maxWeight: 50
|
||||
# canary increment step
|
||||
# percentage (0-100)
|
||||
stepWeight: 10
|
||||
stepWeight: 5
|
||||
metrics:
|
||||
- name: istio_requests_total
|
||||
# minimum req success rate (non 5xx responses)
|
||||
@@ -150,7 +150,7 @@ spec:
|
||||
# maximum req duration P99
|
||||
# milliseconds
|
||||
threshold: 500
|
||||
interval: 30s
|
||||
interval: 1m
|
||||
```
|
||||
|
||||
The canary analysis is using the following promql queries:
|
||||
@@ -230,16 +230,16 @@ Create a virtual service (replace the Istio gateway and the internet domain with
|
||||
kubectl apply -f ${REPO}/artifacts/workloads/virtual-service.yaml
|
||||
```
|
||||
|
||||
Create a rollout custom resource:
|
||||
Create a canary promotion custom resource:
|
||||
|
||||
```bash
|
||||
kubectl apply -f ${REPO}/artifacts/rollouts/podinfo.yaml
|
||||
```
|
||||
|
||||
Rollout output:
|
||||
Canary promotion output:
|
||||
|
||||
```
|
||||
kubectl -n test describe rollout/podinfo
|
||||
kubectl -n test describe canary/podinfo
|
||||
|
||||
Status:
|
||||
Canary Revision: 16271121
|
||||
@@ -248,29 +248,29 @@ Status:
|
||||
Events:
|
||||
Type Reason Age From Message
|
||||
---- ------ ---- ---- -------
|
||||
Normal Synced 3m steerer Starting rollout for podinfo.test
|
||||
Normal Synced 3m steerer Advance rollout podinfo.test weight 10
|
||||
Normal Synced 3m steerer Advance rollout podinfo.test weight 20
|
||||
Normal Synced 3m steerer Advance rollout podinfo.test weight 30
|
||||
Warning Synced 3m steerer Halt rollout podinfo.test request duration 2.525s > 500ms
|
||||
Warning Synced 3m steerer Halt rollout podinfo.test request duration 1.567s > 500ms
|
||||
Warning Synced 3m steerer Halt rollout podinfo.test request duration 823ms > 500ms
|
||||
Normal Synced 2m steerer Advance rollout podinfo.test weight 40
|
||||
Normal Synced 2m steerer Advance rollout podinfo.test weight 50
|
||||
Normal Synced 1m steerer Advance rollout podinfo.test weight 60
|
||||
Warning Synced 1m steerer Halt rollout podinfo.test success rate 82.33% < 99%
|
||||
Warning Synced 1m steerer Halt rollout podinfo.test success rate 87.22% < 99%
|
||||
Warning Synced 1m steerer Halt rollout podinfo.test success rate 94.74% < 99%
|
||||
Normal Synced 1m steerer Advance rollout podinfo.test weight 70
|
||||
Normal Synced 55s steerer Advance rollout podinfo.test weight 80
|
||||
Normal Synced 45s steerer Advance rollout podinfo.test weight 90
|
||||
Normal Synced 35s steerer Advance rollout podinfo.test weight 100
|
||||
Normal Synced 3m steerer Starting canary deployment for podinfo.test
|
||||
Normal Synced 3m steerer Advance podinfo.test canary weight 5
|
||||
Normal Synced 3m steerer Advance podinfo.test canary weight 10
|
||||
Normal Synced 3m steerer Advance podinfo.test canary weight 15
|
||||
Warning Synced 3m steerer Halt podinfo.test advancement request duration 2.525s > 500ms
|
||||
Warning Synced 3m steerer Halt podinfo.test advancement request duration 1.567s > 500ms
|
||||
Warning Synced 3m steerer Halt podinfo.test advancement request duration 823ms > 500ms
|
||||
Normal Synced 2m steerer Advance podinfo.test canary weight 20
|
||||
Normal Synced 2m steerer Advance podinfo.test canary weight 25
|
||||
Normal Synced 1m steerer Advance podinfo.test canary weight 30
|
||||
Warning Synced 1m steerer Halt podinfo.test advancement success rate 82.33% < 99%
|
||||
Warning Synced 1m steerer Halt podinfo.test advancement success rate 87.22% < 99%
|
||||
Warning Synced 1m steerer Halt podinfo.test advancement success rate 94.74% < 99%
|
||||
Normal Synced 1m steerer Advance podinfo.test canary weight 35
|
||||
Normal Synced 55s steerer Advance podinfo.test canary weight 40
|
||||
Normal Synced 45s steerer Advance podinfo.test canary weight 45
|
||||
Normal Synced 35s steerer Advance podinfo.test canary weight 50
|
||||
Normal Synced 25s steerer Copying podinfo-canary.test template spec to podinfo.test
|
||||
Warning Synced 15s steerer Waiting for podinfo.test rollout to finish: 1 of 2 updated replicas are available
|
||||
Normal Synced 5s steerer Promotion completed! Scaling down podinfo-canary.test
|
||||
```
|
||||
|
||||
During the rollout you can generate HTTP 500 errors and high latency to test if Steerer pauses the rollout.
|
||||
During the canary analysis you can generate HTTP 500 errors and high latency to test if Steerer pauses the rollout.
|
||||
|
||||
Create a tester pod and exec into it:
|
||||
|
||||
@@ -295,7 +295,7 @@ When the number of failed checks reaches the canary analysis threshold, the traf
|
||||
the canary is scaled to zero and the rollout is marked as failed.
|
||||
|
||||
```
|
||||
kubectl -n test describe rollout/podinfo
|
||||
kubectl -n test describe canary/podinfo
|
||||
|
||||
Status:
|
||||
Canary Revision: 16695041
|
||||
@@ -304,20 +304,20 @@ Status:
|
||||
Events:
|
||||
Type Reason Age From Message
|
||||
---- ------ ---- ---- -------
|
||||
Normal Synced 3m steerer Starting rollout for podinfo.test
|
||||
Normal Synced 3m steerer Advance rollout podinfo.test weight 10
|
||||
Normal Synced 3m steerer Advance rollout podinfo.test weight 20
|
||||
Normal Synced 3m steerer Advance rollout podinfo.test weight 30
|
||||
Normal Synced 3m steerer Halt rollout podinfo.test success rate 69.17% < 99%
|
||||
Normal Synced 2m steerer Halt rollout podinfo.test success rate 61.39% < 99%
|
||||
Normal Synced 2m steerer Halt rollout podinfo.test success rate 55.06% < 99%
|
||||
Normal Synced 2m steerer Halt rollout podinfo.test success rate 47.00% < 99%
|
||||
Normal Synced 2m steerer (combined from similar events): Halt rollout podinfo.test success rate 38.08% < 99%
|
||||
Normal Synced 3m steerer Starting canary deployment for podinfo.test
|
||||
Normal Synced 3m steerer Advance podinfo.test canary weight 5
|
||||
Normal Synced 3m steerer Advance podinfo.test canary weight 10
|
||||
Normal Synced 3m steerer Advance podinfo.test canary weight 15
|
||||
Normal Synced 3m steerer Halt podinfo.test advancement success rate 69.17% < 99%
|
||||
Normal Synced 2m steerer Halt podinfo.test advancement success rate 61.39% < 99%
|
||||
Normal Synced 2m steerer Halt podinfo.test advancement success rate 55.06% < 99%
|
||||
Normal Synced 2m steerer Halt podinfo.test advancement success rate 47.00% < 99%
|
||||
Normal Synced 2m steerer (combined from similar events): Halt podinfo.test advancement success rate 38.08% < 99%
|
||||
Warning Synced 1m steerer Rolling back podinfo-canary.test failed checks threshold reached 10
|
||||
Warning Synced 1m steerer Canary failed! Scaling down podinfo-canary.test
|
||||
```
|
||||
|
||||
Trigger a new rollout by updating the canary image:
|
||||
Trigger a new canary deployment by updating the canary image:
|
||||
|
||||
```bash
|
||||
kubectl -n test set image deployment/podinfo-canary \
|
||||
@@ -327,7 +327,7 @@ podinfod=quay.io/stefanprodan/podinfo:1.2.1
|
||||
Steer detects that the canary revision changed and starts a new rollout:
|
||||
|
||||
```
|
||||
kubectl -n test describe rollout/podinfo
|
||||
kubectl -n test describe canary/podinfo
|
||||
|
||||
Status:
|
||||
Canary Revision: 19871136
|
||||
@@ -339,16 +339,16 @@ Events:
|
||||
Normal Synced 3m steerer New revision detected podinfo-canary.test old 17211012 new 17246876
|
||||
Normal Synced 3m steerer Scaling up podinfo.test
|
||||
Warning Synced 3m steerer Waiting for podinfo.test rollout to finish: 0 of 1 updated replicas are available
|
||||
Normal Synced 3m steerer Advance rollout podinfo.test weight 10
|
||||
Normal Synced 3m steerer Advance rollout podinfo.test weight 20
|
||||
Normal Synced 3m steerer Advance rollout podinfo.test weight 30
|
||||
Normal Synced 2m steerer Advance rollout podinfo.test weight 40
|
||||
Normal Synced 2m steerer Advance rollout podinfo.test weight 50
|
||||
Normal Synced 1m steerer Advance rollout podinfo.test weight 60
|
||||
Normal Synced 1m steerer Advance rollout podinfo.test weight 70
|
||||
Normal Synced 55s steerer Advance rollout podinfo.test weight 80
|
||||
Normal Synced 45s steerer Advance rollout podinfo.test weight 90
|
||||
Normal Synced 35s steerer Advance rollout podinfo.test weight 100
|
||||
Normal Synced 3m steerer Advance podinfo.test canary weight 5
|
||||
Normal Synced 3m steerer Advance podinfo.test canary weight 10
|
||||
Normal Synced 3m steerer Advance podinfo.test canary weight 15
|
||||
Normal Synced 2m steerer Advance podinfo.test canary weight 20
|
||||
Normal Synced 2m steerer Advance podinfo.test canary weight 25
|
||||
Normal Synced 1m steerer Advance podinfo.test canary weight 30
|
||||
Normal Synced 1m steerer Advance podinfo.test canary weight 35
|
||||
Normal Synced 55s steerer Advance podinfo.test canary weight 40
|
||||
Normal Synced 45s steerer Advance podinfo.test canary weight 45
|
||||
Normal Synced 35s steerer Advance podinfo.test canary weight 50
|
||||
Normal Synced 25s steerer Copying podinfo-canary.test template spec to podinfo.test
|
||||
Warning Synced 15s steerer Waiting for podinfo.test rollout to finish: 1 of 2 updated replicas are available
|
||||
Normal Synced 5s steerer Promotion completed! Scaling down podinfo-canary.test
|
||||
@@ -375,19 +375,19 @@ The canary errors and latency spikes have been recorded as Kubernetes events and
|
||||
```
|
||||
kubectl -n istio-system logs deployment/steerer --tail=100 | jq .msg
|
||||
|
||||
Starting rollout for podinfo.test
|
||||
Advance rollout podinfo.test weight 5
|
||||
Advance rollout podinfo.test weight 10
|
||||
Advance rollout podinfo.test weight 15
|
||||
Advance rollout podinfo.test weight 20
|
||||
Advance rollout podinfo.test weight 25
|
||||
Advance rollout podinfo.test weight 30
|
||||
Advance rollout podinfo.test weight 35
|
||||
Halt rollout podinfo.test success rate 98.69% < 99%
|
||||
Advance rollout podinfo.test weight 40
|
||||
Halt rollout podinfo.test request duration 1.515s > 500ms
|
||||
Advance rollout podinfo.test weight 45
|
||||
Advance rollout podinfo.test weight 50
|
||||
Starting canary deployment for podinfo.test
|
||||
Advance podinfo.test canary weight 5
|
||||
Advance podinfo.test canary weight 10
|
||||
Advance podinfo.test canary weight 15
|
||||
Advance podinfo.test canary weight 20
|
||||
Advance podinfo.test canary weight 25
|
||||
Advance podinfo.test canary weight 30
|
||||
Advance podinfo.test canary weight 35
|
||||
Halt podinfo.test advancement success rate 98.69% < 99%
|
||||
Advance podinfo.test canary weight 40
|
||||
Halt podinfo.test advancement request duration 1.515s > 500ms
|
||||
Advance podinfo.test canary weight 45
|
||||
Advance podinfo.test canary weight 50
|
||||
Copying podinfo-canary.test template spec to podinfo-primary.test
|
||||
Scaling down podinfo-canary.test
|
||||
Promotion completed! podinfo-canary.test revision 81289
|
||||
@@ -409,5 +409,5 @@ When submitting bug reports please include as much details as possible:
|
||||
* which Steerer version
|
||||
* which Steerer CRD version
|
||||
* which Kubernetes/Istio version
|
||||
* what configuration (rollout, virtual service and workloads definitions)
|
||||
* what configuration (canary, virtual service and workloads definitions)
|
||||
* what happened (Steerer, Istio Pilot and Proxy logs)
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
# generate errors: watch curl http://podinfo-canary:9898/status/500
|
||||
# run load test: kubectl run -n test -it --rm --restart=Never hey --image=stefanprodan/loadtest -- sh
|
||||
# generate load: hey -z 2m -h2 -m POST -d '{test: 1}' -c 10 -q 5 http://podinfo:9898/api/echo
|
||||
apiVersion: apps.weave.works/v1beta1
|
||||
kind: Rollout
|
||||
apiVersion: steerer.app/v1beta1
|
||||
kind: Canary
|
||||
metadata:
|
||||
name: podinfo
|
||||
namespace: test
|
||||
@@ -22,10 +22,10 @@ spec:
|
||||
canaryAnalysis:
|
||||
# max number of failed metric checks
|
||||
# before rolling back the canary
|
||||
threshold: 10
|
||||
threshold: 5
|
||||
# max traffic percentage routed to canary
|
||||
# percentage (0-100)
|
||||
maxWeight: 100
|
||||
maxWeight: 50
|
||||
# canary increment step
|
||||
# percentage (0-100)
|
||||
stepWeight: 10
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
apiVersion: apps.weave.works/v1beta1
|
||||
kind: Rollout
|
||||
apiVersion: steerer.app/v1beta1
|
||||
kind: Canary
|
||||
metadata:
|
||||
name: podinfoc
|
||||
namespace: test
|
||||
|
||||
@@ -1,20 +1,18 @@
|
||||
apiVersion: apiextensions.k8s.io/v1beta1
|
||||
kind: CustomResourceDefinition
|
||||
metadata:
|
||||
name: rollouts.apps.weave.works
|
||||
name: canaries.steerer.app
|
||||
spec:
|
||||
group: apps.weave.works
|
||||
group: steerer.app
|
||||
version: v1beta1
|
||||
versions:
|
||||
- name: v1beta1
|
||||
served: true
|
||||
storage: true
|
||||
names:
|
||||
plural: rollouts
|
||||
singular: rollout
|
||||
kind: Rollout
|
||||
shortNames:
|
||||
- roll
|
||||
plural: canaries
|
||||
singular: canary
|
||||
kind: Canary
|
||||
scope: Namespaced
|
||||
validation:
|
||||
openAPIV3Schema:
|
||||
|
||||
@@ -22,7 +22,7 @@ spec:
|
||||
serviceAccountName: steerer
|
||||
containers:
|
||||
- name: steerer
|
||||
image: stefanprodan/steerer:0.0.1-rc.18
|
||||
image: stefanprodan/steerer:0.0.1-rc.23
|
||||
imagePullPolicy: Always
|
||||
ports:
|
||||
- name: http
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
apiVersion: v1
|
||||
name: steerer
|
||||
version: 0.0.1
|
||||
appVersion: 0.0.1-rc.16
|
||||
appVersion: 0.0.1-rc.23
|
||||
description: Steerer is a Kubernetes operator that automates the promotion of canary deployments using Istio routing for traffic shifting and Prometheus metrics for canary analysis.
|
||||
|
||||
@@ -2,20 +2,18 @@
|
||||
apiVersion: apiextensions.k8s.io/v1beta1
|
||||
kind: CustomResourceDefinition
|
||||
metadata:
|
||||
name: rollouts.apps.weave.works
|
||||
name: canaries.steerer.app
|
||||
spec:
|
||||
group: apps.weave.works
|
||||
group: steerer.app
|
||||
version: v1beta1
|
||||
versions:
|
||||
- name: v1beta1
|
||||
served: true
|
||||
storage: true
|
||||
names:
|
||||
plural: rollouts
|
||||
singular: rollout
|
||||
kind: Rollout
|
||||
shortNames:
|
||||
- roll
|
||||
plural: canaries
|
||||
singular: canary
|
||||
kind: Canary
|
||||
scope: Namespaced
|
||||
validation:
|
||||
openAPIV3Schema:
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
image:
|
||||
repository: stefanprodan/steerer
|
||||
tag: 0.0.1-rc.16
|
||||
tag: 0.0.1-rc.23
|
||||
pullPolicy: IfNotPresent
|
||||
|
||||
controlLoopInterval: "10s"
|
||||
|
||||
+1
-1
@@ -70,7 +70,7 @@ func main() {
|
||||
}
|
||||
|
||||
rolloutInformerFactory := informers.NewSharedInformerFactory(rolloutClient, time.Second*30)
|
||||
rolloutInformer := rolloutInformerFactory.Apps().V1beta1().Rollouts()
|
||||
rolloutInformer := rolloutInformerFactory.Steerer().V1beta1().Canaries()
|
||||
|
||||
logger.Infof("Starting steerer version %s revision %s", version.VERSION, version.REVISION)
|
||||
|
||||
|
||||
Binary file not shown.
+9
-9
@@ -3,10 +3,10 @@ entries:
|
||||
grafana:
|
||||
- apiVersion: v1
|
||||
appVersion: 5.2.0
|
||||
created: 2018-10-03T15:13:25.29361+03:00
|
||||
created: 2018-10-04T14:48:57.585857+03:00
|
||||
description: A Helm chart for monitoring progressive deployments powered by Istio
|
||||
and Steerer
|
||||
digest: 34cfba546cbccadc4907106e0a34dfcd8dad7ddc86517c7b3c29a7f176c91b7b
|
||||
digest: f8cac4d99069abdffd432b0c7e741aa1cf3c6f88435fd1cc54c00004514d740d
|
||||
home: https://github.com/stefanprodan/steerer
|
||||
name: grafana
|
||||
urls:
|
||||
@@ -15,9 +15,9 @@ entries:
|
||||
podinfo-steerer:
|
||||
- apiVersion: v1
|
||||
appVersion: 1.2.1
|
||||
created: 2018-10-03T15:13:25.294489+03:00
|
||||
created: 2018-10-04T14:48:57.586743+03:00
|
||||
description: Podinfo Helm chart for Steerer progressive delivery
|
||||
digest: c56d35abf54959141bc6289af9509c5075233f4b9bda90e5d99510b5187b25a2
|
||||
digest: 0d9a5037f9765cb74882bcbc1c873527b49af742bdde5ea9ca8c674efcfcb178
|
||||
engine: gotpl
|
||||
home: https://github.com/stefanprodan/k8s-podinfo
|
||||
maintainers:
|
||||
@@ -31,7 +31,7 @@ entries:
|
||||
version: 2.0.0
|
||||
- apiVersion: v1
|
||||
appVersion: 1.2.1
|
||||
created: 2018-10-03T15:13:25.294153+03:00
|
||||
created: 2018-10-04T14:48:57.586403+03:00
|
||||
description: Podinfo Helm chart for Steerer progressive delivery
|
||||
digest: f559f387aa45005be085af207b8b4c91776e489fcb6ca7e60f20913ecd21184e
|
||||
engine: gotpl
|
||||
@@ -47,14 +47,14 @@ entries:
|
||||
version: 1.2.1
|
||||
steerer:
|
||||
- apiVersion: v1
|
||||
appVersion: 0.0.1-rc.16
|
||||
created: 2018-10-03T15:13:25.294827+03:00
|
||||
appVersion: 0.0.1-rc.23
|
||||
created: 2018-10-04T14:48:57.587058+03:00
|
||||
description: Steerer is a Kubernetes operator that automates the promotion of
|
||||
canary deployments using Istio routing for traffic shifting and Prometheus metrics
|
||||
for canary analysis.
|
||||
digest: 523e304d6820fdbe06934b61761d7519b89a6c948ed8d0ae812a1d0159f534dd
|
||||
digest: e403eb0e6aff36146d00f0dc56820fd5a464acf6509b5d715e937757bbb29aac
|
||||
name: steerer
|
||||
urls:
|
||||
- https://stefanprodan.github.io/steerer/steerer-0.0.1.tgz
|
||||
version: 0.0.1
|
||||
generated: 2018-10-03T15:13:25.293021+03:00
|
||||
generated: 2018-10-04T14:48:57.584927+03:00
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@@ -17,5 +17,5 @@ limitations under the License.
|
||||
package rollout
|
||||
|
||||
const (
|
||||
GroupName = "apps.weave.works"
|
||||
GroupName = "steerer.app"
|
||||
)
|
||||
|
||||
@@ -17,5 +17,5 @@ limitations under the License.
|
||||
// +k8s:deepcopy-gen=package
|
||||
|
||||
// Package v1beta1 is the v1beta1 version of the API.
|
||||
// +groupName=apps.weave.works
|
||||
// +groupName=steerer.app
|
||||
package v1beta1
|
||||
|
||||
@@ -45,8 +45,8 @@ var (
|
||||
// Adds the list of known types to Scheme.
|
||||
func addKnownTypes(scheme *runtime.Scheme) error {
|
||||
scheme.AddKnownTypes(SchemeGroupVersion,
|
||||
&Rollout{},
|
||||
&RolloutList{},
|
||||
&Canary{},
|
||||
&CanaryList{},
|
||||
)
|
||||
metav1.AddToGroupVersion(scheme, SchemeGroupVersion)
|
||||
return nil
|
||||
|
||||
@@ -23,17 +23,17 @@ import (
|
||||
// +genclient
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
|
||||
// Rollout is a specification for a Rollout resource
|
||||
type Rollout struct {
|
||||
// Canary is a specification for a Canary resource
|
||||
type Canary struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ObjectMeta `json:"metadata,omitempty"`
|
||||
|
||||
Spec RolloutSpec `json:"spec"`
|
||||
Status RolloutStatus `json:"status"`
|
||||
Spec CanarySpec `json:"spec"`
|
||||
Status CanaryStatus `json:"status"`
|
||||
}
|
||||
|
||||
// RolloutSpec is the spec for a Rollout resource
|
||||
type RolloutSpec struct {
|
||||
// CanarySpec is the spec for a Canary resource
|
||||
type CanarySpec struct {
|
||||
TargetKind string `json:"targetKind"`
|
||||
Primary Target `json:"primary"`
|
||||
Canary Target `json:"canary"`
|
||||
@@ -63,8 +63,8 @@ type Metric struct {
|
||||
Threshold int `json:"threshold"`
|
||||
}
|
||||
|
||||
// RolloutStatus is the status for a Rollout resource
|
||||
type RolloutStatus struct {
|
||||
// CanaryStatus is the status for a Canary resource
|
||||
type CanaryStatus struct {
|
||||
State string `json:"state"`
|
||||
CanaryRevision string `json:"canaryRevision"`
|
||||
FailedChecks int `json:"failedChecks"`
|
||||
@@ -72,10 +72,10 @@ type RolloutStatus struct {
|
||||
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
|
||||
// RolloutList is a list of Rollout resources
|
||||
type RolloutList struct {
|
||||
// CanaryList is a list of Canary resources
|
||||
type CanaryList struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ListMeta `json:"metadata"`
|
||||
|
||||
Items []Rollout `json:"items"`
|
||||
Items []Canary `json:"items"`
|
||||
}
|
||||
|
||||
@@ -24,6 +24,34 @@ import (
|
||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||
)
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *Canary) DeepCopyInto(out *Canary) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
||||
in.Spec.DeepCopyInto(&out.Spec)
|
||||
out.Status = in.Status
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Canary.
|
||||
func (in *Canary) DeepCopy() *Canary {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(Canary)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *Canary) 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 *CanaryAnalysis) DeepCopyInto(out *CanaryAnalysis) {
|
||||
*out = *in
|
||||
@@ -45,6 +73,75 @@ func (in *CanaryAnalysis) DeepCopy() *CanaryAnalysis {
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *CanaryList) DeepCopyInto(out *CanaryList) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
out.ListMeta = in.ListMeta
|
||||
if in.Items != nil {
|
||||
in, out := &in.Items, &out.Items
|
||||
*out = make([]Canary, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CanaryList.
|
||||
func (in *CanaryList) DeepCopy() *CanaryList {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(CanaryList)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *CanaryList) 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 *CanarySpec) DeepCopyInto(out *CanarySpec) {
|
||||
*out = *in
|
||||
out.Primary = in.Primary
|
||||
out.Canary = in.Canary
|
||||
in.CanaryAnalysis.DeepCopyInto(&out.CanaryAnalysis)
|
||||
out.VirtualService = in.VirtualService
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CanarySpec.
|
||||
func (in *CanarySpec) DeepCopy() *CanarySpec {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(CanarySpec)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *CanaryStatus) DeepCopyInto(out *CanaryStatus) {
|
||||
*out = *in
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CanaryStatus.
|
||||
func (in *CanaryStatus) DeepCopy() *CanaryStatus {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(CanaryStatus)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *Metric) DeepCopyInto(out *Metric) {
|
||||
*out = *in
|
||||
@@ -61,103 +158,6 @@ func (in *Metric) DeepCopy() *Metric {
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *Rollout) DeepCopyInto(out *Rollout) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
||||
in.Spec.DeepCopyInto(&out.Spec)
|
||||
out.Status = in.Status
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Rollout.
|
||||
func (in *Rollout) DeepCopy() *Rollout {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(Rollout)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *Rollout) 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 *RolloutList) DeepCopyInto(out *RolloutList) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
out.ListMeta = in.ListMeta
|
||||
if in.Items != nil {
|
||||
in, out := &in.Items, &out.Items
|
||||
*out = make([]Rollout, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RolloutList.
|
||||
func (in *RolloutList) DeepCopy() *RolloutList {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(RolloutList)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *RolloutList) 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 *RolloutSpec) DeepCopyInto(out *RolloutSpec) {
|
||||
*out = *in
|
||||
out.Primary = in.Primary
|
||||
out.Canary = in.Canary
|
||||
in.CanaryAnalysis.DeepCopyInto(&out.CanaryAnalysis)
|
||||
out.VirtualService = in.VirtualService
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RolloutSpec.
|
||||
func (in *RolloutSpec) DeepCopy() *RolloutSpec {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(RolloutSpec)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *RolloutStatus) DeepCopyInto(out *RolloutStatus) {
|
||||
*out = *in
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RolloutStatus.
|
||||
func (in *RolloutStatus) DeepCopy() *RolloutStatus {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(RolloutStatus)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *Target) DeepCopyInto(out *Target) {
|
||||
*out = *in
|
||||
|
||||
@@ -19,7 +19,7 @@ limitations under the License.
|
||||
package versioned
|
||||
|
||||
import (
|
||||
appsv1beta1 "github.com/stefanprodan/steerer/pkg/client/clientset/versioned/typed/rollout/v1beta1"
|
||||
steererv1beta1 "github.com/stefanprodan/steerer/pkg/client/clientset/versioned/typed/rollout/v1beta1"
|
||||
discovery "k8s.io/client-go/discovery"
|
||||
rest "k8s.io/client-go/rest"
|
||||
flowcontrol "k8s.io/client-go/util/flowcontrol"
|
||||
@@ -27,27 +27,27 @@ import (
|
||||
|
||||
type Interface interface {
|
||||
Discovery() discovery.DiscoveryInterface
|
||||
AppsV1beta1() appsv1beta1.AppsV1beta1Interface
|
||||
SteererV1beta1() steererv1beta1.SteererV1beta1Interface
|
||||
// Deprecated: please explicitly pick a version if possible.
|
||||
Apps() appsv1beta1.AppsV1beta1Interface
|
||||
Steerer() steererv1beta1.SteererV1beta1Interface
|
||||
}
|
||||
|
||||
// Clientset contains the clients for groups. Each group has exactly one
|
||||
// version included in a Clientset.
|
||||
type Clientset struct {
|
||||
*discovery.DiscoveryClient
|
||||
appsV1beta1 *appsv1beta1.AppsV1beta1Client
|
||||
steererV1beta1 *steererv1beta1.SteererV1beta1Client
|
||||
}
|
||||
|
||||
// AppsV1beta1 retrieves the AppsV1beta1Client
|
||||
func (c *Clientset) AppsV1beta1() appsv1beta1.AppsV1beta1Interface {
|
||||
return c.appsV1beta1
|
||||
// SteererV1beta1 retrieves the SteererV1beta1Client
|
||||
func (c *Clientset) SteererV1beta1() steererv1beta1.SteererV1beta1Interface {
|
||||
return c.steererV1beta1
|
||||
}
|
||||
|
||||
// Deprecated: Apps retrieves the default version of AppsClient.
|
||||
// Deprecated: Steerer retrieves the default version of SteererClient.
|
||||
// Please explicitly pick a version.
|
||||
func (c *Clientset) Apps() appsv1beta1.AppsV1beta1Interface {
|
||||
return c.appsV1beta1
|
||||
func (c *Clientset) Steerer() steererv1beta1.SteererV1beta1Interface {
|
||||
return c.steererV1beta1
|
||||
}
|
||||
|
||||
// Discovery retrieves the DiscoveryClient
|
||||
@@ -66,7 +66,7 @@ func NewForConfig(c *rest.Config) (*Clientset, error) {
|
||||
}
|
||||
var cs Clientset
|
||||
var err error
|
||||
cs.appsV1beta1, err = appsv1beta1.NewForConfig(&configShallowCopy)
|
||||
cs.steererV1beta1, err = steererv1beta1.NewForConfig(&configShallowCopy)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -82,7 +82,7 @@ func NewForConfig(c *rest.Config) (*Clientset, error) {
|
||||
// panics if there is an error in the config.
|
||||
func NewForConfigOrDie(c *rest.Config) *Clientset {
|
||||
var cs Clientset
|
||||
cs.appsV1beta1 = appsv1beta1.NewForConfigOrDie(c)
|
||||
cs.steererV1beta1 = steererv1beta1.NewForConfigOrDie(c)
|
||||
|
||||
cs.DiscoveryClient = discovery.NewDiscoveryClientForConfigOrDie(c)
|
||||
return &cs
|
||||
@@ -91,7 +91,7 @@ func NewForConfigOrDie(c *rest.Config) *Clientset {
|
||||
// New creates a new Clientset for the given RESTClient.
|
||||
func New(c rest.Interface) *Clientset {
|
||||
var cs Clientset
|
||||
cs.appsV1beta1 = appsv1beta1.New(c)
|
||||
cs.steererV1beta1 = steererv1beta1.New(c)
|
||||
|
||||
cs.DiscoveryClient = discovery.NewDiscoveryClient(c)
|
||||
return &cs
|
||||
|
||||
@@ -20,8 +20,8 @@ package fake
|
||||
|
||||
import (
|
||||
clientset "github.com/stefanprodan/steerer/pkg/client/clientset/versioned"
|
||||
appsv1beta1 "github.com/stefanprodan/steerer/pkg/client/clientset/versioned/typed/rollout/v1beta1"
|
||||
fakeappsv1beta1 "github.com/stefanprodan/steerer/pkg/client/clientset/versioned/typed/rollout/v1beta1/fake"
|
||||
steererv1beta1 "github.com/stefanprodan/steerer/pkg/client/clientset/versioned/typed/rollout/v1beta1"
|
||||
fakesteererv1beta1 "github.com/stefanprodan/steerer/pkg/client/clientset/versioned/typed/rollout/v1beta1/fake"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/apimachinery/pkg/watch"
|
||||
"k8s.io/client-go/discovery"
|
||||
@@ -71,12 +71,12 @@ func (c *Clientset) Discovery() discovery.DiscoveryInterface {
|
||||
|
||||
var _ clientset.Interface = &Clientset{}
|
||||
|
||||
// AppsV1beta1 retrieves the AppsV1beta1Client
|
||||
func (c *Clientset) AppsV1beta1() appsv1beta1.AppsV1beta1Interface {
|
||||
return &fakeappsv1beta1.FakeAppsV1beta1{Fake: &c.Fake}
|
||||
// SteererV1beta1 retrieves the SteererV1beta1Client
|
||||
func (c *Clientset) SteererV1beta1() steererv1beta1.SteererV1beta1Interface {
|
||||
return &fakesteererv1beta1.FakeSteererV1beta1{Fake: &c.Fake}
|
||||
}
|
||||
|
||||
// Apps retrieves the AppsV1beta1Client
|
||||
func (c *Clientset) Apps() appsv1beta1.AppsV1beta1Interface {
|
||||
return &fakeappsv1beta1.FakeAppsV1beta1{Fake: &c.Fake}
|
||||
// Steerer retrieves the SteererV1beta1Client
|
||||
func (c *Clientset) Steerer() steererv1beta1.SteererV1beta1Interface {
|
||||
return &fakesteererv1beta1.FakeSteererV1beta1{Fake: &c.Fake}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ limitations under the License.
|
||||
package fake
|
||||
|
||||
import (
|
||||
appsv1beta1 "github.com/stefanprodan/steerer/pkg/apis/rollout/v1beta1"
|
||||
steererv1beta1 "github.com/stefanprodan/steerer/pkg/apis/rollout/v1beta1"
|
||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||
schema "k8s.io/apimachinery/pkg/runtime/schema"
|
||||
@@ -50,5 +50,5 @@ func init() {
|
||||
// After this, RawExtensions in Kubernetes types will serialize kube-aggregator types
|
||||
// correctly.
|
||||
func AddToScheme(scheme *runtime.Scheme) {
|
||||
appsv1beta1.AddToScheme(scheme)
|
||||
steererv1beta1.AddToScheme(scheme)
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ limitations under the License.
|
||||
package scheme
|
||||
|
||||
import (
|
||||
appsv1beta1 "github.com/stefanprodan/steerer/pkg/apis/rollout/v1beta1"
|
||||
steererv1beta1 "github.com/stefanprodan/steerer/pkg/apis/rollout/v1beta1"
|
||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||
schema "k8s.io/apimachinery/pkg/runtime/schema"
|
||||
@@ -50,5 +50,5 @@ func init() {
|
||||
// After this, RawExtensions in Kubernetes types will serialize kube-aggregator types
|
||||
// correctly.
|
||||
func AddToScheme(scheme *runtime.Scheme) {
|
||||
appsv1beta1.AddToScheme(scheme)
|
||||
steererv1beta1.AddToScheme(scheme)
|
||||
}
|
||||
|
||||
@@ -0,0 +1,174 @@
|
||||
/*
|
||||
Copyright The 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 client-gen. DO NOT EDIT.
|
||||
|
||||
package v1beta1
|
||||
|
||||
import (
|
||||
v1beta1 "github.com/stefanprodan/steerer/pkg/apis/rollout/v1beta1"
|
||||
scheme "github.com/stefanprodan/steerer/pkg/client/clientset/versioned/scheme"
|
||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
types "k8s.io/apimachinery/pkg/types"
|
||||
watch "k8s.io/apimachinery/pkg/watch"
|
||||
rest "k8s.io/client-go/rest"
|
||||
)
|
||||
|
||||
// CanariesGetter has a method to return a CanaryInterface.
|
||||
// A group's client should implement this interface.
|
||||
type CanariesGetter interface {
|
||||
Canaries(namespace string) CanaryInterface
|
||||
}
|
||||
|
||||
// CanaryInterface has methods to work with Canary resources.
|
||||
type CanaryInterface interface {
|
||||
Create(*v1beta1.Canary) (*v1beta1.Canary, error)
|
||||
Update(*v1beta1.Canary) (*v1beta1.Canary, error)
|
||||
UpdateStatus(*v1beta1.Canary) (*v1beta1.Canary, error)
|
||||
Delete(name string, options *v1.DeleteOptions) error
|
||||
DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error
|
||||
Get(name string, options v1.GetOptions) (*v1beta1.Canary, error)
|
||||
List(opts v1.ListOptions) (*v1beta1.CanaryList, error)
|
||||
Watch(opts v1.ListOptions) (watch.Interface, error)
|
||||
Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1beta1.Canary, err error)
|
||||
CanaryExpansion
|
||||
}
|
||||
|
||||
// canaries implements CanaryInterface
|
||||
type canaries struct {
|
||||
client rest.Interface
|
||||
ns string
|
||||
}
|
||||
|
||||
// newCanaries returns a Canaries
|
||||
func newCanaries(c *SteererV1beta1Client, namespace string) *canaries {
|
||||
return &canaries{
|
||||
client: c.RESTClient(),
|
||||
ns: namespace,
|
||||
}
|
||||
}
|
||||
|
||||
// Get takes name of the canary, and returns the corresponding canary object, and an error if there is any.
|
||||
func (c *canaries) Get(name string, options v1.GetOptions) (result *v1beta1.Canary, err error) {
|
||||
result = &v1beta1.Canary{}
|
||||
err = c.client.Get().
|
||||
Namespace(c.ns).
|
||||
Resource("canaries").
|
||||
Name(name).
|
||||
VersionedParams(&options, scheme.ParameterCodec).
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// List takes label and field selectors, and returns the list of Canaries that match those selectors.
|
||||
func (c *canaries) List(opts v1.ListOptions) (result *v1beta1.CanaryList, err error) {
|
||||
result = &v1beta1.CanaryList{}
|
||||
err = c.client.Get().
|
||||
Namespace(c.ns).
|
||||
Resource("canaries").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Watch returns a watch.Interface that watches the requested canaries.
|
||||
func (c *canaries) Watch(opts v1.ListOptions) (watch.Interface, error) {
|
||||
opts.Watch = true
|
||||
return c.client.Get().
|
||||
Namespace(c.ns).
|
||||
Resource("canaries").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Watch()
|
||||
}
|
||||
|
||||
// Create takes the representation of a canary and creates it. Returns the server's representation of the canary, and an error, if there is any.
|
||||
func (c *canaries) Create(canary *v1beta1.Canary) (result *v1beta1.Canary, err error) {
|
||||
result = &v1beta1.Canary{}
|
||||
err = c.client.Post().
|
||||
Namespace(c.ns).
|
||||
Resource("canaries").
|
||||
Body(canary).
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Update takes the representation of a canary and updates it. Returns the server's representation of the canary, and an error, if there is any.
|
||||
func (c *canaries) Update(canary *v1beta1.Canary) (result *v1beta1.Canary, err error) {
|
||||
result = &v1beta1.Canary{}
|
||||
err = c.client.Put().
|
||||
Namespace(c.ns).
|
||||
Resource("canaries").
|
||||
Name(canary.Name).
|
||||
Body(canary).
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// UpdateStatus was generated because the type contains a Status member.
|
||||
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
|
||||
|
||||
func (c *canaries) UpdateStatus(canary *v1beta1.Canary) (result *v1beta1.Canary, err error) {
|
||||
result = &v1beta1.Canary{}
|
||||
err = c.client.Put().
|
||||
Namespace(c.ns).
|
||||
Resource("canaries").
|
||||
Name(canary.Name).
|
||||
SubResource("status").
|
||||
Body(canary).
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Delete takes name of the canary and deletes it. Returns an error if one occurs.
|
||||
func (c *canaries) Delete(name string, options *v1.DeleteOptions) error {
|
||||
return c.client.Delete().
|
||||
Namespace(c.ns).
|
||||
Resource("canaries").
|
||||
Name(name).
|
||||
Body(options).
|
||||
Do().
|
||||
Error()
|
||||
}
|
||||
|
||||
// DeleteCollection deletes a collection of objects.
|
||||
func (c *canaries) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
|
||||
return c.client.Delete().
|
||||
Namespace(c.ns).
|
||||
Resource("canaries").
|
||||
VersionedParams(&listOptions, scheme.ParameterCodec).
|
||||
Body(options).
|
||||
Do().
|
||||
Error()
|
||||
}
|
||||
|
||||
// Patch applies the patch and returns the patched canary.
|
||||
func (c *canaries) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1beta1.Canary, err error) {
|
||||
result = &v1beta1.Canary{}
|
||||
err = c.client.Patch(pt).
|
||||
Namespace(c.ns).
|
||||
Resource("canaries").
|
||||
SubResource(subresources...).
|
||||
Name(name).
|
||||
Body(data).
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
@@ -0,0 +1,140 @@
|
||||
/*
|
||||
Copyright The 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 client-gen. DO NOT EDIT.
|
||||
|
||||
package fake
|
||||
|
||||
import (
|
||||
v1beta1 "github.com/stefanprodan/steerer/pkg/apis/rollout/v1beta1"
|
||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
labels "k8s.io/apimachinery/pkg/labels"
|
||||
schema "k8s.io/apimachinery/pkg/runtime/schema"
|
||||
types "k8s.io/apimachinery/pkg/types"
|
||||
watch "k8s.io/apimachinery/pkg/watch"
|
||||
testing "k8s.io/client-go/testing"
|
||||
)
|
||||
|
||||
// FakeCanaries implements CanaryInterface
|
||||
type FakeCanaries struct {
|
||||
Fake *FakeSteererV1beta1
|
||||
ns string
|
||||
}
|
||||
|
||||
var canariesResource = schema.GroupVersionResource{Group: "steerer.app", Version: "v1beta1", Resource: "canaries"}
|
||||
|
||||
var canariesKind = schema.GroupVersionKind{Group: "steerer.app", Version: "v1beta1", Kind: "Canary"}
|
||||
|
||||
// Get takes name of the canary, and returns the corresponding canary object, and an error if there is any.
|
||||
func (c *FakeCanaries) Get(name string, options v1.GetOptions) (result *v1beta1.Canary, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewGetAction(canariesResource, c.ns, name), &v1beta1.Canary{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v1beta1.Canary), err
|
||||
}
|
||||
|
||||
// List takes label and field selectors, and returns the list of Canaries that match those selectors.
|
||||
func (c *FakeCanaries) List(opts v1.ListOptions) (result *v1beta1.CanaryList, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewListAction(canariesResource, canariesKind, c.ns, opts), &v1beta1.CanaryList{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
label, _, _ := testing.ExtractFromListOptions(opts)
|
||||
if label == nil {
|
||||
label = labels.Everything()
|
||||
}
|
||||
list := &v1beta1.CanaryList{ListMeta: obj.(*v1beta1.CanaryList).ListMeta}
|
||||
for _, item := range obj.(*v1beta1.CanaryList).Items {
|
||||
if label.Matches(labels.Set(item.Labels)) {
|
||||
list.Items = append(list.Items, item)
|
||||
}
|
||||
}
|
||||
return list, err
|
||||
}
|
||||
|
||||
// Watch returns a watch.Interface that watches the requested canaries.
|
||||
func (c *FakeCanaries) Watch(opts v1.ListOptions) (watch.Interface, error) {
|
||||
return c.Fake.
|
||||
InvokesWatch(testing.NewWatchAction(canariesResource, c.ns, opts))
|
||||
|
||||
}
|
||||
|
||||
// Create takes the representation of a canary and creates it. Returns the server's representation of the canary, and an error, if there is any.
|
||||
func (c *FakeCanaries) Create(canary *v1beta1.Canary) (result *v1beta1.Canary, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewCreateAction(canariesResource, c.ns, canary), &v1beta1.Canary{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v1beta1.Canary), err
|
||||
}
|
||||
|
||||
// Update takes the representation of a canary and updates it. Returns the server's representation of the canary, and an error, if there is any.
|
||||
func (c *FakeCanaries) Update(canary *v1beta1.Canary) (result *v1beta1.Canary, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewUpdateAction(canariesResource, c.ns, canary), &v1beta1.Canary{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v1beta1.Canary), err
|
||||
}
|
||||
|
||||
// UpdateStatus was generated because the type contains a Status member.
|
||||
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
|
||||
func (c *FakeCanaries) UpdateStatus(canary *v1beta1.Canary) (*v1beta1.Canary, error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewUpdateSubresourceAction(canariesResource, "status", c.ns, canary), &v1beta1.Canary{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v1beta1.Canary), err
|
||||
}
|
||||
|
||||
// Delete takes name of the canary and deletes it. Returns an error if one occurs.
|
||||
func (c *FakeCanaries) Delete(name string, options *v1.DeleteOptions) error {
|
||||
_, err := c.Fake.
|
||||
Invokes(testing.NewDeleteAction(canariesResource, c.ns, name), &v1beta1.Canary{})
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
// DeleteCollection deletes a collection of objects.
|
||||
func (c *FakeCanaries) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
|
||||
action := testing.NewDeleteCollectionAction(canariesResource, c.ns, listOptions)
|
||||
|
||||
_, err := c.Fake.Invokes(action, &v1beta1.CanaryList{})
|
||||
return err
|
||||
}
|
||||
|
||||
// Patch applies the patch and returns the patched canary.
|
||||
func (c *FakeCanaries) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1beta1.Canary, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewPatchSubresourceAction(canariesResource, c.ns, name, data, subresources...), &v1beta1.Canary{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v1beta1.Canary), err
|
||||
}
|
||||
@@ -1,140 +0,0 @@
|
||||
/*
|
||||
Copyright The 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 client-gen. DO NOT EDIT.
|
||||
|
||||
package fake
|
||||
|
||||
import (
|
||||
v1beta1 "github.com/stefanprodan/steerer/pkg/apis/rollout/v1beta1"
|
||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
labels "k8s.io/apimachinery/pkg/labels"
|
||||
schema "k8s.io/apimachinery/pkg/runtime/schema"
|
||||
types "k8s.io/apimachinery/pkg/types"
|
||||
watch "k8s.io/apimachinery/pkg/watch"
|
||||
testing "k8s.io/client-go/testing"
|
||||
)
|
||||
|
||||
// FakeRollouts implements RolloutInterface
|
||||
type FakeRollouts struct {
|
||||
Fake *FakeAppsV1beta1
|
||||
ns string
|
||||
}
|
||||
|
||||
var rolloutsResource = schema.GroupVersionResource{Group: "apps.weave.works", Version: "v1beta1", Resource: "rollouts"}
|
||||
|
||||
var rolloutsKind = schema.GroupVersionKind{Group: "apps.weave.works", Version: "v1beta1", Kind: "Rollout"}
|
||||
|
||||
// Get takes name of the rollout, and returns the corresponding rollout object, and an error if there is any.
|
||||
func (c *FakeRollouts) Get(name string, options v1.GetOptions) (result *v1beta1.Rollout, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewGetAction(rolloutsResource, c.ns, name), &v1beta1.Rollout{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v1beta1.Rollout), err
|
||||
}
|
||||
|
||||
// List takes label and field selectors, and returns the list of Rollouts that match those selectors.
|
||||
func (c *FakeRollouts) List(opts v1.ListOptions) (result *v1beta1.RolloutList, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewListAction(rolloutsResource, rolloutsKind, c.ns, opts), &v1beta1.RolloutList{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
label, _, _ := testing.ExtractFromListOptions(opts)
|
||||
if label == nil {
|
||||
label = labels.Everything()
|
||||
}
|
||||
list := &v1beta1.RolloutList{ListMeta: obj.(*v1beta1.RolloutList).ListMeta}
|
||||
for _, item := range obj.(*v1beta1.RolloutList).Items {
|
||||
if label.Matches(labels.Set(item.Labels)) {
|
||||
list.Items = append(list.Items, item)
|
||||
}
|
||||
}
|
||||
return list, err
|
||||
}
|
||||
|
||||
// Watch returns a watch.Interface that watches the requested rollouts.
|
||||
func (c *FakeRollouts) Watch(opts v1.ListOptions) (watch.Interface, error) {
|
||||
return c.Fake.
|
||||
InvokesWatch(testing.NewWatchAction(rolloutsResource, c.ns, opts))
|
||||
|
||||
}
|
||||
|
||||
// Create takes the representation of a rollout and creates it. Returns the server's representation of the rollout, and an error, if there is any.
|
||||
func (c *FakeRollouts) Create(rollout *v1beta1.Rollout) (result *v1beta1.Rollout, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewCreateAction(rolloutsResource, c.ns, rollout), &v1beta1.Rollout{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v1beta1.Rollout), err
|
||||
}
|
||||
|
||||
// Update takes the representation of a rollout and updates it. Returns the server's representation of the rollout, and an error, if there is any.
|
||||
func (c *FakeRollouts) Update(rollout *v1beta1.Rollout) (result *v1beta1.Rollout, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewUpdateAction(rolloutsResource, c.ns, rollout), &v1beta1.Rollout{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v1beta1.Rollout), err
|
||||
}
|
||||
|
||||
// UpdateStatus was generated because the type contains a Status member.
|
||||
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
|
||||
func (c *FakeRollouts) UpdateStatus(rollout *v1beta1.Rollout) (*v1beta1.Rollout, error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewUpdateSubresourceAction(rolloutsResource, "status", c.ns, rollout), &v1beta1.Rollout{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v1beta1.Rollout), err
|
||||
}
|
||||
|
||||
// Delete takes name of the rollout and deletes it. Returns an error if one occurs.
|
||||
func (c *FakeRollouts) Delete(name string, options *v1.DeleteOptions) error {
|
||||
_, err := c.Fake.
|
||||
Invokes(testing.NewDeleteAction(rolloutsResource, c.ns, name), &v1beta1.Rollout{})
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
// DeleteCollection deletes a collection of objects.
|
||||
func (c *FakeRollouts) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
|
||||
action := testing.NewDeleteCollectionAction(rolloutsResource, c.ns, listOptions)
|
||||
|
||||
_, err := c.Fake.Invokes(action, &v1beta1.RolloutList{})
|
||||
return err
|
||||
}
|
||||
|
||||
// Patch applies the patch and returns the patched rollout.
|
||||
func (c *FakeRollouts) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1beta1.Rollout, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewPatchSubresourceAction(rolloutsResource, c.ns, name, data, subresources...), &v1beta1.Rollout{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v1beta1.Rollout), err
|
||||
}
|
||||
@@ -24,17 +24,17 @@ import (
|
||||
testing "k8s.io/client-go/testing"
|
||||
)
|
||||
|
||||
type FakeAppsV1beta1 struct {
|
||||
type FakeSteererV1beta1 struct {
|
||||
*testing.Fake
|
||||
}
|
||||
|
||||
func (c *FakeAppsV1beta1) Rollouts(namespace string) v1beta1.RolloutInterface {
|
||||
return &FakeRollouts{c, namespace}
|
||||
func (c *FakeSteererV1beta1) Canaries(namespace string) v1beta1.CanaryInterface {
|
||||
return &FakeCanaries{c, namespace}
|
||||
}
|
||||
|
||||
// RESTClient returns a RESTClient that is used to communicate
|
||||
// with API server by this client implementation.
|
||||
func (c *FakeAppsV1beta1) RESTClient() rest.Interface {
|
||||
func (c *FakeSteererV1beta1) RESTClient() rest.Interface {
|
||||
var ret *rest.RESTClient
|
||||
return ret
|
||||
}
|
||||
|
||||
@@ -18,4 +18,4 @@ limitations under the License.
|
||||
|
||||
package v1beta1
|
||||
|
||||
type RolloutExpansion interface{}
|
||||
type CanaryExpansion interface{}
|
||||
|
||||
@@ -1,174 +0,0 @@
|
||||
/*
|
||||
Copyright The 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 client-gen. DO NOT EDIT.
|
||||
|
||||
package v1beta1
|
||||
|
||||
import (
|
||||
v1beta1 "github.com/stefanprodan/steerer/pkg/apis/rollout/v1beta1"
|
||||
scheme "github.com/stefanprodan/steerer/pkg/client/clientset/versioned/scheme"
|
||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
types "k8s.io/apimachinery/pkg/types"
|
||||
watch "k8s.io/apimachinery/pkg/watch"
|
||||
rest "k8s.io/client-go/rest"
|
||||
)
|
||||
|
||||
// RolloutsGetter has a method to return a RolloutInterface.
|
||||
// A group's client should implement this interface.
|
||||
type RolloutsGetter interface {
|
||||
Rollouts(namespace string) RolloutInterface
|
||||
}
|
||||
|
||||
// RolloutInterface has methods to work with Rollout resources.
|
||||
type RolloutInterface interface {
|
||||
Create(*v1beta1.Rollout) (*v1beta1.Rollout, error)
|
||||
Update(*v1beta1.Rollout) (*v1beta1.Rollout, error)
|
||||
UpdateStatus(*v1beta1.Rollout) (*v1beta1.Rollout, error)
|
||||
Delete(name string, options *v1.DeleteOptions) error
|
||||
DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error
|
||||
Get(name string, options v1.GetOptions) (*v1beta1.Rollout, error)
|
||||
List(opts v1.ListOptions) (*v1beta1.RolloutList, error)
|
||||
Watch(opts v1.ListOptions) (watch.Interface, error)
|
||||
Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1beta1.Rollout, err error)
|
||||
RolloutExpansion
|
||||
}
|
||||
|
||||
// rollouts implements RolloutInterface
|
||||
type rollouts struct {
|
||||
client rest.Interface
|
||||
ns string
|
||||
}
|
||||
|
||||
// newRollouts returns a Rollouts
|
||||
func newRollouts(c *AppsV1beta1Client, namespace string) *rollouts {
|
||||
return &rollouts{
|
||||
client: c.RESTClient(),
|
||||
ns: namespace,
|
||||
}
|
||||
}
|
||||
|
||||
// Get takes name of the rollout, and returns the corresponding rollout object, and an error if there is any.
|
||||
func (c *rollouts) Get(name string, options v1.GetOptions) (result *v1beta1.Rollout, err error) {
|
||||
result = &v1beta1.Rollout{}
|
||||
err = c.client.Get().
|
||||
Namespace(c.ns).
|
||||
Resource("rollouts").
|
||||
Name(name).
|
||||
VersionedParams(&options, scheme.ParameterCodec).
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// List takes label and field selectors, and returns the list of Rollouts that match those selectors.
|
||||
func (c *rollouts) List(opts v1.ListOptions) (result *v1beta1.RolloutList, err error) {
|
||||
result = &v1beta1.RolloutList{}
|
||||
err = c.client.Get().
|
||||
Namespace(c.ns).
|
||||
Resource("rollouts").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Watch returns a watch.Interface that watches the requested rollouts.
|
||||
func (c *rollouts) Watch(opts v1.ListOptions) (watch.Interface, error) {
|
||||
opts.Watch = true
|
||||
return c.client.Get().
|
||||
Namespace(c.ns).
|
||||
Resource("rollouts").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Watch()
|
||||
}
|
||||
|
||||
// Create takes the representation of a rollout and creates it. Returns the server's representation of the rollout, and an error, if there is any.
|
||||
func (c *rollouts) Create(rollout *v1beta1.Rollout) (result *v1beta1.Rollout, err error) {
|
||||
result = &v1beta1.Rollout{}
|
||||
err = c.client.Post().
|
||||
Namespace(c.ns).
|
||||
Resource("rollouts").
|
||||
Body(rollout).
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Update takes the representation of a rollout and updates it. Returns the server's representation of the rollout, and an error, if there is any.
|
||||
func (c *rollouts) Update(rollout *v1beta1.Rollout) (result *v1beta1.Rollout, err error) {
|
||||
result = &v1beta1.Rollout{}
|
||||
err = c.client.Put().
|
||||
Namespace(c.ns).
|
||||
Resource("rollouts").
|
||||
Name(rollout.Name).
|
||||
Body(rollout).
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// UpdateStatus was generated because the type contains a Status member.
|
||||
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
|
||||
|
||||
func (c *rollouts) UpdateStatus(rollout *v1beta1.Rollout) (result *v1beta1.Rollout, err error) {
|
||||
result = &v1beta1.Rollout{}
|
||||
err = c.client.Put().
|
||||
Namespace(c.ns).
|
||||
Resource("rollouts").
|
||||
Name(rollout.Name).
|
||||
SubResource("status").
|
||||
Body(rollout).
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Delete takes name of the rollout and deletes it. Returns an error if one occurs.
|
||||
func (c *rollouts) Delete(name string, options *v1.DeleteOptions) error {
|
||||
return c.client.Delete().
|
||||
Namespace(c.ns).
|
||||
Resource("rollouts").
|
||||
Name(name).
|
||||
Body(options).
|
||||
Do().
|
||||
Error()
|
||||
}
|
||||
|
||||
// DeleteCollection deletes a collection of objects.
|
||||
func (c *rollouts) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
|
||||
return c.client.Delete().
|
||||
Namespace(c.ns).
|
||||
Resource("rollouts").
|
||||
VersionedParams(&listOptions, scheme.ParameterCodec).
|
||||
Body(options).
|
||||
Do().
|
||||
Error()
|
||||
}
|
||||
|
||||
// Patch applies the patch and returns the patched rollout.
|
||||
func (c *rollouts) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1beta1.Rollout, err error) {
|
||||
result = &v1beta1.Rollout{}
|
||||
err = c.client.Patch(pt).
|
||||
Namespace(c.ns).
|
||||
Resource("rollouts").
|
||||
SubResource(subresources...).
|
||||
Name(name).
|
||||
Body(data).
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
@@ -25,22 +25,22 @@ import (
|
||||
rest "k8s.io/client-go/rest"
|
||||
)
|
||||
|
||||
type AppsV1beta1Interface interface {
|
||||
type SteererV1beta1Interface interface {
|
||||
RESTClient() rest.Interface
|
||||
RolloutsGetter
|
||||
CanariesGetter
|
||||
}
|
||||
|
||||
// AppsV1beta1Client is used to interact with features provided by the apps.weave.works group.
|
||||
type AppsV1beta1Client struct {
|
||||
// SteererV1beta1Client is used to interact with features provided by the steerer.app group.
|
||||
type SteererV1beta1Client struct {
|
||||
restClient rest.Interface
|
||||
}
|
||||
|
||||
func (c *AppsV1beta1Client) Rollouts(namespace string) RolloutInterface {
|
||||
return newRollouts(c, namespace)
|
||||
func (c *SteererV1beta1Client) Canaries(namespace string) CanaryInterface {
|
||||
return newCanaries(c, namespace)
|
||||
}
|
||||
|
||||
// NewForConfig creates a new AppsV1beta1Client for the given config.
|
||||
func NewForConfig(c *rest.Config) (*AppsV1beta1Client, error) {
|
||||
// NewForConfig creates a new SteererV1beta1Client for the given config.
|
||||
func NewForConfig(c *rest.Config) (*SteererV1beta1Client, error) {
|
||||
config := *c
|
||||
if err := setConfigDefaults(&config); err != nil {
|
||||
return nil, err
|
||||
@@ -49,12 +49,12 @@ func NewForConfig(c *rest.Config) (*AppsV1beta1Client, error) {
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &AppsV1beta1Client{client}, nil
|
||||
return &SteererV1beta1Client{client}, nil
|
||||
}
|
||||
|
||||
// NewForConfigOrDie creates a new AppsV1beta1Client for the given config and
|
||||
// NewForConfigOrDie creates a new SteererV1beta1Client for the given config and
|
||||
// panics if there is an error in the config.
|
||||
func NewForConfigOrDie(c *rest.Config) *AppsV1beta1Client {
|
||||
func NewForConfigOrDie(c *rest.Config) *SteererV1beta1Client {
|
||||
client, err := NewForConfig(c)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
@@ -62,9 +62,9 @@ func NewForConfigOrDie(c *rest.Config) *AppsV1beta1Client {
|
||||
return client
|
||||
}
|
||||
|
||||
// New creates a new AppsV1beta1Client for the given RESTClient.
|
||||
func New(c rest.Interface) *AppsV1beta1Client {
|
||||
return &AppsV1beta1Client{c}
|
||||
// New creates a new SteererV1beta1Client for the given RESTClient.
|
||||
func New(c rest.Interface) *SteererV1beta1Client {
|
||||
return &SteererV1beta1Client{c}
|
||||
}
|
||||
|
||||
func setConfigDefaults(config *rest.Config) error {
|
||||
@@ -82,7 +82,7 @@ func setConfigDefaults(config *rest.Config) error {
|
||||
|
||||
// RESTClient returns a RESTClient that is used to communicate
|
||||
// with API server by this client implementation.
|
||||
func (c *AppsV1beta1Client) RESTClient() rest.Interface {
|
||||
func (c *SteererV1beta1Client) RESTClient() rest.Interface {
|
||||
if c == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -172,9 +172,9 @@ type SharedInformerFactory interface {
|
||||
ForResource(resource schema.GroupVersionResource) (GenericInformer, error)
|
||||
WaitForCacheSync(stopCh <-chan struct{}) map[reflect.Type]bool
|
||||
|
||||
Apps() rollout.Interface
|
||||
Steerer() rollout.Interface
|
||||
}
|
||||
|
||||
func (f *sharedInformerFactory) Apps() rollout.Interface {
|
||||
func (f *sharedInformerFactory) Steerer() rollout.Interface {
|
||||
return rollout.New(f, f.namespace, f.tweakListOptions)
|
||||
}
|
||||
|
||||
@@ -52,9 +52,9 @@ func (f *genericInformer) Lister() cache.GenericLister {
|
||||
// TODO extend this to unknown resources with a client pool
|
||||
func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource) (GenericInformer, error) {
|
||||
switch resource {
|
||||
// Group=apps.weave.works, Version=v1beta1
|
||||
case v1beta1.SchemeGroupVersion.WithResource("rollouts"):
|
||||
return &genericInformer{resource: resource.GroupResource(), informer: f.Apps().V1beta1().Rollouts().Informer()}, nil
|
||||
// Group=steerer.app, Version=v1beta1
|
||||
case v1beta1.SchemeGroupVersion.WithResource("canaries"):
|
||||
return &genericInformer{resource: resource.GroupResource(), informer: f.Steerer().V1beta1().Canaries().Informer()}, nil
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ limitations under the License.
|
||||
|
||||
// Code generated by informer-gen. DO NOT EDIT.
|
||||
|
||||
package apps
|
||||
package steerer
|
||||
|
||||
import (
|
||||
internalinterfaces "github.com/stefanprodan/steerer/pkg/client/informers/externalversions/internalinterfaces"
|
||||
|
||||
+19
-19
@@ -31,59 +31,59 @@ import (
|
||||
cache "k8s.io/client-go/tools/cache"
|
||||
)
|
||||
|
||||
// RolloutInformer provides access to a shared informer and lister for
|
||||
// Rollouts.
|
||||
type RolloutInformer interface {
|
||||
// CanaryInformer provides access to a shared informer and lister for
|
||||
// Canaries.
|
||||
type CanaryInformer interface {
|
||||
Informer() cache.SharedIndexInformer
|
||||
Lister() v1beta1.RolloutLister
|
||||
Lister() v1beta1.CanaryLister
|
||||
}
|
||||
|
||||
type rolloutInformer struct {
|
||||
type canaryInformer struct {
|
||||
factory internalinterfaces.SharedInformerFactory
|
||||
tweakListOptions internalinterfaces.TweakListOptionsFunc
|
||||
namespace string
|
||||
}
|
||||
|
||||
// NewRolloutInformer constructs a new informer for Rollout type.
|
||||
// NewCanaryInformer constructs a new informer for Canary type.
|
||||
// Always prefer using an informer factory to get a shared informer instead of getting an independent
|
||||
// one. This reduces memory footprint and number of connections to the server.
|
||||
func NewRolloutInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer {
|
||||
return NewFilteredRolloutInformer(client, namespace, resyncPeriod, indexers, nil)
|
||||
func NewCanaryInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer {
|
||||
return NewFilteredCanaryInformer(client, namespace, resyncPeriod, indexers, nil)
|
||||
}
|
||||
|
||||
// NewFilteredRolloutInformer constructs a new informer for Rollout type.
|
||||
// NewFilteredCanaryInformer constructs a new informer for Canary type.
|
||||
// Always prefer using an informer factory to get a shared informer instead of getting an independent
|
||||
// one. This reduces memory footprint and number of connections to the server.
|
||||
func NewFilteredRolloutInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer {
|
||||
func NewFilteredCanaryInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer {
|
||||
return cache.NewSharedIndexInformer(
|
||||
&cache.ListWatch{
|
||||
ListFunc: func(options v1.ListOptions) (runtime.Object, error) {
|
||||
if tweakListOptions != nil {
|
||||
tweakListOptions(&options)
|
||||
}
|
||||
return client.AppsV1beta1().Rollouts(namespace).List(options)
|
||||
return client.SteererV1beta1().Canaries(namespace).List(options)
|
||||
},
|
||||
WatchFunc: func(options v1.ListOptions) (watch.Interface, error) {
|
||||
if tweakListOptions != nil {
|
||||
tweakListOptions(&options)
|
||||
}
|
||||
return client.AppsV1beta1().Rollouts(namespace).Watch(options)
|
||||
return client.SteererV1beta1().Canaries(namespace).Watch(options)
|
||||
},
|
||||
},
|
||||
&rolloutv1beta1.Rollout{},
|
||||
&rolloutv1beta1.Canary{},
|
||||
resyncPeriod,
|
||||
indexers,
|
||||
)
|
||||
}
|
||||
|
||||
func (f *rolloutInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
|
||||
return NewFilteredRolloutInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions)
|
||||
func (f *canaryInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
|
||||
return NewFilteredCanaryInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions)
|
||||
}
|
||||
|
||||
func (f *rolloutInformer) Informer() cache.SharedIndexInformer {
|
||||
return f.factory.InformerFor(&rolloutv1beta1.Rollout{}, f.defaultInformer)
|
||||
func (f *canaryInformer) Informer() cache.SharedIndexInformer {
|
||||
return f.factory.InformerFor(&rolloutv1beta1.Canary{}, f.defaultInformer)
|
||||
}
|
||||
|
||||
func (f *rolloutInformer) Lister() v1beta1.RolloutLister {
|
||||
return v1beta1.NewRolloutLister(f.Informer().GetIndexer())
|
||||
func (f *canaryInformer) Lister() v1beta1.CanaryLister {
|
||||
return v1beta1.NewCanaryLister(f.Informer().GetIndexer())
|
||||
}
|
||||
@@ -24,8 +24,8 @@ import (
|
||||
|
||||
// Interface provides access to all the informers in this group version.
|
||||
type Interface interface {
|
||||
// Rollouts returns a RolloutInformer.
|
||||
Rollouts() RolloutInformer
|
||||
// Canaries returns a CanaryInformer.
|
||||
Canaries() CanaryInformer
|
||||
}
|
||||
|
||||
type version struct {
|
||||
@@ -39,7 +39,7 @@ func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakList
|
||||
return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions}
|
||||
}
|
||||
|
||||
// Rollouts returns a RolloutInformer.
|
||||
func (v *version) Rollouts() RolloutInformer {
|
||||
return &rolloutInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}
|
||||
// Canaries returns a CanaryInformer.
|
||||
func (v *version) Canaries() CanaryInformer {
|
||||
return &canaryInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,94 @@
|
||||
/*
|
||||
Copyright The 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 lister-gen. DO NOT EDIT.
|
||||
|
||||
package v1beta1
|
||||
|
||||
import (
|
||||
v1beta1 "github.com/stefanprodan/steerer/pkg/apis/rollout/v1beta1"
|
||||
"k8s.io/apimachinery/pkg/api/errors"
|
||||
"k8s.io/apimachinery/pkg/labels"
|
||||
"k8s.io/client-go/tools/cache"
|
||||
)
|
||||
|
||||
// CanaryLister helps list Canaries.
|
||||
type CanaryLister interface {
|
||||
// List lists all Canaries in the indexer.
|
||||
List(selector labels.Selector) (ret []*v1beta1.Canary, err error)
|
||||
// Canaries returns an object that can list and get Canaries.
|
||||
Canaries(namespace string) CanaryNamespaceLister
|
||||
CanaryListerExpansion
|
||||
}
|
||||
|
||||
// canaryLister implements the CanaryLister interface.
|
||||
type canaryLister struct {
|
||||
indexer cache.Indexer
|
||||
}
|
||||
|
||||
// NewCanaryLister returns a new CanaryLister.
|
||||
func NewCanaryLister(indexer cache.Indexer) CanaryLister {
|
||||
return &canaryLister{indexer: indexer}
|
||||
}
|
||||
|
||||
// List lists all Canaries in the indexer.
|
||||
func (s *canaryLister) List(selector labels.Selector) (ret []*v1beta1.Canary, err error) {
|
||||
err = cache.ListAll(s.indexer, selector, func(m interface{}) {
|
||||
ret = append(ret, m.(*v1beta1.Canary))
|
||||
})
|
||||
return ret, err
|
||||
}
|
||||
|
||||
// Canaries returns an object that can list and get Canaries.
|
||||
func (s *canaryLister) Canaries(namespace string) CanaryNamespaceLister {
|
||||
return canaryNamespaceLister{indexer: s.indexer, namespace: namespace}
|
||||
}
|
||||
|
||||
// CanaryNamespaceLister helps list and get Canaries.
|
||||
type CanaryNamespaceLister interface {
|
||||
// List lists all Canaries in the indexer for a given namespace.
|
||||
List(selector labels.Selector) (ret []*v1beta1.Canary, err error)
|
||||
// Get retrieves the Canary from the indexer for a given namespace and name.
|
||||
Get(name string) (*v1beta1.Canary, error)
|
||||
CanaryNamespaceListerExpansion
|
||||
}
|
||||
|
||||
// canaryNamespaceLister implements the CanaryNamespaceLister
|
||||
// interface.
|
||||
type canaryNamespaceLister struct {
|
||||
indexer cache.Indexer
|
||||
namespace string
|
||||
}
|
||||
|
||||
// List lists all Canaries in the indexer for a given namespace.
|
||||
func (s canaryNamespaceLister) List(selector labels.Selector) (ret []*v1beta1.Canary, err error) {
|
||||
err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) {
|
||||
ret = append(ret, m.(*v1beta1.Canary))
|
||||
})
|
||||
return ret, err
|
||||
}
|
||||
|
||||
// Get retrieves the Canary from the indexer for a given namespace and name.
|
||||
func (s canaryNamespaceLister) Get(name string) (*v1beta1.Canary, error) {
|
||||
obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if !exists {
|
||||
return nil, errors.NewNotFound(v1beta1.Resource("canary"), name)
|
||||
}
|
||||
return obj.(*v1beta1.Canary), nil
|
||||
}
|
||||
@@ -18,10 +18,10 @@ limitations under the License.
|
||||
|
||||
package v1beta1
|
||||
|
||||
// RolloutListerExpansion allows custom methods to be added to
|
||||
// RolloutLister.
|
||||
type RolloutListerExpansion interface{}
|
||||
// CanaryListerExpansion allows custom methods to be added to
|
||||
// CanaryLister.
|
||||
type CanaryListerExpansion interface{}
|
||||
|
||||
// RolloutNamespaceListerExpansion allows custom methods to be added to
|
||||
// RolloutNamespaceLister.
|
||||
type RolloutNamespaceListerExpansion interface{}
|
||||
// CanaryNamespaceListerExpansion allows custom methods to be added to
|
||||
// CanaryNamespaceLister.
|
||||
type CanaryNamespaceListerExpansion interface{}
|
||||
|
||||
@@ -1,94 +0,0 @@
|
||||
/*
|
||||
Copyright The 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 lister-gen. DO NOT EDIT.
|
||||
|
||||
package v1beta1
|
||||
|
||||
import (
|
||||
v1beta1 "github.com/stefanprodan/steerer/pkg/apis/rollout/v1beta1"
|
||||
"k8s.io/apimachinery/pkg/api/errors"
|
||||
"k8s.io/apimachinery/pkg/labels"
|
||||
"k8s.io/client-go/tools/cache"
|
||||
)
|
||||
|
||||
// RolloutLister helps list Rollouts.
|
||||
type RolloutLister interface {
|
||||
// List lists all Rollouts in the indexer.
|
||||
List(selector labels.Selector) (ret []*v1beta1.Rollout, err error)
|
||||
// Rollouts returns an object that can list and get Rollouts.
|
||||
Rollouts(namespace string) RolloutNamespaceLister
|
||||
RolloutListerExpansion
|
||||
}
|
||||
|
||||
// rolloutLister implements the RolloutLister interface.
|
||||
type rolloutLister struct {
|
||||
indexer cache.Indexer
|
||||
}
|
||||
|
||||
// NewRolloutLister returns a new RolloutLister.
|
||||
func NewRolloutLister(indexer cache.Indexer) RolloutLister {
|
||||
return &rolloutLister{indexer: indexer}
|
||||
}
|
||||
|
||||
// List lists all Rollouts in the indexer.
|
||||
func (s *rolloutLister) List(selector labels.Selector) (ret []*v1beta1.Rollout, err error) {
|
||||
err = cache.ListAll(s.indexer, selector, func(m interface{}) {
|
||||
ret = append(ret, m.(*v1beta1.Rollout))
|
||||
})
|
||||
return ret, err
|
||||
}
|
||||
|
||||
// Rollouts returns an object that can list and get Rollouts.
|
||||
func (s *rolloutLister) Rollouts(namespace string) RolloutNamespaceLister {
|
||||
return rolloutNamespaceLister{indexer: s.indexer, namespace: namespace}
|
||||
}
|
||||
|
||||
// RolloutNamespaceLister helps list and get Rollouts.
|
||||
type RolloutNamespaceLister interface {
|
||||
// List lists all Rollouts in the indexer for a given namespace.
|
||||
List(selector labels.Selector) (ret []*v1beta1.Rollout, err error)
|
||||
// Get retrieves the Rollout from the indexer for a given namespace and name.
|
||||
Get(name string) (*v1beta1.Rollout, error)
|
||||
RolloutNamespaceListerExpansion
|
||||
}
|
||||
|
||||
// rolloutNamespaceLister implements the RolloutNamespaceLister
|
||||
// interface.
|
||||
type rolloutNamespaceLister struct {
|
||||
indexer cache.Indexer
|
||||
namespace string
|
||||
}
|
||||
|
||||
// List lists all Rollouts in the indexer for a given namespace.
|
||||
func (s rolloutNamespaceLister) List(selector labels.Selector) (ret []*v1beta1.Rollout, err error) {
|
||||
err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) {
|
||||
ret = append(ret, m.(*v1beta1.Rollout))
|
||||
})
|
||||
return ret, err
|
||||
}
|
||||
|
||||
// Get retrieves the Rollout from the indexer for a given namespace and name.
|
||||
func (s rolloutNamespaceLister) Get(name string) (*v1beta1.Rollout, error) {
|
||||
obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if !exists {
|
||||
return nil, errors.NewNotFound(v1beta1.Resource("rollout"), name)
|
||||
}
|
||||
return obj.(*v1beta1.Rollout), nil
|
||||
}
|
||||
@@ -31,7 +31,7 @@ type Controller struct {
|
||||
kubeClient kubernetes.Interface
|
||||
istioClient istioclientset.Interface
|
||||
rolloutClient clientset.Interface
|
||||
rolloutLister rolloutlisters.RolloutLister
|
||||
rolloutLister rolloutlisters.CanaryLister
|
||||
rolloutSynced cache.InformerSynced
|
||||
rolloutWindow time.Duration
|
||||
workqueue workqueue.RateLimitingInterface
|
||||
@@ -45,7 +45,7 @@ func NewController(
|
||||
kubeClient kubernetes.Interface,
|
||||
istioClient istioclientset.Interface,
|
||||
rolloutClient clientset.Interface,
|
||||
rolloutInformer rolloutinformers.RolloutInformer,
|
||||
rolloutInformer rolloutinformers.CanaryInformer,
|
||||
rolloutWindow time.Duration,
|
||||
metricServer string,
|
||||
logger *zap.SugaredLogger,
|
||||
@@ -174,7 +174,7 @@ func (c *Controller) syncHandler(key string) error {
|
||||
utilruntime.HandleError(fmt.Errorf("invalid resource key: %s", key))
|
||||
return nil
|
||||
}
|
||||
rollout, err := c.rolloutLister.Rollouts(namespace).Get(name)
|
||||
rollout, err := c.rolloutLister.Canaries(namespace).Get(name)
|
||||
if errors.IsNotFound(err) {
|
||||
utilruntime.HandleError(fmt.Errorf("rollout '%s' in work queue no longer exists", key))
|
||||
return nil
|
||||
@@ -196,27 +196,27 @@ func (c *Controller) enqueueRollout(obj interface{}) {
|
||||
c.workqueue.AddRateLimited(key)
|
||||
}
|
||||
|
||||
func (c *Controller) recordEventInfof(r *rolloutv1.Rollout, template string, args ...interface{}) {
|
||||
func (c *Controller) recordEventInfof(r *rolloutv1.Canary, template string, args ...interface{}) {
|
||||
c.logger.Infof(template, args...)
|
||||
c.recorder.Event(r, corev1.EventTypeNormal, "Synced", fmt.Sprintf(template, args...))
|
||||
}
|
||||
|
||||
func (c *Controller) recordEventErrorf(r *rolloutv1.Rollout, template string, args ...interface{}) {
|
||||
func (c *Controller) recordEventErrorf(r *rolloutv1.Canary, template string, args ...interface{}) {
|
||||
c.logger.Errorf(template, args...)
|
||||
c.recorder.Event(r, corev1.EventTypeWarning, "Synced", fmt.Sprintf(template, args...))
|
||||
}
|
||||
|
||||
func (c *Controller) recordEventWarningf(r *rolloutv1.Rollout, template string, args ...interface{}) {
|
||||
func (c *Controller) recordEventWarningf(r *rolloutv1.Canary, template string, args ...interface{}) {
|
||||
c.logger.Infof(template, args...)
|
||||
c.recorder.Event(r, corev1.EventTypeWarning, "Synced", fmt.Sprintf(template, args...))
|
||||
}
|
||||
|
||||
func checkCustomResourceType(obj interface{}, logger *zap.SugaredLogger) (rolloutv1.Rollout, bool) {
|
||||
var roll *rolloutv1.Rollout
|
||||
func checkCustomResourceType(obj interface{}, logger *zap.SugaredLogger) (rolloutv1.Canary, bool) {
|
||||
var roll *rolloutv1.Canary
|
||||
var ok bool
|
||||
if roll, ok = obj.(*rolloutv1.Rollout); !ok {
|
||||
if roll, ok = obj.(*rolloutv1.Canary); !ok {
|
||||
logger.Errorf("Event Watch received an invalid object: %#v", obj)
|
||||
return rolloutv1.Rollout{}, false
|
||||
return rolloutv1.Canary{}, false
|
||||
}
|
||||
return *roll, true
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ import (
|
||||
|
||||
func (c *Controller) doRollouts() {
|
||||
c.rollouts.Range(func(key interface{}, value interface{}) bool {
|
||||
r := value.(*rolloutv1.Rollout)
|
||||
r := value.(*rolloutv1.Canary)
|
||||
if r.Spec.TargetKind == "Deployment" {
|
||||
go c.advanceDeploymentRollout(r.Name, r.Namespace)
|
||||
}
|
||||
@@ -83,7 +83,7 @@ func (c *Controller) advanceDeploymentRollout(name string, namespace string) {
|
||||
// gate stage: check if the canary success rate is above the threshold
|
||||
// skip check if no traffic is routed to canary
|
||||
if canaryRoute.Weight == 0 {
|
||||
c.recordEventInfof(r, "Starting rollout for %s.%s", r.Name, r.Namespace)
|
||||
c.recordEventInfof(r, "Starting canary deployment for %s.%s", r.Name, r.Namespace)
|
||||
} else {
|
||||
if ok := c.checkDeploymentMetrics(r); !ok {
|
||||
c.updateRolloutFailedChecks(r, r.Status.FailedChecks+1)
|
||||
@@ -106,7 +106,7 @@ func (c *Controller) advanceDeploymentRollout(name string, namespace string) {
|
||||
return
|
||||
}
|
||||
|
||||
c.recordEventInfof(r, "Advance rollout %s.%s weight %v", r.Name, r.Namespace, canaryRoute.Weight)
|
||||
c.recordEventInfof(r, "Advance %s.%s canary weight %v", r.Name, r.Namespace, canaryRoute.Weight)
|
||||
|
||||
// promotion stage: override primary.template.spec with the canary spec
|
||||
if canaryRoute.Weight == maxWeight {
|
||||
@@ -116,7 +116,7 @@ func (c *Controller) advanceDeploymentRollout(name string, namespace string) {
|
||||
primary.Spec.Template.Spec = canary.Spec.Template.Spec
|
||||
_, err := c.kubeClient.AppsV1().Deployments(primary.Namespace).Update(primary)
|
||||
if err != nil {
|
||||
c.recordEventErrorf(r, "Deployment %s.%s promotion failed: %v", primary.GetName(), primary.Namespace, err)
|
||||
c.recordEventErrorf(r, "Updating template spec %s.%s failed: %v", primary.GetName(), primary.Namespace, err)
|
||||
return
|
||||
}
|
||||
}
|
||||
@@ -135,27 +135,27 @@ func (c *Controller) advanceDeploymentRollout(name string, namespace string) {
|
||||
}
|
||||
}
|
||||
|
||||
func (c *Controller) getRollout(name string, namespace string) (*rolloutv1.Rollout, bool) {
|
||||
r, err := c.rolloutClient.AppsV1beta1().Rollouts(namespace).Get(name, v1.GetOptions{})
|
||||
func (c *Controller) getRollout(name string, namespace string) (*rolloutv1.Canary, bool) {
|
||||
r, err := c.rolloutClient.SteererV1beta1().Canaries(namespace).Get(name, v1.GetOptions{})
|
||||
if err != nil {
|
||||
c.logger.Errorf("Rollout %s.%s not found", name, namespace)
|
||||
c.logger.Errorf("Canary %s.%s not found", name, namespace)
|
||||
return nil, false
|
||||
}
|
||||
|
||||
return r, true
|
||||
}
|
||||
|
||||
func (c *Controller) checkRolloutStatus(r *rolloutv1.Rollout, canary *appsv1.Deployment) bool {
|
||||
func (c *Controller) checkRolloutStatus(r *rolloutv1.Canary, canary *appsv1.Deployment) bool {
|
||||
var err error
|
||||
if r.Status.State == "" {
|
||||
r.Status = rolloutv1.RolloutStatus{
|
||||
r.Status = rolloutv1.CanaryStatus{
|
||||
State: "running",
|
||||
CanaryRevision: canary.ResourceVersion,
|
||||
FailedChecks: 0,
|
||||
}
|
||||
r, err = c.rolloutClient.AppsV1beta1().Rollouts(r.Namespace).Update(r)
|
||||
r, err = c.rolloutClient.SteererV1beta1().Canaries(r.Namespace).Update(r)
|
||||
if err != nil {
|
||||
c.logger.Errorf("Rollout %s.%s status update failed: %v", r.Name, r.Namespace, err)
|
||||
c.logger.Errorf("Canary %s.%s status update failed: %v", r.Name, r.Namespace, err)
|
||||
return false
|
||||
}
|
||||
return true
|
||||
@@ -188,14 +188,14 @@ func (c *Controller) checkRolloutStatus(r *rolloutv1.Rollout, canary *appsv1.Dep
|
||||
c.recordEventErrorf(r, "Scaling up %s.%s failed: %v", canary.GetName(), canary.Namespace, err)
|
||||
return false
|
||||
}
|
||||
r.Status = rolloutv1.RolloutStatus{
|
||||
r.Status = rolloutv1.CanaryStatus{
|
||||
State: "running",
|
||||
CanaryRevision: canary.ResourceVersion,
|
||||
FailedChecks: 0,
|
||||
}
|
||||
r, err = c.rolloutClient.AppsV1beta1().Rollouts(r.Namespace).Update(r)
|
||||
r, err = c.rolloutClient.SteererV1beta1().Canaries(r.Namespace).Update(r)
|
||||
if err != nil {
|
||||
c.logger.Errorf("Rollout %s.%s status update failed: %v", r.Name, r.Namespace, err)
|
||||
c.logger.Errorf("Canary %s.%s status update failed: %v", r.Name, r.Namespace, err)
|
||||
return false
|
||||
}
|
||||
c.recordEventInfof(r, "Scaling up %s.%s", canary.GetName(), canary.Namespace)
|
||||
@@ -206,29 +206,29 @@ func (c *Controller) checkRolloutStatus(r *rolloutv1.Rollout, canary *appsv1.Dep
|
||||
return false
|
||||
}
|
||||
|
||||
func (c *Controller) updateRolloutStatus(r *rolloutv1.Rollout, status string) bool {
|
||||
func (c *Controller) updateRolloutStatus(r *rolloutv1.Canary, status string) bool {
|
||||
var err error
|
||||
r.Status.State = status
|
||||
r, err = c.rolloutClient.AppsV1beta1().Rollouts(r.Namespace).Update(r)
|
||||
r, err = c.rolloutClient.SteererV1beta1().Canaries(r.Namespace).Update(r)
|
||||
if err != nil {
|
||||
c.logger.Errorf("Rollout %s.%s status update failed: %v", r.Name, r.Namespace, err)
|
||||
c.logger.Errorf("Canary %s.%s status update failed: %v", r.Name, r.Namespace, err)
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
func (c *Controller) updateRolloutFailedChecks(r *rolloutv1.Rollout, val int) bool {
|
||||
func (c *Controller) updateRolloutFailedChecks(r *rolloutv1.Canary, val int) bool {
|
||||
var err error
|
||||
r.Status.FailedChecks = val
|
||||
r, err = c.rolloutClient.AppsV1beta1().Rollouts(r.Namespace).Update(r)
|
||||
r, err = c.rolloutClient.SteererV1beta1().Canaries(r.Namespace).Update(r)
|
||||
if err != nil {
|
||||
c.logger.Errorf("Rollout %s.%s status update failed: %v", r.Name, r.Namespace, err)
|
||||
c.logger.Errorf("Canary %s.%s status update failed: %v", r.Name, r.Namespace, err)
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
func (c *Controller) getDeployment(r *rolloutv1.Rollout, name string, namespace string) (*appsv1.Deployment, bool) {
|
||||
func (c *Controller) getDeployment(r *rolloutv1.Canary, name string, namespace string) (*appsv1.Deployment, bool) {
|
||||
dep, err := c.kubeClient.AppsV1().Deployments(namespace).Get(name, v1.GetOptions{})
|
||||
if err != nil {
|
||||
c.recordEventErrorf(r, "Deployment %s.%s not found", name, namespace)
|
||||
@@ -236,7 +236,7 @@ func (c *Controller) getDeployment(r *rolloutv1.Rollout, name string, namespace
|
||||
}
|
||||
|
||||
if msg, healthy := getDeploymentStatus(dep); !healthy {
|
||||
c.recordEventWarningf(r, "Halt rollout %s.%s %s", dep.GetName(), dep.Namespace, msg)
|
||||
c.recordEventWarningf(r, "Halt %s.%s advancement %s", dep.GetName(), dep.Namespace, msg)
|
||||
return nil, false
|
||||
}
|
||||
|
||||
@@ -247,7 +247,7 @@ func (c *Controller) getDeployment(r *rolloutv1.Rollout, name string, namespace
|
||||
return dep, true
|
||||
}
|
||||
|
||||
func (c *Controller) getCanaryDeployment(r *rolloutv1.Rollout, name string, namespace string) (*appsv1.Deployment, bool) {
|
||||
func (c *Controller) getCanaryDeployment(r *rolloutv1.Canary, name string, namespace string) (*appsv1.Deployment, bool) {
|
||||
dep, err := c.kubeClient.AppsV1().Deployments(namespace).Get(name, v1.GetOptions{})
|
||||
if err != nil {
|
||||
c.recordEventErrorf(r, "Deployment %s.%s not found", name, namespace)
|
||||
@@ -255,7 +255,7 @@ func (c *Controller) getCanaryDeployment(r *rolloutv1.Rollout, name string, name
|
||||
}
|
||||
|
||||
if msg, healthy := getDeploymentStatus(dep); !healthy {
|
||||
c.recordEventWarningf(r, "Halt rollout %s.%s %s", dep.GetName(), dep.Namespace, msg)
|
||||
c.recordEventWarningf(r, "Halt %s.%s advancement %s", dep.GetName(), dep.Namespace, msg)
|
||||
return nil, false
|
||||
}
|
||||
|
||||
@@ -272,7 +272,7 @@ func (c *Controller) getDeploymentRevision(name string, namespace string) string
|
||||
return dep.ResourceVersion
|
||||
}
|
||||
|
||||
func (c *Controller) checkDeploymentMetrics(r *rolloutv1.Rollout) bool {
|
||||
func (c *Controller) checkDeploymentMetrics(r *rolloutv1.Canary) bool {
|
||||
for _, metric := range r.Spec.CanaryAnalysis.Metrics {
|
||||
if metric.Name == "istio_requests_total" {
|
||||
val, err := c.getDeploymentCounter(r.Spec.Canary.Name, r.Namespace, metric.Name, metric.Interval)
|
||||
@@ -281,7 +281,7 @@ func (c *Controller) checkDeploymentMetrics(r *rolloutv1.Rollout) bool {
|
||||
return false
|
||||
}
|
||||
if float64(metric.Threshold) > val {
|
||||
c.recordEventWarningf(r, "Halt rollout %s.%s success rate %.2f%% < %v%%",
|
||||
c.recordEventWarningf(r, "Halt %s.%s advancement success rate %.2f%% < %v%%",
|
||||
r.Name, r.Namespace, val, metric.Threshold)
|
||||
return false
|
||||
}
|
||||
@@ -295,7 +295,7 @@ func (c *Controller) checkDeploymentMetrics(r *rolloutv1.Rollout) bool {
|
||||
}
|
||||
t := time.Duration(metric.Threshold) * time.Millisecond
|
||||
if val > t {
|
||||
c.recordEventWarningf(r, "Halt rollout %s.%s request duration %v > %v",
|
||||
c.recordEventWarningf(r, "Halt %s.%s advancement request duration %v > %v",
|
||||
r.Name, r.Namespace, val, t)
|
||||
return false
|
||||
}
|
||||
@@ -305,7 +305,7 @@ func (c *Controller) checkDeploymentMetrics(r *rolloutv1.Rollout) bool {
|
||||
return true
|
||||
}
|
||||
|
||||
func (c *Controller) scaleToZeroCanary(r *rolloutv1.Rollout) {
|
||||
func (c *Controller) scaleToZeroCanary(r *rolloutv1.Canary) {
|
||||
canary, err := c.kubeClient.AppsV1().Deployments(r.Namespace).Get(r.Spec.Canary.Name, v1.GetOptions{})
|
||||
if err != nil {
|
||||
c.recordEventErrorf(r, "Deployment %s.%s not found", r.Spec.Canary.Name, r.Namespace)
|
||||
@@ -320,25 +320,25 @@ func (c *Controller) scaleToZeroCanary(r *rolloutv1.Rollout) {
|
||||
}
|
||||
}
|
||||
|
||||
func (c *Controller) setCanaryRevision(r *rolloutv1.Rollout, status string) {
|
||||
func (c *Controller) setCanaryRevision(r *rolloutv1.Canary, status string) {
|
||||
canaryRevision := c.getDeploymentRevision(r.Spec.Canary.Name, r.Namespace)
|
||||
r, ok := c.getRollout(r.Name, r.Namespace)
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
r.Status = rolloutv1.RolloutStatus{
|
||||
r.Status = rolloutv1.CanaryStatus{
|
||||
State: status,
|
||||
CanaryRevision: canaryRevision,
|
||||
FailedChecks: r.Status.FailedChecks,
|
||||
}
|
||||
r, err := c.rolloutClient.AppsV1beta1().Rollouts(r.Namespace).Update(r)
|
||||
r, err := c.rolloutClient.SteererV1beta1().Canaries(r.Namespace).Update(r)
|
||||
if err != nil {
|
||||
c.logger.Errorf("Rollout %s.%s status update failed: %v", r.Name, r.Namespace, err)
|
||||
c.logger.Errorf("Canary %s.%s status update failed: %v", r.Name, r.Namespace, err)
|
||||
}
|
||||
//c.logger.Infof("Rollout %s.%s status %+v", r.Spec.Canary.Name, r.Namespace, r.Status)
|
||||
//c.logger.Infof("Canary %s.%s status %+v", r.Spec.Canary.Name, r.Namespace, r.Status)
|
||||
}
|
||||
|
||||
func (c *Controller) getVirtualService(r *rolloutv1.Rollout) (
|
||||
func (c *Controller) getVirtualService(r *rolloutv1.Canary) (
|
||||
vs *istiov1alpha3.VirtualService,
|
||||
primary istiov1alpha3.DestinationWeight,
|
||||
canary istiov1alpha3.DestinationWeight,
|
||||
@@ -373,7 +373,7 @@ func (c *Controller) getVirtualService(r *rolloutv1.Rollout) (
|
||||
}
|
||||
|
||||
func (c *Controller) updateVirtualServiceRoutes(
|
||||
r *rolloutv1.Rollout,
|
||||
r *rolloutv1.Canary,
|
||||
vs *istiov1alpha3.VirtualService,
|
||||
primary istiov1alpha3.DestinationWeight,
|
||||
canary istiov1alpha3.DestinationWeight,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package version
|
||||
|
||||
var VERSION = "0.0.1-rc.18"
|
||||
var VERSION = "0.0.1-rc.23"
|
||||
var REVISION = "unknown"
|
||||
|
||||
Reference in New Issue
Block a user