Skip to content

Commit

Permalink
Updated strimzi version (#827)
Browse files Browse the repository at this point in the history
  • Loading branch information
psav authored Jun 14, 2023
1 parent 25cea61 commit d8400e4
Show file tree
Hide file tree
Showing 22 changed files with 968 additions and 450 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ IMAGE_TAG_BASE ?= quay.io/cloudservices/clowder
CLOWDER_BUILD_TAG ?= $(shell git rev-parse --short=8 HEAD)

# ENVTEST_K8S_VERSION refers to the version of kubebuilder assets to be downloaded by envtest binary.
ENVTEST_K8S_VERSION = 1.24
ENVTEST_K8S_VERSION = 1.26

# Image URL to use all building/pushing image targets
ifeq ($(findstring -minikube,${MAKECMDGOALS}), -minikube)
Expand Down
8 changes: 4 additions & 4 deletions build/kube_setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ mkdir -p "$DOWNLOAD_DIR"


function install_strimzi_operator {
STRIMZI_VERSION=0.29.0
STRIMZI_VERSION=0.34.0
STRIMZI_OPERATOR_NS=strimzi
WATCH_NS="*"
STRIMZI_TARFILE="strimzi-${STRIMZI_VERSION}.tar.gz"
Expand Down Expand Up @@ -115,8 +115,8 @@ function install_strimzi_operator {
--clusterrole=strimzi-cluster-operator-namespaced --serviceaccount ${STRIMZI_OPERATOR_NS}:strimzi-cluster-operator || echo " ... ignoring that error"
${KUBECTL_CMD} create clusterrolebinding strimzi-cluster-operator-entity-operator-delegation \
--clusterrole=strimzi-entity-operator --serviceaccount ${STRIMZI_OPERATOR_NS}:strimzi-cluster-operator || echo " ... ignoring that error"
${KUBECTL_CMD} create clusterrolebinding strimzi-cluster-operator-topic-operator-delegation \
--clusterrole=strimzi-topic-operator --serviceaccount ${STRIMZI_OPERATOR_NS}:strimzi-cluster-operator || echo " ... ignoring that error"
${KUBECTL_CMD} create clusterrolebinding strimzi-cluster-operator-watched \
--clusterrole=strimzi-cluster-operator-watched --serviceaccount ${STRIMZI_OPERATOR_NS}:strimzi-cluster-operator || echo " ... ignoring that error"

if [ $REINSTALL -ne 1 ]; then
echo "*** Installing Strimzi resources ..."
Expand Down Expand Up @@ -286,7 +286,7 @@ function install_keda_operator {
fi

echo "*** Applying keda-operator manifest ..."
${KUBECTL_CMD} apply -f https://github.com/kedacore/keda/releases/download/v2.4.0/keda-2.4.0.yaml
${KUBECTL_CMD} apply -f https://github.com/kedacore/keda/releases/download/v2.10.1/keda-2.10.1.yaml

echo "*** Will wait for keda-operator to come up in background"
${KUBECTL_CMD} rollout status deployment/$DEPLOYMENT -n $OPERATOR_NS | sed "s/^/[keda-operator] /" &
Expand Down
2 changes: 1 addition & 1 deletion build/pr_check_inner.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export PATH="/bins:$PATH"
chmod 600 minikube-ssh-ident

ssh -o StrictHostKeyChecking=no $MINIKUBE_USER@$MINIKUBE_HOST -i minikube-ssh-ident "minikube delete"
ssh -o StrictHostKeyChecking=no $MINIKUBE_USER@$MINIKUBE_HOST -i minikube-ssh-ident "minikube start --cpus 6 --disk-size 10GB --memory 16000MB --kubernetes-version=1.23.5 --addons=metrics-server --disable-optimizations"
ssh -o StrictHostKeyChecking=no $MINIKUBE_USER@$MINIKUBE_HOST -i minikube-ssh-ident "minikube start --cpus 6 --disk-size 10GB --memory 16000MB --kubernetes-version=1.26.3 --addons=metrics-server --disable-optimizations"

export MINIKUBE_IP=`ssh -o StrictHostKeyChecking=no $MINIKUBE_USER@$MINIKUBE_HOST -i minikube-ssh-ident "minikube ip"`

Expand Down
254 changes: 200 additions & 54 deletions config/crd/bases/cloud.redhat.com_clowdapps.yaml

Large diffs are not rendered by default.

67 changes: 67 additions & 0 deletions config/crd/bases/cloud.redhat.com_clowdenvironments.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -517,6 +517,29 @@ spec:
default resource requirements from the ClowdEnvironment
will be used.
properties:
claims:
description: "Claims lists the names of resources,
defined in spec.resourceClaims, that are used by
this container. \n This is an alpha field and requires
enabling the DynamicResourceAllocation feature gate.
\n This field is immutable."
items:
description: ResourceClaim references one entry
in PodSpec.ResourceClaims.
properties:
name:
description: Name must match the name of one
entry in pod.spec.resourceClaims of the Pod
where this field is used. It makes that resource
available inside a container.
type: string
required:
- name
type: object
type: array
x-kubernetes-list-map-keys:
- name
x-kubernetes-list-type: map
limits:
additionalProperties:
anyOf:
Expand Down Expand Up @@ -561,6 +584,30 @@ spec:
description: Defines the resource requests/limits
set on selenium containers
properties:
claims:
description: "Claims lists the names of resources,
defined in spec.resourceClaims, that are
used by this container. \n This is an alpha
field and requires enabling the DynamicResourceAllocation
feature gate. \n This field is immutable."
items:
description: ResourceClaim references one
entry in PodSpec.ResourceClaims.
properties:
name:
description: Name must match the name
of one entry in pod.spec.resourceClaims
of the Pod where this field is used.
It makes that resource available inside
a container.
type: string
required:
- name
type: object
type: array
x-kubernetes-list-map-keys:
- name
x-kubernetes-list-type: map
limits:
additionalProperties:
anyOf:
Expand Down Expand Up @@ -714,6 +761,26 @@ spec:
k8s format in the event that they omitted from a PodSpec inside
a ClowdApp.
properties:
claims:
description: "Claims lists the names of resources, defined in
spec.resourceClaims, that are used by this container. \n This
is an alpha field and requires enabling the DynamicResourceAllocation
feature gate. \n This field is immutable."
items:
description: ResourceClaim references one entry in PodSpec.ResourceClaims.
properties:
name:
description: Name must match the name of one entry in pod.spec.resourceClaims
of the Pod where this field is used. It makes that resource
available inside a container.
type: string
required:
- name
type: object
type: array
x-kubernetes-list-map-keys:
- name
x-kubernetes-list-type: map
limits:
additionalProperties:
anyOf:
Expand Down
12 changes: 11 additions & 1 deletion controllers/cloud.redhat.com/clowdapp_reconciliation.go
Original file line number Diff line number Diff line change
Expand Up @@ -249,8 +249,18 @@ func (r *ClowdAppReconciliation) isEnvReady() (ctrl.Result, error) {
return ctrl.Result{}, nil
}

var applyOrder = []string{
"*",
"Service",
"Secret",
"Deployment",
"Job",
"CronJob",
"ScaledObject",
}

func (r *ClowdAppReconciliation) createCache() (ctrl.Result, error) {
cacheConfig := rc.NewCacheConfig(Scheme, nil, ProtectedGVKs, rc.Options{StrictGVK: true, DebugOptions: DebugOptions})
cacheConfig := rc.NewCacheConfig(Scheme, nil, ProtectedGVKs, rc.Options{StrictGVK: true, DebugOptions: DebugOptions, Ordering: applyOrder})
cache := rc.NewObjectCache(r.ctx, r.client, r.log, cacheConfig)
r.cache = &cache
return ctrl.Result{}, nil
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ func (r *ClowdEnvironmentReconciler) Reconcile(ctx context.Context, req ctrl.Req
}

ctx = context.WithValue(ctx, errors.ClowdKey("obj"), &env)
cacheConfig := rc.NewCacheConfig(Scheme, nil, ProtectedGVKs, rc.Options{StrictGVK: true, DebugOptions: DebugOptions})
cacheConfig := rc.NewCacheConfig(Scheme, nil, ProtectedGVKs, rc.Options{StrictGVK: true, DebugOptions: DebugOptions, Ordering: applyOrder})
cache := rc.NewObjectCache(ctx, r.Client, &log, cacheConfig)

r.initMetrics(env)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ func (r *ClowdJobInvocationReconciler) Reconcile(ctx context.Context, req ctrl.R
return ctrl.Result{}, err
}

cacheConfig := rc.NewCacheConfig(Scheme, nil, ProtectedGVKs, rc.Options{StrictGVK: true, DebugOptions: DebugOptions})
cacheConfig := rc.NewCacheConfig(Scheme, nil, ProtectedGVKs, rc.Options{StrictGVK: true, DebugOptions: DebugOptions, Ordering: applyOrder})
cache := rc.NewObjectCache(ctx, r.Client, &log, cacheConfig)
cache.AddPossibleGVKFromIdent(
iqe.IqeSecret,
Expand Down
2 changes: 1 addition & 1 deletion controllers/cloud.redhat.com/providers/autoscaler/keda.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ func getTriggerRoute(triggerType string, c *config.AppConfig, env *crd.ClowdEnvi
case "kafka":
result["bootstrapServers"] = fmt.Sprintf("%s:%d", c.Kafka.Brokers[0].Hostname, *c.Kafka.Brokers[0].Port)
case "prometheus":
result["serverAddress"] = env.Status.Prometheus.Hostname
result["serverAddress"] = "http://" + env.Status.Prometheus.Hostname + ":9090"

// The following are the possible triggers for the keda autoscaler.
// See https://github.com/kedacore/keda/blob/main/pkg/scaling/scale_handler.go#L313.
Expand Down
15 changes: 9 additions & 6 deletions controllers/cloud.redhat.com/providers/kafka/strimzi.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ func (s *strimziProvider) configureKafkaCluster() error {

version := s.Env.Spec.Providers.Kafka.Cluster.Version
if version == "" {
version = "3.1.0"
version = "3.4.0"
}

deleteClaim := s.Env.Spec.Providers.Kafka.Cluster.DeleteClaim
Expand Down Expand Up @@ -510,9 +510,11 @@ func (s *strimziProvider) createKafkaConnectUser() error {
topic := "*"
patternType := strimzi.KafkaUserSpecAuthorizationAclsElemResourcePatternTypeLiteral

all := strimzi.KafkaUserSpecAuthorizationAclsElemOperationAll

ku.Spec.Authorization.Acls = append(ku.Spec.Authorization.Acls, strimzi.KafkaUserSpecAuthorizationAclsElem{
Host: &address,
Operation: strimzi.KafkaUserSpecAuthorizationAclsElemOperationAll,
Operation: &all,
Resource: strimzi.KafkaUserSpecAuthorizationAclsElemResource{
Name: &topic,
PatternType: &patternType,
Expand All @@ -523,7 +525,7 @@ func (s *strimziProvider) createKafkaConnectUser() error {
group := "*"
ku.Spec.Authorization.Acls = append(ku.Spec.Authorization.Acls, strimzi.KafkaUserSpecAuthorizationAclsElem{
Host: &address,
Operation: strimzi.KafkaUserSpecAuthorizationAclsElemOperationAll,
Operation: &all,
Resource: strimzi.KafkaUserSpecAuthorizationAclsElemResource{
Name: &group,
PatternType: &patternType,
Expand Down Expand Up @@ -595,7 +597,7 @@ func (s *strimziProvider) configureKafkaConnectCluster(configs *config.KafkaConf

version := s.Env.Spec.Providers.Kafka.Connect.Version
if version == "" {
version = "3.1.0"
version = "3.4.0"
}

image := s.Env.Spec.Providers.Kafka.Connect.Image
Expand Down Expand Up @@ -890,13 +892,14 @@ func (s *strimziProvider) createKafkaUser(app *crd.ClowdApp) error {

address := "*"
patternType := strimzi.KafkaUserSpecAuthorizationAclsElemResourcePatternTypeLiteral
all := strimzi.KafkaUserSpecAuthorizationAclsElemOperationAll

for _, topic := range app.Spec.KafkaTopics {
topicName := getTopicName(topic, *s.Env, app.Namespace)

ku.Spec.Authorization.Acls = append(ku.Spec.Authorization.Acls, strimzi.KafkaUserSpecAuthorizationAclsElem{
Host: &address,
Operation: strimzi.KafkaUserSpecAuthorizationAclsElemOperationAll,
Operation: &all,
Resource: strimzi.KafkaUserSpecAuthorizationAclsElemResource{
Name: &topicName,
PatternType: &patternType,
Expand All @@ -908,7 +911,7 @@ func (s *strimziProvider) createKafkaUser(app *crd.ClowdApp) error {
group := "*"
ku.Spec.Authorization.Acls = append(ku.Spec.Authorization.Acls, strimzi.KafkaUserSpecAuthorizationAclsElem{
Host: &address,
Operation: strimzi.KafkaUserSpecAuthorizationAclsElemOperationAll,
Operation: &all,
Resource: strimzi.KafkaUserSpecAuthorizationAclsElemResource{
Name: &group,
PatternType: &patternType,
Expand Down
12 changes: 10 additions & 2 deletions controllers/cloud.redhat.com/providers/objectstore/minio_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,15 +165,23 @@ func (fc *FakeClient) RESTMapper() meta.RESTMapper {
return nil
}

func (fc *FakeClient) SubResource(_ string) client.SubResourceClient {
return nil
}

func (fc *FakeClient) Status() client.StatusWriter {
return &FakeStatus{}
}

func (fc *FakeStatus) Update(_ context.Context, _ client.Object, _ ...client.UpdateOption) error {
func (fc *FakeStatus) Patch(_ context.Context, _ client.Object, _ client.Patch, _ ...client.SubResourcePatchOption) error {
return nil
}

func (fc *FakeStatus) Create(_ context.Context, _ client.Object, _ client.Object, _ ...client.SubResourceCreateOption) error {
return nil
}

func (fc *FakeStatus) Patch(_ context.Context, _ client.Object, _ client.Patch, _ ...client.PatchOption) error {
func (fc *FakeStatus) Update(_ context.Context, _ client.Object, _ ...client.SubResourceUpdateOption) error {
return nil
}

Expand Down
Loading

0 comments on commit d8400e4

Please sign in to comment.