diff --git a/Dockerfile b/Dockerfile index 5299ebc..7cc35af 100644 --- a/Dockerfile +++ b/Dockerfile @@ -13,12 +13,12 @@ COPY go.sum go.sum RUN go mod download # Copy the go source -COPY main.go main.go +COPY cmd/main.go cmd/main.go COPY api/ api/ COPY controllers/ controllers/ # Build -RUN CGO_ENABLED=0 GOOS=$BUILDOS GOARCH=$TARGETARCH go build -a -o manager main.go +RUN CGO_ENABLED=0 GOOS=$BUILDOS GOARCH=$TARGETARCH go build -a -o manager cmd/main.go # Use distroless as minimal base image to package the manager binary # Refer to https://github.com/GoogleContainerTools/distroless for more details diff --git a/Makefile b/Makefile index 8b75df3..0c44259 100644 --- a/Makefile +++ b/Makefile @@ -69,10 +69,10 @@ KUBECTL := $(TOOLS_BIN_DIR)/kubectl GOLANGCI_LINT_VERSION := "v1.57.2" CLUSTERCTL_VERSION := "v1.7.2" -KUSTOMIZE_VER := v4.5.2 +KUSTOMIZE_VER := v5.3.0 KUSTOMIZE_BIN := kustomize KUSTOMIZE := $(abspath $(TOOLS_BIN_DIR)/$(KUSTOMIZE_BIN)-$(KUSTOMIZE_VER)) -KUSTOMIZE_PKG := sigs.k8s.io/kustomize/kustomize/v4 +KUSTOMIZE_PKG := sigs.k8s.io/kustomize/kustomize/v5 $(KUSTOMIZE): # Build kustomize from tools folder. CGO_ENABLED=0 GOBIN=$(TOOLS_BIN_DIR) $(GO_INSTALL) $(KUSTOMIZE_PKG) $(KUSTOMIZE_BIN) $(KUSTOMIZE_VER) @@ -134,7 +134,6 @@ manifests: $(CONTROLLER_GEN) $(KUSTOMIZE) $(ENVSUBST) fmt generate ## Generate W .PHONY: generate generate: $(CONTROLLER_GEN) ## Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations. - go generate $(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./..." .PHONY: fmt @@ -227,15 +226,14 @@ set-manifest-pull-policy: .PHONY: build build: generate fmt vet ## Build manager binary. - go build -o bin/manager main.go + go build -o bin/manager cmd/main.go .PHONY: run run: manifests generate fmt vet ## Run a controller from your host. - go run ./main.go + go run ./cmd/main.go .PHONY: docker-build docker-build: ## Build docker image with the manager. - go generate docker build --load --build-arg BUILDOS=linux --build-arg TARGETARCH=amd64 -t $(CONTROLLER_IMG):$(TAG) . MANIFEST_IMG=$(CONTROLLER_IMG) MANIFEST_TAG=$(TAG) $(MAKE) set-manifest-image $(MAKE) set-manifest-pull-policy diff --git a/PROJECT b/PROJECT index 6b2bd0e..032bf72 100644 --- a/PROJECT +++ b/PROJECT @@ -1,6 +1,10 @@ +# Code generated by tool. DO NOT EDIT. +# This file is used to track the info used to scaffold your project +# and allow the plugins properly work. +# More info: https://book.kubebuilder.io/reference/project-config.html domain: projectsveltos.io layout: -- go.kubebuilder.io/v3 +- go.kubebuilder.io/v4 projectName: jsonnet-controller repo: github.com/gianlucam76/jsonnet-controller resources: @@ -13,4 +17,12 @@ resources: kind: JsonnetSource path: github.com/gianlucam76/jsonnet-controller/api/v1alpha1 version: v1alpha1 +- api: + crdVersion: v1 + namespaced: true + domain: projectsveltos.io + group: extension + kind: JsonnetSource + path: github.com/gianlucam76/jsonnet-controller/api/v1beta1 + version: v1beta1 version: "3" diff --git a/README.md b/README.md index 356d49d..213e773 100644 --- a/README.md +++ b/README.md @@ -25,11 +25,11 @@ kubectl apply -f https://raw.githubusercontent.com/gianlucam76/jsonnet-controlle ## Using Flux GitRepository For instance, this Github repository https://github.com/gianlucam76/jsonnet-examples contains jsonnet files. -You can use Flux to sync from it and then simply post this [JsonnetSource](https://github.com/gianlucam76/jsonnet-controller/blob/main/api/v1alpha1/jsonnetsource_types.go) CRD instance. +You can use Flux to sync from it and then simply post this [JsonnetSource](https://github.com/gianlucam76/jsonnet-controller/blob/main/api/v1beta1/jsonnetsource_types.go) CRD instance. The jsonnet-controller will detect when Flux has synced the repo (and anytime there is a change), will programatically invoke jsonnet go module and store the outcome in its Status.Resources field. ```yaml -apiVersion: extension.projectsveltos.io/v1alpha1 +apiVersion: extension.projectsveltos.io/v1beta1 kind: JsonnetSource metadata: name: jsonnetsource-flux @@ -45,12 +45,12 @@ spec: ``` ```yaml -apiVersion: extension.projectsveltos.io/v1alpha1 +apiVersion: extension.projectsveltos.io/v1beta1 kind: JsonnetSource metadata: annotations: kubectl.kubernetes.io/last-applied-configuration: | - {"apiVersion":"extension.projectsveltos.io/v1alpha1","kind":"JsonnetSource","metadata":{"annotations":{},"name":"jsonnetsource-flux","namespace":"default"},"spec":{"kind":"GitRepository","name":"flux-system","namespace":"flux-system","path":"./variables/deployment.jsonnet","variables":{"deploymentName":"eng","namespace":"staging","replicas":"3"}}} + {"apiVersion":"extension.projectsveltos.io/v1beta1","kind":"JsonnetSource","metadata":{"annotations":{},"name":"jsonnetsource-flux","namespace":"default"},"spec":{"kind":"GitRepository","name":"flux-system","namespace":"flux-system","path":"./variables/deployment.jsonnet","variables":{"deploymentName":"eng","namespace":"staging","replicas":"3"}}} creationTimestamp: "2023-05-26T06:55:13Z" generation: 3 name: jsonnetsource-flux @@ -74,7 +74,7 @@ status: Sveltos can used at this point to deploy resources in managed clusters: ```yaml -apiVersion: config.projectsveltos.io/v1alpha1 +apiVersion: config.projectsveltos.io/v1beta1 kind: ClusterProfile metadata: name: deploy-resources @@ -82,7 +82,7 @@ spec: clusterSelector: env=fv templateResourceRefs: - resource: - apiVersion: extension.projectsveltos.io/v1alpha1 + apiVersion: extension.projectsveltos.io/v1beta1 kind: JsonnetSource name: jsonnetsource-flux namespace: default @@ -125,7 +125,7 @@ kubectl create configmap jsonnet --from-file=jsonnet.tar.gz=jsonnet.tar.gz Then we can have JsonnetSource reference this ConfigMap instance ```yaml -apiVersion: extension.projectsveltos.io/v1alpha1 +apiVersion: extension.projectsveltos.io/v1beta1 kind: JsonnetSource metadata: name: jsonnetsource-configmap @@ -141,12 +141,12 @@ spec: and the controller will programmatically execute jsonnet go module and store the outcome in Status.Results. ```yaml -apiVersion: extension.projectsveltos.io/v1alpha1 +apiVersion: extension.projectsveltos.io/v1beta1 kind: JsonnetSource metadata: annotations: kubectl.kubernetes.io/last-applied-configuration: | - {"apiVersion":"extension.projectsveltos.io/v1alpha1","kind":"JsonnetSource","metadata":{"annotations":{},"name":"jsonnetsource-configmap","namespace":"default"},"spec":{"kind":"ConfigMap","name":"jsonnet","namespace":"default","path":"./main.jsonnet","variables":{"namespace":"production"}}} + {"apiVersion":"extension.projectsveltos.io/v1beta1","kind":"JsonnetSource","metadata":{"annotations":{},"name":"jsonnetsource-configmap","namespace":"default"},"spec":{"kind":"ConfigMap","name":"jsonnet","namespace":"default","path":"./main.jsonnet","variables":{"namespace":"production"}}} creationTimestamp: "2023-05-26T08:28:48Z" generation: 1 name: jsonnetsource-configmap diff --git a/api/v1alpha1/groupversion_info.go b/api/v1alpha1/groupversion_info.go index e6bb6e2..fb5c67b 100644 --- a/api/v1alpha1/groupversion_info.go +++ b/api/v1alpha1/groupversion_info.go @@ -1,5 +1,5 @@ /* -Copyright 2023. +Copyright 2023. projectsveltos.io. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/api/v1beta1/groupversion_info.go b/api/v1beta1/groupversion_info.go new file mode 100644 index 0000000..21d0540 --- /dev/null +++ b/api/v1beta1/groupversion_info.go @@ -0,0 +1,36 @@ +/* +Copyright 2023. projectsveltos.io. All rights reserved. + +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. +*/ + +// Package v1beta1 contains API Schema definitions for the extension v1beta1 API group +// +kubebuilder:object:generate=true +// +groupName=extension.projectsveltos.io +package v1beta1 + +import ( + "k8s.io/apimachinery/pkg/runtime/schema" + "sigs.k8s.io/controller-runtime/pkg/scheme" +) + +var ( + // GroupVersion is group version used to register these objects + GroupVersion = schema.GroupVersion{Group: "extension.projectsveltos.io", Version: "v1beta1"} + + // SchemeBuilder is used to add go types to the GroupVersionKind scheme + SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion} + + // AddToScheme adds the types in this group-version to the given scheme. + AddToScheme = SchemeBuilder.AddToScheme +) diff --git a/api/v1beta1/jsonnetsource_types.go b/api/v1beta1/jsonnetsource_types.go new file mode 100644 index 0000000..c894f65 --- /dev/null +++ b/api/v1beta1/jsonnetsource_types.go @@ -0,0 +1,88 @@ +/* +Copyright 2024. projectsveltos.io. All rights reserved. + +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. +*/ + +package v1beta1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +const ( + JsonnetSourceKind = "JsonnetSourceKind" +) + +// JsonnetSourceSpec defines the desired state of JsonnetSource +type JsonnetSourceSpec struct { + // Namespace of the referenced resource. + // Namespace can be left empty. In such a case, namespace will + // be implicit set to cluster's namespace. + Namespace string `json:"namespace"` + + // Name of the rreferenced resource. + // +kubebuilder:validation:MinLength=1 + Name string `json:"name"` + + // Kind of the resource. Supported kinds are: + // - flux GitRepository;OCIRepository;Bucket + // - ConfigMap/Secret (which will be mounted as volume) + // +kubebuilder:validation:Enum=GitRepository;OCIRepository;Bucket;ConfigMap;Secret + Kind string `json:"kind"` + + // Path to the jsonnet file. + // Defaults to 'None', which translates to the root path of the SourceRef. + // +optional + Path string `json:"path,omitempty"` + + // Variables contains set of variable to pass to jsonnet + Variables map[string]string `json:"variables,omitempty"` +} + +// JsonnetSourceStatus defines the observed state of JsonnetSource +type JsonnetSourceStatus struct { + // Resources contains the output of jsonnet, so the + // resources to be deployed + Resources string `json:"resources,omitempty"` + + // FailureMessage provides more information about the error. + // +optional + FailureMessage *string `json:"failureMessage,omitempty"` +} + +//+kubebuilder:object:root=true +//+kubebuilder:subresource:status +//+kubebuilder:storageversion + +// JsonnetSource is the Schema for the jsonnetsources API +type JsonnetSource struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec JsonnetSourceSpec `json:"spec,omitempty"` + Status JsonnetSourceStatus `json:"status,omitempty"` +} + +//+kubebuilder:object:root=true + +// JsonnetSourceList contains a list of JsonnetSource +type JsonnetSourceList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []JsonnetSource `json:"items"` +} + +func init() { + SchemeBuilder.Register(&JsonnetSource{}, &JsonnetSourceList{}) +} diff --git a/api/v1beta1/zz_generated.deepcopy.go b/api/v1beta1/zz_generated.deepcopy.go new file mode 100644 index 0000000..6ff5176 --- /dev/null +++ b/api/v1beta1/zz_generated.deepcopy.go @@ -0,0 +1,126 @@ +//go:build !ignore_autogenerated + +/* +Copyright 2023. projectsveltos.io. All rights reserved. + +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. +*/ + +// Code generated by controller-gen. DO NOT EDIT. + +package v1beta1 + +import ( + runtime "k8s.io/apimachinery/pkg/runtime" +) + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *JsonnetSource) DeepCopyInto(out *JsonnetSource) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new JsonnetSource. +func (in *JsonnetSource) DeepCopy() *JsonnetSource { + if in == nil { + return nil + } + out := new(JsonnetSource) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *JsonnetSource) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *JsonnetSourceList) DeepCopyInto(out *JsonnetSourceList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]JsonnetSource, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new JsonnetSourceList. +func (in *JsonnetSourceList) DeepCopy() *JsonnetSourceList { + if in == nil { + return nil + } + out := new(JsonnetSourceList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *JsonnetSourceList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *JsonnetSourceSpec) DeepCopyInto(out *JsonnetSourceSpec) { + *out = *in + if in.Variables != nil { + in, out := &in.Variables, &out.Variables + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new JsonnetSourceSpec. +func (in *JsonnetSourceSpec) DeepCopy() *JsonnetSourceSpec { + if in == nil { + return nil + } + out := new(JsonnetSourceSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *JsonnetSourceStatus) DeepCopyInto(out *JsonnetSourceStatus) { + *out = *in + if in.FailureMessage != nil { + in, out := &in.FailureMessage, &out.FailureMessage + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new JsonnetSourceStatus. +func (in *JsonnetSourceStatus) DeepCopy() *JsonnetSourceStatus { + if in == nil { + return nil + } + out := new(JsonnetSourceStatus) + in.DeepCopyInto(out) + return out +} diff --git a/main.go b/cmd/main.go similarity index 100% rename from main.go rename to cmd/main.go diff --git a/config/crd/bases/extension.projectsveltos.io_jsonnetsources.yaml b/config/crd/bases/extension.projectsveltos.io_jsonnetsources.yaml index d692a90..fd4edf4 100644 --- a/config/crd/bases/extension.projectsveltos.io_jsonnetsources.yaml +++ b/config/crd/bases/extension.projectsveltos.io_jsonnetsources.yaml @@ -15,6 +15,85 @@ spec: scope: Namespaced versions: - name: v1alpha1 + schema: + openAPIV3Schema: + description: JsonnetSource is the Schema for the jsonnetsources API + properties: + apiVersion: + description: |- + APIVersion defines the versioned schema of this representation of an object. + Servers should convert recognized schemas to the latest internal value, and + may reject unrecognized values. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources + type: string + kind: + description: |- + Kind is a string value representing the REST resource this object represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + type: string + metadata: + type: object + spec: + description: JsonnetSourceSpec defines the desired state of JsonnetSource + properties: + kind: + description: |- + Kind of the resource. Supported kinds are: + - flux GitRepository;OCIRepository;Bucket + - ConfigMap/Secret (which will be mounted as volume) + enum: + - GitRepository + - OCIRepository + - Bucket + - ConfigMap + - Secret + type: string + name: + description: Name of the rreferenced resource. + minLength: 1 + type: string + namespace: + description: |- + Namespace of the referenced resource. + Namespace can be left empty. In such a case, namespace will + be implicit set to cluster's namespace. + type: string + path: + description: |- + Path to the jsonnet file. + Defaults to 'None', which translates to the root path of the SourceRef. + type: string + variables: + additionalProperties: + type: string + description: Variables contains set of variable to pass to jsonnet + type: object + required: + - kind + - name + - namespace + type: object + status: + description: JsonnetSourceStatus defines the observed state of JsonnetSource + properties: + failureMessage: + description: FailureMessage provides more information about the error. + type: string + resources: + description: |- + Resources contains the output of jsonnet, so the + resources to be deployed + type: string + type: object + type: object + served: true + storage: false + subresources: + status: {} + - name: v1beta1 schema: openAPIV3Schema: description: JsonnetSource is the Schema for the jsonnetsources API diff --git a/config/crd/kustomization.yaml b/config/crd/kustomization.yaml index 4999d7a..343e63e 100644 --- a/config/crd/kustomization.yaml +++ b/config/crd/kustomization.yaml @@ -5,7 +5,7 @@ resources: - bases/extension.projectsveltos.io_jsonnetsources.yaml #+kubebuilder:scaffold:crdkustomizeresource -patchesStrategicMerge: +patches: # [WEBHOOK] To enable webhook, uncomment all the sections with [WEBHOOK] prefix. # patches here are for enabling the conversion webhook for each CRD #- patches/webhook_in_jsonnetsources.yaml @@ -14,6 +14,7 @@ patchesStrategicMerge: # [CERTMANAGER] To enable cert-manager, uncomment all the sections with [CERTMANAGER] prefix. # patches here are for enabling the CA injection for each CRD #- patches/cainjection_in_jsonnetsources.yaml +#- path: patches/cainjection_in_jsonnetsources.yaml #+kubebuilder:scaffold:crdkustomizecainjectionpatch # the following config is for teaching kustomize how to do kustomization for CRDs. diff --git a/config/default/kustomization.yaml b/config/default/kustomization.yaml index 1fee2f2..e4959f3 100644 --- a/config/default/kustomization.yaml +++ b/config/default/kustomization.yaml @@ -12,7 +12,7 @@ namePrefix: jsonnet- #commonLabels: # someName: someValue -bases: +resources: - ../crd - ../rbac - ../manager @@ -24,13 +24,13 @@ bases: # [PROMETHEUS] To enable prometheus monitor, uncomment all sections with 'PROMETHEUS'. #- ../prometheus -patchesStrategicMerge: +patches: # Protect the /metrics endpoint by putting it behind auth. # If you want your controller-manager to expose the /metrics # endpoint w/o any authn/z, please comment the following line. -- manager_auth_proxy_patch.yaml -- manager_image_patch.yaml -- manager_pull_policy.yaml +- path: manager_auth_proxy_patch.yaml +- path: manager_image_patch.yaml +- path: manager_pull_policy.yaml # Mount the controller config file for loading manager configurations # through a ComponentConfig type diff --git a/config/rbac/kustomization.yaml b/config/rbac/kustomization.yaml index 4e42541..1e29ea9 100644 --- a/config/rbac/kustomization.yaml +++ b/config/rbac/kustomization.yaml @@ -14,3 +14,10 @@ resources: - auth_proxy_role.yaml - auth_proxy_role_binding.yaml - auth_proxy_client_clusterrole.yaml +# For each CRD, "Editor" and "Viewer" roles are scaffolded by +# default, aiding admins in cluster management. Those roles are +# not used by the Project itself. You can comment the following lines +# if you do not want those helpers be installed with your Project. +- jsonnetsource_editor_role.yaml +- jsonnetsource_viewer_role.yaml + diff --git a/config/samples/extension_v1alpha1_jsonnetsource.yaml b/config/samples/extension_v1alpha1_jsonnetsource.yaml index 48039b6..8129296 100644 --- a/config/samples/extension_v1alpha1_jsonnetsource.yaml +++ b/config/samples/extension_v1alpha1_jsonnetsource.yaml @@ -1,4 +1,4 @@ -apiVersion: extension.projectsveltos.io/v1alpha1 +apiVersion: extension.projectsveltos.io/v1beta1 kind: JsonnetSource metadata: name: jsonnetsource-sample diff --git a/config/samples/extension_v1beta1_jsonnetsource.yaml b/config/samples/extension_v1beta1_jsonnetsource.yaml new file mode 100644 index 0000000..a6a0764 --- /dev/null +++ b/config/samples/extension_v1beta1_jsonnetsource.yaml @@ -0,0 +1,9 @@ +apiVersion: extension.projectsveltos.io/v1beta1 +kind: JsonnetSource +metadata: + labels: + app.kubernetes.io/name: jsonnet-controller + app.kubernetes.io/managed-by: kustomize + name: jsonnetsource-sample +spec: + # TODO(user): Add fields here diff --git a/config/samples/kustomization.yaml b/config/samples/kustomization.yaml new file mode 100644 index 0000000..922f981 --- /dev/null +++ b/config/samples/kustomization.yaml @@ -0,0 +1,4 @@ +## Append samples of your project ## +resources: +- extension_v1beta1_jsonnetsource.yaml +# +kubebuilder:scaffold:manifestskustomizesamples diff --git a/controllers/jsonnetsource_controller.go b/controllers/jsonnetsource_controller.go index faa12a4..840df3e 100644 --- a/controllers/jsonnetsource_controller.go +++ b/controllers/jsonnetsource_controller.go @@ -30,7 +30,7 @@ import ( sourcev1 "github.com/fluxcd/source-controller/api/v1" sourcev1b2 "github.com/fluxcd/source-controller/api/v1beta2" "github.com/ghodss/yaml" - extensionv1alpha1 "github.com/gianlucam76/jsonnet-controller/api/v1alpha1" + extensionv1beta1 "github.com/gianlucam76/jsonnet-controller/api/v1beta1" "github.com/go-logr/logr" "github.com/google/go-jsonnet" "github.com/pkg/errors" @@ -48,7 +48,7 @@ import ( "sigs.k8s.io/controller-runtime/pkg/reconcile" "sigs.k8s.io/controller-runtime/pkg/source" - libsveltosv1alpha1 "github.com/projectsveltos/libsveltos/api/v1alpha1" + libsveltosv1beta1 "github.com/projectsveltos/libsveltos/api/v1beta1" logs "github.com/projectsveltos/libsveltos/lib/logsettings" libsveltosset "github.com/projectsveltos/libsveltos/lib/set" ) @@ -81,7 +81,7 @@ func (r *JsonnetSourceReconciler) Reconcile(ctx context.Context, req ctrl.Reques logger.V(logs.LogInfo).Info("Reconciling") // Fecth the JsonnetSource instance - jsonnetSource := &extensionv1alpha1.JsonnetSource{} + jsonnetSource := &extensionv1beta1.JsonnetSource{} if err := r.Get(ctx, req.NamespacedName, jsonnetSource); err != nil { if apierrors.IsNotFound(err) { return reconcile.Result{}, nil @@ -133,7 +133,7 @@ func (r *JsonnetSourceReconciler) Reconcile(ctx context.Context, req ctrl.Reques func (r *JsonnetSourceReconciler) reconcileNormal( ctx context.Context, - jsonnetSource *extensionv1alpha1.JsonnetSource, + jsonnetSource *extensionv1beta1.JsonnetSource, logger logr.Logger, ) (string, error) { @@ -209,7 +209,7 @@ func (r *JsonnetSourceReconciler) SetupWithManager(mgr ctrl.Manager, ) (controller.Controller, error) { c, err := ctrl.NewControllerManagedBy(mgr). - For(&extensionv1alpha1.JsonnetSource{}). + For(&extensionv1beta1.JsonnetSource{}). WithOptions(controller.Options{ MaxConcurrentReconciles: 5, }). @@ -279,7 +279,7 @@ func (r *JsonnetSourceReconciler) getReferenceMapForEntry(entry *corev1.ObjectRe return s } -func (r *JsonnetSourceReconciler) getCurrentReference(jsonnetSource *extensionv1alpha1.JsonnetSource) *corev1.ObjectReference { +func (r *JsonnetSourceReconciler) getCurrentReference(jsonnetSource *extensionv1beta1.JsonnetSource) *corev1.ObjectReference { return &corev1.ObjectReference{ APIVersion: getReferenceAPIVersion(jsonnetSource), Kind: jsonnetSource.Spec.Kind, @@ -288,7 +288,7 @@ func (r *JsonnetSourceReconciler) getCurrentReference(jsonnetSource *extensionv1 } } -func (r *JsonnetSourceReconciler) updateMaps(jsonnetSource *extensionv1alpha1.JsonnetSource, logger logr.Logger) { +func (r *JsonnetSourceReconciler) updateMaps(jsonnetSource *extensionv1beta1.JsonnetSource, logger logr.Logger) { logger.V(logs.LogDebug).Info("update policy map") ref := r.getCurrentReference(jsonnetSource) @@ -321,7 +321,7 @@ func (r *JsonnetSourceReconciler) updateMaps(jsonnetSource *extensionv1alpha1.Js r.JsonnetSourceMap[JsonnetSourceName] = currentReference } -func (r *JsonnetSourceReconciler) cleanMaps(jsonnetSource *extensionv1alpha1.JsonnetSource) { +func (r *JsonnetSourceReconciler) cleanMaps(jsonnetSource *extensionv1beta1.JsonnetSource) { r.PolicyMux.Lock() defer r.PolicyMux.Unlock() @@ -336,13 +336,13 @@ func (r *JsonnetSourceReconciler) cleanMaps(jsonnetSource *extensionv1alpha1.Jso } func (r *JsonnetSourceReconciler) prepareFileSystem(ctx context.Context, - jsonnetSource *extensionv1alpha1.JsonnetSource, logger logr.Logger) (string, error) { + jsonnetSource *extensionv1beta1.JsonnetSource, logger logr.Logger) (string, error) { ref := r.getCurrentReference(jsonnetSource) - if ref.Kind == string(libsveltosv1alpha1.ConfigMapReferencedResourceKind) { + if ref.Kind == string(libsveltosv1beta1.ConfigMapReferencedResourceKind) { return prepareFileSystemWithConfigMap(ctx, r.Client, ref, logger) - } else if ref.Kind == string(libsveltosv1alpha1.SecretReferencedResourceKind) { + } else if ref.Kind == string(libsveltosv1beta1.SecretReferencedResourceKind) { return prepareFileSystemWithSecret(ctx, r.Client, ref, logger) } @@ -496,7 +496,7 @@ func getSource(ctx context.Context, c client.Client, ref *corev1.ObjectReference } // Close closes the current scope persisting the JsonnetSource status. -func (s *JsonnetSourceReconciler) Close(ctx context.Context, jsonnetSource *extensionv1alpha1.JsonnetSource, +func (s *JsonnetSourceReconciler) Close(ctx context.Context, jsonnetSource *extensionv1beta1.JsonnetSource, patchHelper *patch.Helper) error { return patchHelper.Patch( diff --git a/controllers/jsonnetsource_transformations.go b/controllers/jsonnetsource_transformations.go index 73ebaef..b1e2df0 100644 --- a/controllers/jsonnetsource_transformations.go +++ b/controllers/jsonnetsource_transformations.go @@ -29,7 +29,7 @@ import ( sourcev1 "github.com/fluxcd/source-controller/api/v1" sourcev1b2 "github.com/fluxcd/source-controller/api/v1beta2" - libsveltosv1alpha1 "github.com/projectsveltos/libsveltos/api/v1alpha1" + libsveltosv1beta1 "github.com/projectsveltos/libsveltos/api/v1beta1" logs "github.com/projectsveltos/libsveltos/lib/logsettings" ) @@ -143,14 +143,14 @@ func (r *JsonnetSourceReconciler) requeueJsonnetSourceForReference( case *corev1.ConfigMap: key = corev1.ObjectReference{ APIVersion: corev1.SchemeGroupVersion.String(), - Kind: string(libsveltosv1alpha1.ConfigMapReferencedResourceKind), + Kind: string(libsveltosv1beta1.ConfigMapReferencedResourceKind), Namespace: o.GetNamespace(), Name: o.GetName(), } case *corev1.Secret: key = corev1.ObjectReference{ APIVersion: corev1.SchemeGroupVersion.String(), - Kind: string(libsveltosv1alpha1.SecretReferencedResourceKind), + Kind: string(libsveltosv1beta1.SecretReferencedResourceKind), Namespace: o.GetNamespace(), Name: o.GetName(), } diff --git a/controllers/jsonnetsource_transformations_test.go b/controllers/jsonnetsource_transformations_test.go index caf24df..16c3170 100644 --- a/controllers/jsonnetsource_transformations_test.go +++ b/controllers/jsonnetsource_transformations_test.go @@ -31,10 +31,10 @@ import ( "sigs.k8s.io/controller-runtime/pkg/client/fake" "sigs.k8s.io/controller-runtime/pkg/reconcile" - extensionv1alpha1 "github.com/gianlucam76/jsonnet-controller/api/v1alpha1" + extensionv1beta1 "github.com/gianlucam76/jsonnet-controller/api/v1beta1" "github.com/gianlucam76/jsonnet-controller/controllers" - libsveltosv1alpha1 "github.com/projectsveltos/libsveltos/api/v1alpha1" + libsveltosv1beta1 "github.com/projectsveltos/libsveltos/api/v1beta1" libsveltosset "github.com/projectsveltos/libsveltos/lib/set" ) @@ -49,27 +49,27 @@ var _ = Describe("JsonnetSourceTransformation map functions", func() { controllers.AddTypeInformationToObject(scheme, configMap) - JsonnetSource0 := &extensionv1alpha1.JsonnetSource{ + JsonnetSource0 := &extensionv1beta1.JsonnetSource{ ObjectMeta: metav1.ObjectMeta{ Name: randomString(), Namespace: randomString(), }, - Spec: extensionv1alpha1.JsonnetSourceSpec{ + Spec: extensionv1beta1.JsonnetSourceSpec{ Namespace: configMap.Namespace, Name: configMap.Name, - Kind: string(libsveltosv1alpha1.ConfigMapReferencedResourceKind), + Kind: string(libsveltosv1beta1.ConfigMapReferencedResourceKind), }, } - JsonnetSource1 := &extensionv1alpha1.JsonnetSource{ + JsonnetSource1 := &extensionv1beta1.JsonnetSource{ ObjectMeta: metav1.ObjectMeta{ Name: randomString(), Namespace: randomString(), }, - Spec: extensionv1alpha1.JsonnetSourceSpec{ + Spec: extensionv1beta1.JsonnetSourceSpec{ Namespace: randomString(), Name: configMap.Name, - Kind: string(libsveltosv1alpha1.ConfigMapReferencedResourceKind), + Kind: string(libsveltosv1beta1.ConfigMapReferencedResourceKind), }, } @@ -91,10 +91,10 @@ var _ = Describe("JsonnetSourceTransformation map functions", func() { set := libsveltosset.Set{} key := corev1.ObjectReference{APIVersion: configMap.APIVersion, - Kind: string(libsveltosv1alpha1.ConfigMapReferencedResourceKind), Namespace: configMap.Namespace, Name: configMap.Name} + Kind: string(libsveltosv1beta1.ConfigMapReferencedResourceKind), Namespace: configMap.Namespace, Name: configMap.Name} - set.Insert(&corev1.ObjectReference{APIVersion: extensionv1alpha1.GroupVersion.String(), - Kind: extensionv1alpha1.JsonnetSourceKind, Namespace: JsonnetSource0.Namespace, Name: JsonnetSource0.Name}) + set.Insert(&corev1.ObjectReference{APIVersion: extensionv1beta1.GroupVersion.String(), + Kind: extensionv1beta1.JsonnetSourceKind, Namespace: JsonnetSource0.Namespace, Name: JsonnetSource0.Name}) reconciler.ReferenceMap[key] = &set requests := controllers.RequeueJsonnetSourceForReference(reconciler, context.TODO(), configMap) @@ -102,8 +102,8 @@ var _ = Describe("JsonnetSourceTransformation map functions", func() { Expect(requests[0].Name).To(Equal(JsonnetSource0.Name)) Expect(requests[0].Namespace).To(Equal(JsonnetSource0.Namespace)) - set.Insert(&corev1.ObjectReference{APIVersion: extensionv1alpha1.GroupVersion.String(), - Kind: extensionv1alpha1.JsonnetSourceKind, Namespace: JsonnetSource1.Namespace, Name: JsonnetSource1.Name}) + set.Insert(&corev1.ObjectReference{APIVersion: extensionv1beta1.GroupVersion.String(), + Kind: extensionv1beta1.JsonnetSourceKind, Namespace: JsonnetSource1.Namespace, Name: JsonnetSource1.Name}) reconciler.ReferenceMap[key] = &set requests = controllers.RequeueJsonnetSourceForReference(reconciler, context.TODO(), configMap) @@ -126,24 +126,24 @@ var _ = Describe("JsonnetSourceTransformation map functions", func() { controllers.AddTypeInformationToObject(scheme, gitRepo) - JsonnetSource0 := &extensionv1alpha1.JsonnetSource{ + JsonnetSource0 := &extensionv1beta1.JsonnetSource{ ObjectMeta: metav1.ObjectMeta{ Name: randomString(), Namespace: randomString(), }, - Spec: extensionv1alpha1.JsonnetSourceSpec{ + Spec: extensionv1beta1.JsonnetSourceSpec{ Namespace: gitRepo.Namespace, Name: gitRepo.Name, Kind: sourcev1.GitRepositoryKind, }, } - JsonnetSource1 := &extensionv1alpha1.JsonnetSource{ + JsonnetSource1 := &extensionv1beta1.JsonnetSource{ ObjectMeta: metav1.ObjectMeta{ Name: randomString(), Namespace: randomString(), }, - Spec: extensionv1alpha1.JsonnetSourceSpec{ + Spec: extensionv1beta1.JsonnetSourceSpec{ Namespace: gitRepo.Namespace, Name: randomString(), Kind: sourcev1.GitRepositoryKind, @@ -170,8 +170,8 @@ var _ = Describe("JsonnetSourceTransformation map functions", func() { key := corev1.ObjectReference{APIVersion: gitRepo.APIVersion, Kind: sourcev1.GitRepositoryKind, Namespace: gitRepo.Namespace, Name: gitRepo.Name} - set.Insert(&corev1.ObjectReference{APIVersion: extensionv1alpha1.GroupVersion.String(), - Kind: extensionv1alpha1.JsonnetSourceKind, Namespace: JsonnetSource0.Namespace, Name: JsonnetSource0.Name}) + set.Insert(&corev1.ObjectReference{APIVersion: extensionv1beta1.GroupVersion.String(), + Kind: extensionv1beta1.JsonnetSourceKind, Namespace: JsonnetSource0.Namespace, Name: JsonnetSource0.Name}) reconciler.ReferenceMap[key] = &set requests := controllers.RequeueJsonnetSourceForFluxGitRepository(reconciler, context.TODO(), gitRepo) @@ -179,8 +179,8 @@ var _ = Describe("JsonnetSourceTransformation map functions", func() { Expect(requests[0].Name).To(Equal(JsonnetSource0.Name)) Expect(requests[0].Namespace).To(Equal(JsonnetSource0.Namespace)) - set.Insert(&corev1.ObjectReference{APIVersion: extensionv1alpha1.GroupVersion.String(), - Kind: extensionv1alpha1.JsonnetSourceKind, Namespace: JsonnetSource1.Namespace, Name: JsonnetSource1.Name}) + set.Insert(&corev1.ObjectReference{APIVersion: extensionv1beta1.GroupVersion.String(), + Kind: extensionv1beta1.JsonnetSourceKind, Namespace: JsonnetSource1.Namespace, Name: JsonnetSource1.Name}) reconciler.ReferenceMap[key] = &set requests = controllers.RequeueJsonnetSourceForFluxGitRepository(reconciler, context.TODO(), gitRepo) diff --git a/controllers/utils.go b/controllers/utils.go index 568d7ac..ee14b40 100644 --- a/controllers/utils.go +++ b/controllers/utils.go @@ -36,9 +36,9 @@ import ( clientgoscheme "k8s.io/client-go/kubernetes/scheme" "sigs.k8s.io/controller-runtime/pkg/client" - extensionv1alpha1 "github.com/gianlucam76/jsonnet-controller/api/v1alpha1" + extensionv1beta1 "github.com/gianlucam76/jsonnet-controller/api/v1beta1" - libsveltosv1alpha1 "github.com/projectsveltos/libsveltos/api/v1alpha1" + libsveltosv1beta1 "github.com/projectsveltos/libsveltos/api/v1beta1" ) //+kubebuilder:rbac:groups=apiextensions.k8s.io,resources=customresourcedefinitions,verbs=get;list;watch @@ -63,7 +63,7 @@ func InitScheme() (*runtime.Scheme, error) { if err := sourcev1b2.AddToScheme(s); err != nil { return nil, err } - if err := extensionv1alpha1.AddToScheme(s); err != nil { + if err := extensionv1beta1.AddToScheme(s); err != nil { return nil, err } return s, nil @@ -101,11 +101,11 @@ func addTypeInformationToObject(scheme *runtime.Scheme, obj client.Object) { } } -func getReferenceAPIVersion(jsonnetSource *extensionv1alpha1.JsonnetSource) string { +func getReferenceAPIVersion(jsonnetSource *extensionv1beta1.JsonnetSource) string { switch jsonnetSource.Spec.Kind { - case string(libsveltosv1alpha1.ConfigMapReferencedResourceKind): + case string(libsveltosv1beta1.ConfigMapReferencedResourceKind): return corev1.SchemeGroupVersion.String() - case string(libsveltosv1alpha1.SecretReferencedResourceKind): + case string(libsveltosv1beta1.SecretReferencedResourceKind): return corev1.SchemeGroupVersion.String() case sourcev1b2.OCIRepositoryKind: case sourcev1b2.BucketKind: @@ -142,8 +142,8 @@ func getSecret(ctx context.Context, c client.Client, secretName types.Namespaced return nil, err } - if secret.Type != libsveltosv1alpha1.ClusterProfileSecretType { - return nil, libsveltosv1alpha1.ErrSecretTypeNotSupported + if secret.Type != libsveltosv1beta1.ClusterProfileSecretType { + return nil, libsveltosv1beta1.ErrSecretTypeNotSupported } return secret, nil diff --git a/controllers/utils_test.go b/controllers/utils_test.go index 3783a5b..1387d1a 100644 --- a/controllers/utils_test.go +++ b/controllers/utils_test.go @@ -23,7 +23,7 @@ import ( clientgoscheme "k8s.io/client-go/kubernetes/scheme" "sigs.k8s.io/cluster-api/util" - extensionv1alpha1 "github.com/gianlucam76/jsonnet-controller/api/v1alpha1" + extensionv1beta1 "github.com/gianlucam76/jsonnet-controller/api/v1beta1" ) func randomString() string { @@ -42,7 +42,7 @@ func setupScheme() (*runtime.Scheme, error) { if err := sourcev1b2.AddToScheme(s); err != nil { return nil, err } - if err := extensionv1alpha1.AddToScheme(s); err != nil { + if err := extensionv1beta1.AddToScheme(s); err != nil { return nil, err } diff --git a/go.mod b/go.mod index 23396c6..6dc56eb 100644 --- a/go.mod +++ b/go.mod @@ -13,16 +13,16 @@ require ( github.com/onsi/ginkgo/v2 v2.19.0 github.com/onsi/gomega v1.33.1 github.com/pkg/errors v0.9.1 - github.com/projectsveltos/libsveltos v0.31.0 + github.com/projectsveltos/libsveltos v0.33.0 github.com/spf13/pflag v1.0.5 - k8s.io/api v0.30.1 - k8s.io/apiextensions-apiserver v0.30.1 - k8s.io/apimachinery v0.30.1 - k8s.io/client-go v0.30.1 - k8s.io/component-base v0.30.1 - k8s.io/klog/v2 v2.120.1 - sigs.k8s.io/cluster-api v1.7.2 - sigs.k8s.io/controller-runtime v0.18.3 + k8s.io/api v0.30.2 + k8s.io/apiextensions-apiserver v0.30.2 + k8s.io/apimachinery v0.30.2 + k8s.io/client-go v0.30.2 + k8s.io/component-base v0.30.2 + k8s.io/klog/v2 v2.130.1 + sigs.k8s.io/cluster-api v1.7.3 + sigs.k8s.io/controller-runtime v0.18.4 ) require ( @@ -75,9 +75,9 @@ require ( golang.org/x/oauth2 v0.18.0 // indirect golang.org/x/sys v0.20.0 // indirect golang.org/x/term v0.20.0 // indirect - golang.org/x/text v0.15.0 // indirect + golang.org/x/text v0.16.0 // indirect golang.org/x/time v0.5.0 // indirect - golang.org/x/tools v0.21.0 // indirect + golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d // indirect gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect google.golang.org/appengine v1.6.7 // indirect google.golang.org/protobuf v1.33.0 // indirect @@ -85,7 +85,7 @@ require ( gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect k8s.io/kube-openapi v0.0.0-20240228011516-70dd3763d340 // indirect - k8s.io/kubectl v0.30.1 // indirect + k8s.io/kubectl v0.30.2 // indirect k8s.io/utils v0.0.0-20240502163921-fe8a2dddb1d0 // indirect sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect diff --git a/go.sum b/go.sum index 6fccf9b..a943df3 100644 --- a/go.sum +++ b/go.sum @@ -146,8 +146,8 @@ github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/projectsveltos/libsveltos v0.31.0 h1:wNRW4gSqfFtCt+dfYxWkR6nVb/NBlgUkVK//djWEZfk= -github.com/projectsveltos/libsveltos v0.31.0/go.mod h1:APYCWXBZ/+RhCKq/uetAW99CcJVxL1g0/Kh5GZlvIHk= +github.com/projectsveltos/libsveltos v0.33.0 h1:DHPxqX9zlALgW7Ahn5OaHtcSA35Tfv3H6JU6Cjn+rYA= +github.com/projectsveltos/libsveltos v0.33.0/go.mod h1:GRQ9Otq55Aii1icSvkrTjyDOniBZjYVA5018BRpMvdA= github.com/prometheus/client_golang v1.18.0 h1:HzFfmkOzH5Q8L8G+kSJKUx5dtG87sewO+FoDDqP5Tbk= github.com/prometheus/client_golang v1.18.0/go.mod h1:T+GXkCk5wSJyOqMIzVgvvjFDlkOQntgjkJWKrN5txjA= github.com/prometheus/client_model v0.5.0 h1:VQw1hfvPvk3Uv6Qf29VrPF32JB6rtbgI6cYPYQjL0Qw= @@ -229,16 +229,16 @@ golang.org/x/term v0.20.0/go.mod h1:8UkIAJTvZgivsXaD6/pH6U9ecQzZ45awqEOzuCvwpFY= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.15.0 h1:h1V/4gjBv8v9cjcR6+AR5+/cIYK5N/WAgiv4xlsEtAk= -golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4= +golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI= golang.org/x/time v0.5.0 h1:o7cqy6amK/52YcAKIPlM3a+Fpj35zvRj2TP+e1xFSfk= golang.org/x/time v0.5.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.21.0 h1:qc0xYgIbsSDt9EyWz05J5wfa7LOVW0YTLOXrqdLAWIw= -golang.org/x/tools v0.21.0/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk= +golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d h1:vU5i/LfpvrRCpgM/VPfJLg5KjxD3E+hfT1SH+d9zLwg= +golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -266,32 +266,32 @@ gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C gopkg.in/yaml.v3 v3.0.0/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -k8s.io/api v0.30.1 h1:kCm/6mADMdbAxmIh0LBjS54nQBE+U4KmbCfIkF5CpJY= -k8s.io/api v0.30.1/go.mod h1:ddbN2C0+0DIiPntan/bye3SW3PdwLa11/0yqwvuRrJM= -k8s.io/apiextensions-apiserver v0.30.1 h1:4fAJZ9985BmpJG6PkoxVRpXv9vmPUOVzl614xarePws= -k8s.io/apiextensions-apiserver v0.30.1/go.mod h1:R4GuSrlhgq43oRY9sF2IToFh7PVlF1JjfWdoG3pixk4= -k8s.io/apimachinery v0.30.1 h1:ZQStsEfo4n65yAdlGTfP/uSHMQSoYzU/oeEbkmF7P2U= -k8s.io/apimachinery v0.30.1/go.mod h1:iexa2somDaxdnj7bha06bhb43Zpa6eWH8N8dbqVjTUc= -k8s.io/apiserver v0.30.1 h1:BEWEe8bzS12nMtDKXzCF5Q5ovp6LjjYkSp8qOPk8LZ8= -k8s.io/apiserver v0.30.1/go.mod h1:i87ZnQ+/PGAmSbD/iEKM68bm1D5reX8fO4Ito4B01mo= -k8s.io/client-go v0.30.1 h1:uC/Ir6A3R46wdkgCV3vbLyNOYyCJ8oZnjtJGKfytl/Q= -k8s.io/client-go v0.30.1/go.mod h1:wrAqLNs2trwiCH/wxxmT/x3hKVH9PuV0GGW0oDoHVqc= +k8s.io/api v0.30.2 h1:+ZhRj+28QT4UOH+BKznu4CBgPWgkXO7XAvMcMl0qKvI= +k8s.io/api v0.30.2/go.mod h1:ULg5g9JvOev2dG0u2hig4Z7tQ2hHIuS+m8MNZ+X6EmI= +k8s.io/apiextensions-apiserver v0.30.2 h1:l7Eue2t6QiLHErfn2vwK4KgF4NeDgjQkCXtEbOocKIE= +k8s.io/apiextensions-apiserver v0.30.2/go.mod h1:lsJFLYyK40iguuinsb3nt+Sj6CmodSI4ACDLep1rgjw= +k8s.io/apimachinery v0.30.2 h1:fEMcnBj6qkzzPGSVsAZtQThU62SmQ4ZymlXRC5yFSCg= +k8s.io/apimachinery v0.30.2/go.mod h1:iexa2somDaxdnj7bha06bhb43Zpa6eWH8N8dbqVjTUc= +k8s.io/apiserver v0.30.2 h1:ACouHiYl1yFI2VFI3YGM+lvxgy6ir4yK2oLOsLI1/tw= +k8s.io/apiserver v0.30.2/go.mod h1:BOTdFBIch9Sv0ypSEcUR6ew/NUFGocRFNl72Ra7wTm8= +k8s.io/client-go v0.30.2 h1:sBIVJdojUNPDU/jObC+18tXWcTJVcwyqS9diGdWHk50= +k8s.io/client-go v0.30.2/go.mod h1:JglKSWULm9xlJLx4KCkfLLQ7XwtlbflV6uFFSHTMgVs= k8s.io/cluster-bootstrap v0.29.3 h1:DIMDZSN8gbFMy9CS2mAS2Iqq/fIUG783WN/1lqi5TF8= k8s.io/cluster-bootstrap v0.29.3/go.mod h1:aPAg1VtXx3uRrx5qU2jTzR7p1rf18zLXWS+pGhiqPto= -k8s.io/component-base v0.30.1 h1:bvAtlPh1UrdaZL20D9+sWxsJljMi0QZ3Lmw+kmZAaxQ= -k8s.io/component-base v0.30.1/go.mod h1:e/X9kDiOebwlI41AvBHuWdqFriSRrX50CdwA9TFaHLI= -k8s.io/klog/v2 v2.120.1 h1:QXU6cPEOIslTGvZaXvFWiP9VKyeet3sawzTOvdXb4Vw= -k8s.io/klog/v2 v2.120.1/go.mod h1:3Jpz1GvMt720eyJH1ckRHK1EDfpxISzJ7I9OYgaDtPE= +k8s.io/component-base v0.30.2 h1:pqGBczYoW1sno8q9ObExUqrYSKhtE5rW3y6gX88GZII= +k8s.io/component-base v0.30.2/go.mod h1:yQLkQDrkK8J6NtP+MGJOws+/PPeEXNpwFixsUI7h/OE= +k8s.io/klog/v2 v2.130.1 h1:n9Xl7H1Xvksem4KFG4PYbdQCQxqc/tTUyrgXaOhHSzk= +k8s.io/klog/v2 v2.130.1/go.mod h1:3Jpz1GvMt720eyJH1ckRHK1EDfpxISzJ7I9OYgaDtPE= k8s.io/kube-openapi v0.0.0-20240228011516-70dd3763d340 h1:BZqlfIlq5YbRMFko6/PM7FjZpUb45WallggurYhKGag= k8s.io/kube-openapi v0.0.0-20240228011516-70dd3763d340/go.mod h1:yD4MZYeKMBwQKVht279WycxKyM84kkAx2DPrTXaeb98= -k8s.io/kubectl v0.30.1 h1:sHFIRI3oP0FFZmBAVEE8ErjnTyXDPkBcvO88mH9RjuY= -k8s.io/kubectl v0.30.1/go.mod h1:7j+L0Cc38RYEcx+WH3y44jRBe1Q1jxdGPKkX0h4iDq0= +k8s.io/kubectl v0.30.2 h1:cgKNIvsOiufgcs4yjvgkK0+aPCfa8pUwzXdJtkbhsH8= +k8s.io/kubectl v0.30.2/go.mod h1:rz7GHXaxwnigrqob0lJsiA07Df8RE3n1TSaC2CTeuB4= k8s.io/utils v0.0.0-20240502163921-fe8a2dddb1d0 h1:jgGTlFYnhF1PM1Ax/lAlxUPE+KfCIXHaathvJg1C3ak= k8s.io/utils v0.0.0-20240502163921-fe8a2dddb1d0/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= -sigs.k8s.io/cluster-api v1.7.2 h1:bRE8zoao7ajuLC0HijqfZVcubKQCPlZ04HMgcA53FGE= -sigs.k8s.io/cluster-api v1.7.2/go.mod h1:V9ZhKLvQtsDODwjXOKgbitjyCmC71yMBwDcMyNNIov0= -sigs.k8s.io/controller-runtime v0.18.3 h1:B5Wmmo8WMWK7izei+2LlXLVDGzMwAHBNLX68lwtlSR4= -sigs.k8s.io/controller-runtime v0.18.3/go.mod h1:TVoGrfdpbA9VRFaRnKgk9P5/atA0pMwq+f+msb9M8Sg= +sigs.k8s.io/cluster-api v1.7.3 h1:DsSRxsA+18jxLqPAo29abZ9kOPK1/xwhSuQb/MROzSs= +sigs.k8s.io/cluster-api v1.7.3/go.mod h1:V9ZhKLvQtsDODwjXOKgbitjyCmC71yMBwDcMyNNIov0= +sigs.k8s.io/controller-runtime v0.18.4 h1:87+guW1zhvuPLh1PHybKdYFLU0YJp4FhJRmiHvm5BZw= +sigs.k8s.io/controller-runtime v0.18.4/go.mod h1:TVoGrfdpbA9VRFaRnKgk9P5/atA0pMwq+f+msb9M8Sg= sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd h1:EDPBXCAspyGV4jQlpZSudPeMmr1bNJefnuqLsRAsHZo= sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd/go.mod h1:B8JuhiUyNFVKdsE8h686QcCxMaH6HrOAZj4vswFpcB0= sigs.k8s.io/structured-merge-diff/v4 v4.4.1 h1:150L+0vs/8DA78h1u02ooW1/fFq/Lwr+sGiqlzvrtq4= diff --git a/hack/tools/go.mod b/hack/tools/go.mod index 74ad51a..4ea116f 100644 --- a/hack/tools/go.mod +++ b/hack/tools/go.mod @@ -5,15 +5,15 @@ go 1.22.0 require ( github.com/a8m/envsubst v1.4.2 github.com/onsi/ginkgo/v2 v2.19.0 - golang.org/x/oauth2 v0.20.0 - k8s.io/client-go v0.30.1 + golang.org/x/oauth2 v0.21.0 + k8s.io/client-go v0.30.2 sigs.k8s.io/controller-tools v0.15.0 sigs.k8s.io/kind v0.23.0 ) require ( cloud.google.com/go/compute/metadata v0.3.0 // indirect - github.com/BurntSushi/toml v1.2.1 // indirect + github.com/BurntSushi/toml v1.0.0 // indirect github.com/alessio/shellescape v1.4.1 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/evanphx/json-patch/v5 v5.6.0 // indirect @@ -31,7 +31,7 @@ require ( github.com/mattn/go-isatty v0.0.20 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect - github.com/pelletier/go-toml v1.9.5 // indirect + github.com/pelletier/go-toml v1.9.4 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/spf13/cobra v1.8.0 // indirect github.com/spf13/pflag v1.0.5 // indirect @@ -46,9 +46,9 @@ require ( gopkg.in/inf.v0 v0.9.1 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect - k8s.io/api v0.30.1 // indirect + k8s.io/api v0.30.2 // indirect k8s.io/apiextensions-apiserver v0.30.0 // indirect - k8s.io/apimachinery v0.30.1 // indirect + k8s.io/apimachinery v0.30.2 // indirect k8s.io/klog/v2 v2.120.1 // indirect k8s.io/utils v0.0.0-20230726121419-3b25d923346b // indirect sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect diff --git a/hack/tools/go.sum b/hack/tools/go.sum index 95aef8c..f7ba78c 100644 --- a/hack/tools/go.sum +++ b/hack/tools/go.sum @@ -1,7 +1,7 @@ cloud.google.com/go/compute/metadata v0.3.0 h1:Tz+eQXMEqDIKRsmY3cHTL6FVaynIjX2QxYC4trgAKZc= cloud.google.com/go/compute/metadata v0.3.0/go.mod h1:zFmK7XCadkQkj6TtorcaGlCW1hT1fIilQDwofLpJ20k= -github.com/BurntSushi/toml v1.2.1 h1:9F2/+DoOYIOksmaJFPw1tGFy1eDnIJXg+UHjuD8lTak= -github.com/BurntSushi/toml v1.2.1/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= +github.com/BurntSushi/toml v1.0.0 h1:dtDWrepsVPfW9H/4y7dDgFc2MBUSeJhlaDtK13CxFlU= +github.com/BurntSushi/toml v1.0.0/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= github.com/a8m/envsubst v1.4.2 h1:4yWIHXOLEJHQEFd4UjrWDrYeYlV7ncFWJOCBRLOZHQg= github.com/a8m/envsubst v1.4.2/go.mod h1:MVUTQNGQ3tsjOOtKCNd+fl8RzhsXcDvvAEzkhGtlsbY= github.com/alessio/shellescape v1.4.1 h1:V7yhSDDn8LP4lc4jS8pFkt0zCnzVJlG5JXy9BVKJUX0= @@ -83,8 +83,8 @@ github.com/onsi/ginkgo/v2 v2.19.0 h1:9Cnnf7UHo57Hy3k6/m5k3dRfGTMXGvxhHFvkDTCTpvA github.com/onsi/ginkgo/v2 v2.19.0/go.mod h1:rlwLi9PilAFJ8jCg9UE1QP6VBpd6/xj3SRC0d6TU0To= github.com/onsi/gomega v1.33.1 h1:dsYjIxxSR755MDmKVsaFQTE22ChNBcuuTWgkUDSubOk= github.com/onsi/gomega v1.33.1/go.mod h1:U4R44UsT+9eLIaYRB2a5qajjtQYn0hauxvRm16AVYg0= -github.com/pelletier/go-toml v1.9.5 h1:4yBQzkHv+7BHq2PQUZF3Mx0IYxG7LsP222s7Agd3ve8= -github.com/pelletier/go-toml v1.9.5/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= +github.com/pelletier/go-toml v1.9.4 h1:tjENF6MfZAg8e4ZmZTeWaWiT2vXtsoO6+iuOjFhECwM= +github.com/pelletier/go-toml v1.9.4/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= @@ -121,8 +121,8 @@ golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLL golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.25.0 h1:d/OCCoBEUq33pjydKrGQhw7IlUPI2Oylr+8qLx49kac= golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM= -golang.org/x/oauth2 v0.20.0 h1:4mQdhULixXKP1rwYBW0vAijoXnkTG0BLCDRzfe1idMo= -golang.org/x/oauth2 v0.20.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= +golang.org/x/oauth2 v0.21.0 h1:tsimM75w1tF/uws5rbeHzIWxEqElMehnc+iW793zsZs= +golang.org/x/oauth2 v0.21.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -168,14 +168,14 @@ gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -k8s.io/api v0.30.1 h1:kCm/6mADMdbAxmIh0LBjS54nQBE+U4KmbCfIkF5CpJY= -k8s.io/api v0.30.1/go.mod h1:ddbN2C0+0DIiPntan/bye3SW3PdwLa11/0yqwvuRrJM= +k8s.io/api v0.30.2 h1:+ZhRj+28QT4UOH+BKznu4CBgPWgkXO7XAvMcMl0qKvI= +k8s.io/api v0.30.2/go.mod h1:ULg5g9JvOev2dG0u2hig4Z7tQ2hHIuS+m8MNZ+X6EmI= k8s.io/apiextensions-apiserver v0.30.0 h1:jcZFKMqnICJfRxTgnC4E+Hpcq8UEhT8B2lhBcQ+6uAs= k8s.io/apiextensions-apiserver v0.30.0/go.mod h1:N9ogQFGcrbWqAY9p2mUAL5mGxsLqwgtUce127VtRX5Y= -k8s.io/apimachinery v0.30.1 h1:ZQStsEfo4n65yAdlGTfP/uSHMQSoYzU/oeEbkmF7P2U= -k8s.io/apimachinery v0.30.1/go.mod h1:iexa2somDaxdnj7bha06bhb43Zpa6eWH8N8dbqVjTUc= -k8s.io/client-go v0.30.1 h1:uC/Ir6A3R46wdkgCV3vbLyNOYyCJ8oZnjtJGKfytl/Q= -k8s.io/client-go v0.30.1/go.mod h1:wrAqLNs2trwiCH/wxxmT/x3hKVH9PuV0GGW0oDoHVqc= +k8s.io/apimachinery v0.30.2 h1:fEMcnBj6qkzzPGSVsAZtQThU62SmQ4ZymlXRC5yFSCg= +k8s.io/apimachinery v0.30.2/go.mod h1:iexa2somDaxdnj7bha06bhb43Zpa6eWH8N8dbqVjTUc= +k8s.io/client-go v0.30.2 h1:sBIVJdojUNPDU/jObC+18tXWcTJVcwyqS9diGdWHk50= +k8s.io/client-go v0.30.2/go.mod h1:JglKSWULm9xlJLx4KCkfLLQ7XwtlbflV6uFFSHTMgVs= k8s.io/klog/v2 v2.120.1 h1:QXU6cPEOIslTGvZaXvFWiP9VKyeet3sawzTOvdXb4Vw= k8s.io/klog/v2 v2.120.1/go.mod h1:3Jpz1GvMt720eyJH1ckRHK1EDfpxISzJ7I9OYgaDtPE= k8s.io/kube-openapi v0.0.0-20240228011516-70dd3763d340 h1:BZqlfIlq5YbRMFko6/PM7FjZpUb45WallggurYhKGag= diff --git a/manifest/manifest.yaml b/manifest/manifest.yaml index 3f9c886..ff3985a 100644 --- a/manifest/manifest.yaml +++ b/manifest/manifest.yaml @@ -21,6 +21,85 @@ spec: scope: Namespaced versions: - name: v1alpha1 + schema: + openAPIV3Schema: + description: JsonnetSource is the Schema for the jsonnetsources API + properties: + apiVersion: + description: |- + APIVersion defines the versioned schema of this representation of an object. + Servers should convert recognized schemas to the latest internal value, and + may reject unrecognized values. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources + type: string + kind: + description: |- + Kind is a string value representing the REST resource this object represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + type: string + metadata: + type: object + spec: + description: JsonnetSourceSpec defines the desired state of JsonnetSource + properties: + kind: + description: |- + Kind of the resource. Supported kinds are: + - flux GitRepository;OCIRepository;Bucket + - ConfigMap/Secret (which will be mounted as volume) + enum: + - GitRepository + - OCIRepository + - Bucket + - ConfigMap + - Secret + type: string + name: + description: Name of the rreferenced resource. + minLength: 1 + type: string + namespace: + description: |- + Namespace of the referenced resource. + Namespace can be left empty. In such a case, namespace will + be implicit set to cluster's namespace. + type: string + path: + description: |- + Path to the jsonnet file. + Defaults to 'None', which translates to the root path of the SourceRef. + type: string + variables: + additionalProperties: + type: string + description: Variables contains set of variable to pass to jsonnet + type: object + required: + - kind + - name + - namespace + type: object + status: + description: JsonnetSourceStatus defines the observed state of JsonnetSource + properties: + failureMessage: + description: FailureMessage provides more information about the error. + type: string + resources: + description: |- + Resources contains the output of jsonnet, so the + resources to be deployed + type: string + type: object + type: object + served: true + storage: false + subresources: + status: {} + - name: v1beta1 schema: openAPIV3Schema: description: JsonnetSource is the Schema for the jsonnetsources API @@ -108,6 +187,50 @@ metadata: --- apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole +metadata: + name: jsonnet-jsonnetsource-editor-role +rules: +- apiGroups: + - extension.projectsveltos.io + resources: + - jsonnetsources + verbs: + - create + - delete + - get + - list + - patch + - update + - watch +- apiGroups: + - extension.projectsveltos.io + resources: + - jsonnetsources/status + verbs: + - get +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + name: jsonnet-jsonnetsource-viewer-role +rules: +- apiGroups: + - extension.projectsveltos.io + resources: + - jsonnetsources + verbs: + - get + - list + - watch +- apiGroups: + - extension.projectsveltos.io + resources: + - jsonnetsources/status + verbs: + - get +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole metadata: name: jsonnet-manager-role rules: diff --git a/test/fv/fv_suite_test.go b/test/fv/fv_suite_test.go index 4a053eb..65b160c 100644 --- a/test/fv/fv_suite_test.go +++ b/test/fv/fv_suite_test.go @@ -34,7 +34,7 @@ import ( ctrl "sigs.k8s.io/controller-runtime" "sigs.k8s.io/controller-runtime/pkg/client" - extensionv1alpha1 "github.com/gianlucam76/jsonnet-controller/api/v1alpha1" + extensionv1beta1 "github.com/gianlucam76/jsonnet-controller/api/v1beta1" ) var ( @@ -84,7 +84,7 @@ var _ = BeforeSuite(func() { Expect(clientgoscheme.AddToScheme(scheme)).To(Succeed()) Expect(clusterv1.AddToScheme(scheme)).To(Succeed()) - Expect(extensionv1alpha1.AddToScheme(scheme)).To(Succeed()) + Expect(extensionv1beta1.AddToScheme(scheme)).To(Succeed()) Expect(sourcev1.AddToScheme(scheme)).To(Succeed()) var err error diff --git a/test/fv/jsonnet_test.go b/test/fv/jsonnet_test.go index 376b40a..9fcf43b 100644 --- a/test/fv/jsonnet_test.go +++ b/test/fv/jsonnet_test.go @@ -26,7 +26,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/types" - extensionv1alpha1 "github.com/gianlucam76/jsonnet-controller/api/v1alpha1" + extensionv1beta1 "github.com/gianlucam76/jsonnet-controller/api/v1beta1" ) // ConfigMap jsonnet contains @@ -114,12 +114,12 @@ func verifyJsonnetSourceWithConfigMap(namePrefix, jsonnetConfigMapName, jsonnetF Expect(ok).To(BeTrue()) Byf("Creating a JsonnetSource referencing this ConfigMap") - jsonnetSource := &extensionv1alpha1.JsonnetSource{ + jsonnetSource := &extensionv1beta1.JsonnetSource{ ObjectMeta: metav1.ObjectMeta{ Name: namePrefix + randomString(), Namespace: randomString(), }, - Spec: extensionv1alpha1.JsonnetSourceSpec{ + Spec: extensionv1beta1.JsonnetSourceSpec{ Namespace: jsonnetConfigMap.Namespace, Name: jsonnetConfigMap.Name, Kind: configMapKind, @@ -143,7 +143,7 @@ func verifyJsonnetSourceWithConfigMap(namePrefix, jsonnetConfigMapName, jsonnetF Byf("Verifying JsonnetSource %s/%s Status", jsonnetSource.Namespace, jsonnetSource.Name) Eventually(func() bool { - currentJsonnetSource := &extensionv1alpha1.JsonnetSource{} + currentJsonnetSource := &extensionv1beta1.JsonnetSource{} err := k8sClient.Get(context.TODO(), types.NamespacedName{Namespace: jsonnetSource.Namespace, Name: jsonnetSource.Name}, currentJsonnetSource) @@ -161,7 +161,7 @@ func verifyJsonnetSourceWithConfigMap(namePrefix, jsonnetConfigMapName, jsonnetF Byf("Verifying JsonnetSource %s/%s Status.Resources", jsonnetSource.Namespace, jsonnetSource.Name) - currentJsonnetSource := &extensionv1alpha1.JsonnetSource{} + currentJsonnetSource := &extensionv1beta1.JsonnetSource{} Expect(k8sClient.Get(context.TODO(), types.NamespacedName{Namespace: jsonnetSource.Namespace, Name: jsonnetSource.Name}, currentJsonnetSource)).To(Succeed())