diff --git a/.github/workflows/build-test-dev.yml b/.github/workflows/build-test-dev.yml index b852dc9..f8a7ae5 100644 --- a/.github/workflows/build-test-dev.yml +++ b/.github/workflows/build-test-dev.yml @@ -6,7 +6,7 @@ on: - main env: - VERSION: 1.4.1 + VERSION: 1.4.2 IMAGE_NAME: pubsubplus-eventbroker-operator VAULT_ADDR: ${{ secrets.VAULT_ADDR }} GCLOUD_PROJECT_ID_DEV: ${{ secrets.GCLOUD_PROJECT_ID }} @@ -21,11 +21,12 @@ jobs: contents: read actions: read id-token: write + packages: write steps: - name: Set up Go uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5 with: - go-version: "1.24.2" + go-version: "1.26.5" - name: Check out code uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4 @@ -38,7 +39,7 @@ jobs: with: registry: ghcr.io username: ${{ github.actor }} - password: ${{ secrets.RELEASE_GITHUB_TOKEN }} + password: ${{ secrets.GITHUB_TOKEN }} - id: 'auth' name: 'Authenticate to Google Cloud' @@ -109,56 +110,17 @@ jobs: if: ${{ startsWith(github.ref_name, 'dev1.') && (github.ref_name != 'main') }} uses: docker/setup-buildx-action@885d1462b80bc1c1c7f0b00334ad271f09369c55 # v2 - - name: Checkout SolaceDev/maas-build-actions - if: ${{ startsWith(github.ref_name, 'dev1.') && (github.ref_name != 'main') }} - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4 - with: - repository: SolaceDev/maas-build-actions - ref: refs/heads/master - token: ${{ secrets.RELEASE_GITHUB_TOKEN }} - persist-credentials: false - path: maas-build-actions - - - name: Retrieve google container registry secrets - id: docker_registry_secrets - if: ${{ startsWith(github.ref_name, 'dev1.') && (github.ref_name != 'main') }} - uses: hashicorp/vault-action@130d1f5f4fe645bb6c83e4225c04d64cfb62de6e # v2.5.0 - with: - url: "${{ env.VAULT_ADDR }}" - role: github-docker-secrets-read-role - method: jwt - path: jwt-github - jwtGithubAudience: https://github.com/SolaceDev - exportToken: true - secrets: | - secret/data/development/gcp-gcr GCP_SERVICE_ACCOUNT | GCP_DEV_SERVICE_ACCOUNT - env: - VERSION: ${{ env.VERSION }} - IMAGE_NAME: pubsubplus-eventbroker-operator - VAULT_ADDR: ${{ secrets.VAULT_ADDR }} - GCLOUD_PROJECT_ID_DEV: ${{ secrets.GCLOUD_PROJECT_ID }} - - - name: Log in to gcr development docker registry - uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9 - if: ${{ startsWith(github.ref_name, 'dev1.') && (github.ref_name != 'main') }} - with: - registry: gcr.io - username: _json_key - password: ${{ steps.docker_registry_secrets.outputs.GCP_DEV_SERVICE_ACCOUNT }} - - - name: Build image and push Google Container Registry - uses: docker/build-push-action@ac9327eae2b366085ac7f6a2d02df8aa8ead720a # v2 - if: ${{ startsWith(github.ref_name, 'dev1.') && (github.ref_name != 'main') }} - with: - context: ./ - tags: | - gcr.io/${{ env.GCLOUD_PROJECT_ID_DEV }}/${{ env.IMAGE_NAME }}:${{ env.VERSION }} - push: true - env: - VERSION: ${{ env.VERSION }} - IMAGE_NAME: ${{ env.IMAGE_NAME }} - VAULT_ADDR: ${{ secrets.VAULT_ADDR }} - GCLOUD_PROJECT_ID_DEV: ${{ secrets.GCLOUD_PROJECT_ID }} + # Checkout only feeds the Prisma vulnerability check below, which is disabled - skip it too + # (its RELEASE_GITHUB_TOKEN checkout was failing with no consumer left to justify fixing it) +# - name: Checkout SolaceDev/maas-build-actions +# if: ${{ startsWith(github.ref_name, 'dev1.') && (github.ref_name != 'main') }} +# uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4 +# with: +# repository: SolaceDev/maas-build-actions +# ref: refs/heads/master +# token: ${{ secrets.RELEASE_GITHUB_TOKEN }} +# persist-credentials: false +# path: maas-build-actions - name: Build image and push GitHub Container Registry run: make docker-push @@ -174,7 +136,7 @@ jobs: - name: Run Trivy vulnerability scanner - uses: aquasecurity/trivy-action@6c175e9c4083a92bbca2f9724c8a5e33bc2d97a5 # v0.30.0 + uses: aquasecurity/trivy-action@ed142fd0673e97e23eac54620cfb913e5ce36c25 # v0.36.0 if: ${{ startsWith(github.ref_name, 'dev1.') && (github.ref_name != 'main') }} with: image-ref: ghcr.io/solacedev/${{ env.IMAGE_NAME }}:${{ env.VERSION }} @@ -191,7 +153,7 @@ jobs: trivy-results.sarif - name: Run Trivy vulnerability scanner - uses: aquasecurity/trivy-action@6c175e9c4083a92bbca2f9724c8a5e33bc2d97a5 # v0.30.0 + uses: aquasecurity/trivy-action@ed142fd0673e97e23eac54620cfb913e5ce36c25 # v0.36.0 if: ${{ startsWith(github.ref_name, 'dev1.') && (github.ref_name != 'main') }} with: image-ref: ghcr.io/solacedev/${{ env.IMAGE_NAME }}:${{ env.VERSION }} diff --git a/.github/workflows/main-branch-only.yml b/.github/workflows/main-branch-only.yml index fe91275..df9ba4a 100644 --- a/.github/workflows/main-branch-only.yml +++ b/.github/workflows/main-branch-only.yml @@ -9,25 +9,50 @@ jobs: test: name: Deploy Operator then deploy broker runs-on: ubuntu-latest + permissions: + contents: 'read' + id-token: 'write' steps: + - name: Set env + run: | + echo "TESTNAMESPACE=main-branch-$(date +%s)" >> $GITHUB_ENV + - name: Check out code uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4 - - name: Create k8s Kind Cluster - uses: helm/kind-action@d08cf6ff1575077dee99962540d77ce91c62387d # v1.3.0 + - id: 'auth' + name: 'Authenticate to Google Cloud' + uses: google-github-actions/auth@ef5d53e30bbcd8d0836f4288f5e50ff3e086997d # v1.0.0 + with: + service_account: ${{ secrets.GCP_SERVICE_ACCOUNT }} + workload_identity_provider: ${{ secrets.GCP_WORKLOAD_IDENTITY_PROVIDER }} + access_token_lifetime: 600s + + - name: Use the GKE Autopilot test cluster + uses: google-github-actions/get-gke-credentials@ef10cc0013c465a6ea0b8e36c24064576ec25f87 # v1.0.0 + with: + cluster_name: 'dev-integrationtesting' + location: 'us-central1' - name: Testing operator deployment run: | kubectl cluster-info - kubectl get pods -n kube-system echo "current-context:" $(kubectl config current-context) - echo "environment-kubeconfig:" ${KUBECONFIG} - kubectl apply -f deploy/deploy.yaml - kubectl rollout status deployment pubsubplus-eventbroker-operator -n pubsubplus-operator-system --timeout=30s + for i in {1..3}; do + kubectl apply -f deploy/deploy.yaml + kubectl rollout status deployment pubsubplus-eventbroker-operator -n pubsubplus-operator-system --timeout=240s + if [ $? -eq 0 ]; then + break + else + echo "Rollout status check failed, retrying in 20 seconds..." + sleep 20 + fi + done kubectl get crd | grep eventbrokers - name: Deploy and test broker - nonHA Minimal run: | + kubectl create ns $TESTNAMESPACE && kubectl config set-context --current --namespace=$TESTNAMESPACE echo " apiVersion: pubsubplus.solace.com/v1beta1 kind: PubSubPlusEventBroker @@ -38,7 +63,15 @@ jobs: # Then apply it kubectl apply -f developer.yaml | grep "test-broker created" sleep 25 ; kubectl get all - kubectl wait pods --selector app.kubernetes.io/instance=test-broker --for condition=Ready --timeout=120s + for i in {1..3}; do + kubectl wait pods --selector app.kubernetes.io/instance=test-broker --for condition=Ready --timeout=300s + if [ $? -eq 0 ]; then + break + else + echo "Waiting for pods failed, retrying in 15 seconds..." + sleep 15 + fi + done kubectl get po --show-labels | grep test-broker | grep "1/1" kubectl get po --show-labels | grep test-broker | grep active=true kubectl get sts | grep test-broker @@ -48,6 +81,8 @@ jobs: tar -xvf SDKPERF_C_LINUX64 pubSubTools/sdkperf_c -cip=tcp://localhost:55555 -mn=1000 -mr=0 -ptl=t1 -stl=t1 | grep "Total Messages" - - name: Delete broker + - name: Delete broker deployment + if: always() run: | - kubectl delete eventbroker test-broker | grep deleted \ No newline at end of file + kubectl delete eventbroker test-broker --ignore-not-found | grep deleted || true + kubectl delete ns $TESTNAMESPACE --ignore-not-found \ No newline at end of file diff --git a/.github/workflows/prep-release.yml b/.github/workflows/prep-release.yml index 1990790..02256d4 100644 --- a/.github/workflows/prep-release.yml +++ b/.github/workflows/prep-release.yml @@ -4,7 +4,7 @@ on: release_tag: description: 'Release tag' required: true - default: '1.4.1' + default: '1.4.2' prep_internal_release: # Need to distinguish between internal and external releases # Internal release: Will use default internal location for created images (ghcr.io) and will tag and push operator candidate there @@ -24,7 +24,7 @@ jobs: - name: Set up Go uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5 with: - go-version: 1.24.2 + go-version: 1.26.5 - name: Login to Github Packages uses: docker/login-action@465a07811f14bebb1938fbed4728c6a1ff8901fc # v2 diff --git a/.github/workflows/vulncheck_periodic.yml b/.github/workflows/vulncheck_periodic.yml index d2174ec..78ad3c5 100644 --- a/.github/workflows/vulncheck_periodic.yml +++ b/.github/workflows/vulncheck_periodic.yml @@ -4,7 +4,7 @@ on: - cron: '0 */ * * *' env: - VERSION: 1.4.1 + VERSION: 1.4.2 IMAGE_NAME: pubsubplus-eventbroker-operator VAULT_ADDR: ${{ secrets.VAULT_ADDR }} GCLOUD_PROJECT_ID_DEV: ${{ secrets.GCLOUD_PROJECT_ID }} @@ -23,11 +23,12 @@ jobs: contents: read actions: read id-token: write + packages: write steps: - name: Set up Go uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5 with: - go-version: "1.24.2" + go-version: "1.26.5" - name: Check out code uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4 @@ -37,7 +38,7 @@ jobs: with: registry: ghcr.io username: ${{ github.actor }} - password: ${{ secrets.RELEASE_GITHUB_TOKEN }} + password: ${{ secrets.GITHUB_TOKEN }} - name: Set up Docker Buildx id: buildx @@ -65,7 +66,7 @@ jobs: secrets: | secret/data/development/gcp-gcr GCP_SERVICE_ACCOUNT | GCP_DEV_SERVICE_ACCOUNT env: - VERSION: 1.4.1 + VERSION: 1.4.2 IMAGE_NAME: pubsubplus-eventbroker-operator VAULT_ADDR: ${{ secrets.VAULT_ADDR }} GCLOUD_PROJECT_ID_DEV: ${{ secrets.GCLOUD_PROJECT_ID }} @@ -85,7 +86,7 @@ jobs: gcr.io/${{ env.GCLOUD_PROJECT_ID_DEV }}/${{ env.IMAGE_NAME }}:${{ env.VERSION }} push: true env: - VERSION: 1.4.1 + VERSION: 1.4.2 IMAGE_NAME: pubsubplus-eventbroker-operator VAULT_ADDR: ${{ secrets.VAULT_ADDR }} GCLOUD_PROJECT_ID_DEV: ${{ secrets.GCLOUD_PROJECT_ID }} @@ -103,7 +104,7 @@ jobs: run: make docker-push - name: Run Trivy vulnerability scanner - uses: aquasecurity/trivy-action@6c175e9c4083a92bbca2f9724c8a5e33bc2d97a5 # v0.30.0 + uses: aquasecurity/trivy-action@ed142fd0673e97e23eac54620cfb913e5ce36c25 # v0.36.0 with: image-ref: ghcr.io/solacedev/${{ env.IMAGE_NAME }}:${{ env.VERSION }} format: 'sarif' @@ -118,7 +119,7 @@ jobs: trivy-results.sarif - name: Run Trivy vulnerability scanner - uses: aquasecurity/trivy-action@6c175e9c4083a92bbca2f9724c8a5e33bc2d97a5 # v0.30.0 + uses: aquasecurity/trivy-action@ed142fd0673e97e23eac54620cfb913e5ce36c25 # v0.36.0 with: image-ref: ghcr.io/solacedev/${{ env.IMAGE_NAME }}:${{ env.VERSION }} format: 'sarif' diff --git a/Dockerfile b/Dockerfile index fee6a26..21d1a64 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ # Build the manager binary -FROM golang:1.24.2 as builder +FROM golang:1.26.5 as builder WORKDIR /workspace # Copy the Go Modules manifests @@ -19,13 +19,16 @@ RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -o manager main.go # Use distroless as minimal base image to package the manager binary # Refer to https://github.com/GoogleContainerTools/distroless for more details -FROM registry.access.redhat.com/ubi9/ubi-minimal:9.6-1754000177 +FROM registry.access.redhat.com/ubi10/ubi-minimal:10.2-1785778687 + +RUN microdnf update -y --nodocs && \ + microdnf clean all LABEL name="solace/pubsubplus-eventbroker-operator" LABEL maintainer="Solace Corporation" LABEL vendor="Solace Corporation" -LABEL version="1.4.1" -LABEL release="1.4.1" +LABEL version="1.4.2" +LABEL release="1.4.2" LABEL summary="Solace PubSub+ Event Broker Kubernetes Operator" LABEL description="The Solace PubSub+ Event Broker Kubernetes Operator deploys and manages the lifecycle of PubSub+ Event Brokers" diff --git a/Makefile b/Makefile index 8e1bfcc..3e16940 100644 --- a/Makefile +++ b/Makefile @@ -3,7 +3,7 @@ # To re-generate a bundle for another specific version without changing the standard setup, you can: # - use the VERSION as arg of the bundle target (e.g make bundle VERSION=0.0.2) # - use environment variables to overwrite this value (e.g export VERSION=0.0.2) -VERSION ?= 1.4.1 +VERSION ?= 1.4.2 # API_VERSION defines the API version for the PubSubPlusEventBroker CRD API_VERSION ?= v1beta1 @@ -182,7 +182,7 @@ ENVTEST ?= $(LOCALBIN)/setup-envtest ## Tool Versions KUSTOMIZE_VERSION ?= v4.5.7 -CONTROLLER_TOOLS_VERSION ?= v0.14.0 +CONTROLLER_TOOLS_VERSION ?= v0.17.0 KUSTOMIZE_INSTALL_SCRIPT ?= "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh" .PHONY: kustomize diff --git a/api/v1beta1/eventbroker_types.go b/api/v1beta1/eventbroker_types.go index 600b7a5..1b3ad8e 100644 --- a/api/v1beta1/eventbroker_types.go +++ b/api/v1beta1/eventbroker_types.go @@ -152,6 +152,7 @@ type BrokerPort struct { // Unique name for the port that can be referred to by services. Name string `json:"name"` //+kubebuilder:validation:Enum=TCP;UDP;SCTP + //+kubebuilder:default:=TCP // Protocol for port. Must be UDP, TCP, or SCTP. Protocol corev1.Protocol `json:"protocol"` //+kubebuilder:validation:Type:=number @@ -500,6 +501,7 @@ type MonitoringMetricsEndpoint struct { ListenTLS bool `json:"listenTLS"` //+optional //+kubebuilder:validation:Enum=TCP;UDP;SCTP + //+kubebuilder:default:=TCP // Protocol for port. Must be UDP, TCP, or SCTP. Protocol corev1.Protocol `json:"protocol"` //+optional diff --git a/bundle/manifests/pubsubplus-eventbroker-operator.clusterserviceversion.yaml b/bundle/manifests/pubsubplus-eventbroker-operator.clusterserviceversion.yaml index cbbc1e0..4cf7f59 100644 --- a/bundle/manifests/pubsubplus-eventbroker-operator.clusterserviceversion.yaml +++ b/bundle/manifests/pubsubplus-eventbroker-operator.clusterserviceversion.yaml @@ -20,7 +20,7 @@ metadata: certified: "true" com.redhat.delivery.operator.bundle: "true" com.redhat.openshift.versions: v4.10 - containerImage: docker.io/solace/pubsubplus-eventbroker-operator:1.4.1 + containerImage: docker.io/solace/pubsubplus-eventbroker-operator:1.4.2 createdAt: "2025-07-31T19:48:36Z" description: The Solace PubSub+ Event Broker Operator deploys and manages the lifecycle of PubSub+ Event Brokers @@ -29,7 +29,7 @@ metadata: operators.operatorframework.io/project_layout: go.kubebuilder.io/v3 repository: https://github.com/SolaceProducts/pubsubplus-kubernetes-quickstart support: Solace Products - name: pubsubplus-eventbroker-operator.v1.4.1 + name: pubsubplus-eventbroker-operator.v1.4.2 namespace: placeholder spec: apiservicedefinitions: {} @@ -296,7 +296,7 @@ spec: valueFrom: fieldRef: fieldPath: metadata.annotations['olm.targetNamespaces'] - image: docker.io/solace/pubsubplus-eventbroker-operator:1.4.1 + image: docker.io/solace/pubsubplus-eventbroker-operator:1.4.2 imagePullPolicy: Always livenessProbe: httpGet: @@ -411,4 +411,4 @@ spec: provider: name: Solace Corporation url: www.solace.com - version: 1.4.1 \ No newline at end of file + version: 1.4.2 \ No newline at end of file diff --git a/bundle/manifests/pubsubplus.solace.com_pubsubpluseventbrokers.yaml b/bundle/manifests/pubsubplus.solace.com_pubsubpluseventbrokers.yaml index 50073f0..2864bb0 100644 --- a/bundle/manifests/pubsubplus.solace.com_pubsubpluseventbrokers.yaml +++ b/bundle/manifests/pubsubplus.solace.com_pubsubpluseventbrokers.yaml @@ -4,7 +4,7 @@ metadata: annotations: controller-gen.kubebuilder.io/version: v0.14.0 labels: - app.kubernetes.io/version: v1.4.1 + app.kubernetes.io/version: v1.4.2 name: pubsubpluseventbrokers.pubsubplus.solace.com spec: group: pubsubplus.solace.com diff --git a/config/crd/bases/pubsubplus.solace.com_pubsubpluseventbrokers.yaml b/config/crd/bases/pubsubplus.solace.com_pubsubpluseventbrokers.yaml index e3dabb3..fdc58dd 100644 --- a/config/crd/bases/pubsubplus.solace.com_pubsubpluseventbrokers.yaml +++ b/config/crd/bases/pubsubplus.solace.com_pubsubpluseventbrokers.yaml @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.14.0 + controller-gen.kubebuilder.io/version: v0.17.0 name: pubsubpluseventbrokers.pubsubplus.solace.com spec: group: pubsubplus.solace.com @@ -136,7 +136,6 @@ spec: description: |- Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - TODO: Add other useful fields. apiVersion, kind, uid? type: string type: object x-kubernetes-map-type: atomic @@ -202,7 +201,6 @@ spec: description: |- Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - TODO: Add other useful fields. apiVersion, kind, uid? type: string type: object x-kubernetes-map-type: atomic @@ -1626,16 +1624,8 @@ spec: description: Conditions provide information about the observed status of the deployment items: - description: "Condition contains details for one aspect of the current - state of this API Resource.\n---\nThis struct is intended for - direct use as an array at the field path .status.conditions. For - example,\n\n\n\ttype FooStatus struct{\n\t // Represents the - observations of a foo's current state.\n\t // Known .status.conditions.type - are: \"Available\", \"Progressing\", and \"Degraded\"\n\t // - +patchMergeKey=type\n\t // +patchStrategy=merge\n\t // +listType=map\n\t - \ // +listMapKey=type\n\t Conditions []metav1.Condition `json:\"conditions,omitempty\" - patchStrategy:\"merge\" patchMergeKey:\"type\" protobuf:\"bytes,1,rep,name=conditions\"`\n\n\n\t - \ // other fields\n\t}" + description: Condition contains details for one aspect of the current + state of this API Resource. properties: lastTransitionTime: description: |- @@ -1676,12 +1666,7 @@ spec: - Unknown type: string type: - description: |- - type of condition in CamelCase or in foo.example.com/CamelCase. - --- - Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be - useful (see .node.status.conditions), the ability to deconflict is important. - The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt) + description: type of condition in CamelCase or in foo.example.com/CamelCase. maxLength: 316 pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ type: string diff --git a/config/manager/kustomization.yaml b/config/manager/kustomization.yaml index b8e940c..f81bf75 100644 --- a/config/manager/kustomization.yaml +++ b/config/manager/kustomization.yaml @@ -11,4 +11,4 @@ kind: Kustomization images: - name: controller newName: ghcr.io/solacedev/pubsubplus-eventbroker-operator - newTag: 1.4.1 + newTag: 1.4.2 diff --git a/config/manifests/bases/pubsubplus-eventbroker-operator.clusterserviceversion.yaml b/config/manifests/bases/pubsubplus-eventbroker-operator.clusterserviceversion.yaml index f6f243d..dbd2ff8 100644 --- a/config/manifests/bases/pubsubplus-eventbroker-operator.clusterserviceversion.yaml +++ b/config/manifests/bases/pubsubplus-eventbroker-operator.clusterserviceversion.yaml @@ -8,7 +8,7 @@ metadata: certified: "true" com.redhat.delivery.operator.bundle: "true" com.redhat.openshift.versions: v4.10 - containerImage: docker.io/solace/pubsubplus-eventbroker-operator:v1.4.1 + containerImage: docker.io/solace/pubsubplus-eventbroker-operator:v1.4.2 createdAt: "2023-03-31T12:00:00.000Z" description: The Solace PubSub+ Event Broker Operator deploys and manages the lifecycle of PubSub+ Event Brokers diff --git a/config/rbac/role.yaml b/config/rbac/role.yaml index 06c5786..f0bee13 100644 --- a/config/rbac/role.yaml +++ b/config/rbac/role.yaml @@ -8,45 +8,10 @@ rules: - "" resources: - configmaps - verbs: - - create - - delete - - get - - list - - patch - - update - - watch -- apiGroups: - - "" - resources: - - events - verbs: - - create - - patch -- apiGroups: - - "" - resources: - - namespaces - verbs: - - get - - list - - watch -- apiGroups: - - "" - resources: - pods - verbs: - - create - - delete - - get - - list - - patch - - update - - watch -- apiGroups: - - "" - resources: - secrets + - serviceaccounts + - services verbs: - create - delete @@ -58,42 +23,22 @@ rules: - apiGroups: - "" resources: - - serviceaccounts + - events verbs: - create - - delete - - get - - list - patch - - update - - watch - apiGroups: - "" resources: - - services + - namespaces verbs: - - create - - delete - get - list - - patch - - update - watch - apiGroups: - apps resources: - deployments - verbs: - - create - - delete - - get - - list - - patch - - update - - watch -- apiGroups: - - apps - resources: - statefulsets verbs: - create @@ -145,17 +90,6 @@ rules: - rbac.authorization.k8s.io resources: - rolebindings - verbs: - - create - - delete - - get - - list - - patch - - update - - watch -- apiGroups: - - rbac.authorization.k8s.io - resources: - roles verbs: - create diff --git a/controllers/prometheus_exporter_test.go b/controllers/prometheus_exporter_test.go index 6d6b948..095b1ef 100644 --- a/controllers/prometheus_exporter_test.go +++ b/controllers/prometheus_exporter_test.go @@ -117,7 +117,7 @@ var _ = Describe("Monitoring Exporter Test", func() { monitoringExporter := getObjectName("PrometheusExporterDeployment", brokerMNonHA.Name) err := k8sClient.Get(ctx, types.NamespacedName{Name: monitoringExporter, Namespace: brokerMNonHA.Namespace}, monitoringDeployment) return err == nil - }).WithTimeout(90 * time.Second).Should(BeTrue()) + }).WithTimeout(200 * time.Second).Should(BeTrue()) //delete broker Expect(k8sClient.Delete(ctx, brokerMNonHA)).Should(Succeed()) diff --git a/controllers/statefulset_test.go b/controllers/statefulset_test.go index 4150ea4..52255ff 100644 --- a/controllers/statefulset_test.go +++ b/controllers/statefulset_test.go @@ -236,6 +236,19 @@ var _ = Describe("Statefulset test", func() { }) By("set up when in prod-level HA mode", func() { + tlsSecretProdHA := &corev1.Secret{ + ObjectMeta: metav1.ObjectMeta{ + Name: "s-test-ha-prod-tls-secret", + Namespace: namespace, + }, + Data: map[string][]byte{ + "tls.crt": []byte("dummy"), + "tls.key": []byte("dummy"), + }, + Type: corev1.SecretTypeTLS, + } + Expect(k8sClient.Create(ctx, tlsSecretProdHA)).Should(Succeed()) + brokerHA := pubsubplus.PubSubPlusEventBroker{ ObjectMeta: metav1.ObjectMeta{ Name: broker_ha_prod_level_config, @@ -273,7 +286,10 @@ var _ = Describe("Statefulset test", func() { MonitorNodeStorageSize: "0", }, BrokerTLS: pubsubplus.BrokerTLS{ - Enabled: true, + Enabled: true, + ServerTLsConfigSecret: tlsSecretProdHA.Name, + TLSCertKeyName: "tls.crt", + TLSCertName: "tls.key", }, Service: pubsubplus.Service{ ServiceType: corev1.ServiceTypeClusterIP, @@ -312,10 +328,24 @@ var _ = Describe("Statefulset test", func() { //delete broker Expect(k8sClient.Delete(ctx, &brokerHA)).To(Succeed()) + Expect(k8sClient.Delete(ctx, tlsSecretProdHA)).Should(Succeed()) }) By("set up when in prod-level HA mode with Node Config", func() { + tlsSecretProdHANodeConfig := &corev1.Secret{ + ObjectMeta: metav1.ObjectMeta{ + Name: "s-test-ha-prod-nodeconfig-tls-secret", + Namespace: namespace, + }, + Data: map[string][]byte{ + "tls.crt": []byte("dummy"), + "tls.key": []byte("dummy"), + }, + Type: corev1.SecretTypeTLS, + } + Expect(k8sClient.Create(ctx, tlsSecretProdHANodeConfig)).Should(Succeed()) + brokerHA := pubsubplus.PubSubPlusEventBroker{ ObjectMeta: metav1.ObjectMeta{ Name: broker_ha_prod_level_config, @@ -362,7 +392,7 @@ var _ = Describe("Statefulset test", func() { Tolerations: []corev1.Toleration{ { Key: "key1", - Operator: corev1.TolerationOperator("Equals"), + Operator: corev1.TolerationOpEqual, Value: "value1", Effect: corev1.TaintEffect("NoSchedule"), }, @@ -371,7 +401,10 @@ var _ = Describe("Statefulset test", func() { }, }, BrokerTLS: pubsubplus.BrokerTLS{ - Enabled: true, + Enabled: true, + ServerTLsConfigSecret: tlsSecretProdHANodeConfig.Name, + TLSCertKeyName: "tls.crt", + TLSCertName: "tls.key", }, Service: pubsubplus.Service{ ServiceType: corev1.ServiceTypeClusterIP, @@ -410,6 +443,7 @@ var _ = Describe("Statefulset test", func() { //delete broker Expect(k8sClient.Delete(ctx, &brokerHA)).To(Succeed()) + Expect(k8sClient.Delete(ctx, tlsSecretProdHANodeConfig)).Should(Succeed()) }) diff --git a/controllers/suite_test.go b/controllers/suite_test.go index 0cbb906..c9108f6 100644 --- a/controllers/suite_test.go +++ b/controllers/suite_test.go @@ -21,6 +21,8 @@ import ( pubsubplus "github.com/SolaceProducts/pubsubplus-operator/api/v1beta1" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/client-go/kubernetes" "k8s.io/client-go/kubernetes/scheme" "path/filepath" @@ -31,6 +33,7 @@ import ( "sigs.k8s.io/controller-runtime/pkg/log/zap" "sigs.k8s.io/controller-runtime/pkg/metrics/server" "testing" + "time" //+kubebuilder:scaffold:imports //+kubebuilder:scaffold:imports ) @@ -79,6 +82,37 @@ var _ = BeforeSuite(func() { //+kubebuilder:scaffold:scheme + By("cleaning up any stale PubSubPlusEventBroker resources left behind by a previous run") + cleanupClient, err := runtimeClient.New(cfg, runtimeClient.Options{Scheme: scheme.Scheme}) + Expect(err).NotTo(HaveOccurred()) + staleBrokers := &pubsubplus.PubSubPlusEventBrokerList{} + Expect(cleanupClient.List(ctx, staleBrokers, runtimeClient.InNamespace("default"))).To(Succeed()) + for i := range staleBrokers.Items { + Expect(runtimeClient.IgnoreNotFound(cleanupClient.Delete(ctx, &staleBrokers.Items[i]))).To(Succeed()) + } + Eventually(func() int { + remaining := &pubsubplus.PubSubPlusEventBrokerList{} + Expect(cleanupClient.List(ctx, remaining, runtimeClient.InNamespace("default"))).To(Succeed()) + return len(remaining.Items) + }).WithTimeout(60 * time.Second).WithPolling(2 * time.Second).Should(Equal(0)) + + By("cleaning up any stale Secrets/ConfigMaps left behind by a previous run") + staleSecretNames := []string{ + "monitoring-tls", "monitoring-user-secret", "monitoring-tls-new-config", + "monitoring-ds-secret", "secret-s-tls", "broker-sample-secret", + "preshared-sample-secret", "admin-sample-secret", "sample-secret", + "s-test-ha-prod-tls-secret", "s-test-ha-prod-nodeconfig-tls-secret", + } + for _, name := range staleSecretNames { + secret := &corev1.Secret{ObjectMeta: metav1.ObjectMeta{Name: name, Namespace: "default"}} + Expect(runtimeClient.IgnoreNotFound(cleanupClient.Delete(ctx, secret))).To(Succeed()) + } + staleConfigMapNames := []string{"sample-config"} + for _, name := range staleConfigMapNames { + cm := &corev1.ConfigMap{ObjectMeta: metav1.ObjectMeta{Name: name, Namespace: "default"}} + Expect(runtimeClient.IgnoreNotFound(cleanupClient.Delete(ctx, cm))).To(Succeed()) + } + clientSet, err = kubernetes.NewForConfig(cfg) Expect(err).NotTo(HaveOccurred()) diff --git a/deploy/deploy.yaml b/deploy/deploy.yaml index 6987659..22e2e95 100644 --- a/deploy/deploy.yaml +++ b/deploy/deploy.yaml @@ -1994,7 +1994,7 @@ spec: env: - name: WATCH_NAMESPACE value: "" - image: docker.io/solace/pubsubplus-eventbroker-operator:1.4.1 + image: docker.io/solace/pubsubplus-eventbroker-operator:1.4.2 imagePullPolicy: Always livenessProbe: httpGet: diff --git a/go.mod b/go.mod index 1940630..05efb5b 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/SolaceProducts/pubsubplus-operator -go 1.24.2 +go 1.26 require ( github.com/google/gnostic-models v0.6.8 // indirect @@ -48,13 +48,13 @@ require ( github.com/spf13/pflag v1.0.5 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.26.0 - golang.org/x/net v0.23.0 // indirect + golang.org/x/net v0.56.0 // indirect golang.org/x/oauth2 v0.27.0 // indirect - golang.org/x/sys v0.18.0 // indirect - golang.org/x/term v0.18.0 // indirect - golang.org/x/text v0.14.0 // indirect + golang.org/x/sys v0.46.0 // indirect + golang.org/x/term v0.44.0 // indirect + golang.org/x/text v0.39.0 // indirect golang.org/x/time v0.3.0 // indirect - golang.org/x/tools v0.17.0 // indirect + golang.org/x/tools v0.47.0 // indirect gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect google.golang.org/protobuf v1.33.0 // indirect gopkg.in/inf.v0 v0.9.1 // indirect diff --git a/go.sum b/go.sum index d744caa..7dcb900 100644 --- a/go.sum +++ b/go.sum @@ -126,8 +126,8 @@ golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.23.0 h1:7EYJ93RZ9vYSZAIb2x3lnuvqO5zneoD6IvWjuhfxjTs= -golang.org/x/net v0.23.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg= +golang.org/x/net v0.56.0 h1:Rw8j/hFzGvJUZwNBXnAtf5sVDVt+65SK2C7IxCxZt5o= +golang.org/x/net v0.56.0/go.mod h1:D3Ku6r+V6JROoZK144D2XfMHFcMq/0zSfLelVTCFKec= golang.org/x/oauth2 v0.27.0 h1:da9Vo7/tDv5RH/7nZDz1eMGS/q1Vv1N/7FCrBhI9I3M= golang.org/x/oauth2 v0.27.0/go.mod h1:onh5ek6nERTohokkhCD/y2cV4Do3fxFHFuAejCkRWT8= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -137,22 +137,22 @@ golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5h golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4= -golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/term v0.18.0 h1:FcHjZXDMxI8mM3nwhX9HlKop4C0YQvCVCdwYl2wOtE8= -golang.org/x/term v0.18.0/go.mod h1:ILwASektA3OnRv7amZ1xhE/KTR+u50pbXfZ03+6Nx58= +golang.org/x/sys v0.46.0 h1:noSf2Fq6F8DBgS+LysIkx7rIExoNHJsxOAtPp4rthXw= +golang.org/x/sys v0.46.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw= +golang.org/x/term v0.44.0 h1:0rLvDRCtNj0gZkyIXhCyOb2OAzEhLVqc4B+hrsBhrmc= +golang.org/x/term v0.44.0/go.mod h1:7ze4MdzUzLXpSAoFP1H0bOI9aXDqveSvatT5vKcFh2Y= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= -golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +golang.org/x/text v0.39.0 h1:UbZz4pLOvn600D6Oh6GGEI6VAmndrEBLv8/6BEXzyus= +golang.org/x/text v0.39.0/go.mod h1:3UwRclnC2g0TU9x8PZiyfOajCd1zaUNHF9cvqcQZ+ZM= golang.org/x/time v0.3.0 h1:rg5rLMjNzMS1RkNLzCG38eapWhnYLFYXDXj2gOlr8j4= golang.org/x/time v0.3.0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.17.0 h1:FvmRgNOcs3kOa+T20R1uhfP9F6HgG2mfxDv1vrx1Htc= -golang.org/x/tools v0.17.0/go.mod h1:xsh6VxdV005rRVaS6SSAf9oiAqljS7UZUacMZ8Bnsps= +golang.org/x/tools v0.47.0 h1:7Kn5x/d1svx/PzryTsqeoZN4TZwqeH5pGWjefhLi/1Q= +golang.org/x/tools v0.47.0/go.mod h1:dFHnyTvFWY212G+h7ZY4Vsp/K3U4/7W9TyVaAul8uCA= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/version.go b/version.go index ef56609..b3e4b5b 100644 --- a/version.go +++ b/version.go @@ -15,4 +15,4 @@ // limitations under the License. package main -const version = "1.4.1" +const version = "1.4.2"