feat: initial version

This commit is contained in:
Peter 2022-12-30 15:31:29 +01:00
parent 4c81b50db6
commit 61e2a09dce
Signed by: prskr
GPG key ID: C1DB5D2E8DB512F9
24 changed files with 556 additions and 0 deletions

46
.concourse/pipeline.yml Normal file
View file

@ -0,0 +1,46 @@
---
resource_types:
- name: helm
type: docker-image
source:
repository: ghcr.io/typositoire/concourse-helm3-resource
resources:
- name: inetmock-docs.git
type: git
icon: github
source:
uri: https://code.icb4dc0.de/inetmock/docs.git
- name: caddy-image
type: docker-image
source:
repository: code.icb4dc0.de/prskr/ci-images/caddy
- name: blog-chart
type: helm
source:
cluster_url: ((k8s-credentials.url))
cluster_ca: ((k8s-credentials.ca-crt))
token: ((k8s-credentials.token))
release: docs
namespace: inetmock
jobs:
- name: build
plan:
- get: inetmock-docs.git
trigger: true
- get: caddy-image
trigger: true
- task: build-container-image
file: inetmock-docs.git/.concourse/tasks/image.yml
input_mapping: {repo: inetmock-docs.git}
- put: blog-chart
params:
chart: inetmock-docs.git/deploy/helm
override_values:
- key: image.tag
path: inetmock-docs.git/.git/ref
type: string

View file

@ -0,0 +1,28 @@
---
platform: linux
image_resource:
name: kaniko-debug
type: registry-image
source:
repository: gcr.io/kaniko-project/executor
tag: debug
inputs:
- name: repo
path: .
params:
GITEA_USER: ((gitea-credentials.user))
GITEA_TOKEN: ((gitea-credentials.token))
run:
path: sh
args:
- -ce
- |
echo "{\"auths\": {\"https://code.icb4dc0.de\": {\"auth\" : \"$(printf '%s:%s' $GITEA_USER $GITEA_TOKEN | base64)\" }}}" > /kaniko/.docker/config.json
/kaniko/executor \
--destination code.icb4dc0.de/inetmock/docs:latest \
--destination code.icb4dc0.de/inetmock/docs:$(cat .git/ref) \
--context .

15
Dockerfile Normal file
View file

@ -0,0 +1,15 @@
FROM docker.io/golang:1.19-alpine as builder
WORKDIR /tmp
RUN apk add -U --no-cache hugo git
WORKDIR /src
COPY . /src/
RUN hugo --minify --environment production --config config.toml
FROM code.icb4dc0.de/prskr/ci-images/caddy:latest as final
COPY --from=builder /src/public /usr/share/caddy

6
archetypes/default.md Normal file
View file

@ -0,0 +1,6 @@
---
title: "{{ replace .Name "-" " " | title }}"
date: {{ .Date }}
draft: true
---

0
assets/.gitkeep Normal file
View file

19
config.toml Normal file
View file

@ -0,0 +1,19 @@
baseURL = 'https://inetmock.icb4dc0.de/docs/'
languageCode = 'en-us'
theme = ['github.com/McShelby/hugo-theme-relearn']
pluralizelisttitles = false
title = "INetMock"
[Params]
author = "Peter Kurfer"
description = "INetMock docs"
style= "auto"
copyCodeButton = true
rssAsSocialIcon = true
ordersectionsby = "weight"
themeVariant = "relearn-light"
collapsibleMenu = true
[outputs]
home = [ "HTML", "RSS", "JSON"]

View file

@ -0,0 +1,8 @@
+++
title = "Basics"
chapter = true
weight = 15
pre = "<b>1. </b>"
+++
# Basics

View file

@ -0,0 +1,19 @@
+++
title = "Installation"
chapter = true
weight = 10
pre = "<b>1. </b>"
+++
# Installation
INetMock can be installed either as a container e.g. with Podman or Docker, as a *systemd* service or with any other run system.
## Requirements
The INetMock server currently only works on Linux.
This has a variety of reasons but the most significant one is that the eBPF components (currently) only work on Linux although Microsoft is working on bringing some capabilities to Windows as well but that might still take some time.
Development of INetMock is mostly done on Arch Linux and CI runs on Ubuntu 22.04.
Latest Fedora version should also work.
INetMock can work also on Ubuntu 20.04 but only if you updated your kernel.

View file

@ -0,0 +1,8 @@
+++
title = "Listeners"
chapter = true
weight = 15
pre = "<b>1. </b>"
+++
# Listeners

View file

@ -0,0 +1,6 @@
+++
title = "Configuration"
chapter = true
weight = 20
pre = "<b>2. </b>"
+++

View file

@ -0,0 +1,6 @@
+++
title = "Architecture"
chapter = true
weight = 30
pre = "<b>3. </b>"
+++

1
content/_index.md Normal file
View file

@ -0,0 +1 @@
# INetMock documentation

0
data/.gitkeep Normal file
View file

23
deploy/helm/.helmignore Normal file
View file

@ -0,0 +1,23 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/

24
deploy/helm/Chart.yaml Normal file
View file

@ -0,0 +1,24 @@
apiVersion: v2
name: inetmock-docs
description: A Helm chart for Kubernetes
# A chart can be either an 'application' or a 'library' chart.
#
# Application charts are a collection of templates that can be packaged into versioned archives
# to be deployed.
#
# Library charts provide useful utilities or functions for the chart developer. They're included as
# a dependency of application charts to inject those utilities and functions into the rendering
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.1.0
# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "1.16.0"

View file

@ -0,0 +1,62 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "inetmock-docs.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}
{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "inetmock-docs.fullname" -}}
{{- if .Values.fullnameOverride }}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- $name := default .Chart.Name .Values.nameOverride }}
{{- if contains $name .Release.Name }}
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
{{- end }}
{{- end }}
{{- end }}
{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "inetmock-docs.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}
{{/*
Common labels
*/}}
{{- define "inetmock-docs.labels" -}}
helm.sh/chart: {{ include "inetmock-docs.chart" . }}
{{ include "inetmock-docs.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}
{{/*
Selector labels
*/}}
{{- define "inetmock-docs.selectorLabels" -}}
app.kubernetes.io/name: {{ include "inetmock-docs.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}
{{/*
Create the name of the service account to use
*/}}
{{- define "inetmock-docs.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "inetmock-docs.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}

View file

@ -0,0 +1,58 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "inetmock-docs.fullname" . }}
labels:
{{- include "inetmock-docs.labels" . | nindent 4 }}
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
{{- include "inetmock-docs.selectorLabels" . | nindent 6 }}
template:
metadata:
{{- with .Values.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "inetmock-docs.selectorLabels" . | nindent 8 }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
containers:
- name: {{ .Chart.Name }}
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
ports:
- name: http
containerPort: {{ .Values.service.port }}
protocol: TCP
livenessProbe:
httpGet:
path: /
port: http
readinessProbe:
httpGet:
path: /
port: http
resources:
{{- toYaml .Values.resources | nindent 12 }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}

View file

@ -0,0 +1,61 @@
{{- if .Values.ingress.enabled -}}
{{- $fullName := include "inetmock-docs.fullname" . -}}
{{- $svcPort := .Values.service.port -}}
{{- if and .Values.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }}
{{- if not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class") }}
{{- $_ := set .Values.ingress.annotations "kubernetes.io/ingress.class" .Values.ingress.className}}
{{- end }}
{{- end }}
{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}}
apiVersion: networking.k8s.io/v1
{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}}
apiVersion: networking.k8s.io/v1beta1
{{- else -}}
apiVersion: extensions/v1beta1
{{- end }}
kind: Ingress
metadata:
name: {{ $fullName }}
labels:
{{- include "inetmock-docs.labels" . | nindent 4 }}
{{- with .Values.ingress.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
{{- if and .Values.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }}
ingressClassName: {{ .Values.ingress.className }}
{{- end }}
{{- if .Values.ingress.tls }}
tls:
{{- range .Values.ingress.tls }}
- hosts:
{{- range .hosts }}
- {{ . | quote }}
{{- end }}
secretName: {{ .secretName }}
{{- end }}
{{- end }}
rules:
{{- range .Values.ingress.hosts }}
- host: {{ .host | quote }}
http:
paths:
{{- range .paths }}
- path: {{ .path }}
{{- if and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }}
pathType: {{ .pathType }}
{{- end }}
backend:
{{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }}
service:
name: {{ $fullName }}
port:
number: {{ $svcPort }}
{{- else }}
serviceName: {{ $fullName }}
servicePort: {{ $svcPort }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}

View file

@ -0,0 +1,15 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "inetmock-docs.fullname" . }}
labels:
{{- include "inetmock-docs.labels" . | nindent 4 }}
spec:
type: {{ .Values.service.type }}
ports:
- port: {{ .Values.service.port }}
targetPort: http
protocol: TCP
name: http
selector:
{{- include "inetmock-docs.selectorLabels" . | nindent 4 }}

View file

@ -0,0 +1,15 @@
apiVersion: v1
kind: Pod
metadata:
name: "{{ include "inetmock-docs.fullname" . }}-test-connection"
labels:
{{- include "inetmock-docs.labels" . | nindent 4 }}
annotations:
"helm.sh/hook": test
spec:
containers:
- name: wget
image: busybox
command: ['wget']
args: ['{{ include "inetmock-docs.fullname" . }}:{{ .Values.service.port }}']
restartPolicy: Never

75
deploy/helm/values.yaml Normal file
View file

@ -0,0 +1,75 @@
# Default values for inetmock-docs.
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.
replicaCount: 2
image:
repository: code.icb4dc0.de/inetmock/docs
pullPolicy: IfNotPresent
# Overrides the image tag whose default is the chart appVersion.
tag: "latest"
imagePullSecrets: []
nameOverride: ""
fullnameOverride: ""
serviceAccount:
# Specifies whether a service account should be created
create: true
# Annotations to add to the service account
annotations: {}
# The name of the service account to use.
# If not set and create is true, a name is generated using the fullname template
name: ""
podAnnotations: {}
podSecurityContext: {}
# fsGroup: 2000
securityContext:
capabilities:
drop:
- ALL
readOnlyRootFilesystem: true
runAsNonRoot: true
runAsUser: 65532
service:
type: ClusterIP
port: 3000
ingress:
enabled: false
className: ""
annotations: {}
# kubernetes.io/ingress.class: nginx
# kubernetes.io/tls-acme: "true"
hosts:
- host: chart-example.local
paths:
- path: /
pathType: ImplementationSpecific
tls: []
# - secretName: chart-example-tls
# hosts:
# - chart-example.local
resources:
# We usually recommend not to specify default resources and to leave this as a conscious
# choice for the user. This also increases chances charts run on environments with little
# resources, such as Minikube. If you do want to specify resources, uncomment the following
# lines, adjust them as necessary, and remove the curly braces after 'resources:'.
limits:
cpu: 100m
memory: 60Mi
requests:
cpu: 50m
memory: 20Mi
nodeSelector: {}
tolerations: []
affinity: {}

5
go.mod Normal file
View file

@ -0,0 +1,5 @@
module code.icb4dc0.de/inetmock/docs
go 1.19
require github.com/McShelby/hugo-theme-relearn v0.0.0-20221230001326-0bed2a7096e6 // indirect

2
go.sum Normal file
View file

@ -0,0 +1,2 @@
github.com/McShelby/hugo-theme-relearn v0.0.0-20221230001326-0bed2a7096e6 h1:7PTU2Xv90O3dEgTfUUbbinYnRutQ5RpwnlnkgZmsM5M=
github.com/McShelby/hugo-theme-relearn v0.0.0-20221230001326-0bed2a7096e6/go.mod h1:mKQQdxZNIlLvAj8X3tMq+RzntIJSr9z7XdzuMomt0IM=

View file

@ -0,0 +1,54 @@
<style>
#logo svg,
#logo svg * {
color: #282828;
color: var(--MENU-SECTIONS-BG-color);
fill: #282828 !important;
fill: var(--MENU-SECTIONS-BG-color) !important;
opacity: .945;
}
a#logo {
color: #282828;
color: var(--MENU-SECTIONS-BG-color);
font-family: 'Work Sans', 'Helvetica', 'Tahoma', 'Geneva', 'Arial', sans-serif;
font-size: 30px;
font-weight: 300;
margin-top: -13px;
margin-left: -100px;
max-width: 60%;
text-transform: uppercase;
width: 226px;
white-space: nowrap;
}
a#logo:hover {
color: #282828;
color: var(--MENU-SECTIONS-BG-color);
}
#logo svg {
margin-bottom: -20px;
margin-left: -23.5px;
width: 40.5%;
}
@media only all and (max-width: 59.938em) {
a#logo {
font-size: 25px;
margin-top: -3px;
}
#logo svg {
margin-bottom: -12px;
margin-left: -23px;
}
}
@media all and (-ms-high-contrast:none) {
{{ "/* IE11s understanding of positioning is weird at best */" | safeCSS }}
a#logo {
margin-top: -58px;
}
#logo svg {
margin-bottom: -62px;
}
}
</style>
<a id="logo" href="{{ partial "relLangPrettyUglyURL.hugo" (dict "to" .Site.Home) }}">
INetMock docs
</a>