appcat-apiserver

command module
v0.2.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 27, 2023 License: BSD-3-Clause Imports: 7 Imported by: 0

README

Build Go version Kubernetes version Version GitHub downloads

appcat-apiserve

Generate Kubernetes code

If you make changes to the auto generated code you'll need to run code generation. This can be done with make:

make generate

Building

See make help for a list of build targets.

  • make build: Build binary for linux/amd64
  • make build -e GOOS=darwin -e GOARCH=arm64: Build binary for macos/arm64
  • make docker-build: Build Docker image for local environment

Local development environment

You can setup a kind-based local environment with

make local-install

See docs for more details on the local environment setup.

Please be aware that the productive deployment of the appcat-apiserver may run on a different Kubernetes distribution than kind.

Debugging in IDE

To run the API server on your local machine you need to register the IDE running instance with kind cluster. This can be achieved with the following guide.

The externalName needs to be changed to your specific host IP. When running kind on Linux you can find it with docker inspect. On some docker distributions the host IP is accessible via host.docker.internal. For Lima distribution the host IP is accessible via host.lima.internal.

HOSTIP=$(docker inspect appcat-apiserver-v1.24.0-control-plane | jq '.[0].NetworkSettings.Networks.kind.Gateway')
# HOSTIP=host.docker.internal # On some docker distributions
# HOSTIP=host.lima.internal # On lima distributions

make local-debug

kind get kubeconfig --name appcat-apiserver-v1.24.0  > ~/.kube/config 

cat <<EOF | sed -e "s/172.21.0.1/$HOSTIP/g" | kubectl apply -f -
apiVersion: apiregistration.k8s.io/v1
kind: APIService
metadata:
  name: v1.api.appcat.vshn.io
  labels:
    api: appcat
    apiserver: "true"
spec:
  version: v1
  group: api.appcat.vshn.io
  insecureSkipTLSVerify: true
  groupPriorityMinimum: 2000
  service:
    name: appcat
    namespace: default
    port: 9443
  versionPriority: 10
---
apiVersion: v1
kind: Service
metadata:
  name: appcat
  namespace: default
spec:
  ports:
  - port: 9443
    protocol: TCP
    targetPort: 9443
  type: ExternalName
  externalName: 172.21.0.1 # Change to host IP
EOF

make apply-test-cases

After the above steps just run the API server via IDE with the following arguments.

api --secure-port=9443 --kubeconfig ~/.kube/config --authentication-kubeconfig ~/.kube/config --authorization-kubeconfig ~/.kube/config --tls-cert-file=dev/certificates/apiserver.crt --tls-private-key-file=dev/certificates/apiserver.key

Protobuf installation

Protocol Buffers (Protobuf) is a free and open-source cross-platform data format used to serialize structured data. Kubernetes internally uses gRPC clients with protobuf serialization. APIServer objects when handled internally in K8S need to implement protobuf interface. The implementation of the interface is done by code-generator. Two dependencies are required to use this tool protoc and protoc-gen-go.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
apis
appcat/v1
Package v1 contains API Schema definitions for the appcat-server v1 API group +kubebuilder:object:generate=true +kubebuilder:skip +groupName=api.appcat.vshn.io
Package v1 contains API Schema definitions for the appcat-server v1 API group +kubebuilder:object:generate=true +kubebuilder:skip +groupName=api.appcat.vshn.io
appcat/mock
Package mock_appcat is a generated GoMock package.
Package mock_appcat is a generated GoMock package.
vshn/postgres/mock
Package mock_postgres is a generated GoMock package.
Package mock_postgres is a generated GoMock package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL