ceph_manifests_previous.go 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  1. /*
  2. Copyright 2016 The Rook Authors. All rights reserved.
  3. Licensed under the Apache License, Version 2.0 (the "License");
  4. you may not use this file except in compliance with the License.
  5. You may obtain a copy of the License at
  6. http://www.apache.org/licenses/LICENSE-2.0
  7. Unless required by applicable law or agreed to in writing, software
  8. distributed under the License is distributed on an "AS IS" BASIS,
  9. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. See the License for the specific language governing permissions and
  11. limitations under the License.
  12. */
  13. package installer
  14. import (
  15. "strings"
  16. "github.com/rook/rook/tests/framework/utils"
  17. )
  18. const (
  19. // The version from which the upgrade test will start
  20. Version1_12 = "v1.12.7"
  21. )
  22. // CephManifestsPreviousVersion wraps rook yaml definitions
  23. type CephManifestsPreviousVersion struct {
  24. settings *TestCephSettings
  25. latest *CephManifestsMaster
  26. }
  27. func (m *CephManifestsPreviousVersion) Settings() *TestCephSettings {
  28. return m.settings
  29. }
  30. func (m *CephManifestsPreviousVersion) GetCRDs(k8shelper *utils.K8sHelper) string {
  31. return m.settings.readManifestFromGitHub("crds.yaml")
  32. }
  33. func (m *CephManifestsPreviousVersion) GetCSINFSRBAC() string {
  34. return m.settings.readManifestFromGitHub("/csi/nfs/rbac.yaml")
  35. }
  36. // GetRookOperator returns rook Operator manifest
  37. func (m *CephManifestsPreviousVersion) GetOperator() string {
  38. var manifest string
  39. if utils.IsPlatformOpenShift() {
  40. manifest = m.settings.readManifestFromGitHub("operator-openshift.yaml")
  41. } else {
  42. manifest = m.settings.readManifestFromGitHub("operator.yaml")
  43. }
  44. return m.settings.replaceOperatorSettings(manifest)
  45. }
  46. // GetCommon returns rook-cluster manifest
  47. func (m *CephManifestsPreviousVersion) GetCommon() string {
  48. return m.settings.readManifestFromGitHub("common.yaml")
  49. }
  50. // GetRookToolBox returns rook-toolbox manifest
  51. func (m *CephManifestsPreviousVersion) GetToolbox() string {
  52. if m.settings.DirectMountToolbox {
  53. manifest := strings.ReplaceAll(m.settings.readManifestFromGitHub("direct-mount.yaml"), "name: rook-direct-mount", "name: rook-ceph-tools")
  54. return strings.ReplaceAll(manifest, "app: rook-direct-mount", "app: rook-ceph-tools")
  55. }
  56. return m.settings.readManifestFromGitHub("toolbox.yaml")
  57. }
  58. func (m *CephManifestsPreviousVersion) GetCommonExternal() string {
  59. return m.settings.readManifestFromGitHub("common-external.yaml")
  60. }
  61. //**********************************************************************************
  62. //**********************************************************************************
  63. // Methods in this section may need to be customized depending on new
  64. // features that are being added in newer releases and may not be possible
  65. // to configure in the previous release. By default, all these methods will
  66. // provide a thin wrapper around the resources created by the master
  67. // implementation.
  68. //**********************************************************************************
  69. //**********************************************************************************
  70. // GetRookCluster returns rook-cluster manifest
  71. func (m *CephManifestsPreviousVersion) GetCephCluster() string {
  72. return m.latest.GetCephCluster()
  73. }
  74. func (m *CephManifestsPreviousVersion) GetBlockSnapshotClass(snapshotClassName, reclaimPolicy string) string {
  75. return m.latest.GetBlockSnapshotClass(snapshotClassName, reclaimPolicy)
  76. }
  77. func (m *CephManifestsPreviousVersion) GetFileStorageSnapshotClass(snapshotClassName, reclaimPolicy string) string {
  78. return m.latest.GetFileStorageSnapshotClass(snapshotClassName, reclaimPolicy)
  79. }
  80. func (m *CephManifestsPreviousVersion) GetBlockPool(poolName, replicaSize string) string {
  81. return m.latest.GetBlockPool(poolName, replicaSize)
  82. }
  83. func (m *CephManifestsPreviousVersion) GetBlockStorageClass(poolName, storageClassName, reclaimPolicy string) string {
  84. return m.latest.GetBlockStorageClass(poolName, storageClassName, reclaimPolicy)
  85. }
  86. func (m *CephManifestsPreviousVersion) GetFileStorageClass(fsName, storageClassName string) string {
  87. return m.latest.GetFileStorageClass(fsName, storageClassName)
  88. }
  89. func (m *CephManifestsPreviousVersion) GetNFSStorageClass(fsName, nfsClusterName, server, storageClassName string) string {
  90. return m.latest.GetNFSStorageClass(fsName, nfsClusterName, server, storageClassName)
  91. }
  92. func (m *CephManifestsPreviousVersion) GetNFSSnapshotClass(fsName, snapshotClassName string) string {
  93. return m.latest.GetNFSSnapshotClass(fsName, snapshotClassName)
  94. }
  95. // GetFilesystem returns the manifest to create a Rook filesystem resource with the given config.
  96. func (m *CephManifestsPreviousVersion) GetFilesystem(name string, activeCount int) string {
  97. return m.latest.GetFilesystem(name, activeCount)
  98. }
  99. // GetNFS returns the manifest to create a Rook Ceph NFS resource with the given config.
  100. func (m *CephManifestsPreviousVersion) GetNFS(name string, count int) string {
  101. return m.latest.GetNFS(name, count)
  102. }
  103. func (m *CephManifestsPreviousVersion) GetNFSPool() string {
  104. return m.latest.GetNFSPool()
  105. }
  106. func (m *CephManifestsPreviousVersion) GetObjectStore(name string, replicaCount, port int, tlsEnable bool) string {
  107. return m.latest.GetObjectStore(name, replicaCount, port, tlsEnable)
  108. }
  109. func (m *CephManifestsPreviousVersion) GetObjectStoreUser(name, displayName, store, usercaps, maxsize string, maxbuckets, maxobjects int) string {
  110. return m.latest.GetObjectStoreUser(name, displayName, store, usercaps, maxsize, maxbuckets, maxobjects)
  111. }
  112. // GetBucketStorageClass returns the manifest to create object bucket
  113. func (m *CephManifestsPreviousVersion) GetBucketStorageClass(storeName, storageClassName, reclaimPolicy string) string {
  114. return m.latest.GetBucketStorageClass(storeName, storageClassName, reclaimPolicy)
  115. }
  116. // GetOBC returns the manifest to create object bucket claim
  117. func (m *CephManifestsPreviousVersion) GetOBC(claimName, storageClassName, objectBucketName, maxObject string, varBucketName bool) string {
  118. return m.latest.GetOBC(claimName, storageClassName, objectBucketName, maxObject, varBucketName)
  119. }
  120. // GetOBCNotification returns the manifest to create object bucket claim
  121. func (m *CephManifestsPreviousVersion) GetOBCNotification(claimName, storageClassName, objectBucketName, notificationName string, varBucketName bool) string {
  122. return m.latest.GetOBCNotification(claimName, storageClassName, objectBucketName, notificationName, varBucketName)
  123. }
  124. // GetBucketNotification returns the manifest to create ceph bucket notification
  125. func (m *CephManifestsPreviousVersion) GetBucketNotification(notificationName, topicName string) string {
  126. return m.latest.GetBucketNotification(notificationName, topicName)
  127. }
  128. // GetBucketTopic returns the manifest to create ceph bucket topic
  129. func (m *CephManifestsPreviousVersion) GetBucketTopic(topicName, storeName, httpEndpointService string) string {
  130. return m.latest.GetBucketTopic(topicName, storeName, httpEndpointService)
  131. }
  132. func (m *CephManifestsPreviousVersion) GetClient(claimName string, caps map[string]string) string {
  133. return m.latest.GetClient(claimName, caps)
  134. }
  135. func (m *CephManifestsPreviousVersion) GetExternalCephCluster() string {
  136. return m.latest.GetExternalCephCluster()
  137. }
  138. // GetRBDMirror returns the manifest to create a Rook Ceph RBD Mirror resource with the given config.
  139. func (m *CephManifestsPreviousVersion) GetRBDMirror(name string, count int) string {
  140. return m.latest.GetRBDMirror(name, count)
  141. }
  142. func (m *CephManifestsPreviousVersion) GetFilesystemSubvolumeGroup(fsName, groupName string) string {
  143. return m.latest.GetFilesystemSubvolumeGroup(fsName, groupName)
  144. }
  145. func (m *CephManifestsPreviousVersion) GetCOSIDriver() string {
  146. return m.latest.GetCOSIDriver()
  147. }
  148. func (m *CephManifestsPreviousVersion) GetBucketClass(name, objectStoreUserSecretName, deletionPolicy string) string {
  149. return m.latest.GetBucketClass(name, objectStoreUserSecretName, deletionPolicy)
  150. }
  151. func (m *CephManifestsPreviousVersion) GetBucketClaim(name, bucketClassName string) string {
  152. return m.latest.GetBucketClaim(name, bucketClassName)
  153. }