Skip to content

Commit 4972e97

Browse files
authored
[release-0.19] cp 165, update ko install (#212)
* cp 165, update ko install * smaller resources * do not use sinkbinding * names / sleep * direct works, change dlq too * just a cosmetic change to try to force actions to run
1 parent 358bed2 commit 4972e97

File tree

8 files changed

+52
-68
lines changed

8 files changed

+52
-68
lines changed

.github/workflows/kind-e2e.yaml

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,13 @@ jobs:
1919
- v1.18.8
2020
- v1.19.1
2121

22+
rabbitmq-operator-version:
23+
- v1.0.0
24+
- v1.1.0
25+
- v1.2.0
26+
- v1.3.0
27+
- v1.4.0
28+
2229
# Map between K8s and KinD versions.
2330
# This is attempting to make it a bit clearer what's being tested.
2431
# See: https://github.com/kubernetes-sigs/kind/releases/tag/v0.9.0
@@ -34,7 +41,9 @@ jobs:
3441
kind-image-sha: sha256:98cf5288864662e37115e362b23e4369c8c4a408f99cbc06e58ac30ddc721600
3542
env:
3643
GOPATH: ${{ github.workspace }}
37-
GO111MODULE: off
44+
SYSTEM_NAMESPACE: knative-eventing
45+
# Where the Rabbitmq cluster operator is installed.
46+
RABBITMQ_SYSTEM_NAMESPACE: rabbitmq-system
3847
KO_DOCKER_REPO: kind.local
3948

4049
steps:
@@ -45,7 +54,9 @@ jobs:
4554

4655
- name: Install Dependencies
4756
run: |
48-
GO111MODULE=on go get github.com/google/ko/cmd/ko@master
57+
curl -L https://github.com/google/ko/releases/download/v0.7.0/ko_0.7.0_Linux_x86_64.tar.gz | tar xzf - ko
58+
chmod +x ./ko
59+
sudo mv ko /usr/local/bin
4960
5061
- name: Check out code onto GOPATH
5162
uses: actions/checkout@v2
@@ -55,7 +66,7 @@ jobs:
5566
- name: Install KinD
5667
working-directory: ./src/knative.dev/${{ github.event.repository.name }}
5768
env:
58-
KIND_VERSION: v0.8.1
69+
KIND_VERSION: ${{ matrix.kind-version }}
5970
run: |
6071
set -x
6172
@@ -100,7 +111,7 @@ jobs:
100111
run: |
101112
set -x
102113
103-
kubectl apply -f https://github.com/rabbitmq/cluster-operator/releases/download/0.46.0/cluster-operator.yml
114+
kubectl apply -f https://github.com/rabbitmq/cluster-operator/releases/download/${{ matrix.rabbitmq-operator-version }}/cluster-operator.yml
104115
105116
- name: Install Knative Eventing
106117
run: |
@@ -130,14 +141,10 @@ jobs:
130141
- name: Wait for Ready
131142
working-directory: ./src/knative.dev/${{ github.event.repository.name }}
132143
run: |
133-
set -x
134-
135-
# Probably don't need this anymore, but keep until we
136-
# have something that waits for pods to becomes ready.
137-
sleep 60
138-
139-
# For debugging.
140-
kubectl get pods --all-namespaces
144+
set -e
145+
source ./vendor/knative.dev/hack/infra-library.sh
146+
wait_until_pods_running ${SYSTEM_NAMESPACE}
147+
wait_until_pods_running ${RABBITMQ_SYSTEM_NAMESPACE}
141148
142149
- name: Run e2e Tests
143150
working-directory: ./src/knative.dev/${{ github.event.repository.name }}

pkg/apis/duck/v1beta1/rabbit.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,11 @@ type RabbitSpec struct{}
4848

4949
// RabbitStatus.
5050
type RabbitStatus struct {
51-
// RabbitAdmin identifies information on internal resources.
52-
Admin *RabbitAdmin `json:"admin,omitempty"`
51+
// DefaultUser identifies information on internal resources.
52+
DefaultUser *RabbitDefaultUser `json:"defaultUser,omitempty"`
5353
}
5454

55-
type RabbitAdmin struct {
55+
type RabbitDefaultUser struct {
5656
SecretReference *RabbitReference `json:"secretReference,omitempty"`
5757
ServiceReference *RabbitReference `json:"serviceReference,omitempty"`
5858
}

pkg/apis/duck/v1beta1/zz_generated.deepcopy.go

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/reconciler/broker/broker_config.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -115,28 +115,28 @@ func (r *Reconciler) rabbitmqURLFromRabbit(ctx context.Context, ref *duckv1.KRef
115115

116116
rab := o.(*duckv1beta1.Rabbit)
117117

118-
if rab.Status.Admin == nil || rab.Status.Admin.SecretReference == nil || rab.Status.Admin.ServiceReference == nil {
118+
if rab.Status.DefaultUser == nil || rab.Status.DefaultUser.SecretReference == nil || rab.Status.DefaultUser.ServiceReference == nil {
119119
return nil, fmt.Errorf("rabbit \"%s/%s\" not ready", ref.Namespace, ref.Name)
120120
}
121121

122-
_ = rab.Status.Admin.SecretReference
122+
_ = rab.Status.DefaultUser.SecretReference
123123

124-
s, err := r.kubeClientSet.CoreV1().Secrets(rab.Status.Admin.SecretReference.Namespace).Get(ctx, rab.Status.Admin.SecretReference.Name, metav1.GetOptions{})
124+
s, err := r.kubeClientSet.CoreV1().Secrets(rab.Status.DefaultUser.SecretReference.Namespace).Get(ctx, rab.Status.DefaultUser.SecretReference.Name, metav1.GetOptions{})
125125
if err != nil {
126126
return nil, err
127127
}
128128

129-
password, ok := s.Data[rab.Status.Admin.SecretReference.Keys["password"]]
129+
password, ok := s.Data[rab.Status.DefaultUser.SecretReference.Keys["password"]]
130130
if !ok {
131-
return nil, fmt.Errorf("rabbit Secret missing key %s", rab.Status.Admin.SecretReference.Keys["password"])
131+
return nil, fmt.Errorf("rabbit Secret missing key %s", rab.Status.DefaultUser.SecretReference.Keys["password"])
132132
}
133133

134-
username, ok := s.Data[rab.Status.Admin.SecretReference.Keys["username"]]
134+
username, ok := s.Data[rab.Status.DefaultUser.SecretReference.Keys["username"]]
135135
if !ok {
136-
return nil, fmt.Errorf("rabbit Secret missing key %s", rab.Status.Admin.SecretReference.Keys["username"])
136+
return nil, fmt.Errorf("rabbit Secret missing key %s", rab.Status.DefaultUser.SecretReference.Keys["username"])
137137
}
138138

139-
host := network.GetServiceHostname(rab.Status.Admin.ServiceReference.Name, rab.Status.Admin.ServiceReference.Namespace)
139+
host := network.GetServiceHostname(rab.Status.DefaultUser.ServiceReference.Name, rab.Status.DefaultUser.ServiceReference.Namespace)
140140

141141
return url.Parse(fmt.Sprintf("amqp://%s:%s@%s:%d", username, password, host, 5672))
142142
}

test/e2e/cmd/producer/main.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ func main() {
3939
log.Print("[ERROR] Failed to process env var: ", err)
4040
os.Exit(1)
4141
}
42+
// The ordering is not all that well supported and do not want
43+
// to migrate this branch to the reconciler-test. Sleep until broker is for sure up.
44+
time.Sleep(128 * time.Second)
45+
4246
ctx := cloudevents.ContextWithTarget(context.Background(), env.Sink)
4347

4448
p, err := cloudevents.NewHTTP()

test/e2e/config/direct/producer.yaml

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -32,22 +32,5 @@ spec:
3232
env:
3333
- name: COUNT
3434
value: '{{ .producerCount }}'
35-
36-
---
37-
38-
apiVersion: sources.knative.dev/v1beta1
39-
kind: SinkBinding
40-
metadata:
41-
name: bind-producer
42-
namespace: {{ .namespace }}
43-
spec:
44-
subject:
45-
apiVersion: apps/v1
46-
kind: Deployment
47-
name: producer
48-
49-
sink:
50-
ref:
51-
apiVersion: eventing.knative.dev/v1
52-
kind: Broker
53-
name: {{ .brokerName }}
35+
- name: K_SINK
36+
value: http://{{ .brokerName }}-broker-ingress.{{ .namespace }}.svc.cluster.local

test/e2e/config/dlq/producer.yaml

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -32,22 +32,5 @@ spec:
3232
env:
3333
- name: COUNT
3434
value: '{{ .producerCount }}'
35-
36-
---
37-
38-
apiVersion: sources.knative.dev/v1beta1
39-
kind: SinkBinding
40-
metadata:
41-
name: bind-producer
42-
namespace: {{ .namespace }}
43-
spec:
44-
subject:
45-
apiVersion: apps/v1
46-
kind: Deployment
47-
name: producer
48-
49-
sink:
50-
ref:
51-
apiVersion: eventing.knative.dev/v1
52-
kind: Broker
53-
name: {{ .brokerName }}
35+
- name: K_SINK
36+
value: http://{{ .brokerName }}-broker-ingress.{{ .namespace }}.svc.cluster.local

test/e2e/config/rabbitmq/cluster.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,10 @@ metadata:
1919
namespace: {{ .namespace }}
2020
spec:
2121
replicas: 1
22+
resources:
23+
limits:
24+
cpu: "400m"
25+
memory: "400Mi"
26+
requests:
27+
cpu: "400m"
28+
memory: "400Mi"

0 commit comments

Comments
 (0)