Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: support new k8s peer discovery #1676

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/build-test-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ env:
KIND_NODE_IMAGE: "kindest/node:v1.29.2@sha256:51a1434a5397193442f0be2a297b488b6c919ce8a3931be0ce822606ea5ca245"
KIND_OLDEST_NODE_IMAGE: "kindest/node:v1.26.3@sha256:61b92f38dff6ccc29969e7aa154d34e38b89443af1a2c14e6cfbd2df6419c66f"
BASELINE_UPGRADE_VERSION: v2.1.0
RABBITMQ_IMAGE: pivotalrabbitmq/rabbitmq:k8s-peer-discovery-simplified

jobs:
kubectl_tests:
Expand Down
10 changes: 0 additions & 10 deletions config/rbac/role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -73,16 +73,6 @@ rules:
- list
- update
- watch
- apiGroups:
- ""
resources:
- serviceaccounts
verbs:
- create
- get
- list
- update
- watch
- apiGroups:
- ""
resources:
Expand Down
1 change: 0 additions & 1 deletion controllers/rabbitmqcluster_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ type RabbitmqClusterReconciler struct {
// +kubebuilder:rbac:groups=rabbitmq.com,resources=rabbitmqclusters/status,verbs=get;update
// +kubebuilder:rbac:groups=rabbitmq.com,resources=rabbitmqclusters/finalizers,verbs=update
// +kubebuilder:rbac:groups="",resources=events,verbs=get;create;patch
// +kubebuilder:rbac:groups="",resources=serviceaccounts,verbs=get;list;watch;create;update
// +kubebuilder:rbac:groups="",resources=persistentvolumeclaims,verbs=get;list;watch;create;update
// +kubebuilder:rbac:groups="rbac.authorization.k8s.io",resources=roles,verbs=get;list;watch;create;update
// +kubebuilder:rbac:groups="rbac.authorization.k8s.io",resources=rolebindings,verbs=get;list;watch;create;update
Expand Down
3 changes: 1 addition & 2 deletions internal/resource/statefulset.go
Original file line number Diff line number Diff line change
Expand Up @@ -570,8 +570,7 @@ func (builder *StatefulSetBuilder) podTemplateSpec(previousPodAnnotations map[st
},
ImagePullSecrets: builder.Instance.Spec.ImagePullSecrets,
TerminationGracePeriodSeconds: builder.Instance.Spec.TerminationGracePeriodSeconds,
ServiceAccountName: builder.Instance.ChildResourceName(serviceAccountName),
AutomountServiceAccountToken: ptr.To(true),
AutomountServiceAccountToken: ptr.To(false),
Affinity: builder.Instance.Spec.Affinity,
Tolerations: builder.Instance.Spec.Tolerations,
InitContainers: []corev1.Container{setupContainer(builder.Instance)},
Expand Down
4 changes: 2 additions & 2 deletions internal/resource/statefulset_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1352,14 +1352,14 @@ default_pass = {{ .Data.data.password }}
stsBuilder := builder.StatefulSet()
Expect(stsBuilder.Update(statefulSet)).To(Succeed())

Expect(statefulSet.Spec.Template.Spec.ServiceAccountName).To(Equal(instance.ChildResourceName("server")))
Expect(statefulSet.Spec.Template.Spec.ServiceAccountName).To(BeEmpty())
})

It("mounts the service account in its pods", func() {
stsBuilder := builder.StatefulSet()
Expect(stsBuilder.Update(statefulSet)).To(Succeed())

Expect(*statefulSet.Spec.Template.Spec.AutomountServiceAccountToken).To(BeTrue())
Expect(*statefulSet.Spec.Template.Spec.AutomountServiceAccountToken).To(BeFalse())
})

It("creates the required SecurityContext", func() {
Expand Down
Loading