Skip to content

Commit

Permalink
TK-65403 disable custom rest backend (#48)
Browse files Browse the repository at this point in the history
* generated code

* TK-65403 disable custom rest backend

- custom rest does not register any resource verbs kubernetes-sigs/apiserver-builder-alpha#551
- template etcd variables
- use temp dir by default
- test example apiserver in PR build

* fix pr build

* test apiserver functionality
  • Loading branch information
drewwells committed Oct 26, 2020
1 parent fd038eb commit db8e01b
Show file tree
Hide file tree
Showing 15 changed files with 27,811 additions and 5,538 deletions.
17 changes: 17 additions & 0 deletions .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,23 @@ jobs:
timeout-minutes: 5
run: |
make kind-load-apiserver deploy-example-apiserver KIND_NAME="chart-testing"
- name: Test APIServer actions
timeout-minutes: 1
run: |
# TODO: move API Registration and test calls to to KONK
until kubectl get apiservice v1alpha1.example.infoblox.com | grep True
do
kubectl describe apiservice v1alpha1.example.infoblox.com
sleep 5
done
until kubectl apply -f test/apiserver/sample/contact.yaml
do
sleep 5
done
until kubectl get contact
do
sleep 5
done
- name: Deploy example-konk-service
timeout-minutes: 5
run: |
Expand Down
6 changes: 4 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -187,13 +187,15 @@ kind-destroy: $(KIND)
kind-load-konk: $(KIND) docker-build
$(KIND) load docker-image ${IMG} --name ${KIND_NAME}

kind-load-apiserver: QUAY_IMG=$(shell $(HELM) template helm-charts/example-apiserver | awk '/image: quay/ {print $$2}')
kind-load-apiserver: $(KIND)
$(MAKE) -C test/apiserver image kind-load \
KIND=$(KIND) KIND_NAME=${KIND_NAME} \
IMAGE_TAG=${GIT_VERSION}
IMAGE_TAG=${GIT_VERSION} \
BUILD_FLAGS="-mod=readonly"

%-example-apiserver: RELEASE_NAME := runner

deploy-example-apiserver: HELM_FLAGS ?=--set=image.tag=$(GIT_VERSION) --set=image.pullPolicy=IfNotPresent
deploy-example-apiserver:
$(HELM) upgrade -i --wait $(RELEASE_NAME)-example-apiserver $(CHART_DIR)/example-apiserver $(HELM_FLAGS)
$(HELM) upgrade --debug -i --wait $(RELEASE_NAME)-example-apiserver $(CHART_DIR)/example-apiserver $(HELM_FLAGS)
19 changes: 11 additions & 8 deletions helm-charts/example-apiserver/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,17 @@ spec:
containers:
# Insecure etcd to chat with
- name: etcd
image: quay.io/coreos/etcd:v3.4.13
imagePullPolicy: IfNotPresent
image: {{ .Values.etcd.image.repository }}:{{ .Values.etcd.image.tag }}
imagePullPolicy: {{ .Values.etcd.imagePullPolicy }}
command:
- etcd
- --listen-client-urls=http://0.0.0.0:2379
- --advertise-client-urls=http://localhost:2379
- --listen-client-urls={{ .Values.etcd.svc.protocol }}://0.0.0.0:{{ .Values.etcd.svc.port }}
- --advertise-client-urls={{ .Values.etcd.svc.protocol }}://{{ .Values.etcd.svc.name }}:{{ .Values.etcd.svc.port }}
ports:
- containerPort: 2379
- containerPort: {{ .Values.etcd.svc.port }}
readinessProbe:
httpGet:
port: 2379
port: {{ .Values.etcd.svc.port }}
path: /health
failureThreshold: 1
initialDelaySeconds: 10
Expand All @@ -50,7 +50,7 @@ spec:
timeoutSeconds: 2
livenessProbe:
httpGet:
port: 2379
port: {{ .Values.etcd.svc.port }}
path: /health
failureThreshold: 3
initialDelaySeconds: 10
Expand Down Expand Up @@ -84,15 +84,18 @@ spec:
- "./apiserver"
args:
- "--delegated-auth=false"
- --etcd-servers=http://127.0.0.1:2379
- --etcd-servers=http://127.0.0.1:{{ .Values.etcd.svc.port }}
- "--tls-cert-file=/apiserver.local.config/certificates/tls.crt"
- "--tls-private-key-file=/apiserver.local.config/certificates/tls.key"
- "-v=10"
- name: controller
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
command:
- "./controller-manager"
args:
- "-v=10"
args:
resources:
{{- toYaml .Values.manager.resources | nindent 12 }}
{{- with .Values.nodeSelector }}
Expand Down
13 changes: 12 additions & 1 deletion helm-charts/example-apiserver/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,17 @@ image:
# Overrides the image tag whose default is the chart appVersion.
tag: ""

etcd:
image:
repository: quay.io/coreos/etcd
tag: v3.4.13
imagePullPolicy: IfNotPresent
svc:
protocol: http
name: localhost
port: 2379


imagePullSecrets: []
nameOverride: ""
fullnameOverride: ""
Expand Down Expand Up @@ -86,7 +97,7 @@ tolerations: []
affinity: {}

apiserver:
create: false
create: true
tls:
caBundle: ""
crt: ""
Expand Down
16 changes: 1 addition & 15 deletions test/apiserver/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,33 +5,19 @@ go 1.13
require (
github.com/go-openapi/loads v0.19.4
github.com/go-openapi/spec v0.19.3
github.com/gogo/protobuf v1.3.1 // indirect
github.com/gorilla/websocket v1.4.1 // indirect
github.com/grpc-ecosystem/go-grpc-middleware v1.0.1-0.20190723091251-e0797f438f94 // indirect
github.com/kubernetes-incubator/reference-docs v0.0.0 // indirect
github.com/markbates/inflect v1.0.4
github.com/onsi/ginkgo v1.12.0
github.com/onsi/gomega v1.9.0
github.com/pkg/errors v0.9.1
github.com/spf13/cobra v1.0.0
github.com/spf13/pflag v1.0.5
github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5 // indirect
k8s.io/api v0.19.2
golang.org/x/net v0.0.0-20200707034311-ab3426394381
k8s.io/apimachinery v0.19.2
k8s.io/apiserver v0.19.2
k8s.io/client-go v0.19.2
k8s.io/code-generator v0.19.2
k8s.io/gengo v0.0.0-20200428234225-8167cfdcfc14
k8s.io/klog v1.0.0
k8s.io/kube-aggregator v0.19.2
k8s.io/kube-openapi v0.0.0-20200805222855-6aeccd4b50c6
k8s.io/utils v0.0.0-20200729134348-d5654de09c73
sigs.k8s.io/apiserver-builder-alpha v1.18.1-0.20201012071248-ca5d7287e44a
sigs.k8s.io/controller-runtime v0.6.0
sigs.k8s.io/controller-tools v0.1.12 // indirect
sigs.k8s.io/kubebuilder v1.0.9-0.20200925141511-a2f239880b04
sigs.k8s.io/structured-merge-diff v0.0.0-20190525122527-15d366b2352e // indirect
sigs.k8s.io/testing_frameworks v0.1.1
)

replace sigs.k8s.io/controller-tools => sigs.k8s.io/controller-tools v0.1.12
Expand Down
Loading

0 comments on commit db8e01b

Please sign in to comment.