Skip to content

Commit

Permalink
Update to Kubernetes v1.28.0
Browse files Browse the repository at this point in the history
  • Loading branch information
iabudiab committed Sep 4, 2023
1 parent 88d3550 commit 80c885d
Show file tree
Hide file tree
Showing 8 changed files with 137 additions and 32 deletions.
2 changes: 1 addition & 1 deletion .swiftformat
Original file line number Diff line number Diff line change
Expand Up @@ -62,5 +62,5 @@
--wrapreturntype preserve
--xcodeindentation disabled
--yodaswap always
--disable anyObjectProtocol,blankLinesAtStartOfScope,emptyBraces,initCoderUnavailable,modifierOrder,redundanttype,spaceAroundBrackets,spaceAroundGenerics,spaceAroundParens,strongOutlets,strongifiedSelf,typeSugar,wrapAttributes,yodaConditions
--disable anyObjectProtocol,blankLinesAtStartOfScope,emptyBraces,initCoderUnavailable,modifierOrder,redundantInternal,redundanttype,spaceAroundBrackets,spaceAroundGenerics,spaceAroundParens,strongOutlets,strongifiedSelf,typeSugar,wrapAttributes,yodaConditions
--enable markTypes
8 changes: 4 additions & 4 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ let package = Package(
),
],
dependencies: [
.package(url: "https://github.com/swiftkube/model.git", .upToNextMinor(from: "0.11.0")),
.package(url: "https://github.com/swiftkube/model.git", .upToNextMinor(from: "0.12.0")),
.package(url: "https://github.com/swift-server/async-http-client.git", .upToNextMajor(from: "1.18.0")),
.package(url: "https://github.com/apple/swift-log.git", .upToNextMajor(from: "1.5.2")),
.package(url: "https://github.com/apple/swift-metrics.git", .upToNextMajor(from: "2.4.0")),
.package(url: "https://github.com/jpsim/Yams.git", .upToNextMajor(from: "5.0.5")),
.package(url: "https://github.com/apple/swift-log.git", .upToNextMajor(from: "1.5.3")),
.package(url: "https://github.com/apple/swift-metrics.git", .upToNextMajor(from: "2.4.1")),
.package(url: "https://github.com/jpsim/Yams.git", .upToNextMajor(from: "5.0.6")),
.package(url: "https://github.com/apple/swift-nio", .upToNextMajor(from: "2.54.0")),
],
targets: [
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
//
// Copyright 2020 Swiftkube Project
//
// Licensed 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.
//

import Foundation
import SwiftkubeModel

// MARK: - AdmissionRegistrationV1Beta1API

public protocol AdmissionRegistrationV1Beta1API {

var validatingAdmissionPolicies: ClusterScopedGenericKubernetesClient<admissionregistration.v1beta1.ValidatingAdmissionPolicy> { get }
var validatingAdmissionPolicyBindings: ClusterScopedGenericKubernetesClient<admissionregistration.v1beta1.ValidatingAdmissionPolicyBinding> { get }
}

/// DSL for `admissionregistration.k8s.io.v1beta1` API Group
public extension KubernetesClient {

class AdmissionRegistrationV1Beta1: AdmissionRegistrationV1Beta1API {
private var client: KubernetesClient

internal init(_ client: KubernetesClient) {
self.client = client
}

public var validatingAdmissionPolicies: ClusterScopedGenericKubernetesClient<admissionregistration.v1beta1.ValidatingAdmissionPolicy> {
client.clusterScoped(for: admissionregistration.v1beta1.ValidatingAdmissionPolicy.self)
}

public var validatingAdmissionPolicyBindings: ClusterScopedGenericKubernetesClient<admissionregistration.v1beta1.ValidatingAdmissionPolicyBinding> {
client.clusterScoped(for: admissionregistration.v1beta1.ValidatingAdmissionPolicyBinding.self)
}
}

var admissionRegistrationV1Beta1: AdmissionRegistrationV1Beta1API {
AdmissionRegistrationV1Beta1(self)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import SwiftkubeModel

public protocol AuthenticationV1API {

var selfSubjectReviews: ClusterScopedGenericKubernetesClient<authentication.v1.SelfSubjectReview> { get }
var tokenRequests: NamespacedGenericKubernetesClient<authentication.v1.TokenRequest> { get }
var tokenReviews: ClusterScopedGenericKubernetesClient<authentication.v1.TokenReview> { get }
}
Expand All @@ -35,6 +36,10 @@ public extension KubernetesClient {
self.client = client
}

public var selfSubjectReviews: ClusterScopedGenericKubernetesClient<authentication.v1.SelfSubjectReview> {
client.clusterScoped(for: authentication.v1.SelfSubjectReview.self)
}

public var tokenRequests: NamespacedGenericKubernetesClient<authentication.v1.TokenRequest> {
client.namespaceScoped(for: authentication.v1.TokenRequest.self)
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
//
// Copyright 2020 Swiftkube Project
//
// Licensed 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.
//

import Foundation
import SwiftkubeModel

// MARK: - AuthenticationV1Beta1API

public protocol AuthenticationV1Beta1API {

var selfSubjectReviews: ClusterScopedGenericKubernetesClient<authentication.v1beta1.SelfSubjectReview> { get }
}

/// DSL for `authentication.k8s.io.v1beta1` API Group
public extension KubernetesClient {

class AuthenticationV1Beta1: AuthenticationV1Beta1API {
private var client: KubernetesClient

internal init(_ client: KubernetesClient) {
self.client = client
}

public var selfSubjectReviews: ClusterScopedGenericKubernetesClient<authentication.v1beta1.SelfSubjectReview> {
client.clusterScoped(for: authentication.v1beta1.SelfSubjectReview.self)
}
}

var authenticationV1Beta1: AuthenticationV1Beta1API {
AuthenticationV1Beta1(self)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,29 +17,29 @@
import Foundation
import SwiftkubeModel

// MARK: - StorageV1Beta1API
// MARK: - CertificatesV1Alpha1API

public protocol StorageV1Beta1API {
public protocol CertificatesV1Alpha1API {

var csiStorageCapacities: NamespacedGenericKubernetesClient<storage.v1beta1.CSIStorageCapacity> { get }
var clusterTrusubundles: ClusterScopedGenericKubernetesClient<certificates.v1alpha1.ClusterTrustBundle> { get }
}

/// DSL for `storage.k8s.io.v1beta1` API Group
/// DSL for `certificates.k8s.io.v1alpha1` API Group
public extension KubernetesClient {

class StorageV1Beta1: StorageV1Beta1API {
class CertificatesV1Alpha1: CertificatesV1Alpha1API {
private var client: KubernetesClient

internal init(_ client: KubernetesClient) {
self.client = client
}

public var csiStorageCapacities: NamespacedGenericKubernetesClient<storage.v1beta1.CSIStorageCapacity> {
client.namespaceScoped(for: storage.v1beta1.CSIStorageCapacity.self)
public var clusterTrusubundles: ClusterScopedGenericKubernetesClient<certificates.v1alpha1.ClusterTrustBundle> {
client.clusterScoped(for: certificates.v1alpha1.ClusterTrustBundle.self)
}
}

var storageV1Beta1: StorageV1Beta1API {
StorageV1Beta1(self)
var certificatesV1Alpha1: CertificatesV1Alpha1API {
CertificatesV1Alpha1(self)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import SwiftkubeModel
public protocol NetworkingV1Alpha1API {

var clusterCIDRs: ClusterScopedGenericKubernetesClient<networking.v1alpha1.ClusterCIDR> { get }
var iPAddresses: ClusterScopedGenericKubernetesClient<networking.v1alpha1.IPAddress> { get }
}

/// DSL for `networking.k8s.io.v1alpha1` API Group
Expand All @@ -37,6 +38,10 @@ public extension KubernetesClient {
public var clusterCIDRs: ClusterScopedGenericKubernetesClient<networking.v1alpha1.ClusterCIDR> {
client.clusterScoped(for: networking.v1alpha1.ClusterCIDR.self)
}

public var iPAddresses: ClusterScopedGenericKubernetesClient<networking.v1alpha1.IPAddress> {
client.clusterScoped(for: networking.v1alpha1.IPAddress.self)
}
}

var networkingV1Alpha1: NetworkingV1Alpha1API {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,44 +17,44 @@
import Foundation
import SwiftkubeModel

// MARK: - ResourceV1Alpha1API
// MARK: - ResourceV1Alpha2API

public protocol ResourceV1Alpha1API {
public protocol ResourceV1Alpha2API {

var podSchedulings: NamespacedGenericKubernetesClient<resource.v1alpha1.PodScheduling> { get }
var resourceClaims: NamespacedGenericKubernetesClient<resource.v1alpha1.ResourceClaim> { get }
var resourceClaimTemplates: NamespacedGenericKubernetesClient<resource.v1alpha1.ResourceClaimTemplate> { get }
var resourceClasses: ClusterScopedGenericKubernetesClient<resource.v1alpha1.ResourceClass> { get }
var podSchedulingContexts: NamespacedGenericKubernetesClient<resource.v1alpha2.PodSchedulingContext> { get }
var resourceClaims: NamespacedGenericKubernetesClient<resource.v1alpha2.ResourceClaim> { get }
var resourceClaimTemplates: NamespacedGenericKubernetesClient<resource.v1alpha2.ResourceClaimTemplate> { get }
var resourceClasses: ClusterScopedGenericKubernetesClient<resource.v1alpha2.ResourceClass> { get }
}

/// DSL for `resource.k8s.io.v1alpha1` API Group
/// DSL for `resource.k8s.io.v1alpha2` API Group
public extension KubernetesClient {

class ResourceV1Alpha1: ResourceV1Alpha1API {
class ResourceV1Alpha2: ResourceV1Alpha2API {
private var client: KubernetesClient

internal init(_ client: KubernetesClient) {
self.client = client
}

public var podSchedulings: NamespacedGenericKubernetesClient<resource.v1alpha1.PodScheduling> {
client.namespaceScoped(for: resource.v1alpha1.PodScheduling.self)
public var podSchedulingContexts: NamespacedGenericKubernetesClient<resource.v1alpha2.PodSchedulingContext> {
client.namespaceScoped(for: resource.v1alpha2.PodSchedulingContext.self)
}

public var resourceClaims: NamespacedGenericKubernetesClient<resource.v1alpha1.ResourceClaim> {
client.namespaceScoped(for: resource.v1alpha1.ResourceClaim.self)
public var resourceClaims: NamespacedGenericKubernetesClient<resource.v1alpha2.ResourceClaim> {
client.namespaceScoped(for: resource.v1alpha2.ResourceClaim.self)
}

public var resourceClaimTemplates: NamespacedGenericKubernetesClient<resource.v1alpha1.ResourceClaimTemplate> {
client.namespaceScoped(for: resource.v1alpha1.ResourceClaimTemplate.self)
public var resourceClaimTemplates: NamespacedGenericKubernetesClient<resource.v1alpha2.ResourceClaimTemplate> {
client.namespaceScoped(for: resource.v1alpha2.ResourceClaimTemplate.self)
}

public var resourceClasses: ClusterScopedGenericKubernetesClient<resource.v1alpha1.ResourceClass> {
client.clusterScoped(for: resource.v1alpha1.ResourceClass.self)
public var resourceClasses: ClusterScopedGenericKubernetesClient<resource.v1alpha2.ResourceClass> {
client.clusterScoped(for: resource.v1alpha2.ResourceClass.self)
}
}

var resourceV1Alpha1: ResourceV1Alpha1API {
ResourceV1Alpha1(self)
var resourceV1Alpha2: ResourceV1Alpha2API {
ResourceV1Alpha2(self)
}
}

0 comments on commit 80c885d

Please sign in to comment.