Skip to content

Commit

Permalink
[release-0.19] cp 165, update ko install (#212)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
vaikas committed Jan 25, 2021
1 parent 358bed2 commit 4972e97
Show file tree
Hide file tree
Showing 8 changed files with 52 additions and 68 deletions.
31 changes: 19 additions & 12 deletions .github/workflows/kind-e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,13 @@ jobs:
- v1.18.8
- v1.19.1

rabbitmq-operator-version:
- v1.0.0
- v1.1.0
- v1.2.0
- v1.3.0
- v1.4.0

# Map between K8s and KinD versions.
# This is attempting to make it a bit clearer what's being tested.
# See: https://github.com/kubernetes-sigs/kind/releases/tag/v0.9.0
Expand All @@ -34,7 +41,9 @@ jobs:
kind-image-sha: sha256:98cf5288864662e37115e362b23e4369c8c4a408f99cbc06e58ac30ddc721600
env:
GOPATH: ${{ github.workspace }}
GO111MODULE: off
SYSTEM_NAMESPACE: knative-eventing
# Where the Rabbitmq cluster operator is installed.
RABBITMQ_SYSTEM_NAMESPACE: rabbitmq-system
KO_DOCKER_REPO: kind.local

steps:
Expand All @@ -45,7 +54,9 @@ jobs:

- name: Install Dependencies
run: |
GO111MODULE=on go get github.com/google/ko/cmd/ko@master
curl -L https://github.com/google/ko/releases/download/v0.7.0/ko_0.7.0_Linux_x86_64.tar.gz | tar xzf - ko
chmod +x ./ko
sudo mv ko /usr/local/bin
- name: Check out code onto GOPATH
uses: actions/checkout@v2
Expand All @@ -55,7 +66,7 @@ jobs:
- name: Install KinD
working-directory: ./src/knative.dev/${{ github.event.repository.name }}
env:
KIND_VERSION: v0.8.1
KIND_VERSION: ${{ matrix.kind-version }}
run: |
set -x
Expand Down Expand Up @@ -100,7 +111,7 @@ jobs:
run: |
set -x
kubectl apply -f https://github.com/rabbitmq/cluster-operator/releases/download/0.46.0/cluster-operator.yml
kubectl apply -f https://github.com/rabbitmq/cluster-operator/releases/download/${{ matrix.rabbitmq-operator-version }}/cluster-operator.yml
- name: Install Knative Eventing
run: |
Expand Down Expand Up @@ -130,14 +141,10 @@ jobs:
- name: Wait for Ready
working-directory: ./src/knative.dev/${{ github.event.repository.name }}
run: |
set -x
# Probably don't need this anymore, but keep until we
# have something that waits for pods to becomes ready.
sleep 60
# For debugging.
kubectl get pods --all-namespaces
set -e
source ./vendor/knative.dev/hack/infra-library.sh
wait_until_pods_running ${SYSTEM_NAMESPACE}
wait_until_pods_running ${RABBITMQ_SYSTEM_NAMESPACE}
- name: Run e2e Tests
working-directory: ./src/knative.dev/${{ github.event.repository.name }}
Expand Down
6 changes: 3 additions & 3 deletions pkg/apis/duck/v1beta1/rabbit.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@ type RabbitSpec struct{}

// RabbitStatus.
type RabbitStatus struct {
// RabbitAdmin identifies information on internal resources.
Admin *RabbitAdmin `json:"admin,omitempty"`
// DefaultUser identifies information on internal resources.
DefaultUser *RabbitDefaultUser `json:"defaultUser,omitempty"`
}

type RabbitAdmin struct {
type RabbitDefaultUser struct {
SecretReference *RabbitReference `json:"secretReference,omitempty"`
ServiceReference *RabbitReference `json:"serviceReference,omitempty"`
}
Expand Down
14 changes: 7 additions & 7 deletions pkg/apis/duck/v1beta1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 8 additions & 8 deletions pkg/reconciler/broker/broker_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,28 +115,28 @@ func (r *Reconciler) rabbitmqURLFromRabbit(ctx context.Context, ref *duckv1.KRef

rab := o.(*duckv1beta1.Rabbit)

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

_ = rab.Status.Admin.SecretReference
_ = rab.Status.DefaultUser.SecretReference

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

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

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

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

return url.Parse(fmt.Sprintf("amqp://%s:%s@%s:%d", username, password, host, 5672))
}
4 changes: 4 additions & 0 deletions test/e2e/cmd/producer/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ func main() {
log.Print("[ERROR] Failed to process env var: ", err)
os.Exit(1)
}
// The ordering is not all that well supported and do not want
// to migrate this branch to the reconciler-test. Sleep until broker is for sure up.
time.Sleep(128 * time.Second)

ctx := cloudevents.ContextWithTarget(context.Background(), env.Sink)

p, err := cloudevents.NewHTTP()
Expand Down
21 changes: 2 additions & 19 deletions test/e2e/config/direct/producer.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,22 +32,5 @@ spec:
env:
- name: COUNT
value: '{{ .producerCount }}'

---

apiVersion: sources.knative.dev/v1beta1
kind: SinkBinding
metadata:
name: bind-producer
namespace: {{ .namespace }}
spec:
subject:
apiVersion: apps/v1
kind: Deployment
name: producer

sink:
ref:
apiVersion: eventing.knative.dev/v1
kind: Broker
name: {{ .brokerName }}
- name: K_SINK
value: http://{{ .brokerName }}-broker-ingress.{{ .namespace }}.svc.cluster.local
21 changes: 2 additions & 19 deletions test/e2e/config/dlq/producer.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,22 +32,5 @@ spec:
env:
- name: COUNT
value: '{{ .producerCount }}'

---

apiVersion: sources.knative.dev/v1beta1
kind: SinkBinding
metadata:
name: bind-producer
namespace: {{ .namespace }}
spec:
subject:
apiVersion: apps/v1
kind: Deployment
name: producer

sink:
ref:
apiVersion: eventing.knative.dev/v1
kind: Broker
name: {{ .brokerName }}
- name: K_SINK
value: http://{{ .brokerName }}-broker-ingress.{{ .namespace }}.svc.cluster.local
7 changes: 7 additions & 0 deletions test/e2e/config/rabbitmq/cluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,10 @@ metadata:
namespace: {{ .namespace }}
spec:
replicas: 1
resources:
limits:
cpu: "400m"
memory: "400Mi"
requests:
cpu: "400m"
memory: "400Mi"

0 comments on commit 4972e97

Please sign in to comment.