jenkins-x, kubernetes

Jenkins-X 3 – Setup Google Pub/Sub Topics

Jenkins-X 3 – Setup Google Pub/Sub Topics

When we were using Jenkins-X 2, we employed some ugly hacks just to get the Google Pub/Sub topics setup using some pipeline override. With Jenkins-X 3, the process is a lot simpler and makes more sense.

Pre-requisites

Setup

We need to describe our Google Pub/Sub topic requirements inside our cluster repo so we need to make our changes there (ie: repo name jx3-cluster-dev). Follow the following layout: charts/pubsub-resources/templates

charts
  - pubsub-resources
      - templates
          - staging-events-topic.yaml
      - Chart.yaml

File: staging-events-topic.yaml

apiVersion: pubsub.cnrm.cloud.google.com/v1beta1
kind: PubSubTopic
metadata:
  name: staging-events-topic

File: Chart.yaml

apiVersion: v1
description: A Helm chart for Pub/Sub resources
name: pubsub-resources
version: 0.0.1
appVersion: 0.0.1
icon: https://avatars2.githubusercontent.com/u/47602533
home: https://github.com/cdfoundation/tekton-helm-chart

This is based on this template example Chart.yaml

Reference the charts/pubsub-resources directory in your helmfile.yaml file in the releases: section via…

releases:
  - chart: ./charts/pubsub-resources
    name: pubsub-resources
    namespace: config-connector

Replace config-connector namespace with your namespace you used for ConfigConnector resources.

Deploy

Commit your changes then create a pull request. Wait for the pull request to verify then merge the changes. Once the deployment is done, we can verify if the Pub/Sub topic now exists in our namespace.

kubectl get PubsubTopic -n config-connector

You should get something like this:

NAME                   AGE   READY   STATUS     STATUS AGE
staging-events-topic   69s   True    UpToDate   69s

That’s a nice result!

Trivia: Above response is an actual response when I run the command at unfortunate timing.

That’s it!

Featured image: ThisIsEngineering

No Comments

Leave a reply

Your email address will not be published. Required fields are marked *