Uploaded image for project: 'OpenShift Windows Containers'
  1. OpenShift Windows Containers
  2. WINC-1576

Migrate consolidated Windows workload templates and helpers from OTP to origin repository

XMLWordPrintable

    • None
    • None
    • None

      Overview

      As part of the OTE migration (WINC-1536), migrate the consolidated Windows workload templates and helper code from openshift-tests-private to the openshift/origin repository. This completes the template consolidation work by moving validated templates to the shared origin location for OTE compatibility.

      Dependency

      BLOCKED BY WINC-1537 - Do not start until consolidation in OTP is complete and validated

      Background

      Current State (After WINC-1537):

      • 4 Go templates in openshift-tests-private/test/extended/testdata/winc/
      • Helper code in openshift-tests-private/test/extended/util/winc/
      • Templates validated and working in OTP
      • Tests using templates from OTP location

      Problem:

      • Templates need to be in origin for OTE compatibility
      • Tests should vendor origin instead of maintaining templates in OTP
      • Shared location enables reuse across repositories

      Target State (Origin):

      • 4 Go templates in openshift/origin/test/extended/testdata/winc/
      • Helper code in openshift/origin/test/extended/util/compat_otp/
      • OTP tests vendor origin and use templates from there
      • Templates removed from OTP (single source of truth in origin)

      Scope

      This story includes:

      • Migrate 4 Go template files to origin
        • windows_web_server_template.yaml
        • linux_web_server_template.yaml
        • hpa_template.yaml
        • olm_bundle_template.yaml
      • Migrate helper code to origin
        • generators.go (8 resource generators)
        • windows_template.go (config structs and renderers)
      • Update OTP to vendor origin
        • Run go mod vendor to pull origin templates
        • Update import paths from winc to compat_otp
        • Remove local template files from OTP
      • Update documentation
        • README.md in origin
        • OWNERS file in origin
      • Validation on all test scenarios

      Files to Migrate (6 files)

      Go Templates (4 files):

      • windows_web_server_template.yaml - Parameterized Windows workload
      • linux_web_server_template.yaml - Linux comparison workload
      • hpa_template.yaml - Horizontal Pod Autoscaler
      • olm_bundle_template.yaml - OLM bundle resources

      Helper Code (2 files):

      • generators.go - Resource code generators
      • windows_template.go - Config structs and template renderers

      Implementation Plan

      Step 1: Create Directory Structure in Origin

      Location: openshift/origin

      Create directories:

      mkdir -p test/extended/testdata/winc/
      mkdir -p test/extended/util/compat_otp/
      

      Step 2: Migrate Template Files

      Copy 4 Go template files from OTP to origin:

      # From: openshift-tests-private/test/extended/testdata/winc/
      # To: origin/test/extended/testdata/winc/
      

      Files:

      • windows_web_server_template.yaml
      • linux_web_server_template.yaml
      • hpa_template.yaml
      • olm_bundle_template.yaml

      Step 3: Migrate Helper Code

      Copy helper files from OTP to origin with package rename:

      Source (OTP):

      • openshift-tests-private/test/extended/util/winc/generators.go
      • openshift-tests-private/test/extended/util/winc/windows_template.go

      Destination (Origin):

      • origin/test/extended/util/compat_otp/generators.go
      • origin/test/extended/util/compat_otp/windows_template.go

      Important: Change package name from package winc to package compat_otp

      Step 4: Create Documentation in Origin

      Create README.md documenting:

      • Template usage
      • Configuration options
      • Code generator functions
      • Example code snippets

      Create OWNERS file with WINC team owners.

      Step 5: Update OTP to Vendor Origin

      In openshift-tests-private:

      Update go.mod to require latest origin:

      go get github.com/openshift/origin@latest
      go mod tidy
      go mod vendor
      

      Update imports in test files:

      // Old import
      import "github.com/openshift/openshift-tests-private/test/extended/util/winc"
      
      // New import
      import compat_otp "github.com/openshift/origin/test/extended/util/compat_otp"
      

      Step 6: Remove Template Files from OTP

      After vendoring and tests pass, remove:

      • test/extended/testdata/winc/windows_web_server_template.yaml
      • test/extended/testdata/winc/linux_web_server_template.yaml
      • test/extended/testdata/winc/hpa_template.yaml
      • test/extended/testdata/winc/olm_bundle_template.yaml
      • test/extended/util/winc/generators.go
      • test/extended/util/winc/windows_template.go

      Keep MachineSet templates in OTP (those migrate in WINC-1575).

      Step 7: Run Full Test Suite

      Verify all WINC tests pass:

      cd openshift-tests-private
      go test -v ./test/extended/winc/... -timeout 2h
      

      Acceptance Criteria

      Migration Complete

      • [ ] 4 Go templates migrated to origin/test/extended/testdata/winc/
      • [ ] generators.go migrated to origin/test/extended/util/compat_otp/
      • [ ] windows_template.go migrated to origin/test/extended/util/compat_otp/
      • [ ] Package renamed from winc to compat_otp in origin
      • [ ] README.md created in origin with usage documentation
      • [ ] OWNERS file created in origin

      OTP Updates

      • [ ] OTP vendoring origin repository
      • [ ] All test imports updated to use compat_otp from origin
      • [ ] Local template files removed from OTP
      • [ ] Local helper files removed from OTP
      • [ ] MachineSet templates NOT removed (those are in WINC-1575)

      Validation

      • [ ] All Go code compiles successfully in origin
      • [ ] All Go code compiles successfully in OTP
      • [ ] All WINC tests pass with vendored origin templates
      • [ ] Template rendering verified for all scenarios

      Documentation

      • [ ] README.md complete with examples
      • [ ] Migration path documented
      • [ ] Import path changes documented

      Delivery

      • [ ] PR submitted to openshift/origin repository
      • [ ] PR reviewed and merged to origin
      • [ ] PR submitted to openshift-tests-private repository
      • [ ] PR reviewed and merged to OTP

      Dependencies

      Blocked by: WINC-1537 - Consolidate Windows workload templates in OTP

      {warning}Do NOT start this story until WINC-1537 is completely done and all tests are passing in OTP{warning}

      Blocks

      None - This is part of the final OTE migration steps

      Risks and Mitigations

      Risks

      • Vendoring issues - Origin dependency might cause conflicts
      • Import path changes - Need to update all test files in OTP
      • Breaking tests - Migration could break existing tests
      • Review delays - Need approval from origin maintainers
      • Two-repo coordination - Changes in both origin and OTP repos

      Mitigations

      • Test vendoring locally before submitting PRs
      • Use find/replace for import path updates
      • Run full test suite before and after migration
      • Coordinate with origin maintainers early
      • Submit origin PR first, then OTP PR after merge
      • Keep PRs focused and well-documented

      Example Usage After Migration

      Using Templates from Origin (in OTP tests)

      import compat_otp "github.com/openshift/origin/test/extended/util/compat_otp"
      
      // Create Windows workload using Go template
      config := compat_otp.NewDefaultWindowsWebServerConfig()
      config.ImageName = "mcr.microsoft.com/windows/servercore:ltsc2022"
      config.Replicas = 3
      
      manifest, err := compat_otp.RenderWindowsWebServerTemplate(config)
      // Apply manifest...
      

      Using Code Generators from Origin

      import compat_otp "github.com/openshift/origin/test/extended/util/compat_otp"
      
      // Generate namespace
      ns := compat_otp.GenerateNamespace("winc-test")
      
      // Generate PVC
      pvc := compat_otp.GeneratePVC("windows-data", "10Gi", "windows-sc")
      
      // Apply manifests...
      

      Verification Steps

      1. Verify Files in Origin

      cd openshift/origin/test/extended/testdata/winc/
      ls -la *.yaml | wc -l
      # Should show 4 template files
      

      2. Verify Helper Code in Origin

      cd openshift/origin/test/extended/util/compat_otp/
      ls -la *.go
      # Should show: generators.go, windows_template.go
      

      3. Verify Package Name

      cd openshift/origin/test/extended/util/compat_otp/
      grep "^package" *.go
      # Should show: package compat_otp
      

      4. Verify Origin Code Compiles

      cd openshift/origin
      go build ./test/extended/util/compat_otp/...
      # Should compile without errors
      

      5. Verify OTP Vendoring

      cd openshift-tests-private
      ls -la vendor/github.com/openshift/origin/test/extended/testdata/winc/
      # Should show 4 template files
      

      6. Verify OTP Tests Pass

      cd openshift-tests-private
      go test -v ./test/extended/winc/... -timeout 2h
      # All tests should pass
      

      7. Verify Files Removed from OTP

      cd openshift-tests-private/test/extended/testdata/winc/
      ls -la windows_web_server_template.yaml
      # Should NOT exist (removed)
      
      cd openshift-tests-private/test/extended/util/winc/
      ls -la generators.go windows_template.go
      # Should NOT exist (removed)
      

      Story Points Breakdown

      • Migrate files to origin: 1 point
      • Update package names and paths: 1 point
      • Create documentation in origin: 1 point
      • Update OTP vendoring and imports: 1 point
      • Validation and testing: 1 point

      Total: 5 story points

      Definition of Done

      • WINC-1537 completely done and validated
      • All 6 files migrated to origin
      • Origin PR merged
      • OTP vendoring origin successfully
      • All test imports updated
      • Local files removed from OTP
      • OTP PR merged
      • All tests passing in both repos
      • Documentation complete

      Notes

      • Depends on WINC-1537 - Cannot start until consolidation in OTP is complete
      • Two-repo migration - Changes required in both origin and OTP
      • Package rename - winc becomes compat_otp in origin
      • Import path changes - All OTP tests need updated imports
      • Single source of truth - Templates live in origin, OTP vendors them
      • MachineSet templates stay in OTP - Only migrate when WINC-1575 completes
      • OTE compatibility - This enables final OTE integration
      • Part of final steps - One of the last steps in OTE migration epic

      Migration Sequence

      This story is part of a sequence:

      1. WINC-1537 - Consolidate in OTP (validate approach) ← Must complete first
      2. THIS STORY - Migrate to origin (share templates)
      3. WINC-1575 - Migrate MachineSets to origin (blocked by WINC-1508)

      All three stories together complete the template migration work for the OTE epic.

              Unassigned Unassigned
              rrasouli Aharon Rasouli
              None
              None
              None
              None
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated: