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

naive rebase to pravega master #2

Closed
wants to merge 23 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
c29d475
use socat instead of nc (#476)
alfred-landrum Oct 27, 2022
adcf3bf
feat: Replace deprecated policy/v1beta1 PDB API (#523)
cbuto Jan 11, 2023
8076745
Add topologySpreadConstraints to PodSpec (#522)
endzyme Jan 12, 2023
66fcc71
Adjust behavior for pod labels (#521)
endzyme Jan 13, 2023
a4a345f
Delete Job scheduling (#520)
georgekaz Jan 14, 2023
3d3e647
Use distroless image for operator image (#533)
AKamyshnikova Mar 14, 2023
12e22de
Bump github.com/emicklei/go-restful (#528)
dependabot[bot] Mar 14, 2023
113814c
Bump golang.org/x/text from 0.3.7 to 0.3.8 (#532)
dependabot[bot] Mar 15, 2023
28d1f69
Bump golang.org/x/net from 0.0.0-20220526153639-5463443f8c37 to 0.7.0…
dependabot[bot] Mar 15, 2023
72bea54
Issue 543: Updating zookeeper operator/zookeeper chart version (#544)
anishakj Apr 4, 2023
281f6f8
Issue 482: Reevaluating number of client connections dynamically in t…
nishant-yt Jun 8, 2022
5a2ac6d
use arm64 for go
mmoscher Oct 4, 2022
0af3fd7
adds docker multiarch builds and use it in push
mmoscher Oct 12, 2022
0dd8f02
change repo for testing
mmoscher Oct 12, 2022
0d04dcf
minor rework, push mutliarch directly
mmoscher Oct 12, 2022
59223d4
adds checkout to ci.yaml
mmoscher Oct 12, 2022
cee55ee
fixes job naming
mmoscher Oct 12, 2022
11f9caf
reworks ci
mmoscher Oct 12, 2022
5812893
fixes variable name
mmoscher Oct 12, 2022
835e747
finally...
mmoscher Oct 12, 2022
217aa0e
fixed missing slash
mmoscher Oct 12, 2022
952137e
undo changes for testing
mmoscher Oct 12, 2022
fb86bc6
Merge branch 'master' into naive-rebase-to-pravega-master
cheleb Apr 15, 2023
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
10 changes: 4 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
ARG DOCKER_REGISTRY
ARG ALPINE_VERSION=3.15
ARG DISTROLESS_DOCKER_REGISTRY
ARG ALPINE_VERSION=3.17
ARG BUILDPLATFORM=linux/amd64
FROM --platform=$BUILDPLATFORM ${DOCKER_REGISTRY:+$DOCKER_REGISTRY/}golang:1.18-alpine${ALPINE_VERSION} as go-builder
FROM --platform=$BUILDPLATFORM ${DOCKER_REGISTRY:+$DOCKER_REGISTRY/}golang:1.19-alpine${ALPINE_VERSION} as go-builder

ARG PROJECT_NAME=zookeeper-operator
ARG REPO_PATH=github.com/pravega/$PROJECT_NAME
Expand Down Expand Up @@ -32,13 +33,10 @@ COPY controllers/ controllers/
RUN GOOS=${TARGETOS} GOARCH=${TARGETARCH} 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}" main.go

FROM ${DOCKER_REGISTRY:+$DOCKER_REGISTRY/}alpine:${ALPINE_VERSION} AS final
FROM ${DISTROLESS_DOCKER_REGISTRY:-gcr.io/}distroless/static-debian11:nonroot 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"]
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,11 @@ build-go:
-o bin/$(EXPORTER_NAME)-windows-amd64.exe cmd/exporter/main.go

build-image:
docker build --build-arg VERSION=$(VERSION) --build-arg DOCKER_REGISTRY=$(DOCKER_REGISTRY) --build-arg GIT_SHA=$(GIT_SHA) -t $(REPO):$(VERSION) .
docker build --build-arg VERSION=$(VERSION) --build-arg DOCKER_REGISTRY=$(DOCKER_REGISTRY) --build-arg DISTROLESS_DOCKER_REGISTRY=$(DISTROLESS_DOCKER_REGISTRY) --build-arg GIT_SHA=$(GIT_SHA) -t $(REPO):$(VERSION) .
docker tag $(REPO):$(VERSION) $(REPO):latest

build-zk-image:

docker build --build-arg VERSION=$(VERSION) --build-arg DOCKER_REGISTRY=$(DOCKER_REGISTRY) --build-arg GIT_SHA=$(GIT_SHA) -t $(APP_REPO):$(VERSION) ./docker
docker tag $(APP_REPO):$(VERSION) $(APP_REPO):latest

Expand Down
11 changes: 11 additions & 0 deletions api/v1beta1/deepcopy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,9 @@ var _ = Describe("ZookeeperCluster DeepCopy", func() {
It("value of Tol should be example", func() {
Ω(z2.Spec.Pod.Tolerations[0].Key).To(Equal("tol"))
})
It("have empty topologySpreadConstraints", func() {
Ω(z2.Spec.Pod.TopologySpreadConstraints).To(HaveLen(0))
})
It("checking status conditions", func() {
Ω(z2.Status.Conditions[0].Reason).To(Equal(z1.Status.Conditions[0].Reason))
})
Expand Down Expand Up @@ -242,6 +245,14 @@ var _ = Describe("ZookeeperCluster DeepCopy", func() {
podpolicy2 := podpolicy.DeepCopy()
Ω(podpolicy2).To(BeNil())
})
It("checking for deepcopy podpolicy.topologyspreadconstraints", func() {
t := v1.TopologySpreadConstraint{}
podpolicy := v1beta1.PodPolicy{
TopologySpreadConstraints: []v1.TopologySpreadConstraint{t},
}
podpolicy2 := podpolicy.DeepCopy()
Ω(podpolicy2.TopologySpreadConstraints).To(HaveLen(1))
})
It("checking for nil zookeepercluster", func() {
var zk *v1beta1.ZookeeperCluster
zk2 := zk.DeepCopy()
Expand Down
14 changes: 9 additions & 5 deletions api/v1beta1/zookeepercluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const (

// DefaultZkContainerVersion is the default tag used for for the zookeeper
// container
DefaultZkContainerVersion = "0.2.14"
DefaultZkContainerVersion = "0.2.15"

// DefaultZkContainerPolicy is the default container pull policy used
DefaultZkContainerPolicy = "Always"
Expand Down Expand Up @@ -82,8 +82,9 @@ type ZookeeperClusterSpec struct {
// Image is the container image. default is zookeeper:0.2.10
Image ContainerImage `json:"image,omitempty"`

// Labels specifies the labels to attach to pods the operator creates for
// the zookeeper cluster.
// Labels specifies the labels to attach to all resources the operator
// creates for the zookeeper cluster, including StatefulSet, Pod,
// PersistentVolumeClaim, Service, ConfigMap, et al.
Labels map[string]string `json:"labels,omitempty"`

// Replicas is the expected size of the zookeeper cluster.
Expand Down Expand Up @@ -433,8 +434,8 @@ func (c *ContainerImage) ToString() string {
// PodPolicy defines the common pod configuration for Pods, including when used
// in deployments, stateful-sets, etc.
type PodPolicy struct {
// Labels specifies the labels to attach to pods the operator creates for
// the zookeeper cluster.
// Labels specifies the labels to attach to pods the operator creates for the
// zookeeper cluster. Overrides any values specified in Spec.Labels.
Labels map[string]string `json:"labels,omitempty"`

// NodeSelector specifies a map of key-value pairs. For the pod to be
Expand All @@ -445,6 +446,9 @@ type PodPolicy struct {
// The scheduling constraints on pods.
Affinity *v1.Affinity `json:"affinity,omitempty"`

// TopologySpreadConstraints to apply to the pods
TopologySpreadConstraints []v1.TopologySpreadConstraint `json:"topologySpreadConstraints,omitempty"`

// Resources is the resource requirements for the container.
// This field cannot be updated once the cluster is created.
Resources v1.ResourceRequirements `json:"resources,omitempty"`
Expand Down
2 changes: 1 addition & 1 deletion api/v1beta1/zookeepercluster_types_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ var _ = Describe("ZookeeperCluster Types", func() {
})

It("Checking tostring() function", func() {
Ω(z.Spec.Image.ToString()).To(Equal("pravega/zookeeper:0.2.14"))
Ω(z.Spec.Image.ToString()).To(Equal("pravega/zookeeper:0.2.15"))
})

})
Expand Down
7 changes: 7 additions & 0 deletions api/v1beta1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions charts/zookeeper-operator/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
apiVersion: v2
name: zookeeper-operator
description: Zookeeper Operator Helm chart for Kubernetes
version: 0.2.14
appVersion: 0.2.14
version: 0.2.15
appVersion: 0.2.15
keywords:
- zookeeper
- storage
Expand Down
2 changes: 1 addition & 1 deletion charts/zookeeper-operator/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ The following table lists the configurable parameters of the zookeeper-operator
| `hooks.image.tag` | Image tag for batch jobs | `"v1.16.10"` |
| `image.pullPolicy` | Image pull policy | `IfNotPresent` |
| `image.repository` | Image repository | `pravega/zookeeper-operator` |
| `image.tag` | Image tag | `0.2.14` |
| `image.tag` | Image tag | `0.2.15` |
| `labels` | Operator pod labels | `{}` |
| `nodeSelector` | Map of key-value pairs to be present as labels in the node in which the pod should run | `{}` |
| `rbac.create` | Create RBAC resources | `true` |
Expand Down
12 changes: 12 additions & 0 deletions charts/zookeeper-operator/templates/pre-delete-hooks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -115,4 +115,16 @@ spec:
configMap:
name: {{ template "zookeeper-operator.fullname" . }}-pre-delete
defaultMode: 0555
{{- if .Values.nodeSelector }}
nodeSelector:
{{ toYaml .Values.nodeSelector | indent 8 }}
{{- end }}
{{- if .Values.affinity }}
affinity:
{{ toYaml .Values.affinity | indent 8 }}
{{- end }}
{{- if .Values.tolerations }}
tolerations:
{{ toYaml .Values.tolerations | indent 8 }}
{{- end }}
{{- end }}
Original file line number Diff line number Diff line change
Expand Up @@ -2684,8 +2684,9 @@ spec:
labels:
additionalProperties:
type: string
description: Labels specifies the labels to attach to pods the operator
creates for the zookeeper cluster.
description: Labels specifies the labels to attach to all resources
the operator creates for the zookeeper cluster, including StatefulSet,
Pod, PersistentVolumeClaim, Service, ConfigMap, et al.
type: object
maxUnavailableReplicas:
description: MaxUnavailableReplicas defines the MaxUnavailable Replicas
Expand Down Expand Up @@ -3875,7 +3876,8 @@ spec:
additionalProperties:
type: string
description: Labels specifies the labels to attach to pods the
operator creates for the zookeeper cluster.
operator creates for the zookeeper cluster. Overrides any values
specified in Spec.Labels.
type: object
nodeSelector:
additionalProperties:
Expand Down Expand Up @@ -4133,6 +4135,144 @@ spec:
type: string
type: object
type: array
topologySpreadConstraints:
description: TopologySpreadConstraints to apply to the pods
items:
description: TopologySpreadConstraint specifies how to spread
matching pods among the given topology.
properties:
labelSelector:
description: LabelSelector is used to find matching pods.
Pods that match this label selector are counted to determine
the number of pods in their corresponding topology domain.
properties:
matchExpressions:
description: matchExpressions is a list of label selector
requirements. The requirements are ANDed.
items:
description: A label selector requirement is a selector
that contains values, a key, and an operator that
relates the key and values.
properties:
key:
description: key is the label key that the selector
applies to.
type: string
operator:
description: operator represents a key's relationship
to a set of values. Valid operators are In,
NotIn, Exists and DoesNotExist.
type: string
values:
description: values is an array of string values.
If the operator is In or NotIn, the values array
must be non-empty. If the operator is Exists
or DoesNotExist, the values array must be empty.
This array is replaced during a strategic merge
patch.
items:
type: string
type: array
required:
- key
- operator
type: object
type: array
matchLabels:
additionalProperties:
type: string
description: matchLabels is a map of {key,value} pairs.
A single {key,value} in the matchLabels map is equivalent
to an element of matchExpressions, whose key field
is "key", the operator is "In", and the values array
contains only "value". The requirements are ANDed.
type: object
type: object
maxSkew:
description: 'MaxSkew describes the degree to which pods
may be unevenly distributed. When `whenUnsatisfiable=DoNotSchedule`,
it is the maximum permitted difference between the number
of matching pods in the target topology and the global
minimum. The global minimum is the minimum number of matching
pods in an eligible domain or zero if the number of eligible
domains is less than MinDomains. For example, in a 3-zone
cluster, MaxSkew is set to 1, and pods with the same labelSelector
spread as 2/2/1: In this case, the global minimum is 1.
| zone1 | zone2 | zone3 | | P P | P P | P | -
if MaxSkew is 1, incoming pod can only be scheduled to
zone3 to become 2/2/2; scheduling it onto zone1(zone2)
would make the ActualSkew(3-1) on zone1(zone2) violate
MaxSkew(1). - if MaxSkew is 2, incoming pod can be scheduled
onto any zone. When `whenUnsatisfiable=ScheduleAnyway`,
it is used to give higher precedence to topologies that
satisfy it. It''s a required field. Default value is 1
and 0 is not allowed.'
format: int32
type: integer
minDomains:
description: "MinDomains indicates a minimum number of eligible
domains. When the number of eligible domains with matching
topology keys is less than minDomains, Pod Topology Spread
treats \"global minimum\" as 0, and then the calculation
of Skew is performed. And when the number of eligible
domains with matching topology keys equals or greater
than minDomains, this value has no effect on scheduling.
As a result, when the number of eligible domains is less
than minDomains, scheduler won't schedule more than maxSkew
Pods to those domains. If value is nil, the constraint
behaves as if MinDomains is equal to 1. Valid values are
integers greater than 0. When value is not nil, WhenUnsatisfiable
must be DoNotSchedule. \n For example, in a 3-zone cluster,
MaxSkew is set to 2, MinDomains is set to 5 and pods with
the same labelSelector spread as 2/2/2: | zone1 | zone2
| zone3 | | P P | P P | P P | The number of domains
is less than 5(MinDomains), so \"global minimum\" is treated
as 0. In this situation, new pod with the same labelSelector
cannot be scheduled, because computed skew will be 3(3
- 0) if new Pod is scheduled to any of the three zones,
it will violate MaxSkew. \n This is an alpha field and
requires enabling MinDomainsInPodTopologySpread feature
gate."
format: int32
type: integer
topologyKey:
description: TopologyKey is the key of node labels. Nodes
that have a label with this key and identical values are
considered to be in the same topology. We consider each
<key, value> as a "bucket", and try to put balanced number
of pods into each bucket. We define a domain as a particular
instance of a topology. Also, we define an eligible domain
as a domain whose nodes match the node selector. e.g.
If TopologyKey is "kubernetes.io/hostname", each Node
is a domain of that topology. And, if TopologyKey is "topology.kubernetes.io/zone",
each zone is a domain of that topology. It's a required
field.
type: string
whenUnsatisfiable:
description: 'WhenUnsatisfiable indicates how to deal with
a pod if it doesn''t satisfy the spread constraint. -
DoNotSchedule (default) tells the scheduler not to schedule
it. - ScheduleAnyway tells the scheduler to schedule the
pod in any location, but giving higher precedence to topologies
that would help reduce the skew. A constraint is considered
"Unsatisfiable" for an incoming pod if and only if every
possible node assignment for that pod would violate "MaxSkew"
on some topology. For example, in a 3-zone cluster, MaxSkew
is set to 1, and pods with the same labelSelector spread
as 3/1/1: | zone1 | zone2 | zone3 | | P P P | P | P |
If WhenUnsatisfiable is set to DoNotSchedule, incoming
pod can only be scheduled to zone2(zone3) to become 3/2/1(3/1/2)
as ActualSkew(2-1) on zone2(zone3) satisfies MaxSkew(1).
In other words, the cluster can still be imbalanced, but
scheduler won''t make it *more* imbalanced. It''s a required
field.'
type: string
required:
- maxSkew
- topologyKey
- whenUnsatisfiable
type: object
type: array
type: object
ports:
items:
Expand Down
2 changes: 1 addition & 1 deletion charts/zookeeper-operator/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ global:

image:
repository: pravega/zookeeper-operator
tag: 0.2.14
tag: 0.2.15
pullPolicy: IfNotPresent

securityContext: {}
Expand Down
4 changes: 2 additions & 2 deletions charts/zookeeper/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
apiVersion: v2
name: zookeeper
description: Zookeeper Helm chart for Kubernetes
version: 0.2.14
appVersion: 0.2.14
version: 0.2.15
appVersion: 0.2.15
keywords:
- zookeeper
- storage
Expand Down
2 changes: 1 addition & 1 deletion charts/zookeeper/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ The following table lists the configurable parameters of the zookeeper chart and
| `maxUnavailableReplicas` | Max unavailable replicas in pdb | `1` |
| `triggerRollingRestart` | If true, the zookeeper cluster is restarted. After the restart is triggered, this value is auto-reverted to false. | `false` |
| `image.repository` | Image repository | `pravega/zookeeper` |
| `image.tag` | Image tag | `0.2.14` |
| `image.tag` | Image tag | `0.2.15` |
| `image.pullPolicy` | Image pull policy | `IfNotPresent` |
| `domainName` | External host name appended for dns annotation | |
| `kubernetesClusterDomain` | Domain of the kubernetes cluster | `cluster.local` |
Expand Down
4 changes: 4 additions & 0 deletions charts/zookeeper/templates/zookeeper.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@ spec:
{{- if .Values.pod.affinity }}
affinity:
{{ toYaml .Values.pod.affinity | indent 6 }}
{{- end }}
{{- if .Values.pod.topologySpreadConstraints }}
topologySpreadConstraints:
{{ toYaml .Values.pod.topologySpreadConstraints | indent 6 }}
{{- end }}
{{- if .Values.pod.resources }}
resources:
Expand Down
3 changes: 2 additions & 1 deletion charts/zookeeper/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ maxUnavailableReplicas:

image:
repository: pravega/zookeeper
tag: 0.2.14
tag: 0.2.15
pullPolicy: IfNotPresent

triggerRollingRestart: false
Expand Down Expand Up @@ -36,6 +36,7 @@ pod:
# labels: {}
# nodeSelector: {}
# affinity: {}
# topologySpreadConstraints: {}
# resources: {}
# tolerations: []
# env: []
Expand Down
Loading