zkt26/z2/configmap-secret.yaml

45 lines
1.4 KiB
YAML

# =============================================
# Secret — PostgreSQL credentials
# Base64-encoded username and password.
# taskuser → dGFza3VzZXI=
# taskpass → dGFza3Bhc3M=
# =============================================
apiVersion: v1
kind: Secret
metadata:
name: postgres-secret
namespace: taskmanager
type: Opaque
data:
username: dGFza3VzZXI=
password: dGFza3Bhc3M=
---
# =============================================
# ConfigMap — PostgreSQL init.sql
# Mounted into the postgres container so the
# tasks table and sample data are created the
# first time the database starts.
# =============================================
apiVersion: v1
kind: ConfigMap
metadata:
name: postgres-init
namespace: taskmanager
data:
init.sql: |
-- Task Manager Database Initialization
CREATE TABLE IF NOT EXISTS tasks (
id SERIAL PRIMARY KEY,
title VARCHAR(255) NOT NULL,
description TEXT DEFAULT '',
completed BOOLEAN DEFAULT FALSE,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
INSERT INTO tasks (title, description, completed) VALUES
('Welcome to Task Manager', 'This is a sample task. You can edit or delete it.', FALSE),
('Try creating a new task', 'Click the "Add Task" button to create your own tasks.', FALSE),
('Mark tasks as complete', 'Click the checkbox to mark a task as done.', TRUE);