Skip to content

Commit

Permalink
chore(rename): Move helm/ingress-controller -> helm/ngrok-operator
Browse files Browse the repository at this point in the history
  • Loading branch information
jonstacks committed Sep 10, 2024
1 parent 4a5e467 commit 2d24958
Show file tree
Hide file tree
Showing 79 changed files with 2,863 additions and 477 deletions.
4 changes: 2 additions & 2 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ PROJECT linguist-generated=true
api/v1alpha1/zz_generated.deepcopy.go linguist-generated=true

# These files are generated by kubebuilder. See Makefile for details.
helm/ingress-controller/templates/crds/** linguist-generated=true
helm/ingress-controller/templates/rbac/role.yaml linguist-generated=true
helm/ngrok-operator/templates/crds/** linguist-generated=true
helm/ngrok-operator/templates/rbac/role.yaml linguist-generated=true
manifest-bundle.yaml linguist-generated=true
4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE/controller_bug_report.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ body:
Thanks for taking the time to fill out this bug report!
Note, you do not need to create an issue if you have a change ready to submit.
You can open a [pull request](https://github.com/ngrok/kubernetes-ingress-controller/pulls) immediately instead.
You can open a [pull request](https://github.com/ngrok/ngrok-operator/pulls) immediately instead.
- type: input
attributes:
label: Kubernetes Version
Expand Down Expand Up @@ -41,7 +41,7 @@ body:
label: Kubernetes Logs
description: We want to see relevant kubernetes logs showing error messages or helpful debugging information
placeholder: >
Run `kubectl logs -l app.kubernetes.io/name=kubernetes-ingress-controller` and copy the output here.
Run `kubectl logs -l app.kubernetes.io/name=ngrok-operator` and copy the output here.
validations:
required: true
- type: textarea
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/helm_bug_report.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ body:
Thanks for taking the time to fill out this bug report!
Note, you do not need to create an issue if you have a change ready to submit.
You can open a [pull request](https://github.com/ngrok/kubernetes-ingress-controller/pulls) immediately instead.
You can open a [pull request](https://github.com/ngrok/ngrok-operator/pulls) immediately instead.
- type: input
attributes:
label: Kubernetes Version
Expand Down
2 changes: 1 addition & 1 deletion .github/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ area/helm-chart:
area/release:
- docs/releases.md
- VERSION
- helm/ingress-controller/Chart.yaml
- helm/ngrok-operator/Chart.yaml

documentation:
- docs/**/*
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ jobs:
with:
filters: |
chartyaml:
- 'helm/ingress-controller/Chart.yaml'
- 'helm/ngrok-operator/Chart.yaml'
charts:
- 'helm/ingress-controller/**'
- 'helm/ngrok-operator/**'
- 'scripts/e2e.sh'
go:
- '**.go'
Expand Down Expand Up @@ -86,7 +86,7 @@ jobs:
context: .
platforms: ${{ steps.buildx-setup.outputs.platforms }}
push: false
tags: ngrok/kubernetes-ingress-controller:latest
tags: ngrok/ngrok-operator:latest

go-mod-tidy:
name: Go Mod Tidy Check
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/docker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
permissions:
contents: read
pull-requests: read
if: github.repository == 'ngrok/kubernetes-ingress-controller'
if: github.repository == 'ngrok/ngrok-operator'
steps:
- name: Checkout repo
uses: actions/checkout@v3
Expand All @@ -39,7 +39,7 @@ jobs:
needs:
- changes
if: |
github.repository == 'ngrok/kubernetes-ingress-controller' &&
github.repository == 'ngrok/ngrok-operator' &&
github.event_name == 'push' &&
github.ref == 'refs/heads/main'
steps:
Expand Down Expand Up @@ -67,15 +67,15 @@ jobs:
context: .
platforms: ${{ steps.buildx-setup.outputs.platforms }}
push: true
tags: ngrok/kubernetes-ingress-controller:latest
tags: ngrok/ngrok-operator:latest
- name: Build and push tag'd docker image
uses: docker/build-push-action@v3
if: ${{ needs.changes.outputs.tag == 'true' }}
with:
context: .
platforms: ${{ steps.buildx-setup.outputs.platforms }}
push: true
tags: ngrok/kubernetes-ingress-controller:${{ steps.extract_tag.outputs.tag }}
tags: ngrok/ngrok-operator:${{ steps.extract_tag.outputs.tag }}
- name: Create GitHub Release
uses: actions/github-script@v6
if: ${{ needs.changes.outputs.tag == 'true' }}
Expand All @@ -86,8 +86,8 @@ jobs:
const release = await github.rest.repos.createRelease({
owner: context.repo.owner,
repo: context.repo.repo,
tag_name: `kubernetes-ingress-controller-${tag}`,
name: `kubernetes-ingress-controller-${tag}`,
tag_name: `ngrok-operator-${tag}`,
name: `ngrok-operator-${tag}`,
body: `${tag}`,
draft: false,
prerelease: false
Expand Down
7 changes: 1 addition & 6 deletions .github/workflows/generate-chart-readme.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,8 @@ jobs:
repository: ${{github.event.pull_request.head.repo.full_name}}
token: ${{ secrets.GITHUB_TOKEN }}
- name: Execute readme-generator-for-helm
working-directory: helm/ingress-controller
working-directory: helm/ngrok-operator
run: |
# Using the Github API to detect the files changed as git merge-base stops working when the branch is behind
# and jitterbit/get-changed-files does not support pull_request_target
URL="https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/files"
files_changed_data=$(curl -s --header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' -X GET -G "$URL")
files_changed="$(echo $files_changed_data | jq -r '.[] | .filename')"
readme-generator --values "values.yaml" --readme "README.md" --schema "/tmp/schema.json"
- name: Push changes
uses: stefanzweifel/git-auto-commit-action@v4
Expand Down
8 changes: 5 additions & 3 deletions .github/workflows/generate-full-install-manifests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ name: 'Generate full install manifests'

on:
push:
# TODO(operator-rename): Change this to main at some point so that we update the manifest bundle.
# This will need to be run post-release.
branches:
- alex/single-manifest-file
# paths:
Expand Down Expand Up @@ -31,9 +33,9 @@ jobs:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Run helm template
run: |
helm template ingress-controller helm/ingress-controller \
-n ngrok-ingress-controller \
--set credentials.secret.name="ngrok-ingress-controller-credentials" > manifest-bundle.yaml
helm template ngrok-operator helm/ngrok-operator \
-n ngrok-operator \
--set credentials.secret.name="ngrok-operator-credentials" > manifest-bundle.yaml
- name: Push changes
uses: stefanzweifel/git-auto-commit-action@v4
with:
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/helm_release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
branches:
- main
paths:
- 'helm/ingress-controller/Chart.yaml'
- 'helm/ngrok-operator/Chart.yaml'

jobs:
changes:
Expand All @@ -17,6 +17,7 @@ jobs:
permissions:
contents: read
pull-requests: read
# TODO(operator-rename): Change this to ngrok/ngrok-operator when we are ready to release the helm chart
if: github.repository == 'ngrok/kubernetes-ingress-controller'
steps:
- name: Checkout repo
Expand All @@ -27,7 +28,7 @@ jobs:
with:
filters: |
charts:
- 'helm/ingress-controller/Chart.yaml'
- 'helm/ngrok-operator/Chart.yaml'
chart:
name: Release Chart
Expand All @@ -36,6 +37,7 @@ jobs:
permissions:
contents: write # need to write releases
needs: [changes]
# TODO(operator-rename): Change this to ngrok/ngrok-operator when we are ready to release the helm chart
if: |
(github.repository == 'ngrok/kubernetes-ingress-controller') &&
(needs.changes.outputs.charts == 'true')
Expand Down
9 changes: 5 additions & 4 deletions .github/workflows/install-relased-helm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
k8s_version: [ 'v1.28.13', 'v1.29.8', 'v1.30.4', 'v1.31.0' ]
max-parallel: 2
env:
NAMESPACE: ngrok-ingress-controller
NAMESPACE: ngrok-operator
steps:
- uses: actions/checkout@v4
- name: Install Helm
Expand All @@ -42,16 +42,17 @@ jobs:
NGROK_AUTHTOKEN: "SOME_AUTHTOKEN" # For now, these don't matter, mainly testing that it pulls the image and can get the CRDs
NGROK_API_KEY: "SOME_API_KEY"
timeout-minutes: 10
# TODO(operator-rename): Change this to ngrok/ngrok-operator when we are ready to release the helm chart
run: |
helm install ngrok-ingress-controller ngrok/kubernetes-ingress-controller \
helm install ngrok-operator ngrok/ngrok-operator \
--namespace $NAMESPACE \
--create-namespace \
--set credentials.apiKey=$NGROK_API_KEY \
--set credentials.authtoken=$NGROK_AUTHTOKEN \
--version ${{ inputs.chart_version }}
- name: Sleep for 30 seconds for startup
run: sleep 30
- name: Report pods # Expected to see the ingress-controller crashlooping. See above comment.
- name: Report pods # Expected to see the operator crashlooping. See above comment.
run: kubectl get pods --all-namespaces
- name: Try to list CRs of the CRDs we installed
run: |
Expand All @@ -60,7 +61,7 @@ jobs:
kubectl get httpsedges.ingress.k8s.ngrok.com
kubectl get tlsedges.ingress.k8s.ngrok.com
kubectl get tcpedges.ingress.k8s.ngrok.com
- name: Show logs of the ingress-controller
- name: Show logs of the ngrok-operator
continue-on-error: true
run: |
kubectl -n $NAMESPACE logs --selector='app.kubernetes.io/component=controller' --tail=100
4 changes: 2 additions & 2 deletions .github/workflows/pr-comments.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ jobs:
with:
filters: |
chartyaml:
- 'helm/ingress-controller/Chart.yaml'
- 'helm/ngrok-operator/Chart.yaml'
charts:
- 'helm/ingress-controller/**'
- 'helm/ngrok-operator/**'
- 'scripts/e2e.sh'
go:
- '**.go'
Expand Down
30 changes: 17 additions & 13 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

# Image URL to use all building/pushing image targets
IMG ?= kubernetes-ingress-controller
IMG ?= ngrok-operator

# ENVTEST_K8S_VERSION refers to the version of kubebuilder assets to be downloaded by envtest binary.
ENVTEST_K8S_VERSION = 1.29.0
Expand All @@ -25,7 +25,7 @@ VERSION = $(shell cat VERSION)

# Tools

HELM_CHART_DIR = ./helm/ingress-controller
HELM_CHART_DIR = ./helm/ngrok-operator
HELM_TEMPLATES_DIR = $(HELM_CHART_DIR)/templates

# Targets
Expand Down Expand Up @@ -58,7 +58,7 @@ preflight: ## Verifies required things like the go version

.PHONY: manifests
manifests: controller-gen ## Generate WebhookConfiguration, ClusterRole and CustomResourceDefinition objects.
$(CONTROLLER_GEN) rbac:roleName=ngrok-ingress-controller-manager-role crd webhook paths="{./api/ingress/v1alpha1/, ./api/ngrok/v1alpha1, ./internal/controller/ingress/, ./internal/controller/ngrok/, ./internal/controller/gateway/}" \
$(CONTROLLER_GEN) rbac:roleName=ngrok-operator-manager-role crd webhook paths="{./api/ingress/v1alpha1/, ./api/ngrok/v1alpha1, ./internal/controller/ingress/, ./internal/controller/ngrok/, ./internal/controller/gateway/}" \
output:crd:artifacts:config=$(HELM_TEMPLATES_DIR)/crds \
output:rbac:artifacts:config=$(HELM_TEMPLATES_DIR)/rbac

Expand Down Expand Up @@ -115,10 +115,14 @@ ifndef ignore-not-found
ignore-not-found = false
endif

KUBE_NAMESPACE ?= ngrok-operator
HELM_RELEASE_NAME ?= ngrok-operator
KUBE_DEPLOYMENT_NAME ?= ngrok-operator-manager

.PHONY: deploy
deploy: _deploy-check-env-vars docker-build manifests kustomize _helm_setup ## Deploy controller to the K8s cluster specified in ~/.kube/config.
helm upgrade ngrok-ingress-controller $(HELM_CHART_DIR) --install \
--namespace ngrok-ingress-controller \
helm upgrade $(HELM_RELEASE_NAME) $(HELM_CHART_DIR) --install \
--namespace $(KUBE_NAMESPACE) \
--create-namespace \
--set image.repository=$(IMG) \
--set image.tag="latest" \
Expand All @@ -129,12 +133,12 @@ deploy: _deploy-check-env-vars docker-build manifests kustomize _helm_setup ## D
--set log.level=debug \
--set log.stacktraceLevel=panic \
--set metaData.env=local,metaData.from=makefile &&\
kubectl rollout restart deployment ngrok-ingress-controller-kubernetes-ingress-controller-manager -n ngrok-ingress-controller
kubectl rollout restart deployment $(KUBE_DEPLOYMENT_NAME) -n $(KUBE_NAMESPACE)

.PHONY: deploy_gateway
deploy_gateway: _deploy-check-env-vars docker-build manifests kustomize _helm_setup ## Deploy controller to the K8s cluster specified in ~/.kube/config.
helm upgrade ngrok-ingress-controller $(HELM_CHART_DIR) --install \
--namespace ngrok-ingress-controller \
helm upgrade $(HELM_RELEASE_NAME) $(HELM_CHART_DIR) --install \
--namespace $(KUBE_NAMESPACE) \
--create-namespace \
--set image.repository=$(IMG) \
--set image.tag="latest" \
Expand All @@ -146,12 +150,12 @@ deploy_gateway: _deploy-check-env-vars docker-build manifests kustomize _helm_se
--set log.stacktraceLevel=panic \
--set metaData.env=local,metaData.from=makefile \
--set useExperimentalGatewayApi=true &&\
kubectl rollout restart deployment ngrok-ingress-controller-kubernetes-ingress-controller-manager -n ngrok-ingress-controller
kubectl rollout restart deployment $(KUBE_DEPLOYMENT_NAME) -n $(KUBE_NAMESPACE)

.PHONY: deploy_with_bindings
deploy_with_bindings: _deploy-check-env-vars docker-build manifests kustomize _helm_setup ## Deploy controller to the K8s cluster specified in ~/.kube/config.
helm upgrade ngrok-ingress-controller $(HELM_CHART_DIR) --install \
--namespace ngrok-ingress-controller \
helm upgrade $(HELM_RELEASE_NAME) $(HELM_CHART_DIR) --install \
--namespace $(KUBE_NAMESPACE) \
--create-namespace \
--set image.repository=$(IMG) \
--set image.tag="latest" \
Expand All @@ -163,7 +167,7 @@ deploy_with_bindings: _deploy-check-env-vars docker-build manifests kustomize _h
--set log.stacktraceLevel=panic \
--set metaData.env=local,metaData.from=makefile \
--set enable-feature-bindings=true &&\
kubectl rollout restart deployment ngrok-ingress-controller-kubernetes-ingress-controller-manager -n ngrok-ingress-controller
kubectl rollout restart deployment $(KUBE_DEPLOYMENT_NAME) -n $(KUBE_NAMESPACE)

.PHONY: _deploy-check-env-vars
_deploy-check-env-vars:
Expand All @@ -176,7 +180,7 @@ endif

.PHONY: undeploy
undeploy: ## Undeploy controller from the K8s cluster specified in ~/.kube/config.
helm uninstall ngrok-ingress-controller
helm uninstall ngrok-operator

##@ Build Dependencies

Expand Down
2 changes: 1 addition & 1 deletion PROJECT

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

8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export NAMESPACE=[YOUR_K8S_NAMESPACE]
export NGROK_AUTHTOKEN=[AUTHTOKEN]
export NGROK_API_KEY=[API_KEY]

helm install ngrok-ingress-controller ngrok/kubernetes-ingress-controller \
helm install ngrok-operator ngrok/ngrok-operator \
--namespace $NAMESPACE \
--create-namespace \
--set credentials.apiKey=$NGROK_API_KEY \
Expand All @@ -78,7 +78,7 @@ kubectl apply -f https://github.com/kubernetes-sigs/gateway-api/releases/downloa
Then, during the helm install set the experimental gateway flag.

```sh
helm install ngrok-ingress-controller ngrok/kubernetes-ingress-controller \
helm install ngrok-operator ngrok/ngrok-operator \
--namespace $NAMESPACE \
--create-namespace \
--set credentials.apiKey=$NGROK_API_KEY \
Expand All @@ -90,8 +90,8 @@ helm install ngrok-ingress-controller ngrok/kubernetes-ingress-controller \
Apply the [sample combined manifest](manifest-bundle.yaml) from our repo:

```sh
kubectl apply -n ngrok-ingress-controller \
-f https://raw.githubusercontent.com/ngrok/kubernetes-ingress-controller/main/manifest-bundle.yaml
kubectl apply -n ngrok-operator \
-f https://raw.githubusercontent.com/ngrok/ngrok-operator/main/manifest-bundle.yaml
```

For a more in-depth installation guide follow our step-by-step [Getting Started](https://ngrok.com/docs/using-ngrok-with/k8s/) guide.
Expand Down
4 changes: 3 additions & 1 deletion cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,13 +118,15 @@ func cmd() *cobra.Command {

c.Flags().StringVar(&opts.metricsAddr, "metrics-bind-address", ":8080", "The address the metric endpoint binds to")
c.Flags().StringVar(&opts.probeAddr, "health-probe-bind-address", ":8081", "The address the probe endpoint binds to.")
c.Flags().StringVar(&opts.electionID, "election-id", "ngrok-ingress-controller-leader", "The name of the configmap that is used for holding the leader lock")
c.Flags().StringVar(&opts.electionID, "election-id", "ngrok-operator-leader", "The name of the configmap that is used for holding the leader lock")
c.Flags().StringVar(&opts.metaData, "metadata", "", "A comma separated list of key value pairs such as 'key1=value1,key2=value2' to be added to ngrok api resources as labels")
c.Flags().StringVar(&opts.region, "region", "", "The region to use for ngrok tunnels")
c.Flags().StringVar(&opts.serverAddr, "server-addr", "", "The address of the ngrok server to use for tunnels")
c.Flags().StringVar(&opts.apiURL, "api-url", "", "The base URL to use for the ngrok api")
// TODO(operator-rename): This probably needs to be on a per controller basis. Each of the controllers will have their own value or we migrate this to k8s.ngrok.com/ngrok-operator.
c.Flags().StringVar(&opts.controllerName, "controller-name", "k8s.ngrok.com/ingress-controller", "The name of the controller to use for matching ingresses classes")
c.Flags().StringVar(&opts.watchNamespace, "watch-namespace", "", "Namespace to watch for Kubernetes resources. Defaults to all namespaces.")
// TODO(operator-rename): Same as above, but for the manager name.
c.Flags().StringVar(&opts.managerName, "manager-name", "ngrok-ingress-controller-manager", "Manager name to identify unique ngrok ingress controller instances")
c.Flags().BoolVar(&opts.useExperimentalGatewayAPI, "use-experimental-gateway-api", false, "sets up experemental gatewayAPI")
c.Flags().StringVar(&opts.clusterDomain, "cluster-domain", "svc.cluster.local", "Cluster domain used in the cluster")
Expand Down
2 changes: 1 addition & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
</a>
</p>

# ngrok Kubernetes Ingress Controller Documentation
# ngrok Kubernetes Operator Documentation

This is the ngrok ingress controller. It can be deployed and operated to a cluster and operated by a team allowing others to create ingress objects to dynamically self service ingress to their apps and services using a shared ngrok account. This is a great way to get started with ngrok and Kubernetes.

Expand Down
Loading

0 comments on commit 2d24958

Please sign in to comment.