Skip to content

Commit 21056c1

Browse files
authored
Merge branch 'renoki-co:master' into feature/add-host-aliases-to-pod
2 parents 51e9a3f + 046c682 commit 21056c1

29 files changed

+215
-210
lines changed

.github/workflows/ci.yml

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,25 +15,29 @@ jobs:
1515
if: "!contains(github.event.head_commit.message, 'skip ci')"
1616

1717
runs-on: ubuntu-latest
18+
timeout-minutes: 15
1819

1920
strategy:
2021
fail-fast: false
2122
matrix:
2223
php:
23-
- '8.0'
2424
- '8.1'
25+
- '8.2'
2526
kubernetes:
26-
- '1.22.9'
27-
- '1.23.6'
28-
- '1.24.0'
27+
- '1.24.12'
28+
- '1.25.8'
29+
- '1.26.3'
2930
laravel:
3031
- 9.*
32+
- 10.*
3133
prefer:
3234
- 'prefer-lowest'
3335
- 'prefer-stable'
3436
include:
3537
- laravel: 9.*
3638
testbench: 7.*
39+
- laravel: 10.*
40+
testbench: 8.*
3741

3842
name: PHP ${{ matrix.php }} - Laravel ${{ matrix.laravel }} - K8s v${{ matrix.kubernetes }} --${{ matrix.prefer }}
3943

@@ -53,12 +57,12 @@ jobs:
5357
path: ~/.composer/cache/files
5458
key: composer-php-${{ matrix.php }}-${{ matrix.laravel }}-${{ matrix.prefer }}-${{ hashFiles('composer.json') }}
5559

56-
- uses: manusa/actions-setup-minikube@v2.6.1
60+
- uses: medyagh/setup-minikube@latest
5761
name: Setup Minikube
5862
with:
59-
minikube version: v1.25.2
60-
kubernetes version: "v${{ matrix.kubernetes }}"
61-
github token: "${{ secrets.GITHUB_TOKEN }}"
63+
minikube-version: 1.29.0
64+
container-runtime: containerd
65+
kubernetes-version: "v${{ matrix.kubernetes }}"
6266

6367
- name: Run Kubernetes Proxy
6468
run: |
@@ -67,7 +71,7 @@ jobs:
6771
- name: Install dependencies
6872
run: |
6973
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update
70-
composer update --${{ matrix.prefer }} --prefer-dist --no-interaction --no-suggest
74+
composer update --${{ matrix.prefer }} --prefer-dist --no-interaction
7175
7276
- name: Setup in-cluster config
7377
run: |
@@ -79,7 +83,7 @@ jobs:
7983
8084
- name: Setting CRDs for testing
8185
run: |
82-
kubectl apply -f https://raw.githubusercontent.com/bitnami-labs/sealed-secrets/main/helm/sealed-secrets/crds/sealedsecret-crd.yaml
86+
kubectl apply -f https://raw.githubusercontent.com/bitnami-labs/sealed-secrets/main/helm/sealed-secrets/crds/bitnami.com_sealedsecrets.yaml
8387
8488
# - name: Run static analysis
8589
# run: |

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ PHP K8s
1111
[![Total Downloads](https://poser.pugx.org/renoki-co/php-k8s/downloads)](https://packagist.org/packages/renoki-co/php-k8s)
1212
[![Monthly Downloads](https://poser.pugx.org/renoki-co/php-k8s/d/monthly)](https://packagist.org/packages/renoki-co/php-k8s)
1313

14-
![v1.22.9 K8s Version](https://img.shields.io/badge/K8s%20v1.22.9-Ready-%23326ce5?colorA=306CE8&colorB=green)
15-
![v1.23.6 K8s Version](https://img.shields.io/badge/K8s%20v1.23.6-Ready-%23326ce5?colorA=306CE8&colorB=green)
16-
![v1.24.0 K8s Version](https://img.shields.io/badge/K8s%20v1.24.0-Ready-%23326ce5?colorA=306CE8&colorB=green)
14+
![v1.24.12 K8s Version](https://img.shields.io/badge/K8s%20v1.24.12-Ready-%23326ce5?colorA=306CE8&colorB=green)
15+
![v1.25.8 K8s Version](https://img.shields.io/badge/K8s%20v1.25.8-Ready-%23326ce5?colorA=306CE8&colorB=green)
16+
![v1.26.3 K8s Version](https://img.shields.io/badge/K8s%20v1.26.3-Ready-%23326ce5?colorA=306CE8&colorB=green)
1717
[![Client Capabilities](https://img.shields.io/badge/Kubernetes%20Client-Silver-blue.svg?colorB=C0C0C0&colorA=306CE8)](https://github.com/kubernetes/community/blob/master/contributors/design-proposals/api-machinery/csi-new-client-library-procedure.md#client-capabilities)
1818
[![Client Support Level](https://img.shields.io/badge/Kubernetes%20Client-stable-green.svg?colorA=306CE8)](https://github.com/kubernetes/community/blob/master/contributors/design-proposals/api-machinery/csi-new-client-library-procedure.md#client-support-level)
1919

composer.json

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
],
1414
"require": {
1515
"guzzlehttp/guzzle": "^6.5|^7.0",
16-
"illuminate/macroable": "^9.0.1",
17-
"illuminate/support": "^9.0.1",
16+
"illuminate/macroable": "^9.35|^10.1",
17+
"illuminate/support": "^9.35|^10.1",
1818
"ratchet/pawl": "^0.4.1",
1919
"symfony/process": "^5.4|^6.0",
2020
"vierbergenlars/php-semver": "^2.1|^3.0"
@@ -37,9 +37,8 @@
3737
},
3838
"require-dev": {
3939
"mockery/mockery": "^1.5",
40-
"orchestra/testbench": "^6.28|^7.0",
41-
"orchestra/testbench-core": "^6.28|^7.0",
42-
"phpunit/phpunit": "^9.5.20",
40+
"orchestra/testbench": "^7.23|^8.1",
41+
"phpunit/phpunit": "^9.5.20|^10.0",
4342
"vimeo/psalm": "^4.20"
4443
},
4544
"config": {

phpunit.xml

Lines changed: 14 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,16 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<phpunit bootstrap="vendor/autoload.php"
3-
backupGlobals="false"
4-
backupStaticAttributes="false"
5-
colors="true"
6-
verbose="true"
7-
convertErrorsToExceptions="true"
8-
convertNoticesToExceptions="true"
9-
convertWarningsToExceptions="true"
10-
processIsolation="false"
11-
stopOnFailure="false">
12-
<testsuites>
13-
<testsuite name="Renoki Co Test Suite">
14-
<directory>tests</directory>
15-
</testsuite>
16-
</testsuites>
17-
<filter>
18-
<whitelist>
19-
<directory suffix=".php">src/</directory>
20-
</whitelist>
21-
</filter>
22-
<php>
23-
<server name="APP_ENV" value="testing" />
24-
</php>
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" bootstrap="vendor/autoload.php" backupGlobals="false" backupStaticAttributes="false" colors="true" verbose="true" convertErrorsToExceptions="true" convertNoticesToExceptions="true" convertWarningsToExceptions="true" processIsolation="false" stopOnFailure="false" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
3+
<coverage>
4+
<include>
5+
<directory suffix=".php">src/</directory>
6+
</include>
7+
</coverage>
8+
<testsuites>
9+
<testsuite name="Renoki Co Test Suite">
10+
<directory>tests</directory>
11+
</testsuite>
12+
</testsuites>
13+
<php>
14+
<server name="APP_ENV" value="testing"/>
15+
</php>
2516
</phpunit>

src/Kinds/K8sCronJob.php

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
use Carbon\Carbon;
66
use Cron\CronExpression;
7+
use DateTime;
8+
use Illuminate\Support\Collection;
79
use RenokiCo\PhpK8s\Contracts\InteractsWithK8sCluster;
810
use RenokiCo\PhpK8s\Contracts\Watchable;
911
use RenokiCo\PhpK8s\Traits\Resource\HasSpec;
@@ -26,7 +28,7 @@ class K8sCronJob extends K8sResource implements InteractsWithK8sCluster, Watchab
2628
*
2729
* @var string
2830
*/
29-
protected static $defaultVersion = 'batch/v1beta1';
31+
protected static $defaultVersion = 'batch/v1';
3032

3133
/**
3234
* Wether the resource has a namespace.
@@ -38,7 +40,7 @@ class K8sCronJob extends K8sResource implements InteractsWithK8sCluster, Watchab
3840
/**
3941
* Set the job template.
4042
*
41-
* @param array|\RenokiCo\PhpK8s\Kinds\K8sJob $job
43+
* @param array|K8sJob $job
4244
* @return $this
4345
*/
4446
public function setJobTemplate($job)
@@ -54,7 +56,7 @@ public function setJobTemplate($job)
5456
* Get the template job.
5557
*
5658
* @param bool $asInstance
57-
* @return array|\RenokiCo\PhpK8s\Kinds\K8sJob
59+
* @return array|K8sJob
5860
*/
5961
public function getJobTemplate(bool $asInstance = true)
6062
{
@@ -70,7 +72,7 @@ public function getJobTemplate(bool $asInstance = true)
7072
/**
7173
* Set the schedule for the cronjob.
7274
*
73-
* @param \Cron\CronExpression|string $schedule
75+
* @param CronExpression|string $schedule
7476
* @return $this
7577
*/
7678
public function setSchedule($schedule)
@@ -86,7 +88,7 @@ public function setSchedule($schedule)
8688
* Retrieve the schedule.
8789
*
8890
* @param bool $asInstance
89-
* @return \Cron\CronExpression|string
91+
* @return CronExpression|string
9092
*/
9193
public function getSchedule(bool $asInstance = true)
9294
{
@@ -102,7 +104,7 @@ public function getSchedule(bool $asInstance = true)
102104
/**
103105
* Get the last time a job was scheduled.
104106
*
105-
* @return \DateTime|null
107+
* @return DateTime|null
106108
*/
107109
public function getLastSchedule()
108110
{
@@ -116,12 +118,12 @@ public function getLastSchedule()
116118
/**
117119
* Get the active jobs created by the cronjob.
118120
*
119-
* @return \Illuminate\Support\Collection
121+
* @return Collection
120122
*/
121123
public function getActiveJobs()
122124
{
123125
return collect($this->getStatus('active', []))->map(function ($job) {
124-
return $this->cluster->job($job)->refresh();
126+
return $this->cluster->getJobByName($job['name'], $this->getNamespace());
125127
});
126128
}
127129
}

src/Kinds/K8sHorizontalPodAutoscaler.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class K8sHorizontalPodAutoscaler extends K8sResource implements InteractsWithK8s
2828
*
2929
* @var string
3030
*/
31-
protected static $defaultVersion = 'autoscaling/v2beta2';
31+
protected static $defaultVersion = 'autoscaling/v2';
3232

3333
/**
3434
* Wether the resource has a namespace.
@@ -40,7 +40,7 @@ class K8sHorizontalPodAutoscaler extends K8sResource implements InteractsWithK8s
4040
/**
4141
* Set the reference to the scaling resource.
4242
*
43-
* @param \RenokiCo\PhpK8s\Contracts\Scalable $resource
43+
* @param Scalable $resource
4444
* @return $this
4545
*/
4646
public function setResource(Scalable $resource)
@@ -55,7 +55,7 @@ public function setResource(Scalable $resource)
5555
/**
5656
* Add a new metric.
5757
*
58-
* @param \RenokiCo\PhpK8s\Instances\ResourceMetric $metric
58+
* @param ResourceMetric $metric
5959
* @return $this
6060
*/
6161
public function addMetric(ResourceMetric $metric)

src/Kinds/K8sJob.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,6 @@ public function getDurationInSeconds(): int
151151
*/
152152
public function hasCompleted(): bool
153153
{
154-
return $this->getActivePodsCount() === 0;
154+
return ! is_null($this->getCompletionTime());
155155
}
156156
}

src/Kinds/K8sPodDisruptionBudget.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class K8sPodDisruptionBudget extends K8sResource implements InteractsWithK8sClus
3333
*
3434
* @var string
3535
*/
36-
protected static $defaultVersion = 'policy/v1beta1';
36+
protected static $defaultVersion = 'policy/v1';
3737

3838
/**
3939
* Set the maximum unavailable pod budget and

src/Kinds/K8sStatefulSet.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ public function setUpdateStrategy(string $strategy, int $partition = 0)
7272
/**
7373
* Set the statefulset service.
7474
*
75-
* @param \RenokiCo\PhpK8s\Kinds\K8sService|string $service
75+
* @param K8sService|string $service
7676
* @return $this
7777
*/
7878
public function setService($service)
@@ -97,7 +97,7 @@ public function getService()
9797
/**
9898
* Get the K8sService instance.
9999
*
100-
* @return null|\RenokiCo\PhpK8s\Kinds\K8sService
100+
* @return null|K8sService
101101
*/
102102
public function getServiceInstance()
103103
{

tests/ContainerTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public function test_container_build()
1414

1515
$volume = K8s::volume()->awsEbs('vol-1234', 'ext3');
1616

17-
$container->setImage('nginx', '1.4')
17+
$container->setImage('public.ecr.aws/docker/library/nginx', '1.23')
1818
->setEnv(['key' => 'value'])
1919
->addEnvs(['key2' => 'value2'])
2020
->addSecretKeyRefs(['SECRET_ONE' => ['secret_ref_name', 'secret_ref_key']])
@@ -55,7 +55,7 @@ public function test_container_build()
5555
->setSuccessThreshold(2)
5656
);
5757

58-
$this->assertEquals('nginx:1.4', $container->getImage());
58+
$this->assertStringEndsWith('nginx:1.23', $container->getImage());
5959
$this->assertEquals([
6060
['name' => 'key', 'value' => 'value'],
6161
['name' => 'key2', 'value' => 'value2'],
@@ -95,7 +95,7 @@ public function test_container_build()
9595
$container->removeEnv();
9696

9797
$this->assertFalse($container->isReady());
98-
$this->assertEquals('nginx:1.4', $container->getImage());
98+
$this->assertStringEndsWith('nginx:1.23', $container->getImage());
9999
$this->assertEquals([], $container->getEnv([]));
100100
$this->assertEquals(['--test'], $container->getArgs());
101101
$this->assertEquals([

0 commit comments

Comments
 (0)