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

Adding a webhook to externalproxy #1

Merged
merged 1 commit into from
Dec 22, 2024
Merged
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
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Build the manager binary
FROM golang:1.22 AS builder
FROM golang:1.23 AS builder
ARG TARGETOS
ARG TARGETARCH

Expand Down
10 changes: 5 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ manifests: controller-gen ## Generate WebhookConfiguration, ClusterRole and Cust
$(CONTROLLER_GEN) rbac:roleName=manager-role crd webhook paths="./..." output:crd:artifacts:config=config/crd/bases

.PHONY: generate
generate: controller-gen ## Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations.
generate: controller-gen manifests ## Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations.
$(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./..."

.PHONY: fmt
Expand Down Expand Up @@ -166,10 +166,10 @@ ENVTEST ?= $(LOCALBIN)/setup-envtest-$(ENVTEST_VERSION)
GOLANGCI_LINT = $(LOCALBIN)/golangci-lint-$(GOLANGCI_LINT_VERSION)

## Tool Versions
KUSTOMIZE_VERSION ?= v5.4.1
CONTROLLER_TOOLS_VERSION ?= v0.15.0
ENVTEST_VERSION ?= release-0.18
GOLANGCI_LINT_VERSION ?= v1.57.2
KUSTOMIZE_VERSION ?= v5.5.0
CONTROLLER_TOOLS_VERSION ?= v0.16.4
ENVTEST_VERSION ?= release-0.19
GOLANGCI_LINT_VERSION ?= v1.61.0

.PHONY: kustomize
kustomize: $(KUSTOMIZE) ## Download kustomize locally if necessary.
Expand Down
7 changes: 7 additions & 0 deletions PROJECT
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
domain: laboys.org
layout:
- go.kubebuilder.io/v4
multigroup: true
plugins:
helm.kubebuilder.io/v1-alpha: {}
projectName: mobius
repo: github.com/wjiec/mobius
resources:
Expand All @@ -17,4 +20,8 @@ resources:
kind: ExternalProxy
path: github.com/wjiec/mobius/api/networking/v1alpha1
version: v1alpha1
webhooks:
defaulting: true
validation: true
webhookVersion: v1
version: "3"
35 changes: 18 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
# mobius
[![Go Report Card](https://goreportcard.com/badge/github.com/wjiec/mobius)](https://goreportcard.com/report/github.com/wjiec/mobius)
[![License](https://img.shields.io/badge/license-Apache%202-4EB1BA.svg)](https://www.apache.org/licenses/LICENSE-2.0.html)
[![CI](https://github.com/wjiec/mobius/actions/workflows/ci.yaml/badge.svg)](https://github.com/wjiec/mobius/actions/workflows/ci.yaml)


## Introduction

Mobius aims to better orchestrate services in a personal Homelab through kubernetes.

**Note: At the moment mobius is only aiming to serve my own Homelab needs and is in the
development phase, so the design and implementation logic will be changed very frequently.
If you are using the project or are interested in it, any suggestions or questions are welcome
(of course if you have a good idea and are also willing to provide PR, that's also very welcome!).**


## Getting Started

Expand All @@ -18,14 +24,20 @@ If you have Helm, you can deploy the mobius with the following command:
```bash
helm upgrade --install mobius-manager mobius-manager \
--repo https://wjiec.github.io/mobius \
--namespace mobius-manager --create-namespace
--namespace mobius-system --create-namespace
```

It will install the mobius in the mobius-manager namespace, creating that namespace if it doesn't already exist.
It will install the mobius in the mobius-system namespace, creating that namespace if it doesn't already exist.

### ExternalProxy

As the name suggests, ExternalProxy creates a unified abstraction for out-of-cluster services through Kubernetes, allowing
us to create services or Ingresses for these out-of-cluster services as if they were in-cluster resources.

### Configure a ExternalProxy
For example, I have some standalone services on my Homelab (TrueNas, openwrt) or something like that, and I'd like to
provide HTTPS ingress for those services via cert-manager or use names within the cluster to access specific services.

Create this manifests locally and update something to your own.
You can refer to the configuration below and update something to your own.
```yaml
apiVersion: networking.laboys.org/v1alpha1
kind: ExternalProxy
Expand All @@ -38,24 +50,13 @@ spec:
ports:
- name: http
port: 80
service:
type: ClusterIP
ports:
- name: http
port: 80
ingress:
rules:
- host: openwrt.home.lab
http:
paths:
- pathType: ImplementationSpecific
backend:
port:
name: http
tls:
- hosts:
- openwrt.home.lab
secretName: star-home-lab
- openwrt.home.lab
secretName: star-domain-com-tls
```


Expand Down
16 changes: 16 additions & 0 deletions api/networking/types.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/*
Copyright 2024 Jayson Wang.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package networking

const (
Expand Down
Loading
Loading