From d326b2595d0c8b5326eac1d5c7c10fb7585939e5 Mon Sep 17 00:00:00 2001 From: Benjamin Lindner Date: Mon, 27 Nov 2023 09:14:37 +0100 Subject: [PATCH 1/7] add make targets for kyma, module build, etc --- Makefile | 46 +++ module-config.yaml | 8 - scripts/local/get_kyma_file_name.sh | 15 + scripts/release/upload_assets.sh | 17 +- template-operator.yaml | 432 ++++++++++++++++++++++++++++ 5 files changed, 501 insertions(+), 17 deletions(-) create mode 100755 scripts/local/get_kyma_file_name.sh create mode 100644 template-operator.yaml diff --git a/Makefile b/Makefile index db6a6d9..c5c4d73 100644 --- a/Makefile +++ b/Makefile @@ -142,6 +142,52 @@ lint: ## Download & Build & Run golangci-lint against code. GOBIN=$(LOCALBIN) go install github.com/golangci/golangci-lint/cmd/golangci-lint@$(GOLANG_CI_LINT_VERSION) $(LOCALBIN)/golangci-lint run +.PHONY: configure-git-origin +configure-git-origin: + @git remote | grep '^origin$$' -q || \ + git remote add origin https://github.com/kyma-project/eventing-manager + +#.PHONY: module-config-template +#module-config-template: +# @cat module-config-template.yaml \ +# | sed -e 's/{{.Channel}}/${MODULE_CHANNEL}/g' \ +# -e 's/{{.Version}}/$(MODULE_VERSION)/g' \ +# -e 's/{{.Name}}/kyma-project.io\/module\/$(MODULE_NAME)/g' \ +# > module-config.yaml + .PHONY: build-manifests build-manifests: manifests kustomize ## Install CRDs into the K8s cluster specified in ~/.kube/config. $(KUSTOMIZE) build config/default > template-operator.yaml + +DEFAULT_CR ?= $(shell pwd)/config/samples/default.yaml +.PHONY: build-module +build-module: kyma build-manifests configure-git-origin ## Build the Module and push it to a registry defined in MODULE_REGISTRY + ################################################################# + ## Building module with: + # - image: ${IMG} + # - channel: ${MODULE_CHANNEL} + # - name: kyma-project.io/module/$(MODULE_NAME) + # - version: $(MODULE_VERSION) + echo "running alpha create" + @$(KYMA) alpha create module --path . --output=module-template.yaml --module-config-file=module-config.yaml $(MODULE_CREATION_FLAGS) + +########## Kyma CLI ########### +KYMA_STABILITY ?= unstable + +# $(call os_error, os-type, os-architecture) +define os_error +$(error Error: unsuported platform OS_TYPE:$1, OS_ARCH:$2; to mitigate this problem set variable KYMA with absolute path to kyma-cli binary compatible with your operating system and architecture) +endef + +KYMA_FILE_NAME ?= $(shell ./scripts/local/get_kyma_file_name.sh ${OS_TYPE} ${OS_ARCH}) +KYMA ?= $(LOCALBIN)/kyma-$(KYMA_STABILITY) + +.PHONY: kyma +kyma: $(LOCALBIN) $(KYMA) ## Download kyma CLI locally if necessary. +$(KYMA): + ################################################################# + $(if $(KYMA_FILE_NAME),,$(call os_error, ${OS_TYPE}, ${OS_ARCH})) + ## Downloading Kyma CLI: https://storage.googleapis.com/kyma-cli-$(KYMA_STABILITY)/$(KYMA_FILE_NAME) + test -f $@ || curl -s -Lo $(KYMA) https://storage.googleapis.com/kyma-cli-$(KYMA_STABILITY)/$(KYMA_FILE_NAME) + chmod 0100 $(KYMA) + ${KYMA} version -c \ No newline at end of file diff --git a/module-config.yaml b/module-config.yaml index ab1c44b..e69de29 100644 --- a/module-config.yaml +++ b/module-config.yaml @@ -1,8 +0,0 @@ -name: kyma-project.io/module/template-operator -channel: regular -version: 0.1.0 -manifest: template-operator.yaml -security: sec-scanners-config.yaml -defaultCR: ./config/samples/default-sample-cr.yaml -annotations: - operator.kyma-project.io/doc-url: https://kyma-project.io diff --git a/scripts/local/get_kyma_file_name.sh b/scripts/local/get_kyma_file_name.sh new file mode 100755 index 0000000..da047b7 --- /dev/null +++ b/scripts/local/get_kyma_file_name.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +function get_kyma_file_name () { + + local _OS_TYPE=$1 + local _OS_ARCH=$2 + + [ "$_OS_TYPE" == "Linux" ] && [ "$_OS_ARCH" == "x86_64" ] && echo "kyma-linux" || + [ "$_OS_TYPE" == "Linux" ] && [ "$_OS_ARCH" == "arm64" ] && echo "kyma-linux-arm" || + [ "$_OS_TYPE" == "Windows" ] && [ "$_OS_ARCH" == "x86_64" ] && echo "kyma.exe" || + [ "$_OS_TYPE" == "Windows" ] && [ "$_OS_ARCH" == "arm64" ] && echo "kyma-arm.exe" || + [ "$_OS_TYPE" == "Darwin" ] && [ "$_OS_ARCH" == "x86_64" ] && echo "kyma-darwin" +} + +get_kyma_file_name "$@" diff --git a/scripts/release/upload_assets.sh b/scripts/release/upload_assets.sh index 5c07331..68c7f6e 100755 --- a/scripts/release/upload_assets.sh +++ b/scripts/release/upload_assets.sh @@ -25,15 +25,13 @@ uploadFile() { fi } -echo "PULL_BASE_REF ${PULL_BASE_REF}" - -MODULE_VERSION=${PULL_BASE_REF} make render-manifest +echo "PULL_BASE_REF= ${PULL_BASE_REF}" +MODULE_VERSION=${PULL_BASE_REF} make build-manifests echo "Generated template-operator.yaml:" cat template-operator.yaml -MODULE_VERSION=${PULL_BASE_REF} make module-build - +MODULE_VERSION=${PULL_BASE_REF} make build-module echo "Generated moduletemplate.yaml:" cat moduletemplate.yaml @@ -62,7 +60,8 @@ fi echo "Adding assets to Github release" UPLOAD_URL="https://uploads.github.com/repos/kyma-project/template-operator/releases/${RELEASE_ID}/assets" -uploadFile "template-operator.yaml" "${UPLOAD_URL}?name=template-operator.yaml" -uploadFile "moduletemplate.yaml" "${UPLOAD_URL}?name=moduletemplate.yaml" -uploadFile "config/samples/default-sample-cr.yaml" "${UPLOAD_URL}?name=default-sample-cr.yaml" -uploadFile "module-config.yaml" "${UPLOAD_URL}?name=module-config.yaml" +echo "$UPLOAD_URL" +#uploadFile "template-operator.yaml" "${UPLOAD_URL}?name=template-operator.yaml" +#uploadFile "moduletemplate.yaml" "${UPLOAD_URL}?name=moduletemplate.yaml" +#uploadFile "config/samples/default-sample-cr.yaml" "${UPLOAD_URL}?name=default-sample-cr.yaml" +#uploadFile "module-config.yaml" "${UPLOAD_URL}?name=module-config.yaml" diff --git a/template-operator.yaml b/template-operator.yaml new file mode 100644 index 0000000..8cb46f0 --- /dev/null +++ b/template-operator.yaml @@ -0,0 +1,432 @@ +apiVersion: v1 +kind: Namespace +metadata: + labels: + app.kubernetes.io/component: template-operator.kyma-project.io + name: template-operator-system +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.13.0 + labels: + app.kubernetes.io/component: template-operator.kyma-project.io + name: samples.operator.kyma-project.io +spec: + group: operator.kyma-project.io + names: + kind: Sample + listKind: SampleList + plural: samples + singular: sample + scope: Namespaced + versions: + - additionalPrinterColumns: + - jsonPath: .status.state + name: State + type: string + name: v1alpha1 + schema: + openAPIV3Schema: + description: Sample is the Schema for the samples 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: + properties: + resourceFilePath: + description: ResourceFilePath indicates the local dir path containing + a .yaml or .yml, with all required resources to be processed + type: string + type: object + status: + properties: + conditions: + description: Conditions contain a set of conditionals to determine + the State of Status. If all Conditions are met, State is expected + to be in StateReady. + items: + description: "Condition contains details for one aspect of the current + state of this API Resource. --- This struct is intended for direct + use as an array at the field path .status.conditions. For example, + \n type FooStatus struct{ // Represents the observations of a + foo's current state. // Known .status.conditions.type are: \"Available\", + \"Progressing\", and \"Degraded\" // +patchMergeKey=type // +patchStrategy=merge + // +listType=map // +listMapKey=type Conditions []metav1.Condition + `json:\"conditions,omitempty\" patchStrategy:\"merge\" patchMergeKey:\"type\" + protobuf:\"bytes,1,rep,name=conditions\"` \n // other fields }" + properties: + lastTransitionTime: + description: lastTransitionTime is the last time the condition + transitioned from one status to another. This should be when + the underlying condition changed. If that is not known, then + using the time when the API field changed is acceptable. + format: date-time + type: string + message: + description: message is a human readable message indicating + details about the transition. This may be an empty string. + maxLength: 32768 + type: string + observedGeneration: + description: observedGeneration represents the .metadata.generation + that the condition was set based upon. For instance, if .metadata.generation + is currently 12, but the .status.conditions[x].observedGeneration + is 9, the condition is out of date with respect to the current + state of the instance. + format: int64 + minimum: 0 + type: integer + reason: + description: reason contains a programmatic identifier indicating + the reason for the condition's last transition. Producers + of specific condition types may define expected values and + meanings for this field, and whether the values are considered + a guaranteed API. The value should be a CamelCase string. + This field may not be empty. + maxLength: 1024 + minLength: 1 + pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$ + type: string + status: + description: status of the condition, one of True, False, Unknown. + enum: + - "True" + - "False" + - Unknown + type: string + type: + description: type of condition in CamelCase or in foo.example.com/CamelCase. + --- Many .condition.type values are consistent across resources + like Available, but because arbitrary conditions can be useful + (see .node.status.conditions), the ability to deconflict is + important. The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt) + maxLength: 316 + pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ + type: string + required: + - lastTransitionTime + - message + - reason + - status + - type + type: object + type: array + state: + description: State signifies current state of Module CR. Value can + be one of ("Ready", "Processing", "Error", "Deleting"). + enum: + - Processing + - Deleting + - Ready + - Error + - Warning + - "" + type: string + required: + - state + type: object + type: object + served: true + storage: true + subresources: + status: {} +--- +apiVersion: v1 +kind: ServiceAccount +metadata: + labels: + app.kubernetes.io/component: template-operator.kyma-project.io + name: template-operator-controller-manager + namespace: template-operator-system +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: Role +metadata: + labels: + app.kubernetes.io/component: template-operator.kyma-project.io + name: template-operator-leader-election-role + namespace: template-operator-system +rules: +- apiGroups: + - "" + resources: + - configmaps + verbs: + - get + - list + - watch + - create + - update + - patch + - delete +- apiGroups: + - coordination.k8s.io + resources: + - leases + verbs: + - get + - list + - watch + - create + - update + - patch + - delete +- apiGroups: + - "" + resources: + - events + verbs: + - create + - patch +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + labels: + app.kubernetes.io/component: template-operator.kyma-project.io + name: template-operator-manager-role +rules: +- apiGroups: + - "" + resources: + - configmaps + verbs: + - create + - delete + - patch +- apiGroups: + - "" + resources: + - events + verbs: + - create + - get + - list + - patch + - watch +- apiGroups: + - "" + resources: + - namespaces + verbs: + - create + - delete + - get + - list + - patch + - update + - watch +- apiGroups: + - apps + resources: + - deployments + verbs: + - create + - delete + - patch +- apiGroups: + - operator.kyma-project.io + resources: + - samples + verbs: + - create + - delete + - get + - list + - patch + - update + - watch +- apiGroups: + - operator.kyma-project.io + resources: + - samples/finalizers + verbs: + - update +- apiGroups: + - operator.kyma-project.io + resources: + - samples/status + verbs: + - get + - patch + - update +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + labels: + app.kubernetes.io/component: template-operator.kyma-project.io + name: template-operator-metrics-reader +rules: +- nonResourceURLs: + - /metrics + verbs: + - get +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + labels: + app.kubernetes.io/component: template-operator.kyma-project.io + name: template-operator-proxy-role +rules: +- apiGroups: + - authentication.k8s.io + resources: + - tokenreviews + verbs: + - create +- apiGroups: + - authorization.k8s.io + resources: + - subjectaccessreviews + verbs: + - create +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: RoleBinding +metadata: + labels: + app.kubernetes.io/component: template-operator.kyma-project.io + name: template-operator-leader-election-rolebinding + namespace: template-operator-system +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: Role + name: template-operator-leader-election-role +subjects: +- kind: ServiceAccount + name: template-operator-controller-manager + namespace: template-operator-system +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRoleBinding +metadata: + labels: + app.kubernetes.io/component: template-operator.kyma-project.io + name: template-operator-manager-rolebinding +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: ClusterRole + name: template-operator-manager-role +subjects: +- kind: ServiceAccount + name: template-operator-controller-manager + namespace: template-operator-system +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRoleBinding +metadata: + labels: + app.kubernetes.io/component: template-operator.kyma-project.io + name: template-operator-proxy-rolebinding +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: ClusterRole + name: template-operator-proxy-role +subjects: +- kind: ServiceAccount + name: template-operator-controller-manager + namespace: template-operator-system +--- +apiVersion: v1 +data: + controller_manager_config.yaml: | + apiVersion: controller-runtime.sigs.k8s.io/v1alpha1 + kind: ControllerManagerConfig + health: + healthProbeBindAddress: :8081 + metrics: + bindAddress: 127.0.0.1:8080 + webhook: + port: 9443 + leaderElection: + leaderElect: true + resourceName: 76223278.kyma-project.io +kind: ConfigMap +metadata: + labels: + app.kubernetes.io/component: template-operator.kyma-project.io + name: template-operator-manager-config + namespace: template-operator-system +--- +apiVersion: v1 +kind: Service +metadata: + labels: + app.kubernetes.io/component: template-operator.kyma-project.io + name: template-operator-metrics-service + namespace: template-operator-system +spec: + ports: + - name: https + port: 8443 + protocol: TCP + targetPort: https + selector: + app.kubernetes.io/component: template-operator.kyma-project.io +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + labels: + app.kubernetes.io/component: template-operator.kyma-project.io + name: template-operator-controller-manager + namespace: template-operator-system +spec: + replicas: 1 + selector: + matchLabels: + app.kubernetes.io/component: template-operator.kyma-project.io + template: + metadata: + annotations: + kubectl.kubernetes.io/default-container: manager + labels: + app.kubernetes.io/component: template-operator.kyma-project.io + spec: + containers: + - args: + - --leader-elect + - --final-state=Ready + image: europe-docker.pkg.dev/kyma-project/prod/template-operator:latest + livenessProbe: + httpGet: + path: /healthz + port: 8081 + initialDelaySeconds: 15 + periodSeconds: 20 + name: manager + ports: + - containerPort: 40000 + readinessProbe: + httpGet: + path: /readyz + port: 8081 + initialDelaySeconds: 5 + periodSeconds: 10 + resources: + limits: + cpu: 500m + memory: 128Mi + requests: + cpu: 10m + memory: 64Mi + securityContext: + allowPrivilegeEscalation: false + securityContext: + runAsNonRoot: true + serviceAccountName: template-operator-controller-manager + terminationGracePeriodSeconds: 10 From 9b881f88aaccf9926a0e52f718661108a8721ff2 Mon Sep 17 00:00:00 2001 From: Benjamin Lindner Date: Mon, 27 Nov 2023 09:22:22 +0100 Subject: [PATCH 2/7] revert module-config --- module-config.yaml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/module-config.yaml b/module-config.yaml index e69de29..ab1c44b 100644 --- a/module-config.yaml +++ b/module-config.yaml @@ -0,0 +1,8 @@ +name: kyma-project.io/module/template-operator +channel: regular +version: 0.1.0 +manifest: template-operator.yaml +security: sec-scanners-config.yaml +defaultCR: ./config/samples/default-sample-cr.yaml +annotations: + operator.kyma-project.io/doc-url: https://kyma-project.io From a2262f9b5ea32393b2ef8d81fd76651505163676 Mon Sep 17 00:00:00 2001 From: Benjamin Lindner Date: Mon, 27 Nov 2023 10:54:11 +0100 Subject: [PATCH 3/7] add module registry usage --- Makefile | 17 +- module-template.yaml | 59 +++++ scripts/release/upload_assets.sh | 12 +- template-operator.yaml | 432 ------------------------------- 4 files changed, 81 insertions(+), 439 deletions(-) create mode 100755 module-template.yaml delete mode 100644 template-operator.yaml diff --git a/Makefile b/Makefile index c5c4d73..fe8d55f 100644 --- a/Makefile +++ b/Makefile @@ -10,6 +10,21 @@ else GOBIN=$(shell go env GOBIN) endif +# Credentials used for authenticating into the module registry +# see `kyma alpha mod create --help for more info` + +# This will change the flags of the `kyma alpha module create` command in case we spot credentials +# Otherwise we will assume http-based local registries without authentication (e.g. for k3d) +ifneq (,$(PROW_JOB_ID)) +GCP_ACCESS_TOKEN=$(shell gcloud auth application-default print-access-token) +MODULE_CREATION_FLAGS=--registry $(MODULE_REGISTRY) --module-archive-version-overwrite -c oauth2accesstoken:$(GCP_ACCESS_TOKEN) +else ifeq (,$(MODULE_CREDENTIALS)) +# when built locally we should not include security content. +MODULE_CREATION_FLAGS=--registry $(MODULE_REGISTRY) --module-archive-version-overwrite --insecure --sec-scanners-config=sec-scanners-config-local.yaml +else +MODULE_CREATION_FLAGS=--registry $(MODULE_REGISTRY) --module-archive-version-overwrite -c $(MODULE_CREDENTIALS) +endif + # Setting SHELL to bash allows bash commands to be executed by recipes. # This is a requirement for 'setup-envtest.sh' in the test target. # Options are set to exit when a recipe line exits non-zero or a piped command fails. @@ -190,4 +205,4 @@ $(KYMA): ## Downloading Kyma CLI: https://storage.googleapis.com/kyma-cli-$(KYMA_STABILITY)/$(KYMA_FILE_NAME) test -f $@ || curl -s -Lo $(KYMA) https://storage.googleapis.com/kyma-cli-$(KYMA_STABILITY)/$(KYMA_FILE_NAME) chmod 0100 $(KYMA) - ${KYMA} version -c \ No newline at end of file + ${KYMA} version -c diff --git a/module-template.yaml b/module-template.yaml new file mode 100755 index 0000000..5230730 --- /dev/null +++ b/module-template.yaml @@ -0,0 +1,59 @@ +apiVersion: operator.kyma-project.io/v1beta2 +kind: ModuleTemplate +metadata: + name: template-operator-regular + namespace: kcp-system + labels: + "operator.kyma-project.io/module-name": "template-operator" + annotations: + "operator.kyma-project.io/doc-url": "https://kyma-project.io" + "operator.kyma-project.io/is-cluster-scoped": "false" + "operator.kyma-project.io/module-version": "0.1.0" +spec: + channel: regular + data: + apiVersion: operator.kyma-project.io/v1alpha1 + kind: Sample + metadata: + name: sample-yaml + spec: + resourceFilePath: "./module-data/yaml" + descriptor: + component: + componentReferences: [] + name: kyma-project.io/module/template-operator + provider: '{"name":"kyma-project.io","labels":[{"name":"kyma-project.io/built-by","value":"cli","version":"v1"}]}' + repositoryContexts: + - baseUrl: http://k3d-oci.localhost:5001 + componentNameMapping: urlPath + type: OCIRegistry + resources: + - access: + globalAccess: + digest: sha256:7ba866a600d699781919f2a55a635d9a44564b830915a90baa2315815b955785 + mediaType: application/octet-stream + ref: http:/k3d-oci.localhost:5001/component-descriptors/kyma-project.io/module/template-operator + size: 12810 + type: ociBlob + localReference: sha256:7ba866a600d699781919f2a55a635d9a44564b830915a90baa2315815b955785 + mediaType: application/octet-stream + type: localBlob + name: raw-manifest + relation: local + type: yaml + version: 0.1.0 + sources: + - access: + commit: 9b881f88aaccf9926a0e52f718661108a8721ff2 + repoUrl: https://github.com/lindnerby/template-operator.git + type: gitHub + labels: + - name: git.kyma-project.io/ref + value: refs/heads/fix-make-targets + version: v1 + name: module-sources + type: Github + version: 0.1.0 + version: 0.1.0 + meta: + schemaVersion: v2 diff --git a/scripts/release/upload_assets.sh b/scripts/release/upload_assets.sh index 68c7f6e..02f52f1 100755 --- a/scripts/release/upload_assets.sh +++ b/scripts/release/upload_assets.sh @@ -32,8 +32,8 @@ echo "Generated template-operator.yaml:" cat template-operator.yaml MODULE_VERSION=${PULL_BASE_REF} make build-module -echo "Generated moduletemplate.yaml:" -cat moduletemplate.yaml +echo "Generated module-template.yaml:" +cat module-template.yaml echo "Fetching releases" CURL_RESPONSE=$(curl -w "%{http_code}" -sL \ @@ -61,7 +61,7 @@ echo "Adding assets to Github release" UPLOAD_URL="https://uploads.github.com/repos/kyma-project/template-operator/releases/${RELEASE_ID}/assets" echo "$UPLOAD_URL" -#uploadFile "template-operator.yaml" "${UPLOAD_URL}?name=template-operator.yaml" -#uploadFile "moduletemplate.yaml" "${UPLOAD_URL}?name=moduletemplate.yaml" -#uploadFile "config/samples/default-sample-cr.yaml" "${UPLOAD_URL}?name=default-sample-cr.yaml" -#uploadFile "module-config.yaml" "${UPLOAD_URL}?name=module-config.yaml" +uploadFile "template-operator.yaml" "${UPLOAD_URL}?name=template-operator.yaml" +uploadFile "module-template.yaml" "${UPLOAD_URL}?name=module-template.yaml" +uploadFile "config/samples/default-sample-cr.yaml" "${UPLOAD_URL}?name=default-sample-cr.yaml" +uploadFile "module-config.yaml" "${UPLOAD_URL}?name=module-config.yaml" diff --git a/template-operator.yaml b/template-operator.yaml deleted file mode 100644 index 8cb46f0..0000000 --- a/template-operator.yaml +++ /dev/null @@ -1,432 +0,0 @@ -apiVersion: v1 -kind: Namespace -metadata: - labels: - app.kubernetes.io/component: template-operator.kyma-project.io - name: template-operator-system ---- -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - annotations: - controller-gen.kubebuilder.io/version: v0.13.0 - labels: - app.kubernetes.io/component: template-operator.kyma-project.io - name: samples.operator.kyma-project.io -spec: - group: operator.kyma-project.io - names: - kind: Sample - listKind: SampleList - plural: samples - singular: sample - scope: Namespaced - versions: - - additionalPrinterColumns: - - jsonPath: .status.state - name: State - type: string - name: v1alpha1 - schema: - openAPIV3Schema: - description: Sample is the Schema for the samples 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: - properties: - resourceFilePath: - description: ResourceFilePath indicates the local dir path containing - a .yaml or .yml, with all required resources to be processed - type: string - type: object - status: - properties: - conditions: - description: Conditions contain a set of conditionals to determine - the State of Status. If all Conditions are met, State is expected - to be in StateReady. - items: - description: "Condition contains details for one aspect of the current - state of this API Resource. --- This struct is intended for direct - use as an array at the field path .status.conditions. For example, - \n type FooStatus struct{ // Represents the observations of a - foo's current state. // Known .status.conditions.type are: \"Available\", - \"Progressing\", and \"Degraded\" // +patchMergeKey=type // +patchStrategy=merge - // +listType=map // +listMapKey=type Conditions []metav1.Condition - `json:\"conditions,omitempty\" patchStrategy:\"merge\" patchMergeKey:\"type\" - protobuf:\"bytes,1,rep,name=conditions\"` \n // other fields }" - properties: - lastTransitionTime: - description: lastTransitionTime is the last time the condition - transitioned from one status to another. This should be when - the underlying condition changed. If that is not known, then - using the time when the API field changed is acceptable. - format: date-time - type: string - message: - description: message is a human readable message indicating - details about the transition. This may be an empty string. - maxLength: 32768 - type: string - observedGeneration: - description: observedGeneration represents the .metadata.generation - that the condition was set based upon. For instance, if .metadata.generation - is currently 12, but the .status.conditions[x].observedGeneration - is 9, the condition is out of date with respect to the current - state of the instance. - format: int64 - minimum: 0 - type: integer - reason: - description: reason contains a programmatic identifier indicating - the reason for the condition's last transition. Producers - of specific condition types may define expected values and - meanings for this field, and whether the values are considered - a guaranteed API. The value should be a CamelCase string. - This field may not be empty. - maxLength: 1024 - minLength: 1 - pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$ - type: string - status: - description: status of the condition, one of True, False, Unknown. - enum: - - "True" - - "False" - - Unknown - type: string - type: - description: type of condition in CamelCase or in foo.example.com/CamelCase. - --- Many .condition.type values are consistent across resources - like Available, but because arbitrary conditions can be useful - (see .node.status.conditions), the ability to deconflict is - important. The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt) - maxLength: 316 - pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ - type: string - required: - - lastTransitionTime - - message - - reason - - status - - type - type: object - type: array - state: - description: State signifies current state of Module CR. Value can - be one of ("Ready", "Processing", "Error", "Deleting"). - enum: - - Processing - - Deleting - - Ready - - Error - - Warning - - "" - type: string - required: - - state - type: object - type: object - served: true - storage: true - subresources: - status: {} ---- -apiVersion: v1 -kind: ServiceAccount -metadata: - labels: - app.kubernetes.io/component: template-operator.kyma-project.io - name: template-operator-controller-manager - namespace: template-operator-system ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: Role -metadata: - labels: - app.kubernetes.io/component: template-operator.kyma-project.io - name: template-operator-leader-election-role - namespace: template-operator-system -rules: -- apiGroups: - - "" - resources: - - configmaps - verbs: - - get - - list - - watch - - create - - update - - patch - - delete -- apiGroups: - - coordination.k8s.io - resources: - - leases - verbs: - - get - - list - - watch - - create - - update - - patch - - delete -- apiGroups: - - "" - resources: - - events - verbs: - - create - - patch ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRole -metadata: - labels: - app.kubernetes.io/component: template-operator.kyma-project.io - name: template-operator-manager-role -rules: -- apiGroups: - - "" - resources: - - configmaps - verbs: - - create - - delete - - patch -- apiGroups: - - "" - resources: - - events - verbs: - - create - - get - - list - - patch - - watch -- apiGroups: - - "" - resources: - - namespaces - verbs: - - create - - delete - - get - - list - - patch - - update - - watch -- apiGroups: - - apps - resources: - - deployments - verbs: - - create - - delete - - patch -- apiGroups: - - operator.kyma-project.io - resources: - - samples - verbs: - - create - - delete - - get - - list - - patch - - update - - watch -- apiGroups: - - operator.kyma-project.io - resources: - - samples/finalizers - verbs: - - update -- apiGroups: - - operator.kyma-project.io - resources: - - samples/status - verbs: - - get - - patch - - update ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRole -metadata: - labels: - app.kubernetes.io/component: template-operator.kyma-project.io - name: template-operator-metrics-reader -rules: -- nonResourceURLs: - - /metrics - verbs: - - get ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRole -metadata: - labels: - app.kubernetes.io/component: template-operator.kyma-project.io - name: template-operator-proxy-role -rules: -- apiGroups: - - authentication.k8s.io - resources: - - tokenreviews - verbs: - - create -- apiGroups: - - authorization.k8s.io - resources: - - subjectaccessreviews - verbs: - - create ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: RoleBinding -metadata: - labels: - app.kubernetes.io/component: template-operator.kyma-project.io - name: template-operator-leader-election-rolebinding - namespace: template-operator-system -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: Role - name: template-operator-leader-election-role -subjects: -- kind: ServiceAccount - name: template-operator-controller-manager - namespace: template-operator-system ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRoleBinding -metadata: - labels: - app.kubernetes.io/component: template-operator.kyma-project.io - name: template-operator-manager-rolebinding -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: ClusterRole - name: template-operator-manager-role -subjects: -- kind: ServiceAccount - name: template-operator-controller-manager - namespace: template-operator-system ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRoleBinding -metadata: - labels: - app.kubernetes.io/component: template-operator.kyma-project.io - name: template-operator-proxy-rolebinding -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: ClusterRole - name: template-operator-proxy-role -subjects: -- kind: ServiceAccount - name: template-operator-controller-manager - namespace: template-operator-system ---- -apiVersion: v1 -data: - controller_manager_config.yaml: | - apiVersion: controller-runtime.sigs.k8s.io/v1alpha1 - kind: ControllerManagerConfig - health: - healthProbeBindAddress: :8081 - metrics: - bindAddress: 127.0.0.1:8080 - webhook: - port: 9443 - leaderElection: - leaderElect: true - resourceName: 76223278.kyma-project.io -kind: ConfigMap -metadata: - labels: - app.kubernetes.io/component: template-operator.kyma-project.io - name: template-operator-manager-config - namespace: template-operator-system ---- -apiVersion: v1 -kind: Service -metadata: - labels: - app.kubernetes.io/component: template-operator.kyma-project.io - name: template-operator-metrics-service - namespace: template-operator-system -spec: - ports: - - name: https - port: 8443 - protocol: TCP - targetPort: https - selector: - app.kubernetes.io/component: template-operator.kyma-project.io ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - labels: - app.kubernetes.io/component: template-operator.kyma-project.io - name: template-operator-controller-manager - namespace: template-operator-system -spec: - replicas: 1 - selector: - matchLabels: - app.kubernetes.io/component: template-operator.kyma-project.io - template: - metadata: - annotations: - kubectl.kubernetes.io/default-container: manager - labels: - app.kubernetes.io/component: template-operator.kyma-project.io - spec: - containers: - - args: - - --leader-elect - - --final-state=Ready - image: europe-docker.pkg.dev/kyma-project/prod/template-operator:latest - livenessProbe: - httpGet: - path: /healthz - port: 8081 - initialDelaySeconds: 15 - periodSeconds: 20 - name: manager - ports: - - containerPort: 40000 - readinessProbe: - httpGet: - path: /readyz - port: 8081 - initialDelaySeconds: 5 - periodSeconds: 10 - resources: - limits: - cpu: 500m - memory: 128Mi - requests: - cpu: 10m - memory: 64Mi - securityContext: - allowPrivilegeEscalation: false - securityContext: - runAsNonRoot: true - serviceAccountName: template-operator-controller-manager - terminationGracePeriodSeconds: 10 From 8c1a7d0a702960d90e0b8f61a48a68eca068bc27 Mon Sep 17 00:00:00 2001 From: Benjamin Lindner Date: Mon, 27 Nov 2023 11:02:48 +0100 Subject: [PATCH 4/7] revert template commit --- module-template.yaml | 59 -------------------------------------------- 1 file changed, 59 deletions(-) delete mode 100755 module-template.yaml diff --git a/module-template.yaml b/module-template.yaml deleted file mode 100755 index 5230730..0000000 --- a/module-template.yaml +++ /dev/null @@ -1,59 +0,0 @@ -apiVersion: operator.kyma-project.io/v1beta2 -kind: ModuleTemplate -metadata: - name: template-operator-regular - namespace: kcp-system - labels: - "operator.kyma-project.io/module-name": "template-operator" - annotations: - "operator.kyma-project.io/doc-url": "https://kyma-project.io" - "operator.kyma-project.io/is-cluster-scoped": "false" - "operator.kyma-project.io/module-version": "0.1.0" -spec: - channel: regular - data: - apiVersion: operator.kyma-project.io/v1alpha1 - kind: Sample - metadata: - name: sample-yaml - spec: - resourceFilePath: "./module-data/yaml" - descriptor: - component: - componentReferences: [] - name: kyma-project.io/module/template-operator - provider: '{"name":"kyma-project.io","labels":[{"name":"kyma-project.io/built-by","value":"cli","version":"v1"}]}' - repositoryContexts: - - baseUrl: http://k3d-oci.localhost:5001 - componentNameMapping: urlPath - type: OCIRegistry - resources: - - access: - globalAccess: - digest: sha256:7ba866a600d699781919f2a55a635d9a44564b830915a90baa2315815b955785 - mediaType: application/octet-stream - ref: http:/k3d-oci.localhost:5001/component-descriptors/kyma-project.io/module/template-operator - size: 12810 - type: ociBlob - localReference: sha256:7ba866a600d699781919f2a55a635d9a44564b830915a90baa2315815b955785 - mediaType: application/octet-stream - type: localBlob - name: raw-manifest - relation: local - type: yaml - version: 0.1.0 - sources: - - access: - commit: 9b881f88aaccf9926a0e52f718661108a8721ff2 - repoUrl: https://github.com/lindnerby/template-operator.git - type: gitHub - labels: - - name: git.kyma-project.io/ref - value: refs/heads/fix-make-targets - version: v1 - name: module-sources - type: Github - version: 0.1.0 - version: 0.1.0 - meta: - schemaVersion: v2 From c5a6c5b23eb01eac16d4bff84b4b9203829c21c6 Mon Sep 17 00:00:00 2001 From: Benjamin Lindner Date: Wed, 29 Nov 2023 08:24:20 +0100 Subject: [PATCH 5/7] retrigger jobs From 17becf541c637c9c9858c9f920c8daab596c9187 Mon Sep 17 00:00:00 2001 From: Benjamin Lindner Date: Wed, 29 Nov 2023 09:25:55 +0100 Subject: [PATCH 6/7] fix copy paste left-overs --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index fe8d55f..084cc7c 100644 --- a/Makefile +++ b/Makefile @@ -160,7 +160,7 @@ lint: ## Download & Build & Run golangci-lint against code. .PHONY: configure-git-origin configure-git-origin: @git remote | grep '^origin$$' -q || \ - git remote add origin https://github.com/kyma-project/eventing-manager + git remote add origin https://github.com/kyma-project/template-operator #.PHONY: module-config-template #module-config-template: @@ -174,7 +174,7 @@ configure-git-origin: build-manifests: manifests kustomize ## Install CRDs into the K8s cluster specified in ~/.kube/config. $(KUSTOMIZE) build config/default > template-operator.yaml -DEFAULT_CR ?= $(shell pwd)/config/samples/default.yaml +DEFAULT_CR ?= $(shell pwd)/config/samples/default-sample-cr.yaml .PHONY: build-module build-module: kyma build-manifests configure-git-origin ## Build the Module and push it to a registry defined in MODULE_REGISTRY ################################################################# From b5870db071610078cd14e1b3ed439fbb0f354f9e Mon Sep 17 00:00:00 2001 From: Benjamin Lindner Date: Wed, 29 Nov 2023 09:27:16 +0100 Subject: [PATCH 7/7] remove commented target --- Makefile | 8 -------- 1 file changed, 8 deletions(-) diff --git a/Makefile b/Makefile index 084cc7c..2979526 100644 --- a/Makefile +++ b/Makefile @@ -162,14 +162,6 @@ configure-git-origin: @git remote | grep '^origin$$' -q || \ git remote add origin https://github.com/kyma-project/template-operator -#.PHONY: module-config-template -#module-config-template: -# @cat module-config-template.yaml \ -# | sed -e 's/{{.Channel}}/${MODULE_CHANNEL}/g' \ -# -e 's/{{.Version}}/$(MODULE_VERSION)/g' \ -# -e 's/{{.Name}}/kyma-project.io\/module\/$(MODULE_NAME)/g' \ -# > module-config.yaml - .PHONY: build-manifests build-manifests: manifests kustomize ## Install CRDs into the K8s cluster specified in ~/.kube/config. $(KUSTOMIZE) build config/default > template-operator.yaml