Skip to content

Commit

Permalink
fix (extensions/certmanager) : Update CertManager extension to v1.9.1 (
Browse files Browse the repository at this point in the history
…fabric8io#4327)

+ Update CertManager extension to latest version
+ Force protobuf and yaml.v2 dependencies to not use vulnerable versions

Signed-off-by: Rohan Kumar <[email protected]>
  • Loading branch information
rohanKanojia committed Aug 29, 2022
1 parent 54560cb commit 143f186
Show file tree
Hide file tree
Showing 18 changed files with 3,215 additions and 1,144 deletions.
15 changes: 9 additions & 6 deletions extensions/certmanager/generator-v1/cmd/generate/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ package main
import (
"fmt"
"github.com/fabric8io/kubernetes-client/generator/pkg/schemagen"
certmanageracme "github.com/jetstack/cert-manager/pkg/apis/acme/v1"
certmanager "github.com/jetstack/cert-manager/pkg/apis/certmanager/v1"
apiextensions "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1"
certmanageracme "github.com/cert-manager/cert-manager/pkg/apis/acme/v1"
certmanager "github.com/cert-manager/cert-manager/pkg/apis/certmanager/v1"
apiextensions "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"reflect"
)
Expand Down Expand Up @@ -51,14 +51,17 @@ func main() {
"k8s.io/apimachinery/pkg/apis/meta/v1": "io.fabric8.kubernetes.api.model",
"k8s.io/apimachinery/pkg/api/resource": "io.fabric8.kubernetes.api.model",
"k8s.io/apimachinery/pkg/runtime": "io.fabric8.kubernetes.api.model.runtime",
"sigs.k8s.io/gateway-api/apis/v1alpha2": "io.fabric8.kubernetes.api.model.gatewayapi.v1alpha2",
}

// mapping of go packages of this module to the resulting java package
// optional ApiGroup and ApiVersion for the go package (which is added to the generated java class)
packageMapping := map[string]schemagen.PackageInformation{
"github.com/jetstack/cert-manager/pkg/apis/certmanager/v1": {JavaPackage: "io.fabric8.certmanager.api.model.v1", ApiGroup: "cert-manager.io", ApiVersion: "v1"},
"github.com/jetstack/cert-manager/pkg/apis/acme/v1": {JavaPackage: "io.fabric8.certmanager.api.model.acme.v1", ApiGroup: "cert-manager.io", ApiVersion: "v1"},
"github.com/jetstack/cert-manager/pkg/apis/meta/v1": {JavaPackage: "io.fabric8.certmanager.api.model.meta.v1", ApiGroup: "cert-manager.io", ApiVersion: "v1"},
"github.com/cert-manager/cert-manager/pkg/apis/certmanager/v1": {JavaPackage: "io.fabric8.certmanager.api.model.v1", ApiGroup: "cert-manager.io", ApiVersion: "v1"},
"github.com/cert-manager/cert-manager/pkg/apis/acme/v1": {JavaPackage: "io.fabric8.certmanager.api.model.acme.v1", ApiGroup: "cert-manager.io", ApiVersion: "v1"},
"github.com/cert-manager/cert-manager/pkg/apis/meta/v1": {JavaPackage: "io.fabric8.certmanager.api.model.meta.v1", ApiGroup: "cert-manager.io", ApiVersion: "v1"},
"github.com/cert-manager/cert-manager/internal/apis/acme": {JavaPackage: "io.fabric8.certmanager.api.model.acme.internal", ApiGroup: "cert-manager.io", ApiVersion: "v1"},
"github.com/cert-manager/cert-manager/internal/apis/meta": {JavaPackage: "io.fabric8.certmanager.api.model.meta.internal", ApiGroup: "cert-manager.io", ApiVersion: "v1"},
}

// converts all packages starting with <key> to a java package using an automated scheme:
Expand Down
12 changes: 8 additions & 4 deletions extensions/certmanager/generator-v1/go.mod
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
module github.com/fabric8io/kubernetes-client/extensions/jetstack/generator

require (
github.com/cert-manager/cert-manager v1.9.0-beta.1.0.20220829113803-8465f1223efb
github.com/fabric8io/kubernetes-client/generator v0.0.0
github.com/jetstack/cert-manager v1.1.1
k8s.io/apiextensions-apiserver v0.19.0
k8s.io/apimachinery v0.19.0
k8s.io/apiextensions-apiserver v0.24.2
k8s.io/apimachinery v0.24.2
)

replace github.com/fabric8io/kubernetes-client/generator v0.0.0 => ./../../../generator
replace (
github.com/fabric8io/kubernetes-client/generator v0.0.0 => ./../../../generator
github.com/gogo/protobuf => github.com/gogo/protobuf v1.3.2
gopkg.in/yaml.v2 => gopkg.in/yaml.v2 v2.4.0
)

go 1.15
1,408 changes: 1,291 additions & 117 deletions extensions/certmanager/generator-v1/go.sum

Large diffs are not rendered by default.

8 changes: 8 additions & 0 deletions extensions/certmanager/model-v1/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,14 @@
<groupId>io.fabric8</groupId>
<artifactId>kubernetes-model-core</artifactId>
</dependency>
<dependency>
<groupId>io.fabric8</groupId>
<artifactId>kubernetes-model-apiextensions</artifactId>
</dependency>
<dependency>
<groupId>io.fabric8</groupId>
<artifactId>kubernetes-model-gatewayapi</artifactId>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
"apiVersion",
"kind",
"metadata",
"gatewayHTTPRoute",
"ingress"
})
@ToString
Expand Down Expand Up @@ -64,6 +65,8 @@
public class ACMEChallengeSolverHTTP01 implements KubernetesResource
{

@JsonProperty("gatewayHTTPRoute")
private ACMEChallengeSolverHTTP01GatewayHTTPRoute gatewayHTTPRoute;
@JsonProperty("ingress")
private ACMEChallengeSolverHTTP01Ingress ingress;
@JsonIgnore
Expand All @@ -79,12 +82,24 @@ public ACMEChallengeSolverHTTP01() {
/**
*
* @param ingress
* @param gatewayHTTPRoute
*/
public ACMEChallengeSolverHTTP01(ACMEChallengeSolverHTTP01Ingress ingress) {
public ACMEChallengeSolverHTTP01(ACMEChallengeSolverHTTP01GatewayHTTPRoute gatewayHTTPRoute, ACMEChallengeSolverHTTP01Ingress ingress) {
super();
this.gatewayHTTPRoute = gatewayHTTPRoute;
this.ingress = ingress;
}

@JsonProperty("gatewayHTTPRoute")
public ACMEChallengeSolverHTTP01GatewayHTTPRoute getGatewayHTTPRoute() {
return gatewayHTTPRoute;
}

@JsonProperty("gatewayHTTPRoute")
public void setGatewayHTTPRoute(ACMEChallengeSolverHTTP01GatewayHTTPRoute gatewayHTTPRoute) {
this.gatewayHTTPRoute = gatewayHTTPRoute;
}

@JsonProperty("ingress")
public ACMEChallengeSolverHTTP01Ingress getIngress() {
return ingress;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@

package io.fabric8.certmanager.api.model.acme.v1;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import io.fabric8.kubernetes.api.model.Container;
import io.fabric8.kubernetes.api.model.ContainerPort;
import io.fabric8.kubernetes.api.model.EnvVar;
import io.fabric8.kubernetes.api.model.IntOrString;
import io.fabric8.kubernetes.api.model.KubernetesResource;
import io.fabric8.kubernetes.api.model.LabelSelector;
import io.fabric8.kubernetes.api.model.LocalObjectReference;
import io.fabric8.kubernetes.api.model.ObjectMeta;
import io.fabric8.kubernetes.api.model.ObjectReference;
import io.fabric8.kubernetes.api.model.PersistentVolumeClaim;
import io.fabric8.kubernetes.api.model.PodTemplateSpec;
import io.fabric8.kubernetes.api.model.ResourceRequirements;
import io.fabric8.kubernetes.api.model.Volume;
import io.fabric8.kubernetes.api.model.VolumeMount;
import io.fabric8.kubernetes.api.model.gatewayapi.v1alpha2.ParentReference;
import io.sundr.builder.annotations.Buildable;
import io.sundr.builder.annotations.BuildableReference;
import lombok.EqualsAndHashCode;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.Accessors;

@JsonDeserialize(using = com.fasterxml.jackson.databind.JsonDeserializer.None.class)
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonPropertyOrder({
"apiVersion",
"kind",
"metadata",
"labels",
"parentRefs",
"serviceType"
})
@ToString
@EqualsAndHashCode
@Setter
@Accessors(prefix = {
"_",
""
})
@Buildable(editableEnabled = false, validationEnabled = false, generateBuilderPackage = false, lazyCollectionInitEnabled = false, builderPackage = "io.fabric8.kubernetes.api.builder", refs = {
@BuildableReference(ObjectMeta.class),
@BuildableReference(LabelSelector.class),
@BuildableReference(Container.class),
@BuildableReference(PodTemplateSpec.class),
@BuildableReference(ResourceRequirements.class),
@BuildableReference(IntOrString.class),
@BuildableReference(ObjectReference.class),
@BuildableReference(LocalObjectReference.class),
@BuildableReference(PersistentVolumeClaim.class),
@BuildableReference(EnvVar.class),
@BuildableReference(ContainerPort.class),
@BuildableReference(Volume.class),
@BuildableReference(VolumeMount.class)
})
public class ACMEChallengeSolverHTTP01GatewayHTTPRoute implements KubernetesResource
{

@JsonProperty("labels")
@JsonInclude(JsonInclude.Include.NON_EMPTY)
private Map<String, String> labels = new LinkedHashMap<String, String>();
@JsonProperty("parentRefs")
@JsonInclude(JsonInclude.Include.NON_EMPTY)
private List<ParentReference> parentRefs = new ArrayList<ParentReference>();
@JsonProperty("serviceType")
private java.lang.String serviceType;
@JsonIgnore
private Map<java.lang.String, Object> additionalProperties = new HashMap<java.lang.String, Object>();

/**
* No args constructor for use in serialization
*
*/
public ACMEChallengeSolverHTTP01GatewayHTTPRoute() {
}

/**
*
* @param serviceType
* @param parentRefs
* @param labels
*/
public ACMEChallengeSolverHTTP01GatewayHTTPRoute(Map<String, String> labels, List<ParentReference> parentRefs, java.lang.String serviceType) {
super();
this.labels = labels;
this.parentRefs = parentRefs;
this.serviceType = serviceType;
}

@JsonProperty("labels")
public Map<String, String> getLabels() {
return labels;
}

@JsonProperty("labels")
public void setLabels(Map<String, String> labels) {
this.labels = labels;
}

@JsonProperty("parentRefs")
public List<ParentReference> getParentRefs() {
return parentRefs;
}

@JsonProperty("parentRefs")
public void setParentRefs(List<ParentReference> parentRefs) {
this.parentRefs = parentRefs;
}

@JsonProperty("serviceType")
public java.lang.String getServiceType() {
return serviceType;
}

@JsonProperty("serviceType")
public void setServiceType(java.lang.String serviceType) {
this.serviceType = serviceType;
}

@JsonAnyGetter
public Map<java.lang.String, Object> getAdditionalProperties() {
return this.additionalProperties;
}

@JsonAnySetter
public void setAdditionalProperty(java.lang.String name, Object value) {
this.additionalProperties.put(name, value);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
"clientSecretSecretRef",
"environment",
"hostedZoneName",
"managedIdentity",
"resourceGroupName",
"subscriptionID",
"tenantID"
Expand Down Expand Up @@ -79,6 +80,8 @@ public class ACMEIssuerDNS01ProviderAzureDNS implements KubernetesResource
private String environment;
@JsonProperty("hostedZoneName")
private String hostedZoneName;
@JsonProperty("managedIdentity")
private AzureManagedIdentity managedIdentity;
@JsonProperty("resourceGroupName")
private String resourceGroupName;
@JsonProperty("subscriptionID")
Expand All @@ -97,6 +100,7 @@ public ACMEIssuerDNS01ProviderAzureDNS() {

/**
*
* @param managedIdentity
* @param environment
* @param clientID
* @param resourceGroupName
Expand All @@ -105,12 +109,13 @@ public ACMEIssuerDNS01ProviderAzureDNS() {
* @param subscriptionID
* @param hostedZoneName
*/
public ACMEIssuerDNS01ProviderAzureDNS(String clientID, SecretKeySelector clientSecretSecretRef, String environment, String hostedZoneName, String resourceGroupName, String subscriptionID, String tenantID) {
public ACMEIssuerDNS01ProviderAzureDNS(String clientID, SecretKeySelector clientSecretSecretRef, String environment, String hostedZoneName, AzureManagedIdentity managedIdentity, String resourceGroupName, String subscriptionID, String tenantID) {
super();
this.clientID = clientID;
this.clientSecretSecretRef = clientSecretSecretRef;
this.environment = environment;
this.hostedZoneName = hostedZoneName;
this.managedIdentity = managedIdentity;
this.resourceGroupName = resourceGroupName;
this.subscriptionID = subscriptionID;
this.tenantID = tenantID;
Expand Down Expand Up @@ -156,6 +161,16 @@ public void setHostedZoneName(String hostedZoneName) {
this.hostedZoneName = hostedZoneName;
}

@JsonProperty("managedIdentity")
public AzureManagedIdentity getManagedIdentity() {
return managedIdentity;
}

@JsonProperty("managedIdentity")
public void setManagedIdentity(AzureManagedIdentity managedIdentity) {
this.managedIdentity = managedIdentity;
}

@JsonProperty("resourceGroupName")
public String getResourceGroupName() {
return resourceGroupName;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
"kind",
"metadata",
"accessKeyID",
"accessKeyIDSecretRef",
"hostedZoneID",
"region",
"role",
Expand Down Expand Up @@ -71,6 +72,8 @@ public class ACMEIssuerDNS01ProviderRoute53 implements KubernetesResource

@JsonProperty("accessKeyID")
private String accessKeyID;
@JsonProperty("accessKeyIDSecretRef")
private SecretKeySelector accessKeyIDSecretRef;
@JsonProperty("hostedZoneID")
private String hostedZoneID;
@JsonProperty("region")
Expand All @@ -94,12 +97,14 @@ public ACMEIssuerDNS01ProviderRoute53() {
* @param accessKeyID
* @param hostedZoneID
* @param role
* @param accessKeyIDSecretRef
* @param secretAccessKeySecretRef
* @param region
*/
public ACMEIssuerDNS01ProviderRoute53(String accessKeyID, String hostedZoneID, String region, String role, SecretKeySelector secretAccessKeySecretRef) {
public ACMEIssuerDNS01ProviderRoute53(String accessKeyID, SecretKeySelector accessKeyIDSecretRef, String hostedZoneID, String region, String role, SecretKeySelector secretAccessKeySecretRef) {
super();
this.accessKeyID = accessKeyID;
this.accessKeyIDSecretRef = accessKeyIDSecretRef;
this.hostedZoneID = hostedZoneID;
this.region = region;
this.role = role;
Expand All @@ -116,6 +121,16 @@ public void setAccessKeyID(String accessKeyID) {
this.accessKeyID = accessKeyID;
}

@JsonProperty("accessKeyIDSecretRef")
public SecretKeySelector getAccessKeyIDSecretRef() {
return accessKeyIDSecretRef;
}

@JsonProperty("accessKeyIDSecretRef")
public void setAccessKeyIDSecretRef(SecretKeySelector accessKeyIDSecretRef) {
this.accessKeyIDSecretRef = accessKeyIDSecretRef;
}

@JsonProperty("hostedZoneID")
public String getHostedZoneID() {
return hostedZoneID;
Expand Down
Loading

0 comments on commit 143f186

Please sign in to comment.