diff --git a/.test-infra/pipelines/infrastructure/03.io/api-overuse-study/02.redis/README.md b/.test-infra/pipelines/infrastructure/03.io/api-overuse-study/02.redis/README.md new file mode 100644 index 000000000000..9ea3a98ee777 --- /dev/null +++ b/.test-infra/pipelines/infrastructure/03.io/api-overuse-study/02.redis/README.md @@ -0,0 +1,46 @@ + + +# Overview + +This directory provisions a redis cluster in Kubernetes. + +# Usage + +Follow terraform workflow convention to apply this module. It assumes the +working directory is at +[.test-infra/pipelines/infrastructure/03.io/api-overuse-study](..). + +## Terraform Init + +Initialize the terraform workspace. + +``` +DIR=02.redis +terraform -chdir=$DIR init +``` + +## Terraform Apply + +Apply the terraform module. + +``` +DIR=02.redis +terraform -chdir=$DIR apply -var-file=common.tfvars +``` \ No newline at end of file diff --git a/.test-infra/pipelines/infrastructure/03.io/api-overuse-study/02.redis/common.tfvars b/.test-infra/pipelines/infrastructure/03.io/api-overuse-study/02.redis/common.tfvars new file mode 100644 index 000000000000..f71b496b5a20 --- /dev/null +++ b/.test-infra/pipelines/infrastructure/03.io/api-overuse-study/02.redis/common.tfvars @@ -0,0 +1,19 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace = "api-overuse-study" \ No newline at end of file diff --git a/.test-infra/pipelines/infrastructure/03.io/api-overuse-study/02.redis/data.tf b/.test-infra/pipelines/infrastructure/03.io/api-overuse-study/02.redis/data.tf new file mode 100644 index 000000000000..32cb7434d300 --- /dev/null +++ b/.test-infra/pipelines/infrastructure/03.io/api-overuse-study/02.redis/data.tf @@ -0,0 +1,24 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// Query the Kubernetes namespace to verify existence. +data "kubernetes_namespace" "default" { + metadata { + name = var.namespace + } +} \ No newline at end of file diff --git a/.test-infra/pipelines/infrastructure/03.io/api-overuse-study/02.redis/provider.tf b/.test-infra/pipelines/infrastructure/03.io/api-overuse-study/02.redis/provider.tf new file mode 100644 index 000000000000..20bdbac74ea2 --- /dev/null +++ b/.test-infra/pipelines/infrastructure/03.io/api-overuse-study/02.redis/provider.tf @@ -0,0 +1,27 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +provider "kubernetes" { + config_path = "~/.kube/config" +} + +provider "helm" { + kubernetes { + config_path = "~/.kube/config" + } +} \ No newline at end of file diff --git a/.test-infra/pipelines/infrastructure/03.io/api-overuse-study/02.redis/redis.tf b/.test-infra/pipelines/infrastructure/03.io/api-overuse-study/02.redis/redis.tf new file mode 100644 index 000000000000..93b74a28782e --- /dev/null +++ b/.test-infra/pipelines/infrastructure/03.io/api-overuse-study/02.redis/redis.tf @@ -0,0 +1,35 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// Spin up a Redis cluster within the Kubernetes cluster using the bitami +// helm chart. +resource "helm_release" "redis" { + wait = false + repository = "https://charts.bitnami.com/bitnami" + chart = "redis" + name = "redis" + namespace = data.kubernetes_namespace.default.metadata[0].name + set { + name = "auth.enabled" + value = false + } + set { + name = "auth.sentinel" + value = false + } +} \ No newline at end of file diff --git a/.test-infra/pipelines/infrastructure/03.io/api-overuse-study/02.redis/variables.tf b/.test-infra/pipelines/infrastructure/03.io/api-overuse-study/02.redis/variables.tf new file mode 100644 index 000000000000..b55ce279654a --- /dev/null +++ b/.test-infra/pipelines/infrastructure/03.io/api-overuse-study/02.redis/variables.tf @@ -0,0 +1,22 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +variable "namespace" { + type = string + description = "The Kubernetes namespace" +} \ No newline at end of file