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

portability improvements #3

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ sieve_server/learned_field_path_mask.json
fakegopath/
app/
kind_configs/
audit_logs/
deploy_script/ansible_hosts
sieve_test_results/
sieve_learn_results/
Expand Down
43 changes: 43 additions & 0 deletions examples/zktg/build/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
ARG DOCKER_REGISTRY
ARG GO_VERSION=1.20.10
ARG ALPINE_VERSION=3.11
# FROM ${DOCKER_REGISTRY:+$DOCKER_REGISTRY/}golang:${GO_VERSION}-alpine${ALPINE_VERSION} as go-builder
FROM ${DOCKER_REGISTRY:+$DOCKER_REGISTRY/}golang:${GO_VERSION} as go-builder

ARG PROJECT_NAME=zookeeper-operator
ARG REPO_PATH=github.com/pravega/$PROJECT_NAME

# Build version and commit should be passed in when performing docker build
ARG VERSION=0.0.0-localdev
ARG GIT_SHA=0000000

WORKDIR /src
COPY . ./
# COPY pkg ./pkg
# COPY cmd ./cmd
# COPY go.mod ./
# COPY main.go ./
COPY sieve-dependency/ sieve-dependency/

RUN go mod tidy

# Download all dependencies.
# RUN go mod download

RUN GOOS=darwin GOARCH=arm64 CGO_ENABLED=0 go build -o /src/${PROJECT_NAME} \
-ldflags "-X ${REPO_PATH}/pkg/version.Version=${VERSION} -X ${REPO_PATH}/pkg/version.GitSHA=${GIT_SHA}" \
/src

# =============================================================================

FROM ${DOCKER_REGISTRY:+$DOCKER_REGISTRY/}alpine:${ALPINE_VERSION} AS final


ARG PROJECT_NAME=zookeeper-operator

COPY --from=go-builder /src/${PROJECT_NAME} /usr/local/bin/${PROJECT_NAME}

RUN adduser -D ${PROJECT_NAME}
USER ${PROJECT_NAME}

ENTRYPOINT ["/usr/local/bin/zookeeper-operator"]
4 changes: 4 additions & 0 deletions examples/zktg/build/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash
set -x

make build-image
29 changes: 29 additions & 0 deletions examples/zktg/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"name": "zookeeper-operator",
"github_link": "https://github.com/pravega/zookeeper-operator.git",
"commit": "daac1bdeaace91e4c6e7b712afe7415b2c24df44",
"kubernetes_version": "v1.24.10",
"client_go_version": "v0.24.1",
"dockerfile_path": "Dockerfile",
"controller_image_name": "pravega/zookeeper-operator:latest",
"test_command": "python3 examples/zookeeper-operator/test/test.py",
"custom_resource_definitions": [
"zookeepercluster"
],
"annotated_reconcile_functions": {
"controllers/zookeepercluster_controller.go": "github.com/pravega/zookeeper-operator/controllers/controller.(*ZookeeperClusterReconciler).Reconcile"
},
"controller_pod_label": "zookeeper-operator",
"controller_deployment_file_path": "examples/zookeeper-operator/deploy/default_ns/operator.yaml",
"end_state_checker_mask": {
"*": {
"zookeepercluster/default/zookeeper-cluster": [
[
"status",
"members",
"ready"
]
]
}
}
}
5,990 changes: 5,990 additions & 0 deletions examples/zktg/deploy/crds/zookeeper.pravega.io_zookeeperclusters.yaml

Large diffs are not rendered by default.

45 changes: 45 additions & 0 deletions examples/zktg/deploy/default_ns/operator.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: zookeeper-operator
spec:
replicas: 1
selector:
matchLabels:
name: zookeeper-operator
sievetag: zookeeper-operator
template:
metadata:
labels:
name: zookeeper-operator
sievetag: zookeeper-operator
spec:
serviceAccountName: zookeeper-operator
containers:
- name: zookeeper-operator
# Replace this with the built image name
image: ${SIEVE-DR}/zookeeper-operator:${SIEVE-DT}
ports:
- containerPort: 60000
name: metrics
command:
- zookeeper-operator
imagePullPolicy: IfNotPresent
env:
- name: WATCH_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- name: POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: OPERATOR_NAME
value: "zookeeper-operator"
- name: KUBERNETES_SERVICE_HOST
value: "kind-control-plane"
- name: KUBERNETES_SERVICE_PORT
value: "6443"
envFrom:
- configMapRef:
name: sieve-testing-global-config
58 changes: 58 additions & 0 deletions examples/zktg/deploy/default_ns/rbac.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
apiVersion: v1
kind: ServiceAccount
metadata:
name: zookeeper-operator

---

kind: Role
apiVersion: rbac.authorization.k8s.io/v1beta1
metadata:
name: zookeeper-operator
rules:
- apiGroups:
- zookeeper.pravega.io
resources:
- "*"
verbs:
- "*"
- apiGroups:
- ""
resources:
- pods
- services
- endpoints
- persistentvolumeclaims
- events
- configmaps
- secrets
verbs:
- "*"
- apiGroups:
- apps
resources:
- deployments
- daemonsets
- replicasets
- statefulsets
verbs:
- "*"
- apiGroups:
- policy
resources:
- poddisruptionbudgets
verbs:
- "*"
---
kind: RoleBinding
apiVersion: rbac.authorization.k8s.io/v1beta1
metadata:
name: zookeeper-operator
subjects:
- kind: ServiceAccount
name: zookeeper-operator
namespace: default
roleRef:
kind: Role
name: zookeeper-operator
apiGroup: rbac.authorization.k8s.io
6 changes: 6 additions & 0 deletions examples/zktg/deploy/deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash
set -x

kubectl create -f crds
kubectl create -f default_ns/rbac.yaml
kubectl create -f default_ns/operator.yaml
6 changes: 6 additions & 0 deletions examples/zktg/oracle/recreate/controller_family.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[
"configmap/default/zookeeper-operator-lock",
"deployment/default/zookeeper-operator",
"pod/default/zookeeper-operator-5fc77867c7-k2fhl",
"replicaset/default/zookeeper-operator-5fc77867c7"
]
98 changes: 98 additions & 0 deletions examples/zktg/oracle/recreate/event.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
{
"configmap/default/sieve-testing-global-config": {
"ADDED": 1,
"DELETED": 0
},
"configmap/default/zookeeper-cluster-configmap": {
"ADDED": 2,
"DELETED": 1
},
"configmap/default/zookeeper-operator-lock": {
"ADDED": 1,
"DELETED": 0
},
"controllerrevision/default/zookeeper-cluster-7cf668f98b": {
"ADDED": 2,
"DELETED": 1
},
"deployment/default/zookeeper-operator": {
"ADDED": 1,
"DELETED": 0
},
"endpoints/default/zookeeper-cluster-admin-server": {
"ADDED": 2,
"DELETED": 1
},
"endpoints/default/zookeeper-cluster-client": {
"ADDED": 2,
"DELETED": 1
},
"endpoints/default/zookeeper-cluster-headless": {
"ADDED": 2,
"DELETED": 1
},
"endpointslice/default/zookeeper-cluster-admin-server-*": {
"ADDED": 2,
"DELETED": 1
},
"endpointslice/default/zookeeper-cluster-client-*": {
"ADDED": 2,
"DELETED": 1
},
"endpointslice/default/zookeeper-cluster-headless-*": {
"ADDED": 2,
"DELETED": 1
},
"persistentvolumeclaim/default/data-zookeeper-cluster-0": {
"ADDED": 2,
"DELETED": 1
},
"pod/default/zookeeper-cluster-0": {
"ADDED": 2,
"DELETED": 1
},
"pod/default/zookeeper-operator-5fc77867c7-*": {
"ADDED": 1,
"DELETED": 0
},
"poddisruptionbudget/default/zookeeper-cluster": {
"ADDED": 2,
"DELETED": 1
},
"replicaset/default/zookeeper-operator-5fc77867c7": {
"ADDED": 1,
"DELETED": 0
},
"role/default/zookeeper-operator": {
"ADDED": 2,
"DELETED": 0
},
"rolebinding/default/zookeeper-operator": {
"ADDED": 2,
"DELETED": 0
},
"service/default/zookeeper-cluster-admin-server": {
"ADDED": 2,
"DELETED": 1
},
"service/default/zookeeper-cluster-client": {
"ADDED": 2,
"DELETED": 1
},
"service/default/zookeeper-cluster-headless": {
"ADDED": 2,
"DELETED": 1
},
"serviceaccount/default/zookeeper-operator": {
"ADDED": 1,
"DELETED": 0
},
"statefulset/default/zookeeper-cluster": {
"ADDED": 2,
"DELETED": 1
},
"zookeepercluster/default/zookeeper-cluster": {
"ADDED": 2,
"DELETED": 1
}
}
Loading