Skip to content

Commit

Permalink
Merge branch 'feature/less-gson' into 'main'
Browse files Browse the repository at this point in the history
Feature/less gson

See merge request org/jdrupes/vm-operator!6
  • Loading branch information
mnlipp committed Nov 8, 2024
2 parents 8e692a0 + c8781c2 commit a9c31a3
Show file tree
Hide file tree
Showing 33 changed files with 1,395 additions and 895 deletions.
20 changes: 14 additions & 6 deletions dev-example/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,14 @@
"/Reconciler":
runnerData:
storageClassName: null
loadBalancerService:
labels:
label1: label1
label2: toBeReplaced
annotations:
metallb.universe.tf/loadBalancerIPs: 192.168.168.1
metallb.universe.tf/ip-allocated-from-pool: single-common
metallb.universe.tf/allow-shared-ip: single-common
"/GuiSocketServer":
port: 8888
"/GuiHttpServer":
Expand All @@ -17,12 +25,12 @@
"/WebConsole":
"/LoginConlet":
users:
- name: admin
fullName: Administrator
password: "$2b$05$NiBd74ZGdplLC63ePZf1f.UtjMKkbQ23cQoO2OKOFalDBHWAOy21."
- name: test
fullName: Test Account
password: "$2b$05$hZaI/jToXf/d3BctZdT38Or7H7h6Pn2W3WiB49p5AyhDHFkkYCvo2"
- name: admin
fullName: Administrator
password: "$2b$05$NiBd74ZGdplLC63ePZf1f.UtjMKkbQ23cQoO2OKOFalDBHWAOy21."
- name: test
fullName: Test Account
password: "$2b$05$hZaI/jToXf/d3BctZdT38Or7H7h6Pn2W3WiB49p5AyhDHFkkYCvo2"
"/RoleConfigurator":
rolesByUser:
# User admin has role admin
Expand Down
20 changes: 14 additions & 6 deletions dev-example/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,14 @@ patches:
"/Reconciler":
runnerData:
storageClassName: null
loadBalancerService:
labels:
label1: label1
label2: toBeReplaced
annotations:
metallb.universe.tf/loadBalancerIPs: 192.168.168.1
metallb.universe.tf/ip-allocated-from-pool: single-common
metallb.universe.tf/allow-shared-ip: single-common
"/GuiSocketServer":
port: 8888
"/GuiHttpServer":
Expand All @@ -43,12 +51,12 @@ patches:
"/WebConsole":
"/LoginConlet":
users:
admin:
fullName: Administrator
password: "$2b$05$NiBd74ZGdplLC63ePZf1f.UtjMKkbQ23cQoO2OKOFalDBHWAOy21."
test:
fullName: Test Account
password: "$2b$05$hZaI/jToXf/d3BctZdT38Or7H7h6Pn2W3WiB49p5AyhDHFkkYCvo2"
- name: admin
fullName: Administrator
password: "$2b$05$NiBd74ZGdplLC63ePZf1f.UtjMKkbQ23cQoO2OKOFalDBHWAOy21."
- name: test
fullName: Test Account
password: "$2b$05$hZaI/jToXf/d3BctZdT38Or7H7h6Pn2W3WiB49p5AyhDHFkkYCvo2"
"/RoleConfigurator":
rolesByUser:
# User admin has role admin
Expand Down
14 changes: 8 additions & 6 deletions dev-example/test-vm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ spec:
pullPolicy: Always

permissions:
- user: admin
may:
- "*"
- user: test
may:
- "accessConsole"
- user: admin
may:
- "*"
- user: test
may:
- "accessConsole"

resources:
requests:
Expand Down Expand Up @@ -62,3 +62,5 @@ spec:
spice:
port: 5810
generateSecret: true

loadBalancerService: {}
Original file line number Diff line number Diff line change
Expand Up @@ -157,27 +157,6 @@ public static Optional<APIResource> context(ApiClient client,
return Optional.of(apiRes);
}

/**
* Get an object from its metadata.
*
* @param <T> the generic type
* @param <LT> the generic type
* @param api the api
* @param meta the meta
* @return the object
*/
@Deprecated
@SuppressWarnings("PMD.GenericsNaming")
public static <T extends KubernetesObject, LT extends KubernetesListObject>
Optional<T>
get(GenericKubernetesApi<T, LT> api, V1ObjectMeta meta) {
var response = api.get(meta.getNamespace(), meta.getName());
if (response.isSuccess()) {
return Optional.of(response.getObject());
}
return Optional.empty();
}

/**
* Apply the given patch data.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import io.kubernetes.client.util.Strings;
import io.kubernetes.client.util.generic.GenericKubernetesApi;
import io.kubernetes.client.util.generic.KubernetesApiResponse;
import io.kubernetes.client.util.generic.dynamic.DynamicKubernetesObject;
import io.kubernetes.client.util.generic.options.GetOptions;
import io.kubernetes.client.util.generic.options.ListOptions;
import io.kubernetes.client.util.generic.options.PatchOptions;
Expand All @@ -47,7 +48,7 @@
* @param <O> the generic type
* @param <L> the generic type
*/
@SuppressWarnings("PMD.DataflowAnomalyAnalysis")
@SuppressWarnings({ "PMD.DataflowAnomalyAnalysis", "PMD.TooManyMethods" })
public class K8sGenericStub<O extends KubernetesObject,
L extends KubernetesListObject> {
protected final K8sClient client;
Expand Down Expand Up @@ -224,7 +225,7 @@ public Optional<O> updateStatus(Function<O, Object> status)
* @param patchType the patch type
* @param patch the patch
* @param options the options
* @return the kubernetes api response
* @return the kubernetes api response if successful
* @throws ApiException the api exception
*/
public Optional<O> patch(String patchType, V1Patch patch,
Expand All @@ -239,7 +240,7 @@ public Optional<O> patch(String patchType, V1Patch patch,
*
* @param patchType the patch type
* @param patch the patch
* @return the kubernetes api response
* @return the kubernetes api response if successful
* @throws ApiException the api exception
*/
public Optional<O>
Expand All @@ -248,6 +249,21 @@ public Optional<O> patch(String patchType, V1Patch patch,
return patch(patchType, patch, opts);
}

/**
* Apply the given definition.
*
* @param def the def
* @return the kubernetes api response if successful
* @throws ApiException the api exception
*/
public Optional<O> apply(DynamicKubernetesObject def) throws ApiException {
PatchOptions opts = new PatchOptions();
opts.setForce(true);
opts.setFieldManager("kubernetes-java-kubectl-apply");
return patch(V1Patch.PATCH_FORMAT_APPLY_YAML,
new V1Patch(client.getJSON().serialize(def)), opts);
}

/**
* Update the object.
*
Expand Down
Loading

0 comments on commit a9c31a3

Please sign in to comment.