Skip to content

Commit

Permalink
Merge branch 'fix-sgshardedcluster-managed-sql-status' into 'main'
Browse files Browse the repository at this point in the history
fix: SGScript status is corrupted for SGShardedCluster

See merge request ongresinc/stackgres!1501
  • Loading branch information
teoincontatto committed Dec 20, 2023
2 parents 7cab40d + da88031 commit b6c9dc4
Show file tree
Hide file tree
Showing 249 changed files with 4,468 additions and 4,703 deletions.
2 changes: 1 addition & 1 deletion .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ image: null

variables:
SG_CI_IMAGE_NAME: "ci:1.23"
BUILDER_IMAGE_NAME: "builder:1.6"
BUILDER_IMAGE_NAME: "builder:1.7"
SKIP_NATIVE: "false"
SKIP_E2E: "false"
SKIP_DEPLOY: "false"
Expand Down
2 changes: 1 addition & 1 deletion .gitlab-ci/image-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
retry: 2

.build image multi archs:
image: docker:20.10.12
image: docker:24.0.7
stage: image build multi archs
timeout: 1 hour
script:
Expand Down
2 changes: 1 addition & 1 deletion .gitlab-ci/image-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
retry: 2

.release image multi archs:
image: docker:20.10.12
image: docker:24.0.7
stage: image build multi archs
timeout: 1 hour
script:
Expand Down
4 changes: 2 additions & 2 deletions .gitlab-ci/pre-build.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.pre build image:
image: docker:20.10.12
image: docker:24.0.7
stage: pre build
timeout: 1 hour
script:
Expand Down Expand Up @@ -27,7 +27,7 @@
retry: 2

.pre build image multi archs:
image: docker:20.10.12
image: docker:24.0.7
tags:
- stackgres-runner-v2
stage: pre build multi archs
Expand Down
1 change: 0 additions & 1 deletion ?/.redhat/anonymousId

This file was deleted.

7 changes: 3 additions & 4 deletions stackgres-k8s/ci/build/Dockerfile-builder
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,11 @@
#
# Build the image with:
#
# docker build -f stackgres-k8s/ci/build/Dockerfile-builder -t registry.gitlab.com/ongresinc/stackgres/build-amd64:1.6 stackgres-k8s/ci/build/
# docker build -f stackgres-k8s/ci/build/Dockerfile-builder -t registry.gitlab.com/ongresinc/stackgres/build-amd64:1.7 stackgres-k8s/ci/build/
#
###

FROM quay.io/quarkus/ubi-quarkus-mandrel-builder-image:22.3-java17
FROM quay.io/quarkus/ubi-quarkus-mandrel-builder-image:jdk-21.0.1
USER root
RUN microdnf --nodocs install python3-pip jq util-linux findutils
RUN microdnf --nodocs install python3-pip jq util-linux findutils && microdnf clean all
RUN pip3 install yamllint yq
RUN microdnf clean all
14 changes: 6 additions & 8 deletions stackgres-k8s/ci/build/config.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
.images:
ci_image: &ci_image registry.gitlab.com/ongresinc/stackgres/ci:1.23
jdk_build_image: &jdk_build_image registry.gitlab.com/ongresinc/stackgres/builder:1.6
jdk_runtime_image: &jdk_runtime_image registry.access.redhat.com/ubi8/openjdk-17:1.17-4
ubi8_micro_image: &ubi8_micro_image registry.access.redhat.com/ubi8-micro:8.8-7.1696517612
ubi9_minimal_image: &ubi9_minimal_image registry.access.redhat.com/ubi9-minimal:9.3-1361
admin_ui_build_image: &admin_ui_build_image registry.access.redhat.com/ubi8/nodejs-16:1-129.1698060573
admin_ui_nginx_image: &admin_ui_nginx_image registry.access.redhat.com/ubi8/nginx-120:1-127.1698060561
jdk_build_image: &jdk_build_image registry.gitlab.com/ongresinc/stackgres/builder:1.7
jdk_runtime_image: &jdk_runtime_image registry.access.redhat.com/ubi8/openjdk-21-runtime:1.18-2
ubi8_micro_image: &ubi8_micro_image registry.access.redhat.com/ubi8-micro:8.9-4
ubi9_minimal_image: &ubi9_minimal_image registry.access.redhat.com/ubi9-minimal:9.3-1361.1699548032
admin_ui_build_image: &admin_ui_build_image registry.access.redhat.com/ubi8/nodejs-16:1-139
admin_ui_nginx_image: &admin_ui_nginx_image registry.access.redhat.com/ubi8/nginx-120:1-137
platforms:
- linux/x86_64
- linux/aarch64
Expand Down Expand Up @@ -134,8 +134,6 @@ modules:
- sh stackgres-k8s/ci/build/redact-version.sh api-web
sources:
- stackgres-k8s/src/api-web/src/test
post_build_commands:
- 'sh $SHELL_XTRACE stackgres-k8s/src/api-web/src/main/swagger/build.sh'
artifacts:
- stackgres-k8s/src/api-web/target
jobs-java:
Expand Down
6 changes: 3 additions & 3 deletions stackgres-k8s/e2e/envs/kind
Original file line number Diff line number Diff line change
Expand Up @@ -318,14 +318,14 @@ EOF
echo "Setting up calico for kind..."
until kubectl get node --template '{{ if (index .items 0).spec.podCIDR }}true{{ end }}' | grep -q 'true'
do
sleep 1
sleep 3
done
K8S_POD_CIDR="$(kubectl get node --template '{{ (index .items 0).spec.podCIDR }}')"
if [ "$(echo "$K8S_VERSION" | tr . '\n' | head -n 2 | xargs -I @ printf '%05d' @)" \
-ge "$(echo "1.22" | tr . '\n' | xargs -I @ printf '%05d' @)" ]
then
kubectl create -f https://docs.projectcalico.org/archive/v3.24/manifests/tigera-operator.yaml
kubectl create -f https://docs.projectcalico.org/archive/v3.24/manifests/custom-resources.yaml
kubectl create -f https://raw.githubusercontent.com/projectcalico/calico/v3.26.4/manifests/tigera-operator.yaml
kubectl create -f https://raw.githubusercontent.com/projectcalico/calico/v3.26.4/manifests/custom-resources.yaml
kubectl patch installations.operator.tigera.io default --type json \
-p '[{"op":"replace","path":"/spec/calicoNetwork/ipPools/0/cidr","value":"'"$K8S_POD_CIDR"'"}]'
else
Expand Down
6 changes: 3 additions & 3 deletions stackgres-k8s/e2e/spec/operator-cluster-api
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ check_cluster_directly() {

test_named_queries_endpoints() {
# top_pg_stat_statements query
if run_curl -r "stackgres/namespaces/$CLUSTER_NAMESPACE/sgcluster/$CLUSTER_NAME/query?named=top_pg_stat_statements" \
if run_curl -r "stackgres/namespaces/$CLUSTER_NAMESPACE/sgclusters/$CLUSTER_NAME/query?named=top_pg_stat_statements" \
| jq -r '(.[0] | has("fields")) and ((. | length) == 1 or (.[1] | length) == (.[0].fields | length))' \
| grep -qxF "true"
then
Expand All @@ -135,7 +135,7 @@ test_named_queries_endpoints() {
fi

# top_pg_stat_activity query
if run_curl -r "stackgres/namespaces/$CLUSTER_NAMESPACE/sgcluster/$CLUSTER_NAME/query?named=top_pg_stat_activity" \
if run_curl -r "stackgres/namespaces/$CLUSTER_NAMESPACE/sgclusters/$CLUSTER_NAME/query?named=top_pg_stat_activity" \
| jq -r '(.[0] | has("fields")) and ((. | length) == 1 or (.[1] | length) == (.[0].fields | length))' \
| grep -qxF "true"
then
Expand All @@ -146,7 +146,7 @@ test_named_queries_endpoints() {
fi

# top_pg_locks query
if run_curl -r "stackgres/namespaces/$CLUSTER_NAMESPACE/sgcluster/$CLUSTER_NAME/query?named=top_pg_locks" \
if run_curl -r "stackgres/namespaces/$CLUSTER_NAMESPACE/sgclusters/$CLUSTER_NAME/query?named=top_pg_locks" \
| jq -r '(.[0] | has("fields")) and ((. | length) == 1 or (.[1] | length) == (.[0].fields | length))' \
| grep -qxF "true"
then
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,5 +198,6 @@ rules:
- sgscripts.stackgres.io
verbs:
- patch
- update
{{- end }}
{{- end }}
2 changes: 1 addition & 1 deletion stackgres-k8s/src/.mvn/wrapper/maven-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.5/apache-maven-3.9.5-bin.zip
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.6/apache-maven-3.9.6-bin.zip
wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar
65 changes: 29 additions & 36 deletions stackgres-k8s/src/api-web/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@
~ SPDX-License-Identifier: AGPL-3.0-or-later
-->

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>stackgres-parent</artifactId>
<groupId>io.stackgres</groupId>
<version>1.7.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>stackgres-restapi</artifactId>
<packaging>jar</packaging>
Expand Down Expand Up @@ -68,18 +70,18 @@
<artifactId>jakarta.persistence-api</artifactId>
</dependency>
<dependency>
<groupId>io.swagger.core.v3</groupId>
<artifactId>swagger-annotations-jakarta</artifactId>
</dependency>
<dependency>
<groupId>io.swagger.core.v3</groupId>
<artifactId>swagger-maven-plugin-jakarta</artifactId>
<version>${swagger-maven-plugin-jakarta.version}</version>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-smallrye-openapi</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-rest-client</artifactId>
</dependency>
<dependency>
<groupId>io.sundr</groupId>
<artifactId>builder-annotations</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>io.stackgres</groupId>
<artifactId>stackgres-test-util</artifactId>
Expand Down Expand Up @@ -118,6 +120,16 @@
<groupId>com.ongres</groupId>
<artifactId>docker-junit-extension</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.jooq</groupId>
<artifactId>jool-java-8</artifactId>
</exclusion>
<exclusion>
<groupId>net.java.dev.jna</groupId>
<artifactId>jna</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
Expand All @@ -144,6 +156,12 @@
<groupId>io.quarkus</groupId>
<artifactId>quarkus-test-keycloak-server</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>net.java.dev.jna</groupId>
<artifactId>jna</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>

Expand Down Expand Up @@ -171,6 +189,8 @@
<execution>
<goals>
<goal>build</goal>
<goal>generate-code</goal>
<goal>generate-code-tests</goal>
</goals>
</execution>
</executions>
Expand All @@ -179,33 +199,6 @@
<groupId>io.smallrye</groupId>
<artifactId>jandex-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>io.swagger.core.v3</groupId>
<artifactId>swagger-maven-plugin-jakarta</artifactId>
<configuration>
<skip>false</skip>
<resourcePackages>
<resourcePackage>io.stackgres.apiweb.rest</resourcePackage>
<resourcePackage>io.stackgres.apiweb.dto</resourcePackage>
<resourcePackage>io.stackgres.apiweb.security</resourcePackage>
</resourcePackages>
<outputPath>${basedir}/target/</outputPath>
<outputFileName>swagger</outputFileName>
<outputFormat>YAML</outputFormat>
<prettyPrint>true</prettyPrint>
<readAllResources>true</readAllResources>
<alwaysResolveAppPath>true</alwaysResolveAppPath>
<skipResolveAppPath>true</skipResolveAppPath>
</configuration>
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>resolve</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<profiles>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ FROM "$BASE_IMAGE"
echo 'jboss:!!:18655:0:99999:7:::' >> /etc/shadow && \
echo 'jboss:100000:65536' >> /etc/subgid

COPY 'target/*.so' '/app/'
COPY 'src/main/docker/stackgres-restapi.native.sh' '/app/stackgres-restapi.sh'
COPY 'target/stackgres-restapi-runner' '/app/stackgres-restapi'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,21 @@
@JsonInclude(JsonInclude.Include.NON_DEFAULT)
public class ClusterNonProductionOptions {

public Boolean disableClusterPodAntiAffinity;
Boolean disableClusterPodAntiAffinity;

public Boolean disablePatroniResourceRequirements;
Boolean disablePatroniResourceRequirements;

public Boolean disableClusterResourceRequirements;
Boolean disableClusterResourceRequirements;

public Boolean enableSetPatroniCpuRequests;
Boolean enableSetPatroniCpuRequests;

public Boolean enableSetClusterCpuRequests;
Boolean enableSetClusterCpuRequests;

public Boolean enableSetPatroniMemoryRequests;
Boolean enableSetPatroniMemoryRequests;

public Boolean enableSetClusterMemoryRequests;
Boolean enableSetClusterMemoryRequests;

public List<String> enabledFeatureGates;
List<String> enabledFeatureGates;

public Boolean getDisableClusterPodAntiAffinity() {
return disableClusterPodAntiAffinity;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,19 @@
@JsonInclude(JsonInclude.Include.NON_DEFAULT)
public class DistributedLogsNonProductionOptions {

public Boolean disableClusterPodAntiAffinity;
Boolean disableClusterPodAntiAffinity;

public Boolean disablePatroniResourceRequirements;
Boolean disablePatroniResourceRequirements;

public Boolean disableClusterResourceRequirements;
Boolean disableClusterResourceRequirements;

public Boolean enableSetPatroniCpuRequests;
Boolean enableSetPatroniCpuRequests;

public Boolean enableSetClusterCpuRequests;
Boolean enableSetClusterCpuRequests;

public Boolean enableSetPatroniMemoryRequests;
Boolean enableSetPatroniMemoryRequests;

public Boolean enableSetClusterMemoryRequests;
Boolean enableSetClusterMemoryRequests;

public Boolean getDisableClusterPodAntiAffinity() {
return disableClusterPodAntiAffinity;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,12 @@

import java.util.List;

import com.fasterxml.jackson.annotation.JsonInclude;
import io.quarkus.runtime.annotations.RegisterForReflection;
import io.stackgres.apiweb.dto.ResourceClassForDto;
import io.stackgres.common.crd.sgpgconfig.StackGresPostgresConfig;

@RegisterForReflection
@JsonInclude(JsonInclude.Include.NON_DEFAULT)
@ResourceClassForDto(StackGresPostgresConfig.class)
public record PostgresStatDto(int resultSetIndex, List<String> fields) { }
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ protected ImmutableMap<PatroniStatsScripts, String> getPodStats(Pod pod) {
LOGGER.debug("An error accurred while retrieving stats for pod {}.{}: {}",
pod.getMetadata().getNamespace(),
pod.getMetadata().getName(),
ex.getMessage());
ex.getMessage(), ex);
return ImmutableMap.<PatroniStatsScripts, String>of();
}
}
Expand Down
Loading

0 comments on commit b6c9dc4

Please sign in to comment.