From cfbfa6c3ee135b51c0cf14a22b924607dd1f0cd1 Mon Sep 17 00:00:00 2001 From: Ryan Cook Date: Tue, 2 Sep 2025 15:58:52 -0400 Subject: [PATCH 1/2] WIP: bring additional registries Signed-off-by: Ryan Cook --- .../tekton/kaniko-build-step-external.yaml | 53 +++++++++++++++++++ .../tekton/kaniko-build-step-local.yaml | 41 ++++++++++++++ .../templates/tekton/kaniko-build-step.yaml | 10 +++- .../pipeline-template-dev-external.yaml | 52 ++++++++++++++++++ .../tekton/pipeline-template-dev-local.yaml | 52 ++++++++++++++++++ .../api/v1alpha1/component_types.go | 2 +- .../kagenti.operator.dev_components.yaml | 4 ++ .../builder/tekton/pipeline-composer.go | 1 + 8 files changed, 212 insertions(+), 3 deletions(-) create mode 100644 charts/platform-operator/templates/tekton/kaniko-build-step-external.yaml create mode 100644 charts/platform-operator/templates/tekton/kaniko-build-step-local.yaml create mode 100644 charts/platform-operator/templates/tekton/pipeline-template-dev-external.yaml create mode 100644 charts/platform-operator/templates/tekton/pipeline-template-dev-local.yaml diff --git a/charts/platform-operator/templates/tekton/kaniko-build-step-external.yaml b/charts/platform-operator/templates/tekton/kaniko-build-step-external.yaml new file mode 100644 index 00000000..9a83faa6 --- /dev/null +++ b/charts/platform-operator/templates/tekton/kaniko-build-step-external.yaml @@ -0,0 +1,53 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: kaniko-docker-build-step-external + namespace: kagenti-system + labels: + kagenti.operator.dev/tekton: step +data: + task-spec.yaml: | + params: + - name: DOCKERFILE + type: string + description: Path to the Dockerfile relative to context + default: "Dockerfile" + - name: image + type: string + description: Destination image reference + - name: SKIP_TLS_VERIFY + type: string + description: Skip TLS verification when pushing to registry + default: "false" + - name: subfolder-path + type: string + description: Path to the subfolder to use as build context + - name: registry-secret + type: string + description: Name of the secret containing registry credentials + default: "quay-registry-secret" + steps: + - name: docker-build + image: gcr.io/kaniko-project/executor:v1.9.1 + args: + - --dockerfile=$(params.DOCKERFILE) + - --context=$(workspaces.source.path)/$(params.subfolder-path) + - --destination=$(params.image) + - --skip-tls-verify=$(params.SKIP_TLS_VERIFY) + - --verbosity=trace + env: + - name: DOCKER_CONFIG + value: /kaniko/.docker + volumeMounts: + - name: docker-config + mountPath: /kaniko/.docker + readOnly: true + volumes: + - name: docker-config + secret: + secretName: $(params.registry-secret) + items: + - key: .dockerconfigjson + path: config.json + workspaces: + - name: source diff --git a/charts/platform-operator/templates/tekton/kaniko-build-step-local.yaml b/charts/platform-operator/templates/tekton/kaniko-build-step-local.yaml new file mode 100644 index 00000000..7114235a --- /dev/null +++ b/charts/platform-operator/templates/tekton/kaniko-build-step-local.yaml @@ -0,0 +1,41 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: kaniko-docker-build-step-local + namespace: kagenti-system + labels: + kagenti.operator.dev/tekton: step +data: + task-spec.yaml: | + params: + - name: DOCKERFILE + type: string + description: Path to the Dockerfile relative to context + default: "Dockerfile" + - name: image + type: string + description: Destination image reference + - name: SKIP_TLS_VERIFY + type: string + description: Skip TLS verification when pushing to registry + default: "false" + - name: subfolder-path + type: string + description: Path to the subfolder to use as build context + - name: registry-secret + type: string + description: Name of the secret containing registry credentials (unused for local) + default: "" + steps: + - name: docker-build + image: gcr.io/kaniko-project/executor:v1.9.1 + args: + - --dockerfile=$(params.DOCKERFILE) + - --context=$(workspaces.source.path)/$(params.subfolder-path) + - --destination=$(params.image) + - --skip-tls-verify=$(params.SKIP_TLS_VERIFY) + - --verbosity=trace + # No volumeMounts or DOCKER_CONFIG for local registry + # No volumes section for local registry + workspaces: + - name: source diff --git a/charts/platform-operator/templates/tekton/kaniko-build-step.yaml b/charts/platform-operator/templates/tekton/kaniko-build-step.yaml index e2a6073c..a47e47fc 100644 --- a/charts/platform-operator/templates/tekton/kaniko-build-step.yaml +++ b/charts/platform-operator/templates/tekton/kaniko-build-step.yaml @@ -39,10 +39,16 @@ data: env: - name: DOCKER_CONFIG value: /kaniko/.docker - + volumeMounts: + - name: docker-config + mountPath: /kaniko/.docker + readOnly: true volumes: - - name: registry-credentials + - name: docker-config secret: secretName: $(params.registry-secret) + items: + - key: .dockerconfigjson + path: config.json workspaces: - name: source \ No newline at end of file diff --git a/charts/platform-operator/templates/tekton/pipeline-template-dev-external.yaml b/charts/platform-operator/templates/tekton/pipeline-template-dev-external.yaml new file mode 100644 index 00000000..96a52cd5 --- /dev/null +++ b/charts/platform-operator/templates/tekton/pipeline-template-dev-external.yaml @@ -0,0 +1,52 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: pipeline-template-dev-external + namespace: kagenti-system + labels: + app.kubernetes.io/component: pipeline-template + app.kubernetes.io/name: component-operator + component.kagenti.ai/mode: dev-external +data: + template.json: | + { + "name": "Development Pipeline (External Registry)", + "namespace": "kagenti-system", + "description": "Basic pipeline for development builds with external registry authentication", + "requiredParameters": [ + "repo-url", + "revision", + "subfolder-path", + "image" + ], + "steps": [ + { + "name": "github-clone", + "configMap": "github-clone-step", + "enabled": true, + "description": "Clone source code from GitHub repository", + "requiredParameters": ["repo-url"] + }, + { + "name": "folder-verification", + "configMap": "check-subfolder-step", + "enabled": true, + "description": "Verify that the specified subfolder exists", + "requiredParameters": ["subfolder-path"] + }, + { + "name": "kaniko-build", + "configMap": "kaniko-docker-build-step-external", + "enabled": true, + "description": "Build container image using Kaniko with registry authentication", + "requiredParameters": ["image"] + } + ], + "globalParameters": [ + { + "name": "pipeline-timeout", + "value": "20m", + "description": "Overall pipeline timeout" + } + ] + } diff --git a/charts/platform-operator/templates/tekton/pipeline-template-dev-local.yaml b/charts/platform-operator/templates/tekton/pipeline-template-dev-local.yaml new file mode 100644 index 00000000..12b8ec5d --- /dev/null +++ b/charts/platform-operator/templates/tekton/pipeline-template-dev-local.yaml @@ -0,0 +1,52 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: pipeline-template-dev-local + namespace: kagenti-system + labels: + app.kubernetes.io/component: pipeline-template + app.kubernetes.io/name: component-operator + component.kagenti.ai/mode: dev-local +data: + template.json: | + { + "name": "Development Pipeline (Local Registry)", + "namespace": "kagenti-system", + "description": "Basic pipeline for development builds with local registry", + "requiredParameters": [ + "repo-url", + "revision", + "subfolder-path", + "image" + ], + "steps": [ + { + "name": "github-clone", + "configMap": "github-clone-step", + "enabled": true, + "description": "Clone source code from GitHub repository", + "requiredParameters": ["repo-url"] + }, + { + "name": "folder-verification", + "configMap": "check-subfolder-step", + "enabled": true, + "description": "Verify that the specified subfolder exists", + "requiredParameters": ["subfolder-path"] + }, + { + "name": "kaniko-build", + "configMap": "kaniko-docker-build-step-local", + "enabled": true, + "description": "Build container image using Kaniko (no registry authentication)", + "requiredParameters": ["image"] + } + ], + "globalParameters": [ + { + "name": "pipeline-timeout", + "value": "20m", + "description": "Overall pipeline timeout" + } + ] + } diff --git a/platform-operator/api/v1alpha1/component_types.go b/platform-operator/api/v1alpha1/component_types.go index 4e5e9d5b..87dd5f44 100644 --- a/platform-operator/api/v1alpha1/component_types.go +++ b/platform-operator/api/v1alpha1/component_types.go @@ -173,7 +173,7 @@ type BuildSpec struct { // Mode specifies which pipeline template to use (dev, preprod, prod) // This will be used to fetch the pipeline template from ConfigMap // +optional - // +kubebuilder:validation:Enum=dev;preprod;prod;custom + // +kubebuilder:validation:Enum=dev;dev-local;dev-external;preprod;prod;custom // +kubebuilder:default=dev Mode string `json:"mode,omitempty"` } diff --git a/platform-operator/config/crd/bases/kagenti.operator.dev_components.yaml b/platform-operator/config/crd/bases/kagenti.operator.dev_components.yaml index e8d4c517..61d739ea 100644 --- a/platform-operator/config/crd/bases/kagenti.operator.dev_components.yaml +++ b/platform-operator/config/crd/bases/kagenti.operator.dev_components.yaml @@ -114,6 +114,8 @@ spec: This will be used to fetch the pipeline template from ConfigMap enum: - dev + - dev-local + - dev-external - preprod - prod - custom @@ -801,6 +803,8 @@ spec: This will be used to fetch the pipeline template from ConfigMap enum: - dev + - dev-local + - dev-external - preprod - prod - custom diff --git a/platform-operator/internal/builder/tekton/pipeline-composer.go b/platform-operator/internal/builder/tekton/pipeline-composer.go index 13b8d0cc..e42452d6 100644 --- a/platform-operator/internal/builder/tekton/pipeline-composer.go +++ b/platform-operator/internal/builder/tekton/pipeline-composer.go @@ -164,6 +164,7 @@ func (pc *PipelineComposer) createPipelineTasks(steps map[string]*StepDefinition Params: pc.getTaskParams(stepDefinition.Parameters), Steps: stepDefinition.TaskSpec.Steps, Workspaces: stepDefinition.TaskSpec.Workspaces, + Volumes: stepDefinition.TaskSpec.Volumes, }, }, Workspaces: []tektonv1.WorkspacePipelineTaskBinding{ From b9449ef57b0dea5c6c0d41c3756971790fedf1d1 Mon Sep 17 00:00:00 2001 From: Ryan Cook Date: Wed, 3 Sep 2025 12:36:33 -0400 Subject: [PATCH 2/2] removal of unneeded field Signed-off-by: Ryan Cook --- .../templates/tekton/kaniko-build-step-local.yaml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/charts/platform-operator/templates/tekton/kaniko-build-step-local.yaml b/charts/platform-operator/templates/tekton/kaniko-build-step-local.yaml index 7114235a..238d650b 100644 --- a/charts/platform-operator/templates/tekton/kaniko-build-step-local.yaml +++ b/charts/platform-operator/templates/tekton/kaniko-build-step-local.yaml @@ -22,10 +22,6 @@ data: - name: subfolder-path type: string description: Path to the subfolder to use as build context - - name: registry-secret - type: string - description: Name of the secret containing registry credentials (unused for local) - default: "" steps: - name: docker-build image: gcr.io/kaniko-project/executor:v1.9.1